Streaming audio in encoded format in S60 3rd Edition

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): All (S60)
Keywords: SetDataTypeL
Created: User:Technical writer 2 (February 22, 2007
Updated: March 23, 2010)
Last edited: hamishwillee (06 Sep 2013)


This article describes audio streaming in encoded formats, in the S60 3rd Edition platform.


Because DevSound relies on hardware (DSP) codecs, the list of codecs that can be used for streaming is device-dependent. All S60 devices from 3rd Edition onwards support at least the following HW audio codecs for streaming:

 FourCC Type Description
" P16" (encoder+decoder) Uncompressed PCM 16-bit
" AMR" (encoder+decoder) AMR Narrow Band

Additionally, most Nseries and some Eseries devices support also the following:

 "G711"  (encoder+decoder)    G.711
"G729" (encoder+decoder) G.729
"ILBC" (encoder+decoder) iLBC (internet Low Bitrate Codec)
" MP3" (decoder only) MPEG-1 Audio Layer 3 (MP3)
" AWB" (decoder only) AMR Wide Band
" AAC" (decoder only) Adv. Audio Coding (AAC)


A fourCC code (TFourCC) is used to specify the encoding to use when initialising the audio stream. For example, when using CMdaAudioInputStream, this can be done in MaiscOpenComplete once the stream is successfully opened:

 void CMyAudioStreamer::MaiscOpenComplete( TInt aError )
if ( aError == KErrNone )
// Set the data type (encoding)
TRAPD(codecError, iInputStream->SetDataTypeL(
TFourCC( ’G’, ’7’, ’1’, ’1) ) );
if( codecError != KErrNone )
// Codec is not supported
// Set sample rate and channels
TRAPD(propError, iInputStream->SetAudioPropertiesL(
TMdaAudioDataSettings::EChannelsMono ) );
if( propError != KErrNone )
// Codec does not support specified audio properties

HW codec configuration:

Most codecs will be automatically configured with default settings during their initialisation, and require no additional setup. However, some codecs support different encoding modes, bitrates, and other settings. For a HW codec, this configuration is typically done via a codec-specific Custom Interface class. A pointer to an instance of this class is retrieved with the CustomInterface() method from CMdaAudioXXXStream or CMMFDevSound. This pointer is then cast to the codec-specific interface type. These device-dependent interfaces cannot be supported as part of the S60 SDK. However, SDK API Plug-in includes a Speech Encoder Config API that can be used for configuring certain encoders - see Setting AMR encoding mode for audio input stream (Known Issue) for more information.

See also

Archived:Differences in audio streaming configuration on the S60 3rd Edition devices (Known Issue)
Setting AMR encoding mode for audio input stream (Known Issue)

This page was last modified on 6 September 2013, at 05:58.
63 page views in the last 30 days.