CMMFDataPath Class Reference

class CMMFDataPath : public CActive

Abstract utility class that moves data from a single data source to a single data sink, via a codec if required.

All functions are exported form the DLL and are virtual to allow plugins to define their own data paths.

Inherits from

Nested Classes and Structures

Public Member Functions
~CMMFDataPath()
IMPORT_C voidAddDataSinkL(MDataSink *)
IMPORT_C voidAddDataSourceL(MDataSource *)
IMPORT_C voidBufferEmptiedL(CMMFBuffer *)
IMPORT_C voidBufferFilledL(CMMFBuffer *)
IMPORT_C TBoolCanCreateSinkBuffer()
IMPORT_C TBoolCanCreateSourceBuffer()
IMPORT_C voidClearPlayWindowL()
IMPORT_C CMMFBuffer *CreateSinkBufferL(TMediaId)
IMPORT_C CMMFBuffer *CreateSinkBufferL(TMediaId, TBool &)
IMPORT_C CMMFBuffer *CreateSourceBufferL(TMediaId)
IMPORT_C CMMFBuffer *CreateSourceBufferL(TMediaId, TBool &)
IMPORT_C voidDoCancel()
IMPORT_C TIntDoSendEventToClient(TUid, TInt)
IMPORT_C voidEmptyBufferL(CMMFBuffer *, MDataSource *, TMediaId)
IMPORT_C voidFillBufferL(CMMFBuffer *, MDataSink *, TMediaId)
IMPORT_C CMMFDataPath *NewL(MAsyncEventHandler &)
IMPORT_C CMMFDataPath *NewL(TMediaId, MAsyncEventHandler &)
IMPORT_C CMMFDataPath *NewL(TUid, MAsyncEventHandler &)
IMPORT_C CMMFDataPath *NewL(TUid, TMediaId, MAsyncEventHandler &)
IMPORT_C voidPause()
IMPORT_C voidPlayL()
IMPORT_C TTimeIntervalMicroSecondsPosition()
IMPORT_C voidPrimeL()
IMPORT_C voidResetL()
IMPORT_C TIntRunError(TInt)
IMPORT_C voidRunL()
IMPORT_C TIntSetBlockLength(TUint)
IMPORT_C voidSetPlayWindowL(const TTimeIntervalMicroSeconds &, const TTimeIntervalMicroSeconds &)
IMPORT_C voidSetPositionL(const TTimeIntervalMicroSeconds &)
IMPORT_C TFourCCSinkDataTypeCode(TMediaId)
IMPORT_C TFourCCSourceDataTypeCode(TMediaId)
IMPORT_C TIntState()
IMPORT_C voidStop()
Protected Member Functions
CMMFDataPath(TMediaId, MAsyncEventHandler &)
TInt AudioSamplesPlayed()
TInt AudioSamplesRecorded()
TTimeIntervalMicroSeconds CalculateAudioInputPosition()
TTimeIntervalMicroSeconds CalculateAudioOutputPosition()
IMPORT_C voidConstructL(TUid)
IMPORT_C voidConstructSinkL(const TDesC8 &)
IMPORT_C voidConstructSourceL(const TDesC8 &)
TInt DetermineBuffersToUseL(void)
IMPORT_C voidEndOfData()
TTimeIntervalMicroSeconds InputPosition()
TTimeIntervalMicroSeconds OutputPosition()
Private Member Functions
voidChangeDataPathTransferState(TTransferState)
voidCreateDataPathL(MDataSource *, MDataSink *)
voidDoCleanupBuffers()
voidDoEndOfDataL()
voidDoPauseL()
voidDoStopL()
TTimeIntervalMicroSeconds Duration()
voidEmptySinkBufferL()
voidFillSinkBufferL()
voidFillSourceBufferL()
voidInitializeSinkL()
voidInitializeSourceL()
voidObtainSyncBuffersL()
voidResetRefBuffers()
IMPORT_C TIntSendEventToClient(const TMMFEvent &)
voidSetBuffersAvailable()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
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()
Public Member Enumerations
enumTDataPathState { EStopped, EPrimed, EPlaying, ERecording, EConverting }
Protected Member Enumerations
enumTNeedBuffer { ENoBuffers = 0x0, ENeedSinkBuffer = 0x01, ENeedSourceBuffer = 0x10 }
enumTTransferState {
EWaitSink, EWaitSource, EInitializeSink, EInitializeSource, ENeedSourceData, ENeedSinkData, ENeedToMatchSourceToSink, ESendDataToSink, EEndOfData
}
Inherited Enumerations
CActive:TPriority
Protected Attributes
TBool iAllDataSentToSink
TInt iBuffersToUse
TTimeIntervalMicroSeconds iCachedSourceDuration
CMMFCodec *iCodec
TCodecProcessResult iCodecProcessResult
CCompleteCallback *iCompleteCallback
TUint iCurrentSinkFrameNumber
TUint iCurrentSourceFrameNumber
TUint iDataPathCompletedErrorCode
TBool iDataPathCreated
MDataSink *iDataSink
MDataSource *iDataSource
MAsyncEventHandler &iEventHandler
TMediaId iMediaId
TBool iNoMoreSourceData
TBool iObtainingAsyncSinkBuffer
TBool iObtainingAsyncSourceBuffer
TBool iPauseCalled
TTimeIntervalMicroSeconds iPlayWindowEndPosition
TTimeIntervalMicroSeconds iPlayWindowStartPosition
TInt iReferenceAudioSamplesPlayed
TInt iReferenceAudioSamplesRecorded
CMMFBuffer *iSinkBuffer
TBool iSinkBufferWithSink
TBool iSinkCanReceive
TFourCC iSinkFourCC
TBool iSnkBufRef
CMMFBuffer *iSourceBuffer
TBool iSourceBufferWithSource
TFourCC iSourceFourCC
TBool iSrcBufRef
TTimeIntervalMicroSeconds iStartPosition
TDataPathState iState
TTransferState iTransferState
TBool iUseSuppliedCodecUid
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CMMFDataPath(TMediaId, MAsyncEventHandler &)

