Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: MmfCodec.h
Link against: mmfserverbaseclasses.lib

This item is not part of the S60 3rd Edition SDK for Symbian OS, Feature Pack 2.

Class CMMFCodec

class CMMFCodec : public CBase;

Description

ECom plugin class for a codec that processes source data in a certain fourCC coding type and converts it to a destination buffer of another fourCC coding type. The function is synchronous as it is expected that the codec will be operating in its own thread of execution - usually via a CMMFDataPath or CMMFDataPathProxy

The codec can be instantiated in 3 different ways:

1. NewL(const TFourCC& aSrcDatatype, const TFourCC& aDstDataType).

This instantiate a codec that can convert the aSrcDatatype to a aDstDataType.

2. NewL(const TFourCC& aSrcDatatype, const TFourCC& aDstDataType, const TDesC& aPreferredSupplier).

This is similar to the above but is used where there may be multiple codecs that perform the same conversion - the idea is that a 3rd party deveoper may develop there own controller and codecs and can ensure the controller uses their codecs by setting the preferredSupplier to themselves.

3. NewL(TUid aUid).

This is used to explicitly instantiated a codec where the uid is known. This might be used by controlers that only support one codec type.

The processing of the data is handled by the codecs ProcessL() member. The intention is that the source buffer for conversion is converted to the appropriate coding type in the destination buffer. The buffers can be of any size. Since the buffers can be of any size there is no guarantee that all the source buffer can be processed to fill the destination buffer or that the all the source buffer may be processed before the destination is full. Therefore the ProcessL needs to return a TCodecProcessResult returing the number of source bytes processed and the number of destination bytes processed along with a process result code defined thus:

The ProcessL should start processing the source buffer from the iPosition data member of the source data and start filling the destination buffer from its iPosition.

Derivation

Members

Defined in CMMFCodec:
ConfigureL(), NewL(), NewL(), NewL(), ProcessL(), ResetL(), ~CMMFCodec()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


NewL()

static IMPORT_C CMMFCodec *NewL(const TFourCC &aSrcDatatype, const TFourCC &aDstDataType);

Description

Creates a CMMFCodec object with known fourCC codes for source and destination. The first matching plug-in will be used.

The FourCC codes are the same codes as those specified in the resource file and are used to identify the datatype. ECom scans the registry to find a codec that is registered in its resource file as being able to convert between the source data type and the destination data type as specified by their FourCC codes. If a match is found then an instantiation of the appropriate CMMFCodec is made. If a match is not found this function leaves with KErrNotFound. If more than one codec is present with the same fourCC match codes then the one that is instantiated is indeterminate. If there is likely to be any ambiguity due to more than one codec that performs the same conversion being present, then a preferred supplier should be specified.

Parameters

const TFourCC &aSrcDatatype

The source data type.

const TFourCC &aDstDataType

The destination data type.

Return value

CMMFCodec *

An instantiated CMMFCodec derived obeject from an ECOM plugin DLL.


NewL()

static IMPORT_C CMMFCodec *NewL(const TFourCC &aSrcDatatype, const TFourCC &aDstDataType, const TDesC &aPreferredSupplier);

Description

Creates a CMMFCodec object with match parameter in addition to the source and destination fourCC codes (for instance a manufacturer's name).

Will attempt match without extra match string if no match.

Will Leave if no match on 4CC codes (KErrNotFound).

Used where there may be multiple codecs that perform the same conversion to ensure the controller uses the codec specified by aPreferredSupplier.

Parameters

const TFourCC &aSrcDatatype

The source data type.

const TFourCC &aDstDataType

The destination data type.

const TDesC &aPreferredSupplier

Additional resolution criteria when searching for plug in codec. If this is provided, the list of matching plugins will be further searched for the latest version of a plugin supplied by supplier named. Note that the display name field is parsed for a match.

Return value

CMMFCodec *

An instantiated CMMFCodec derived obeject from an ECOM plugin DLL.


NewL()

static IMPORT_C CMMFCodec *NewL(TUid aUid);

Description

Creates a CMMFCodec object with a known UID.

Will Leave if the plug in is not found (KErrNotFound).

Parameters

TUid aUid

The UID of a plugin implementation.

Return value

CMMFCodec *

An instantiated CMMFCodec derived obeject from an ECOM plugin DLL.


~CMMFCodec()

inline virtual ~CMMFCodec();

Description

Destructor.

Destroys any variables then informs ECom that this specific instance of the interface has been destroyed.

[Top]


Member functions


ConfigureL()

inline virtual void ConfigureL(TUid aConfigType, const TDesC8 &aConfigData);

Description

Sets codec configuration.

This is a virtual function which does not need to be implemented by a codec, but may be if required. This function provides additional configuration information for the codec. The configuration is passed in as a descriptor. The default version leaves with KErrNotSupported.

Parameters

TUid aConfigType

The UID of the configuration data.

const TDesC8 &aConfigData

The configuration information.


ResetL()

inline virtual void ResetL();

Description

Codec reset.

Used to flush out status information when a reposition occurs. This is a virtual function that is provided should the codec require resetting prior to use.


ProcessL()

virtual TCodecProcessResult ProcessL(const CMMFBuffer &aSource, CMMFBuffer &aDestination)=0;

Description

Processes the data in the specified source buffer and writes the processed data to the specified destination buffer.

This function is synchronous, when the function returns the data has been processed. The source buffer is converted to the appropriate coding type in the destination buffer. The buffers can be of any size, therefore there is no guarantee that all the source buffer can be processed to fill the destination buffer or that all the source buffer may be processed before the destination is full. This function therefore returns the number of source, and destination, bytes processed along with a process result code indicating completion status.

The aSource and aSink buffers passed in are derived from CMMFBuffer. The buffer type (e.g. a CMMFDataBuffer) passed in should be supported by the codec otherwise this function should leave with KErrNotSupported. The position of the source buffer should be checked by calling the source buffer's Position() member which indicates the current source read position in bytes. The codec should start processing from the current source buffer read position. The position of the destination buffer should be checked by calling the destination buffer's Position() method which indicates the current destination write position in bytes. The codec should start writing to the destination buffer at the current destination buffer write position.

This is a virtual function that each derived class must implement.

Parameters

const CMMFBuffer &aSource

The source buffer containing data to encode or decode.

CMMFBuffer &aDestination

The destination buffer to hold the data after encoding or decoding.

Return value

TCodecProcessResult

The result of the processing.

See also: