CMMFFormatEncode Class Reference

#include <mmf/server/mmfformat.h>

class CMMFFormatEncode : public CBase, public MDataSource, public MDataSink

Inherits from

Protected Attributes
MDataSink *iClip
MDataSource *iDataPath
Public Member Functions
virtual ~CMMFFormatEncode()
virtual voidAddMetaDataEntryL(const CMMFMetaDataEntry &)
virtual TUint BitRate()
virtual voidBufferEmptiedL(CMMFBuffer *)
virtual voidBufferFilledL(CMMFBuffer *)
virtual TInt64 BytesPerSecond()
virtual TBool CanCreateSinkBuffer()
virtual TBool CanCreateSourceBuffer()
pure virtual CMMFBuffer *CreateSinkBufferL(TMediaId, TBool &)
virtual CMMFBuffer *CreateSourceBufferL(TMediaId, TBool &)
virtual voidCropL(TTimeIntervalMicroSeconds, TBool)
pure virtual TTimeIntervalMicroSeconds Duration(TMediaId)
pure virtual voidEmptyBufferL(CMMFBuffer *, MDataSource *, TMediaId)
virtual voidFillBufferL(CMMFBuffer *, MDataSink *, TMediaId)
pure virtual TTimeIntervalMicroSeconds FrameTimeInterval(TMediaId)
virtual TUint GetDefaultSampleRate()
virtual voidGetNumberOfMetaDataEntriesL(TInt &)
virtual voidGetSupportedBitRatesL(RArray< TUint > &)
virtual voidGetSupportedDataTypesL(TMediaId, RArray< TFourCC > &)
virtual voidGetSupportedNumChannelsL(RArray< TUint > &)
virtual voidGetSupportedSampleRatesL(RArray< TUint > &)
TUid ImplementationUid()
virtual TInt MaximumClipSize()
virtual CMMFMetaDataEntry *MetaDataEntryL(TInt)
IMPORT_C CMMFFormatEncode *NewL(TUid, MDataSink *)
IMPORT_C CMMFFormatEncode *NewL(const TDesC &, MDataSink *, const TDesC &)
IMPORT_C CMMFFormatEncode *NewL(const TDesC8 &, MDataSink *, const TDesC &)
IMPORT_C CMMFFormatEncode *NewL(MDataSink *, const TDesC &)
virtual TUint NumChannels()
virtual TTimeIntervalMicroSeconds PositionL()
virtual TInt RemoveMetaDataEntry(TInt)
virtual voidReplaceMetaDataEntryL(TInt, const CMMFMetaDataEntry &)
virtual TUint SampleRate()
virtual TInt SetBitRate(TUint)
virtual voidSetMaximumClipSizeL(TInt)
virtual TInt SetNumChannels(TUint)
virtual voidSetPositionL(const TTimeIntervalMicroSeconds &)
virtual TInt SetSampleRate(TUint)
pure virtual TFourCC SinkDataTypeCode(TMediaId)
virtual TFourCC SourceDataTypeCode(TMediaId)
Protected Member Functions
CMMFFormatEncode()
virtual voidConstructSinkL(const TDesC8 &)
virtual voidConstructSourceL(const TDesC8 &)
CMMFFormatEncode *CreateFormatL(TUid, MDataSink *)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
MDataSink::DataSinkType()const
MDataSink::MDataSink(TUid)
MDataSink::NegotiateL(MDataSource &)
MDataSink::NewSinkL(TUid,const TDesC8 &)
MDataSink::NewSinkLC(TUid,const TDesC8 &)
MDataSink::SetSinkDataTypeCode(TFourCC,TMediaId)
MDataSink::SetSinkPrioritySettings(const TMMFPrioritySettings &)
MDataSink::SinkCustomCommand(TMMFMessage &)
MDataSink::SinkPauseL()
MDataSink::SinkPlayL()
MDataSink::SinkPrimeL()
MDataSink::SinkStopL()
MDataSink::SinkThreadLogoff()
MDataSink::SinkThreadLogon(MAsyncEventHandler &)
MDataSink::~MDataSink()
MDataSource::CreateSourceBufferL(TMediaId,CMMFBuffer &,TBool &)
MDataSource::DataSourceType()const
MDataSource::MDataSource(TUid)
MDataSource::NegotiateSourceL(MDataSink &)
MDataSource::NewSourceL(TUid,const TDesC8 &)
MDataSource::NewSourceLC(TUid,const TDesC8 &)
MDataSource::SetSourceDataTypeCode(TFourCC,TMediaId)
MDataSource::SetSourcePrioritySettings(const TMMFPrioritySettings &)
MDataSource::SourceCustomCommand(TMMFMessage &)
MDataSource::SourcePauseL()
MDataSource::SourcePlayL()
MDataSource::SourcePrimeL()
MDataSource::SourceSampleConvert()
MDataSource::SourceStopL()
MDataSource::SourceThreadLogoff()
MDataSource::SourceThreadLogon(MAsyncEventHandler &)
MDataSource::~MDataSource()