CMMFDataPath(TMediaIdaMediaId,
MAsyncEventHandler &aEventHandler
)[protected, inline]

Parameters

TMediaId aMediaId
MAsyncEventHandler & aEventHandler

~CMMFDataPath()

IMPORT_C~CMMFDataPath()[virtual]

Member Functions Documentation

AddDataSinkL(MDataSink *)

IMPORT_C voidAddDataSinkL(MDataSink *aSink)[virtual]

Parameters

MDataSink * aSink

AddDataSourceL(MDataSource *)

IMPORT_C voidAddDataSourceL(MDataSource *aSource)[virtual]

Parameters

MDataSource * aSource

AudioSamplesPlayed()

TInt AudioSamplesPlayed()const [protected]

AudioSamplesRecorded()

TInt AudioSamplesRecorded()const [protected]

BufferEmptiedL(CMMFBuffer *)

IMPORT_C voidBufferEmptiedL(CMMFBuffer *aBuffer)[virtual]

Parameters

CMMFBuffer * aBuffer

BufferFilledL(CMMFBuffer *)

IMPORT_C voidBufferFilledL(CMMFBuffer *aBuffer)[virtual]

Parameters

CMMFBuffer * aBuffer

CalculateAudioInputPosition()

TTimeIntervalMicroSeconds CalculateAudioInputPosition()const [protected]

CalculateAudioOutputPosition()

TTimeIntervalMicroSeconds CalculateAudioOutputPosition()const [protected]

CanCreateSinkBuffer()

IMPORT_C TBoolCanCreateSinkBuffer()[virtual]

CanCreateSourceBuffer()

IMPORT_C TBoolCanCreateSourceBuffer()[virtual]

ChangeDataPathTransferState(TTransferState)

voidChangeDataPathTransferState(TTransferStateaNewDataPathTransferState)[private]

Parameters

TTransferState aNewDataPathTransferState

ClearPlayWindowL()

IMPORT_C voidClearPlayWindowL()[virtual]

ConstructL(TUid)

IMPORT_C voidConstructL(TUidaCodecUid = KNullUid)[protected]

Parameters

TUid aCodecUid = KNullUid

ConstructSinkL(const TDesC8 &)

IMPORT_C voidConstructSinkL(const TDesC8 &aInitData)[protected, virtual]

Parameters

const TDesC8 & aInitData

ConstructSourceL(const TDesC8 &)

IMPORT_C voidConstructSourceL(const TDesC8 &aInitData)[protected, virtual]

Parameters

const TDesC8 & aInitData

CreateDataPathL(MDataSource *, MDataSink *)

