Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: mmfswcodecwrapper.h
Link against: mmfswcodecwrapper.lib

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

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 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:
CMMFSwCodecWrapper(), Codec(), CustomInterface(), DeleteCodec(), Init(), Pause(), SetConfig(), SetVbrFlag(), Start(), Stop(), StopAndDeleteCodec(), ThisHwBufferEmptied(), ThisHwBufferFilled(), iChannels, iCodec, iDataPath, iDeviceBufferSize, iPlayCustomInterface, iRecordCustomInterface, iSampleRate, iSinkBuffer, iSourceBuffer, ~CMMFSwCodecWrapper()


Construction and destruction


~CMMFSwCodecWrapper()

virtual IMPORT_C ~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()

protected: virtual IMPORT_C 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()

protected: virtual IMPORT_C 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: virtual IMPORT_C 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: virtual IMPORT_C 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()

protected: virtual IMPORT_C 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()

protected: virtual IMPORT_C 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()

protected: virtual IMPORT_C 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()

protected: virtual IMPORT_C 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: virtual IMPORT_C TInt StopAndDeleteCodec();

Description

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.

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: virtual IMPORT_C 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