Detailed Description

Base class from which sink formats can be derived from.

The intended usage is for controllers that can support more than one type of format.

The class is an MDataSink as far as the data path is concerned but is an MDataSource to the clip

that is the sink of the actual data. All CMMFFormatEncode plugin DLLs must include

interface_uid = KMmfUidPluginInterfaceFormatEncode in their .rss files.

Member Attribute Documentation

iClip

MDataSink *iClip[protected]

The clip is the sink for the encode format.

iDataPath

MDataSource *iDataPath[protected]

The Data path is the source for the encode format.

Constructor & Destructor Documentation

CMMFFormatEncode ( )

CMMFFormatEncode()[protected, inline]

Default constructor

~CMMFFormatEncode ( )

~CMMFFormatEncode()[inline, virtual]

Destructor.

Member Function Documentation

AddMetaDataEntryL ( const CMMFMetaDataEntry & )

voidAddMetaDataEntryL(const CMMFMetaDataEntry &aNewEntry)[inline, virtual]

Adds the specified meta data entry to the clip.

The default implementation leaves with KErrNotSupported.

Parameters
aNewEntryThe meta data entry to add.

BitRate ( )

TUint BitRate()[inline, virtual]

Returns the bit rate.

The default returns 0.

Return Value
The bit rate.

BufferEmptiedL ( CMMFBuffer * )

voidBufferEmptiedL(CMMFBuffer *aBuffer)[inline, virtual]

Reimplemented from MDataSource::BufferEmptiedL(CMMFBuffer *)

Called by the clip when it has added the data to the file.

Parameters
aBufferThe emptied buffer.

BufferFilledL ( CMMFBuffer * )

voidBufferFilledL(CMMFBuffer *aBuffer)[inline, virtual]

Reimplemented from MDataSink::BufferFilledL(CMMFBuffer *)

Called by the CMMFDataPath's MDataSource when it has filled the buffer.

Parameters
aBufferThe buffer that has been filled.

BytesPerSecond ( )

TInt64 BytesPerSecond()[inline, virtual]

Returns the bytes per second.

The default returns 0.

Return Value
The bytes per second.

CanCreateSinkBuffer ( )

TBool CanCreateSinkBuffer()[inline, virtual]

Reimplemented from MDataSink::CanCreateSinkBuffer()

Tests whether a sink buffer can be created.

Format would normally pass its own buffer onto the CMMFClip, so

this may not be required. The default returns ETrue.

Return Value
A boolean indicating if the buffer can be created. ETrue if buffer can be created, EFalse otherwise.

CanCreateSourceBuffer ( )

TBool CanCreateSourceBuffer()[inline, virtual]

Reimplemented from MDataSource::CanCreateSourceBuffer()

Tests whether a source buffer can be created.

The default implementation returns EFalse.

Return Value
A boolean indicating if the buffer can be created. ETrue if buffer can be created, EFalse otherwise.

ConstructSinkL ( const TDesC8 & )

voidConstructSinkL(const TDesC8 &)[protected, inline, virtual]

