Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to Write a Codec Plugin

To write a Multimedia Framework (MMF) codec plugin, the following needs to be done:


Derive from the CMMFCodec Base Class

Codecs derived from CMMFCodec can be audio, or video, codecs. Codecs that use the Image Conversion Library (ICL) must conform to the ICL codec API.

Codecs derived from CMMFCodec are synchronous as it is expected that the codec will be operating in its own thread of execution, usually via a CMMFDataPath or CMMFDataPathProxy.

The functions in the CMMFCodec base class, from which a specific CMMFCodec must derive, are: CMMFCodec::NewL() and CMMFCodec::ProcessL(). Optional additions are CMMFCodec::ConfigureL() and CMMFCodec::ResetL().

[Top]


Resource File

One resource file (.RSS) is required for each codec plugin DLL. This enables ECom to identify and instantiate the codec, or codecs, present in the DLL.

An example resource file follows:

// nnnnnnnn.RSS
//
#include <acmeCodecUIDs.hrh>
#include <mmfPluginInterfaceUIDs.hrh>
#include "RegistryInfo.rh"

RESOURCE REGISTRY_INFO theInfo
    {
    dll_uid = KAcmeCodecPluginDLLUid;
    interfaces =
        {
        INTERFACE_INFO
            {
            interface_uid = KMmfUidPluginInterfaceCodec ;  // CMMFCodec
            implementations =
                {
                IMPLEMENTATION_INFO
                    {
                    implementation_uid = KAcmeCodec1Uid;
                    version_no = 1;
                    display_name = "ABCD to WXYZ Acme codec";
                    default_data = "ABCD, WXYZ" ; // FourCC codes
                    },
                IMPLEMENTATION_INFO
                    {
                    implementation_uid = KAcmeCodec2Uid;
                    version_no = 1;
                    display_name = "mp3 to PCM16 Acme codec";
                    default_data = " MP3,  P16" ; // FourCC codes.
                    }
                };
            }
        };
    }

Where:

A number of audio codecs are included as part of the MMF which provide a number of standard codec conversions between common audio data types such as uLaw, aLaw, pcm8, pcm16 and gsm610. These can be found in the multimedia component directory under \Mmf\Src\Plugin\Codec\Audio.

Since most of these codecs are relatively simple, they provide a good source of example code for writing a codec plugin. There are also a number of test codecs in the UnitTest directory in the \acod and \basecl sub-directories which could be used as a template for writing a new CMMFCodec plugin.

[Top]


Define Codec-Specific UIDs

Codec-specific UIDs are defined in a header file. An example is shown below, this contains one plugin only, KExCodecUID which has a UID of 0x101F81D7:

#ifndef _MmfExCodecUIDS_H_
#define _MmfExCodecUIDS_H_
#define KExCodecUID 0x101F81D7

#endif

[Top]


Build File

There are no special requirements for an MMF codec plugin mmp file over and above a conventional ECom plugin.

The main points to note are:

Note that it is not necessary to include mmfserverbaseclasses.lib.

[Top]


Implementation Considerations

When implementing a codec plugin, consider the following: