Overview

Purpose

The AMR payload formatter provides APIs to pack and unpack AMR encoded data as per RFC 3267, giving common APIs for future formatter implementations. This overview shows the usage of APIs included in the AMR payload formatter component. This component is implemented as an ECOM plug-in and has a common interface that can be used by other formatter implementations for codecs like MPEG.

Required background

It is assumed the user has an understanding of the AMR codec, IF1 and IF2 header formats. The user must know the valid AMR stream property values and bit rates supported for AMR wide and narrow band respectively.

Key concepts

Adaptive Multi-Rate (AMR)

The AMR codec is a multi-mode codec that supports 8 narrow band speech encoding modes with bit rates between 4.75 kbps and 12.2 kbps. The sampling frequency used in AMR is 8000 Hz and the speech encoding is performed on 20 ms speech frames. So, each encoded AMR speech frame represents 160 samples of the original speech.

Codec

A codec is a device or a program capable of encoding and decoding a digital data stream or signal.

API summary

Class Name Description

CStreamFormatter::Pack()

An API that is used to pack the encoded AMR data.

CStreamFormatter::Unpack()

An API that is used to extract the AMR payload header from the data and gives it back to the application.

CStreamFormatter::SetStreamProperty()

An API that is used to set the identified AMR stream properties if the session has already started.

CStreamFormatter::GetStreamProperty()

An API that is used to get the current AMR stream properties for the session in progress.

Typical uses

An application using the AMR plug-in component must include streamformatter.h, amrproperty.h, ecom.h and ECOM.lib files, and it uses the DLL that is provided to write the application code. Here we support both AMR narrow band and AMR wide band.

The user has a choice to either use the AMR payload formatter or provide the UID of the implementation that the user wants to use in the CStreamFormatter::NewL() function. This function is overloaded, that is, it takes as default the AMR payload formatter or any formatter the user has.

Creating the interface

A user must first create the interface to use the AMR payload formatter. For more information on creating the interface see, How to Create the Interface.

Packing and unpacking the AMR encoded data

The application user uses the CStreamFormatter::Pack() and CStreamFormatter::Unpack() APIs to pack and unpack the AMR encoded data. For more information on packing and unpacking the AMR encoded data see, How to Pack and Unpack the AMR Encoded Data.

Setting and getting the AMR stream property

A user has an option to set and get the AMR stream properties if the user wants to change any of the AMR stream properties. If a user does not want to change any of the AMR stream properties then it takes the default values assigned to the respective properties.

For more information see, How to Set and Get the AMR Stream Property.