Reimplemented from MDataSink::ConstructSinkL(const TDesC8 &)

ConstructSourceL ( const TDesC8 & )

voidConstructSourceL(const TDesC8 &)[protected, inline, virtual]

CreateFormatL ( TUid, MDataSink * )

CMMFFormatEncode *CreateFormatL(TUidaImplementationUid,
MDataSink *aSink
)[protected, static]

CreateSinkBufferL ( TMediaId, TBool & )

CMMFBuffer *CreateSinkBufferL(TMediaIdaMediaId,
TBool &aReference
)[pure virtual]

Creates a sink buffer for the specified media ID.

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

If EFalse, then the caller owns the buffer.

Parameters
aMediaIdThe media type ID.
aReferenceIf ETrue then MDataSink owns the buffer.
Return Value
A pointer to the CMMFBuffer sink buffer.

CreateSourceBufferL ( TMediaId, TBool & )

CMMFBuffer *CreateSourceBufferL(TMediaIdaMediaId,
TBool &aReference
)[inline, virtual]

Creates a source buffer. The default returns NULL.

If EFalse, then the caller owns the buffer.

Parameters
aMediaIdThe media type id.
aReferenceIf ETrue the MDataSource owns the buffer.
Return Value
Source buffer.

CropL ( TTimeIntervalMicroSeconds, TBool )

voidCropL(TTimeIntervalMicroSecondsaPosition,
TBoolaToEnd = ETrue
)[inline, virtual]

This function is used to truncate the sink ie. a CMMFClip,

If aToEnd = ETrue the sink is cropped from the aPosition to the end of the clip.

If aToEnd = EFalse then the sink is cropped from the start of the clip to aPosition.

This function would be called by the CMMFController. The default implementation leaves

with KErrNotSupported.

Parameters
aPositionThe position within the clip.
aToEndFlag to determine which part of the clip to delete.

Duration ( TMediaId )

TTimeIntervalMicroSeconds Duration(TMediaIdaMediaType)const [pure virtual]

Returns the duration of the sink clip for the specified media type.

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

Parameters
aMediaTypeThe media type ID.
Return Value
The duration of the sink clip.

EmptyBufferL ( CMMFBuffer *, MDataSource *, TMediaId )

voidEmptyBufferL(CMMFBuffer *aBuffer,
MDataSource *aSupplier,
TMediaIdaMediaId
)[pure virtual]

Adds a buffer to a clip.

Called by CMMFDataPath.

(from MDataSink - CMMFFormatEncode is a MDataSink to a CMMFDataPath)

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

Parameters
aBufferThe buffer to which the clip is added.
aSupplierThe data source.
aMediaIdThe media type ID.

FillBufferL ( CMMFBuffer *, MDataSink *, TMediaId )

voidFillBufferL(CMMFBuffer *aBuffer,
MDataSink *aConsumer,
TMediaIdaMediaId
)[inline, virtual]

Request from CMMFDataPath to fill the specified buffer.

Parameters
aBufferThe buffer to fill.
aConsumerThe consumer.
aMediaIdThe media ID.

FrameTimeInterval ( TMediaId )

TTimeIntervalMicroSeconds FrameTimeInterval(TMediaIdaMediaType)const [pure virtual]

Returns the time interval for one frame for the specified media type.

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

Parameters
aMediaTypeThe media type ID.
Return Value
The frame time interval in microseconds.

GetDefaultSampleRate ( )

TUint GetDefaultSampleRate()[inline, virtual]

Returns the default sample rate.

The default returns 0.

Return Value
The default sample rate.

GetNumberOfMetaDataEntriesL ( TInt & )

voidGetNumberOfMetaDataEntriesL(TInt &aNumberOfEntries)[inline, virtual]

Gets the number of meta data entries.

The encode format is capable of reading and writing meta data to the clip.

The default implementation leaves with KErrNotSupported.

Parameters
aNumberOfEntriesOn return, contains the number of meta data entries.

GetSupportedBitRatesL ( RArray< TUint > & )

