Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <mmfSwCodecWrapper.h>
Link against: mmfswcodecwrapper.lib
This item is not part of the S60 5th Edition SDK

Class CMMFSwCodecWrapper

class CMMFSwCodecWrapper : public CMMFHwDevice;

Description

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 CMMFSwCodecWrapper::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.

Derivation

Members

Defined in CMMFSwCodecWrapper:


Construction and destruction


~CMMFSwCodecWrapper()

IMPORT_C virtual ~CMMFSwCodecWrapper();

Description

Destructor.

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


CMMFSwCodecWrapper()

protected: IMPORT_C CMMFSwCodecWrapper();

Description

Constructor.

[Top]


Member functions


Init(THwDeviceInitParams &)

protected: IMPORT_C virtual TInt Init(THwDeviceInitParams &aDevInfo);

Description

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.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


Start(TDeviceFunc,TDeviceFlow)

protected: IMPORT_C virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd);

Description

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

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


Stop()

protected: IMPORT_C virtual TInt Stop();

Description

Stops the current on-going task.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


Pause()

protected: IMPORT_C virtual TInt Pause();

Description

Temporarily suspends the current task of decoding or encoding.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


CustomInterface(TUid)

protected: IMPORT_C virtual TAny* CustomInterface(TUid aInterfaceId);

Description

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.

Return value

TAny *

A pointer to the interface implementation, or NULL if the device can not implement the interface requested. The return value must be cast to the correct type by the user.


ThisHwBufferFilled(CMMFBuffer &)

protected: IMPORT_C virtual TInt ThisHwBufferFilled(CMMFBuffer &aFillBufferPtr);

Description

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.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


ThisHwBufferEmptied(CMMFBuffer &)

protected: IMPORT_C virtual TInt ThisHwBufferEmptied(CMMFBuffer &aBuffer);

Description

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.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


SetConfig(TTaskConfig &)

protected: IMPORT_C virtual TInt SetConfig(TTaskConfig &aConfig);

Description

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.

Return value

TInt


StopAndDeleteCodec()

protected: IMPORT_C virtual TInt StopAndDeleteCodec();

Description

Stops and deletes the codec.

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

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


DeleteCodec()

protected: IMPORT_C virtual TInt DeleteCodec();

Description

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

Return value

TInt

Error code. KErrNone if successful


Codec()

protected: virtual CMMFSwCodec& Codec()=0;

Description

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.

Return value

CMMFSwCodec &

The CMMFSwCodec used by the derrived CMMFSwCodecWrapper


SetVbrFlag()

protected: IMPORT_C void SetVbrFlag();

Description

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.

[Top]


Member data


iCodec

protected: CMMFSwCodec * iCodec;

Description

The software codec used


iSourceBuffer

protected: CMMFDataBuffer * iSourceBuffer;

Description

The source buffer for the codec


iSinkBuffer

protected: CMMFDataBuffer * iSinkBuffer;

Description

The sink buffer for the codec


iDataPath

protected: CMMFSwCodecDataPath * iDataPath;

Description

The datapath used to transfer the data


iPlayCustomInterface

protected: MPlayCustomInterface * iPlayCustomInterface;

Description

The play custom interface


iRecordCustomInterface

protected: MRecordCustomInterface * iRecordCustomInterface;

Description

The record custom interface


iDeviceBufferSize

protected: TUint iDeviceBufferSize;

Description

The buffer size of the sound device


iSampleRate

protected: TInt iSampleRate;

Description

The sample rate of the sound device


iChannels

protected: TInt iChannels;

Description

The number of channels of the sound device