A user has to first create an instance of the AMR payload formatter. Then, the user can set and get the AMR stream property.
The following table contains the configurable AMR stream properties and their default values.
AMR stream properties | Default values |
---|---|
Bit rate |
0 |
Frame Quality |
AMR quality is good (1) |
Header Type |
IF2 (2) |
No of Frames |
1 |
Mode |
Octet Aligned Mode (1) |
Band |
Wide Band (1) |
Change Mode Request |
0 |
The following code shows the valid set of all AMR stream properties so that a user can accordingly get or set the values.
// 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 };
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 CStreamFormatter::SetStreamProperty() API. This is done by using the respective functions for each property.
The following code shows how to set the AMR stream properties.
// 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->ConfigFactory(); // //Get the CAmrStreamProperty property reference from CStreamProperty base class CAmrStreamProperty* aAmrStreamProperty = (CAmrStreamProperty*)aStreamProperty; // Set the bit rate to BitMode TInt8 ret1 = aAmrStreamProperty->SetAmrBitRate(BitMode); // Default bit rate is 0 // Set the AMR frame quality to the value passed as input aAmrStreamProperty->SetAmrFrameQuality(TAmrFrameQuality); // Default AMR quality is good (1) // Set the no of frames to be packed in a single RTP packet TInt8 ret2 = aAmrStreamProperty->SetAmrNoofFrames(NoofFrames); // Default value is 1 // Set the header type to the value passed as input aAmrStreamProperty->SetAmrHeaderType(TAmrHeaderType); // Default header type is IF2 (2) // Set the AMR mode to the value passed aAmrStreamProperty->SetAmrMode(TAmrMode); // Default mode is Octet Aligned Mode (1) // Set the AMR band to the value passed as input aAmrStreamProperty->SetAmrBand(TAmrBand); // Default Band is Wide Band (1) // Set the Change Mode Request to the value passed as input aAmrStreamProperty->SetAmrChangeModeRequest(TAmrChangeModeRequest); //Default mode request is set to 0
After the user sets the AMR properties the CStreamFormatter::SetStreamProperty API is called.
// Call the SetStreamProperty() function of the interface aStreamFormatter->SetStreamProperty(aStreamProperty);
If a user wants to get the AMR stream properties then the application has to call CStreamFormatter::GetStreamProperty() API and then individually get the specific AMR stream properties. This is done by using the respective functions for each property.
The following code shows how to get the AMR stream properties.
// 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->GetStreamProperty(); //Get the CAmrStreamProperty property reference from CStreamProperty base class CAmrStreamProperty* aAmrGetStreamProperty = (CAmrStreamProperty*)aGetStreamProperty; // Get the AMR bit rate TInt BitMode = aAmrGetStreamProperty->AmrBitRate(); // Get the AMR header type TAmrHeaderType amrHeaderType = aAmrGetStreamProperty->AmrHeaderType(); // Get the no of frames packed in the current AMR session TInt NoofFrames = aAmrGetStreamProperty->AmrNoofFrames(); // Get the current AMR mode TAmrMode amrMode = aAmrGetStreamProperty->AmrMode(); // Get the current AMR band TAmrBand amrBand = aAmrGetStreamProperty->AmrBand(); // Get the quality of AMR frame TAmrFrameQuality amrFrameQuality = aAmrGetStreamProperty->AmrFrameQuality(); // Get the Change Mode Request TAmrChangeModeRequest amrChangeModeRequest = aAmrGetStreamProperty->AmrChangeModeRequest();
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.