voidGetSupportedBitRatesL(RArray< TUint > &aBitRates)[inline, virtual]

Gets the supported bit rates.

The default implementation leaves with KErrNotSupported.

Parameters
aBitRatesA reference to an array of supported bit rates.

GetSupportedDataTypesL ( TMediaId, RArray< TFourCC > & )

voidGetSupportedDataTypesL(TMediaIdaMediaId,
RArray< TFourCC > &aDataTypes
)[inline, virtual]

Gets the supported data types for the given media type ID.

The default implementation leaves with KErrNotSupported.

Parameters
aMediaIdThe media type id.
aDataTypesA reference to an array of supported data types.

GetSupportedNumChannelsL ( RArray< TUint > & )

voidGetSupportedNumChannelsL(RArray< TUint > &aNumChannels)[inline, virtual]

Gets the supported number of channels.

The default implementation leaves with KErrNotSupported.

Parameters
aNumChannelsA reference to an array of supported number of channels.

GetSupportedSampleRatesL ( RArray< TUint > & )

voidGetSupportedSampleRatesL(RArray< TUint > &aSampleRates)[inline, virtual]

Gets the supported sample rates.

The default implementation leaves with KErrNotSupported.

Parameters
aSampleRatesA reference to an array of supported sample rates.

ImplementationUid ( )

TUid ImplementationUid()const [inline]

Gets the ECom plugin UID of this format.

Return Value
The plugin UID.

MaximumClipSize ( )

TInt MaximumClipSize()[inline, virtual]

Returns the maximum clip size.

The default returns 0.

Return Value
The maximum clip size.

MetaDataEntryL ( TInt )

CMMFMetaDataEntry *MetaDataEntryL(TIntaIndex)[inline, virtual]

Returns the specified meta data entry.

The default implementation leaves with KErrNotSupported.

Parameters
aIndexThe zero based meta data entry index to retrieve.
Return Value
The meta data entry.

NewL ( TUid, MDataSink * )

IMPORT_C CMMFFormatEncode *NewL(TUidaUid,
MDataSink *aSink
)[static]

Allocates and constructs an ECom format encode object.

leaves with KErrNotFound.

Parameters
aUidThe implementation UID.
aSinkThe data sink.
Return Value
If successful, returns the address of the format decode plugin object created. If not successful,

NewL ( const TDesC &, MDataSink *, const TDesC & )

IMPORT_C CMMFFormatEncode *NewL(const TDesC &aFileName,
MDataSink *aSink,
const TDesC &aPreferredSupplier
)[static]

Attempts to locate and instantiate a CMMFFormatEncode using a filename or an extension.

Only the extension of the supplied file name is used. If no extension is supplied (ie. no dot is present)

the whole of the filename will be treated as the extension.

plugin supplied by supplier named.

leaves with KErrNotFound.

Parameters
aFileNameFile name of target file. May be extension only or may include the full path.
aSinkThe data source.
aPreferredSupplierIf this is provided, the list of matching plugins will be further searched for the latest version of a
Return Value
If successful, returns the address of the format decode plugin object created. If not successful,

NewL ( const TDesC8 &, MDataSink *, const TDesC & )

IMPORT_C CMMFFormatEncode *NewL(const TDesC8 &aSourceHeader,
MDataSink *aSink,
const TDesC &aPreferredSupplier
)[static]

Attempts to locate and instantiate a CMMFFormatEncode using data in the specified buffer.

The buffer is expected to contain header data (from a file, stream or descriptor).

Signatures (supplied by the plugin registry information) are sought in aSourceHeader.

plugin supplied by supplier named.

leaves with KErrNotFound.

Parameters
aSourceHeaderThe data which is searched for matching signatures.
aSinkThe data sink.
aPreferredSupplierIf this is provided the list of matching plugins will be further searched for the latest version of a
Return Value
If successful, returns the address of the format decode plugin object created. If not successful,

NewL ( MDataSink *, const TDesC & )

IMPORT_C CMMFFormatEncode *NewL(MDataSink *aSink,
const TDesC &aPreferredSupplier
)[static]

