CMMFSwCodecWrapper Class Reference

class CMMFSwCodecWrapper : public CMMFHwDevice

Class to make a CMMFSwCodec into a CMMFHwDevice ECOM plugin.

Most of the code to make a CMMFSwCodec into a CMMFHwDevice ECOM plugin is provided in CMMFSwCodecWrapper . Someone writing a plugin derrived from CMMFSwCodecWrapper only needs to provide the standard ECOM implementation code, constructors and destructors and implement the Codec() function which should return the appropriate CMMFSwCodec .

Third parties using CMMFSwCodecWrapper that do not use the RMdaDevSound API to talk to the sound drivers would need to port the datapaths for their own sound drivers. Third parties would also need to change the custom interfaces where necessary.

Inherits from

Constructor & Destructor Documentation

CMMFSwCodecWrapper()

IMPORT_C CMMFSwCodecWrapper ( ) [protected]

Constructor.

~CMMFSwCodecWrapper()

IMPORT_C ~CMMFSwCodecWrapper ( ) [virtual]

Destructor.

The destructor is called by ECom framework allowing derived classes to clean up implementation specific resources. The sound device drivers are freed.

Member Functions Documentation

Codec()

CMMFSwCodec & Codec ( ) [protected, pure virtual]

This method must return the CMMFSwCodec used by the derived CMMFSwCodecWrapper class. The method should create the CMMFSwCodec if it hasn't done so already.

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

CustomInterface(TUid)

IMPORT_C TAny * CustomInterface ( TUid aInterfaceId ) [protected, virtual]

Retrieves a custom interface to the device. The reference CMMFSwCodecWrapper supports two standard custom interfaces, MPlayCustomInterface and MRecordCustomInterface .

Parameters

TUid aInterfaceId Interface UID, defined with the custom interface. aInterface = KMmfPlaySettingsCustomInterface for MPlayCustomInterface, aInterface = KMmfRecordSettingsCustomInterface for MRecordCustomInterface. aInterface = KMmfUidEmptyBuffersCustomInterface for MEmptyBuffersCustomInterface Actual device implementations of CMMFSwCodecWrapper may do this differently however.

DeleteCodec()

IMPORT_C TInt DeleteCodec ( ) [protected, virtual]

Deletes the codec This default implementation does nothing but real hardware devices might use this method to free up resources.

Init(THwDeviceInitParams &)

IMPORT_C TInt Init ( THwDeviceInitParams & aDevInfo ) [protected, virtual]

Initializes the hardware device tasks - in the case of a sw codec wrapper 'hardware device' this consits of loading the sound device drivers and creating the CMMFSwCodec .

Parameters

THwDeviceInitParams & aDevInfo Device initialization parameters. Only the iHwDeviceObserver is used for CMFSwCodecWrapper derived CMMFHwDevices.

Pause()

IMPORT_C TInt Pause ( ) [protected, virtual]

Temporarily suspends the current task of decoding or encoding.

SetConfig(TTaskConfig &)

IMPORT_C TInt SetConfig ( TTaskConfig & aConfig ) [protected, virtual]

Used to configure the sample rate and stereo mode of a CMMFHwDevice plugin.

The configuration of HwDevices is device specific and is not used in any of the reference devices that return KErrNotSupported.

Parameters

TTaskConfig & aConfig The device configuration.

SetVbrFlag()

IMPORT_C void SetVbrFlag ( ) [protected]

Used to set iVbrFlag on the datapath.

This method is used to set the iVbrFlag in datapath. This flag is added to datapath to avail the alternative dataflow wherein datapath makes sure that destinationbuffer is filled to its maximum length before sending it to the sound driver. Sending the buffer directly to the device causes underflow incase of VBR codecs.

Start(TDeviceFunc, TDeviceFlow)

IMPORT_C TInt Start ( TDeviceFunc aFuncCmd,
TDeviceFlow aFlowCmd
) [protected, virtual]

Starts Encoding or Decoding task(s) based on the parameter specified.

Parameters

TDeviceFunc aFuncCmd The device function specifying the requested service i.e. decode or encode where EDevEncode = Record, EDevDecode = Play and EDevNullFunc = Convert.
TDeviceFlow aFlowCmd The device flow directions for requested service. This parameter is ignored for CMMFSwCodecWrapper CMMFHwDevicePlugins

StartConvert()

TInt StartConvert ( ) [private]

StartDecode()

TInt StartDecode ( ) [private]

StartEncode()

TInt StartEncode ( ) [private]

Stop()

IMPORT_C TInt Stop ( ) [protected, virtual]

Stops the current on-going task.

StopAndDeleteCodec()

IMPORT_C TInt StopAndDeleteCodec ( ) [protected, virtual]

Stops and deletes the codec.

This default implementation simply calls DeleteCodec() and then Stop() but real hardware devices might use this method to free up resources.

ThisHwBufferEmptied(CMMFBuffer &)

IMPORT_C TInt ThisHwBufferEmptied ( CMMFBuffer & aBuffer ) [protected, virtual]

Call this function to notify hardware device implementation that data in aEmptyBufferPtr from encoding is processed.

Parameters

CMMFBuffer & aBuffer The data buffer processed by observer.

ThisHwBufferFilled(CMMFBuffer &)

IMPORT_C TInt ThisHwBufferFilled ( CMMFBuffer & aFillBufferPtr ) [protected, virtual]

Call this function to notify hardware device implementation that data is available in aFillBufferPtr for decoding.

Parameters

CMMFBuffer & aFillBufferPtr The data buffer filled by the observer.

Member Data Documentation

TInt iChannels

TInt iChannels [protected]

The number of channels of the sound device

CMMFSwCodec * iCodec

CMMFSwCodec * iCodec [protected]

The software codec used

CMMFSwCodecDataPath * iDataPath

CMMFSwCodecDataPath * iDataPath [protected]

The datapath used to transfer the data

TUint iDeviceBufferSize

TUint iDeviceBufferSize [protected]

The buffer size of the sound device

MPlayCustomInterface * iPlayCustomInterface

MPlayCustomInterface * iPlayCustomInterface [protected]

The play custom interface

MRecordCustomInterface * iRecordCustomInterface

MRecordCustomInterface * iRecordCustomInterface [protected]

The record custom interface

TInt iSampleRate

TInt iSampleRate [protected]

The sample rate of the sound device

CMMFDataBuffer * iSinkBuffer

CMMFDataBuffer * iSinkBuffer [protected]

The sink buffer for the codec

CMMFDataBuffer * iSourceBuffer

CMMFDataBuffer * iSourceBuffer [protected]

The source buffer for the codec