Symbian3/PDK/Source/GUID-CCFFFE06-1FB8-56C8-874C-C4C1B936FAA4.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <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
       
    13 
       
    14 enum TAmrNBBitRate
       
    15     {
       
    16     EAmr_4_75_Kbps = 0,
       
    17     EAmr_5_15_Kbps = 1,
       
    18     EAmr_5_90_Kbps = 2,
       
    19     EAmr_6_70_Kbps = 3,
       
    20     EAmr_7_40_Kbps = 4,
       
    21     EAmr_7_95_Kbps = 5,
       
    22     EAmr_10_2_Kbps = 6,
       
    23     EAmr_12_2_Kbps = 7,
       
    24     EAmr_SID_Nb_Kbps = 8,
       
    25     // Future rates will be added here 
       
    26     EAmr_No_Data_Nb   = 15
       
    27     };
       
    28     
       
    29 enum TAmrWBBitRate
       
    30     {
       
    31     EAmr_6_60_Kbps  = 0,
       
    32     EAmr_8_85_Kbps  = 1,
       
    33     EAmr_12_65_Kbps = 2,
       
    34     EAmr_14_25_Kbps = 3,
       
    35     EAmr_15_85_Kbps = 4,
       
    36     EAmr_18_25_Kbps = 5,
       
    37     EAmr_19_85_Kbps = 6,
       
    38     EAmr_23_05_Kbps = 7,
       
    39     EAmr_23_85_Kbps = 8,
       
    40     EAmr_SID_Wb_Kbps= 9,
       
    41     // future rates will be added here
       
    42     EAmr_No_Data_Wb =15    
       
    43     };
       
    44     
       
    45 enum TAmrFrameQuality
       
    46     {
       
    47     EBadQuality = 0,
       
    48     EGoodQuality = 1
       
    49     };
       
    50     
       
    51 enum TAmrHeaderType
       
    52     {
       
    53     ERawMode = 0,
       
    54     EIF1Mode = 1,
       
    55     EIF2Mode = 2
       
    56     };
       
    57     
       
    58 enum TAmrMode
       
    59     {
       
    60     EOctetAlignedMode = 1,
       
    61     EBandWidthOptimizedMode = 2
       
    62     };
       
    63     
       
    64 enum TAmrBand
       
    65     {
       
    66     EWideBand = 1,
       
    67     ENarrowBand = 2
       
    68     };
       
    69     
       
    70 //The Change Mode Request value depends on whether the AMR is narrow or wide band.
       
    71 enum TAmrChangeModeRequest
       
    72     {
       
    73     EAmrChangeModeRequest_0 = 0,
       
    74     EAmrChangeModeRequest_1 = 1,
       
    75     EAmrChangeModeRequest_2 = 2,
       
    76     EAmrChangeModeRequest_3 = 3,
       
    77     EAmrChangeModeRequest_4 = 4,
       
    78     EAmrChangeModeRequest_5 = 5,
       
    79     EAmrChangeModeRequest_6 = 6,
       
    80     EAmrChangeModeRequest_7 = 7,
       
    81     EAmrChangeModeRequest_8 = 8,
       
    82     EAmrChangeModeRequest_9 = 9,
       
    83     // future modes will be added here
       
    84     EAmrChangeModeRequest_15 = 15
       
    85     };</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
       
    86 CStreamFormatter * aStreamFormatter =  CStreamFormatter::NewL(TUid::Uid(KAmrFormatterUid));
       
    87 
       
    88 // First set the individual AMR stream properties if the user wants to, otherwise default values are used
       
    89 CStreamProperty* aStreamProperty = aStreamFormatter-&gt;ConfigFactory(); //
       
    90 
       
    91 //Get the CAmrStreamProperty property reference from CStreamProperty base class
       
    92 CAmrStreamProperty* aAmrStreamProperty = (CAmrStreamProperty*)aStreamProperty;
       
    93 
       
    94 // Set the bit rate to BitMode
       
    95 TInt8 ret1 = aAmrStreamProperty-&gt;SetAmrBitRate(BitMode);  // Default bit rate is 0
       
    96 
       
    97 // Set the AMR frame quality to the value passed as input
       
    98 aAmrStreamProperty-&gt;SetAmrFrameQuality(TAmrFrameQuality); // Default AMR quality is good (1)
       
    99 
       
   100 // Set the no of frames to be packed in a single RTP packet
       
   101 TInt8 ret2 = aAmrStreamProperty-&gt;SetAmrNoofFrames(NoofFrames); // Default value is 1
       
   102 
       
   103 // Set the header type to the value passed as input
       
   104 aAmrStreamProperty-&gt;SetAmrHeaderType(TAmrHeaderType); // Default header type is IF2 (2)
       
   105 
       
   106 // Set the AMR mode to the value passed
       
   107 aAmrStreamProperty-&gt;SetAmrMode(TAmrMode);  // Default mode is Octet Aligned Mode (1)
       
   108 
       
   109 // Set the AMR band to the value passed as input
       
   110 aAmrStreamProperty-&gt;SetAmrBand(TAmrBand); // Default Band is Wide Band (1)
       
   111 
       
   112 // Set the Change Mode Request to the value passed as input
       
   113 aAmrStreamProperty-&gt;SetAmrChangeModeRequest(TAmrChangeModeRequest); //Default mode request is set to 0
       
   114 </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        
       
   115 aStreamFormatter-&gt;SetStreamProperty(aStreamProperty);
       
   116 </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
       
   117 CStreamFormatter * aStreamFormatter =  CStreamFormatter::NewL(TUid::Uid(KAmrFormatterUid));
       
   118 
       
   119 // Get the AMR stream properties
       
   120 CStreamProperty* aGetStreamProperty = aStreamFormatter-&gt;GetStreamProperty();
       
   121 
       
   122 //Get the CAmrStreamProperty property reference from CStreamProperty base class
       
   123 CAmrStreamProperty* aAmrGetStreamProperty = (CAmrStreamProperty*)aGetStreamProperty;
       
   124 
       
   125 // Get the AMR bit rate
       
   126 TInt BitMode = aAmrGetStreamProperty-&gt;AmrBitRate();
       
   127 
       
   128 // Get the AMR header type
       
   129 TAmrHeaderType amrHeaderType = aAmrGetStreamProperty-&gt;AmrHeaderType();
       
   130         
       
   131 // Get the no of frames packed in the current AMR session
       
   132 TInt NoofFrames = aAmrGetStreamProperty-&gt;AmrNoofFrames();
       
   133 
       
   134 // Get the current AMR mode
       
   135 TAmrMode amrMode = aAmrGetStreamProperty-&gt;AmrMode();
       
   136 
       
   137 // Get the current AMR band
       
   138 TAmrBand amrBand = aAmrGetStreamProperty-&gt;AmrBand();
       
   139 
       
   140 // Get the quality of AMR frame
       
   141 TAmrFrameQuality amrFrameQuality = aAmrGetStreamProperty-&gt;AmrFrameQuality();
       
   142 
       
   143 // Get the Change Mode Request
       
   144 TAmrChangeModeRequest amrChangeModeRequest = aAmrGetStreamProperty-&gt;AmrChangeModeRequest();
       
   145 </codeblock> </section> </conbody></concept>