Symbian3/PDK/Source/GUID-CCFFFE06-1FB8-56C8-874C-C4C1B936FAA4.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Tue, 30 Mar 2010 11:56:28 +0100
changeset 5 f345bda72bc4
parent 3 46218c8b8afa
child 14 578be2adaf3e
permissions -rw-r--r--
Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-CCFFFE06-1FB8-56C8-874C-C4C1B936FAA4"><title>How to Set and Get the AMR Stream Property</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>A user has to first create an instance of the AMR payload formatter. Then, the user can set and get the AMR stream property. </p> <p>The following table contains the configurable AMR stream properties and their default values. </p> <table id="GUID-43036700-3A6E-5288-9D5C-19EC12B59944"><tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/><thead><row><entry>AMR stream properties</entry> <entry>Default values</entry> </row> </thead> <tbody><row><entry><p>Bit rate </p> </entry> <entry><p>0</p> </entry> </row> <row><entry><p>Frame Quality </p> </entry> <entry><p>AMR quality is good (1) </p> </entry> </row> <row><entry><p>Header Type </p> </entry> <entry><p>IF2 (2) </p> </entry> </row> <row><entry><p>No of Frames </p> </entry> <entry><p>1</p> </entry> </row> <row><entry><p>Mode </p> </entry> <entry><p>Octet Aligned Mode (1) </p> </entry> </row> <row><entry><p>Band </p> </entry> <entry><p>Wide Band (1) </p> </entry> </row> <row><entry><p>Change Mode Request </p> </entry> <entry><p>0</p> </entry> </row> </tbody> </tgroup> </table> <p>The following code shows the valid set of all AMR stream properties so that a user can accordingly get or set the values. </p> <codeblock id="GUID-31480714-CB05-52C1-8D67-3F4B556EB8CD" xml:space="preserve">// AMRPROPERTY.H

enum TAmrNBBitRate
    {
    EAmr_4_75_Kbps = 0,
    EAmr_5_15_Kbps = 1,
    EAmr_5_90_Kbps = 2,
    EAmr_6_70_Kbps = 3,
    EAmr_7_40_Kbps = 4,
    EAmr_7_95_Kbps = 5,
    EAmr_10_2_Kbps = 6,
    EAmr_12_2_Kbps = 7,
    EAmr_SID_Nb_Kbps = 8,
    // Future rates will be added here 
    EAmr_No_Data_Nb   = 15
    };
    
enum TAmrWBBitRate
    {
    EAmr_6_60_Kbps  = 0,
    EAmr_8_85_Kbps  = 1,
    EAmr_12_65_Kbps = 2,
    EAmr_14_25_Kbps = 3,
    EAmr_15_85_Kbps = 4,
    EAmr_18_25_Kbps = 5,
    EAmr_19_85_Kbps = 6,
    EAmr_23_05_Kbps = 7,
    EAmr_23_85_Kbps = 8,
    EAmr_SID_Wb_Kbps= 9,
    // future rates will be added here
    EAmr_No_Data_Wb =15    
    };
    
enum TAmrFrameQuality
    {
    EBadQuality = 0,
    EGoodQuality = 1
    };
    
enum TAmrHeaderType
    {
    ERawMode = 0,
    EIF1Mode = 1,
    EIF2Mode = 2
    };
    
enum TAmrMode
    {
    EOctetAlignedMode = 1,
    EBandWidthOptimizedMode = 2
    };
    
enum TAmrBand
    {
    EWideBand = 1,
    ENarrowBand = 2
    };
    
//The Change Mode Request value depends on whether the AMR is narrow or wide band.
enum TAmrChangeModeRequest
    {
    EAmrChangeModeRequest_0 = 0,
    EAmrChangeModeRequest_1 = 1,
    EAmrChangeModeRequest_2 = 2,
    EAmrChangeModeRequest_3 = 3,
    EAmrChangeModeRequest_4 = 4,
    EAmrChangeModeRequest_5 = 5,
    EAmrChangeModeRequest_6 = 6,
    EAmrChangeModeRequest_7 = 7,
    EAmrChangeModeRequest_8 = 8,
    EAmrChangeModeRequest_9 = 9,
    // future modes will be added here
    EAmrChangeModeRequest_15 = 15
    };</codeblock> <section><title>How to set the AMR stream property</title> <p>If a user wants to set the AMR stream properties then the user has to individually set the specific AMR stream properties and then call the <xref href="GUID-2283C5F3-9237-38BE-933C-353ADF676B42.dita#GUID-2283C5F3-9237-38BE-933C-353ADF676B42/GUID-801B3E2A-2B63-35A9-A871-7519D4869326"><apiname>CStreamFormatter::SetStreamProperty()</apiname></xref> API. This is done by using the respective functions for each property. </p> <p>The following code shows how to set the AMR stream properties. </p> <codeblock id="GUID-35AC4B25-BA5E-5B17-B1C9-8C1E31127853" xml:space="preserve">// Create an instance of AMR Payload Formatter by passing KAmrFormatterUid