voidCreateDataPathL(MDataSource *aSource,
MDataSink *aSink
)[private]

Parameters

MDataSource * aSource
MDataSink * aSink

CreateSinkBufferL(TMediaId)

IMPORT_C CMMFBuffer *CreateSinkBufferL(TMediaIdaMediaId)[virtual]

Parameters

TMediaId aMediaId

CreateSinkBufferL(TMediaId, TBool &)

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

Parameters

TMediaId aMediaId
TBool & aReference

CreateSourceBufferL(TMediaId)

IMPORT_C CMMFBuffer *CreateSourceBufferL(TMediaIdaMediaId)[virtual]

Parameters

TMediaId aMediaId

CreateSourceBufferL(TMediaId, TBool &)

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

Parameters

TMediaId aMediaId
TBool & aReference

DetermineBuffersToUseL(void)

TInt DetermineBuffersToUseL(void)const [protected]

Parameters

void

DoCancel()

IMPORT_C voidDoCancel()[virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel().

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel().

CActive::Cancel

DoCleanupBuffers()

voidDoCleanupBuffers()[private]

DoEndOfDataL()

voidDoEndOfDataL()[private]

DoPauseL()

voidDoPauseL()[private]

DoSendEventToClient(TUid, TInt)

IMPORT_C TIntDoSendEventToClient(TUidaEventType,
TIntaErrorCode
)

Parameters

TUid aEventType
TInt aErrorCode

DoStopL()

voidDoStopL()[private]

Duration()

TTimeIntervalMicroSeconds Duration()const [private]

EmptyBufferL(CMMFBuffer *, MDataSource *, TMediaId)

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

Parameters

CMMFBuffer * aBuffer
MDataSource * aSupplier
TMediaId aMediaId

EmptySinkBufferL()

voidEmptySinkBufferL()[private]

EndOfData()

IMPORT_C voidEndOfData()[protected, virtual]

FillBufferL(CMMFBuffer *, MDataSink *, TMediaId)

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

Parameters

CMMFBuffer * aBuffer
MDataSink * aConsumer
TMediaId aMediaId

FillSinkBufferL()

voidFillSinkBufferL()[private]

FillSourceBufferL()

voidFillSourceBufferL()[private]

InitializeSinkL()

voidInitializeSinkL()[private]

InitializeSourceL()

voidInitializeSourceL()[private]

InputPosition()

TTimeIntervalMicroSeconds InputPosition()const [protected]

NewL(MAsyncEventHandler &)

IMPORT_C CMMFDataPath *NewL(MAsyncEventHandler &aEventHandler)[static]

Parameters

MAsyncEventHandler & aEventHandler

NewL(TMediaId, MAsyncEventHandler &)

IMPORT_C CMMFDataPath *NewL(TMediaIdaMediaId,
MAsyncEventHandler &aEventHandler
)[static]

Parameters

TMediaId aMediaId
MAsyncEventHandler & aEventHandler

NewL(TUid, MAsyncEventHandler &)

IMPORT_C CMMFDataPath *NewL(TUidaCodecUid,
MAsyncEventHandler &aEventHandler
)[static]

Parameters

TUid aCodecUid
MAsyncEventHandler & aEventHandler

NewL(TUid, TMediaId, MAsyncEventHandler &)

IMPORT_C CMMFDataPath *NewL(TUidaCodecUid,
TMediaIdaMediaId,
MAsyncEventHandler &aEventHandler
)[static]

Parameters

TUid aCodecUid
TMediaId aMediaId
MAsyncEventHandler & aEventHandler

ObtainSyncBuffersL()

voidObtainSyncBuffersL()[private]

OutputPosition()

TTimeIntervalMicroSeconds OutputPosition()const [protected]

Pause()

IMPORT_C voidPause()[virtual]

PlayL()

IMPORT_C voidPlayL()[virtual]

Position()

IMPORT_C TTimeIntervalMicroSecondsPosition()const [virtual]

PrimeL()

IMPORT_C voidPrimeL()[virtual]

ResetL()

IMPORT_C voidResetL()[virtual]

ResetRefBuffers()

voidResetRefBuffers()[private]

RunError(TInt)

IMPORT_C TIntRunError(TIntaError)[virtual]

Parameters

TInt aError

RunL()

IMPORT_C voidRunL()[virtual]

Handles an active object's request completion event.

A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.

The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.

Before calling this active object's RunL() function, the active scheduler has:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.

Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.

CActiveScheduler::Start

CActiveScheduler::Error

CActiveScheduler::WaitForAnyRequest

TRAPD

SendEventToClient(const TMMFEvent &)

IMPORT_C TIntSendEventToClient(const TMMFEvent &aEvent)[private]

Parameters

const TMMFEvent & aEvent

SetBlockLength(TUint)

IMPORT_C TIntSetBlockLength(TUintaBlockLength)

Parameters

TUint aBlockLength

SetBuffersAvailable()

voidSetBuffersAvailable()[private]

SetPlayWindowL(const TTimeIntervalMicroSeconds &, const TTimeIntervalMicroSeconds &)

IMPORT_C voidSetPlayWindowL(const TTimeIntervalMicroSeconds &aStart,
const TTimeIntervalMicroSeconds &aEnd
)[virtual]

Parameters

const TTimeIntervalMicroSeconds & aStart
const TTimeIntervalMicroSeconds & aEnd

SetPositionL(const TTimeIntervalMicroSeconds &)

IMPORT_C voidSetPositionL(const TTimeIntervalMicroSeconds &aPosition)[virtual]

Parameters

const TTimeIntervalMicroSeconds & aPosition

SinkDataTypeCode(TMediaId)

IMPORT_C TFourCCSinkDataTypeCode(TMediaIdaMediaId)[virtual]

Parameters

TMediaId aMediaId

SourceDataTypeCode(TMediaId)

IMPORT_C TFourCCSourceDataTypeCode(TMediaIdaMediaId)[virtual]

Parameters

TMediaId aMediaId

State()

IMPORT_C TIntState()[virtual]

Stop()

IMPORT_C voidStop()[virtual]

Member Enumerations Documentation

Enum TDataPathState

Indicates the state of the data path.

Mimics typical MultiMedia behaviour of stopped, primed and playing

Enumerators

EStopped

Stopped.

EPrimed

Primed.

EPlaying

Playing.

ERecording

Recording.

EConverting

Converting.

Enum TNeedBuffer

This indicates what buffers are required in order to operate. If a real Codec is in use, buffers are required from both source and sink, else only one is required and source is preferred.

Enumerators

ENoBuffers = 0x0

No buffers needed.

ENeedSinkBuffer = 0x01

Sink buffer needed.

ENeedSourceBuffer = 0x10

Source buffer needed.

Enum TTransferState

Indicates the transfer state.

Buffers maybe be filled, emptied, or have "one" shot initialisatings performed upon them.

TTransferState is used within the datapath RunL which drives databuffer exchange.

Enumerators

EWaitSink

Waiting on a BufferEmptied callback from sink

EWaitSource

Waiting on a BufferFilled callback from source

EInitializeSink

Initialize the sink.

EInitializeSource

Initialize the source.

ENeedSourceData

Source buffer does not contain data.

ENeedSinkData

Sink buffer does not contain data.

ENeedToMatchSourceToSink

There is more source data to send to the sink and need to match sink and source.

ESendDataToSink

Outstanding data to send to sink.

EEndOfData

End of data.

Member Data Documentation

TBool iAllDataSentToSink

TBool iAllDataSentToSink[protected]

Indicates that all data has been sent to the sink.

TInt iBuffersToUse

TInt iBuffersToUse[protected]

Holds the outcome of the call to DetermineBuffersToUseL

TTimeIntervalMicroSeconds iCachedSourceDuration

TTimeIntervalMicroSeconds iCachedSourceDuration[protected]

This value can be used to obtain the duration of the source when playing or converting. This is an optimisation as this value will not change if we are playing or converting.

CMMFCodec * iCodec

CMMFCodec *iCodec[protected]

Codec in use. Null Codec is signified by == NULL

TCodecProcessResult iCodecProcessResult

TCodecProcessResult iCodecProcessResult[protected]

Result of processing the codec.

CCompleteCallback * iCompleteCallback

CCompleteCallback *iCompleteCallback[protected]

Pointer to internal callback completion class

TUint iCurrentSinkFrameNumber

TUint iCurrentSinkFrameNumber[protected]

The sink's position in terms of frames or some other time fixed parameter.

TUint iCurrentSourceFrameNumber

TUint iCurrentSourceFrameNumber[protected]

The source's position in terms of frames or some other time fixed parameter.

TUint iDataPathCompletedErrorCode

TUint iDataPathCompletedErrorCode[protected]

Datapath completed because of an error; usually KErrNone.

TBool iDataPathCreated

TBool iDataPathCreated[protected]

Set to ETrue when the data path has a source and a sink and can send data from the source to the sink.

MDataSink * iDataSink

MDataSink *iDataSink[protected]

The sink of data for which the CMMFDataPath is a MDataSource for

MDataSource * iDataSource

MDataSource *iDataSource[protected]

The source of data to which the CMMFDataPath is a MDataSink for.

MAsyncEventHandler & iEventHandler

MAsyncEventHandler &iEventHandler[protected]

Event handler.

TMediaId iMediaId

TMediaId iMediaId[protected]

Identifies which media type and stream within MDataSource.

TBool iNoMoreSourceData

TBool iNoMoreSourceData[protected]

Indicates that all data has been obtained from the source (ETrue if there is no more source data).

TBool iObtainingAsyncSinkBuffer

TBool iObtainingAsyncSinkBuffer[protected]

Indicates asynchrous buffers from AudioOutput.

TBool iObtainingAsyncSourceBuffer

TBool iObtainingAsyncSourceBuffer[protected]

Indicates asynchrous buffers from AudioInput.

TBool iPauseCalled

TBool iPauseCalled[protected]

Indicates DoPauseL() has been called.

TTimeIntervalMicroSeconds iPlayWindowEndPosition

TTimeIntervalMicroSeconds iPlayWindowEndPosition[protected]

End position of the play window.

TTimeIntervalMicroSeconds iPlayWindowStartPosition

TTimeIntervalMicroSeconds iPlayWindowStartPosition[protected]

Start position of the play window.

TInt iReferenceAudioSamplesPlayed

TInt iReferenceAudioSamplesPlayed[protected]

Holds the number of samples played on audio output at a point where we want to reference play duration from.

TInt iReferenceAudioSamplesRecorded

TInt iReferenceAudioSamplesRecorded[protected]

Holds the number of samples recorded from audio input at a point where we want to reference record duration from.

CMMFBuffer * iSinkBuffer

CMMFBuffer *iSinkBuffer[protected]

This is set to point to whichever sink buffer is in use.

TBool iSinkBufferWithSink

TBool iSinkBufferWithSink[protected]

Flag to indicate that a buffer is with the sink.

This are necessary as it is imperrative that when a buffer is with the sink, it must not be referenced in any way. The reason for this is that it is not mandated that sinks maintain buffer references. For example, it is valid for DevSound to request more audio data in a different buffer to the one supplied to it.

TBool iSinkCanReceive

TBool iSinkCanReceive[protected]

Set to true when the sink is able to accept data. EFalse otherwise.

TFourCC iSinkFourCC

TFourCC iSinkFourCC[protected]

The sink's data type. Same as the codec input data type.

TBool iSnkBufRef

TBool iSnkBufRef[protected]

ETrue if sink buffer is reference to object owned by someone else

CMMFBuffer * iSourceBuffer

CMMFBuffer *iSourceBuffer[protected]

This is the pointer to whichever source buffer is in use

TBool iSourceBufferWithSource

TBool iSourceBufferWithSource[protected]

Flag to indicate that a buffer is with the source.

This is necessary as it is imperrative that when a buffer is with the source, it must not be referenced in any way. The reason for this is that it is not mandated that sources maintain buffer references. For example, it is valid for DevSound to return recorded data in a different buffer to the one supplied to it.

TFourCC iSourceFourCC

TFourCC iSourceFourCC[protected]

The source's data type. Same as the codec output data type.

TBool iSrcBufRef

TBool iSrcBufRef[protected]

ETrue if the source buffer is reference to object owned by someone else.

TTimeIntervalMicroSeconds iStartPosition

TTimeIntervalMicroSeconds iStartPosition[protected]

The position audio will start playing from. When stopping, this is set to iPlayWindowStartPosition. When pausing, this is set to the current position.

TDataPathState iState

TDataPathState iState[protected]

Current data path state. TDataPathState

TTransferState iTransferState

TTransferState iTransferState[protected]

Current transfer state. TTransferState

TBool iUseSuppliedCodecUid

TBool iUseSuppliedCodecUid[protected]

Set to true if data path has to use a supplied codec in its construction.