Encoding and Decoding Audio

Samsung bada enables your application to encode and decode audio.

Encoding Audio

You can use the Osp::Media::AudioEncoder class to encode raw audio data into a compressed audio stream. This class supports audio encoding formats, such as CODE_AAC and CODEC_AMR_NB.

The following table lists the key values used in the AudioEncoder class.

Table: Supported encoding keys
Key Data type Construct() Notes
Value type Supporting codec
MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE Osp::Media::AudioChannelType Osp::Base::Integer CODEC_AAC Channel type of CODEC_AMR_NB is AUDIO_CHANNEL_TYPE_MONO.
MEDIA_PROPERTY_AUDIO_SAMPLE_RATE int Sample rate of CODEC_AMB_NB is 8000 Hz. Range of the sample rate of CODEC_AAC is 8000 ~ 96000 Hz.
MEDIA_PROPERTY_AUDIO_BIT_RATE Bit rate of CODEC_AMB_NB is 12.2 kbps. Maximum bit rate of CODEC_AAC is 320 kbps for 48000 Hz. Maximum bit rate is proportional to the sampling frequency.

Decoding Audio

You can use the Osp::Media::AudioDecoder class to decode a compressed audio stream to raw audio data. This class supports audio decoding formats, such as CODEC_MP3, CODEC_AAC, and CODEC_AMR_NB.

The following table lists the key values used in the AudioDecoder class.

Table: Supported decoding keys
Key Data type Construct() GetValue()
Value type Supporting codec Value type Supporting codec
MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE AudioChannelType Integer CODEC_AAC int CODEC_AAC, CODEC_MP3, CODEC_AMR_NB
MEDIA_PROPERTY_AUDIO_SAMPLE_RATE int
MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE Osp::Media::AudioSampleType - -

Where to Go Next