CStreamFormatter * aStreamFormatter =  CStreamFormatter::NewL(TUid::Uid(KAmrFormatterUid));

// First set the individual AMR stream properties if the user wants to, otherwise default values are used
CStreamProperty* aStreamProperty = aStreamFormatter-&gt;ConfigFactory(); //

//Get the CAmrStreamProperty property reference from CStreamProperty base class
CAmrStreamProperty* aAmrStreamProperty = (CAmrStreamProperty*)aStreamProperty;

// Set the bit rate to BitMode
TInt8 ret1 = aAmrStreamProperty-&gt;SetAmrBitRate(BitMode);  // Default bit rate is 0

// Set the AMR frame quality to the value passed as input
aAmrStreamProperty-&gt;SetAmrFrameQuality(TAmrFrameQuality); // Default AMR quality is good (1)

// Set the no of frames to be packed in a single RTP packet
TInt8 ret2 = aAmrStreamProperty-&gt;SetAmrNoofFrames(NoofFrames); // Default value is 1

// Set the header type to the value passed as input
aAmrStreamProperty-&gt;SetAmrHeaderType(TAmrHeaderType); // Default header type is IF2 (2)

// Set the AMR mode to the value passed
aAmrStreamProperty-&gt;SetAmrMode(TAmrMode);  // Default mode is Octet Aligned Mode (1)

// Set the AMR band to the value passed as input
aAmrStreamProperty-&gt;SetAmrBand(TAmrBand); // Default Band is Wide Band (1)

// Set the Change Mode Request to the value passed as input
aAmrStreamProperty-&gt;SetAmrChangeModeRequest(TAmrChangeModeRequest); //Default mode request is set to 0
</codeblock> <p>After the user sets the AMR properties the <xref href="GUID-2283C5F3-9237-38BE-933C-353ADF676B42.dita#GUID-2283C5F3-9237-38BE-933C-353ADF676B42/GUID-EA184327-994A-35E9-90F2-5E49A5914D46"><apiname>CStreamFormatter::SetStreamProperty</apiname></xref> API is called. </p> <codeblock id="GUID-1320DD2F-8CE8-5068-93C8-50BB186FD3D3" xml:space="preserve">// Call the SetStreamProperty() function of the interface        
aStreamFormatter-&gt;SetStreamProperty(aStreamProperty);
</codeblock> </section> <section><title>How to get the AMR stream property</title> <p>If a user wants to get the AMR stream properties then the application has to call <xref href="GUID-2283C5F3-9237-38BE-933C-353ADF676B42.dita#GUID-2283C5F3-9237-38BE-933C-353ADF676B42/GUID-447345B5-1F60-3273-A320-B313D388748B"><apiname>CStreamFormatter::GetStreamProperty()</apiname></xref> API and then individually get the specific AMR stream properties. This is done by using the respective functions for each property. </p> <p>The following code shows how to get the AMR stream properties. </p> <codeblock id="GUID-A23DDC33-E399-59DA-BA5B-8099CFC49BCB" xml:space="preserve">// Create an instance of AMR Payload Formatter by passing KAmrFormatterUid
CStreamFormatter * aStreamFormatter =  CStreamFormatter::NewL(TUid::Uid(KAmrFormatterUid));

// Get the AMR stream properties
CStreamProperty* aGetStreamProperty = aStreamFormatter-&gt;GetStreamProperty();

//Get the CAmrStreamProperty property reference from CStreamProperty base class
CAmrStreamProperty* aAmrGetStreamProperty = (CAmrStreamProperty*)aGetStreamProperty;

// Get the AMR bit rate
TInt BitMode = aAmrGetStreamProperty-&gt;AmrBitRate();

// Get the AMR header type
TAmrHeaderType amrHeaderType = aAmrGetStreamProperty-&gt;AmrHeaderType();
        
// Get the no of frames packed in the current AMR session
TInt NoofFrames = aAmrGetStreamProperty-&gt;AmrNoofFrames();

// Get the current AMR mode
TAmrMode amrMode = aAmrGetStreamProperty-&gt;AmrMode();

// Get the current AMR band
TAmrBand amrBand = aAmrGetStreamProperty-&gt;AmrBand();

// Get the quality of AMR frame
TAmrFrameQuality amrFrameQuality = aAmrGetStreamProperty-&gt;AmrFrameQuality();

// Get the Change Mode Request
TAmrChangeModeRequest amrChangeModeRequest = aAmrGetStreamProperty-&gt;AmrChangeModeRequest();
</codeblock> </section> </conbody></concept>