Attempts to locate and instantiate a CMMFFormatEncode using data from aSink.

The data is expected to contain header data (from a file, stream or descriptor).

Signatures (supplied by the plugin registry information) are sought in the source header.

plugin supplied by supplier specified.

leaves with KErrNotFound.

Parameters
aSinkThe header data. Must be derived from CMMFClip.
aPreferredSupplierIf this is provided, the list of matching plugins will be further searched for the latest version of a
Return Value
If successful, returns the address of the format decode plugin object created. If not successful,

NumChannels ( )

TUint NumChannels()[inline, virtual]

Returns the number of channels.

The default implementation returns 0.

Return Value
The number of channels.

PositionL ( )

TTimeIntervalMicroSeconds PositionL()[inline, virtual]

Supplies the current position.

Subsequent data reads will commence from this position.

Return Value
The current position in microseconds.

RemoveMetaDataEntry ( TInt )

TInt RemoveMetaDataEntry(TIntaIndex)[inline, virtual]

Removes the specified meta data entry.

The default implementation returns KErrNotSupported.

another of the system-wide error codes.

Parameters
aIndexThe zero based meta data entry index to remove.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise

ReplaceMetaDataEntryL ( TInt, const CMMFMetaDataEntry & )

voidReplaceMetaDataEntryL(TIntaIndex,
const CMMFMetaDataEntry &aNewEntry
)[inline, virtual]

Replaces the specified meta data entry with the entry supplied in aNewEntry.

The default implementation leaves with KErrNotSupported.

Parameters
aIndexThe zero based meta data entry index to replace.
aNewEntryThe meta data entry to replace.

SampleRate ( )

TUint SampleRate()[inline, virtual]

Returns the sample rate.

The default implementation returns 0.

Return Value
The sample rate.

SetBitRate ( TUint )

TInt SetBitRate(TUintaBitRate)[inline, virtual]

Sets the bit rate.

The default implementation returns KErrNotSupported.

another of the system-wide error codes.

Parameters
aBitRateThe bit rate.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise

SetMaximumClipSizeL ( TInt )

voidSetMaximumClipSizeL(TIntaBytes)[inline, virtual]

Sets the maximum clip size.

The default implementation leaves with KErrNotSupported.

Parameters
aBytesThe maximum clip size.

SetNumChannels ( TUint )

TInt SetNumChannels(TUintaChannels)[inline, virtual]

Sets the number of channels.

The default implementation returns KErrNotSupported.

another of the system-wide error codes.

Parameters
aChannelsThe number of channels.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise

SetPositionL ( const TTimeIntervalMicroSeconds & )

voidSetPositionL(const TTimeIntervalMicroSeconds &aPosition)[inline, virtual]

Used to set the format's position.

Subsequent data reads should ignore the FrameNumber in the CMMFBuffer and use this

setting to determine what data to provide.

The actual position the format sets itself may vary to this setting to ensure

that it is aligned to the sample boundaries ensuring consistent data output.

If not supported, positional information should be extracted from the FrameNumber in CMMFBuffer

Parameters
aPositionThe position the format should use.

SetSampleRate ( TUint )

TInt SetSampleRate(TUintaSampleRate)[inline, virtual]

Sets the sample rate.

The default implementation returns KErrNotSupported.

another of the system-wide error codes.

Parameters
aSampleRateThe sample rate.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise

SinkDataTypeCode ( TMediaId )

TFourCC SinkDataTypeCode(TMediaIdaMediaId)[pure virtual]

Returns the sink data type code for the specified media type ID.

This would be the same as the source data type four CC although the clip

is not going to need this info.

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

Parameters
aMediaIdThe media type ID.
Return Value
The sink data type code.

SourceDataTypeCode ( TMediaId )

TFourCC SourceDataTypeCode(TMediaIdaMediaId)[inline, virtual]

Returns the source data type code for the specified media type ID.

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

Parameters
aMediaIdThe media type id.
Return Value
The source data type code.