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.
Protected Member Functions | |
---|---|
CMMFDataPath(TMediaId, MAsyncEventHandler &) | |
TInt | AudioSamplesPlayed() |
TInt | AudioSamplesRecorded() |
TTimeIntervalMicroSeconds | CalculateAudioInputPosition() |
TTimeIntervalMicroSeconds | CalculateAudioOutputPosition() |
IMPORT_C void | ConstructL(TUid) |
IMPORT_C void | ConstructSinkL(const TDesC8 &) |
IMPORT_C void | ConstructSourceL(const TDesC8 &) |
TInt | DetermineBuffersToUseL(void) |
IMPORT_C void | EndOfData() |
TTimeIntervalMicroSeconds | InputPosition() |
TTimeIntervalMicroSeconds | OutputPosition() |
Private Member Functions | |
---|---|
void | ChangeDataPathTransferState(TTransferState) |
void | CreateDataPathL(MDataSource *, MDataSink *) |
void | DoCleanupBuffers() |
void | DoEndOfDataL() |
void | DoPauseL() |
void | DoStopL() |
TTimeIntervalMicroSeconds | Duration() |
void | EmptySinkBufferL() |
void | FillSinkBufferL() |
void | FillSourceBufferL() |
void | InitializeSinkL() |
void | InitializeSourceL() |
void | ObtainSyncBuffersL() |
void | ResetRefBuffers() |
IMPORT_C TInt | SendEventToClient(const TMMFEvent &) |
void | SetBuffersAvailable() |
Public Member Enumerations | |
---|---|
enum | TDataPathState { EStopped, EPrimed, EPlaying, ERecording, EConverting } |
Protected Member Enumerations | |
---|---|
enum | TNeedBuffer { ENoBuffers = 0x0, ENeedSinkBuffer = 0x01, ENeedSourceBuffer = 0x10 } |
enum | TTransferState { EWaitSink, EWaitSource, EInitializeSink, EInitializeSource, ENeedSourceData, ENeedSinkData, ENeedToMatchSourceToSink, ESendDataToSink, EEndOfData } |
Inherited Enumerations | |
---|---|
CActive:TPriority |
Inherited Attributes | |
---|---|
CActive::iStatus |
CMMFDataPath | ( | TMediaId | aMediaId, |
MAsyncEventHandler & | aEventHandler | ||
) | [protected, inline] |
TMediaId aMediaId | |
MAsyncEventHandler & aEventHandler |
IMPORT_C void | AddDataSinkL | ( | MDataSink * | aSink | ) | [virtual] |
MDataSink * aSink |
IMPORT_C void | AddDataSourceL | ( | MDataSource * | aSource | ) | [virtual] |
MDataSource * aSource |
IMPORT_C void | BufferEmptiedL | ( | CMMFBuffer * | aBuffer | ) | [virtual] |
CMMFBuffer * aBuffer |
IMPORT_C void | BufferFilledL | ( | CMMFBuffer * | aBuffer | ) | [virtual] |
CMMFBuffer * aBuffer |
TTimeIntervalMicroSeconds | CalculateAudioInputPosition | ( | ) | const [protected] |
TTimeIntervalMicroSeconds | CalculateAudioOutputPosition | ( | ) | const [protected] |
void | ChangeDataPathTransferState | ( | TTransferState | aNewDataPathTransferState | ) | [private] |
TTransferState aNewDataPathTransferState |
IMPORT_C void | ConstructL | ( | TUid | aCodecUid = KNullUid | ) | [protected] |
TUid aCodecUid = KNullUid |
IMPORT_C void | ConstructSinkL | ( | const TDesC8 & | aInitData | ) | [protected, virtual] |
const TDesC8 & aInitData |
IMPORT_C void | ConstructSourceL | ( | const TDesC8 & | aInitData | ) | [protected, virtual] |
const TDesC8 & aInitData |
void | CreateDataPathL | ( | MDataSource * | aSource, |
MDataSink * | aSink | |||
) | [private] |
MDataSource * aSource | |
MDataSink * aSink |
IMPORT_C CMMFBuffer * | CreateSinkBufferL | ( | TMediaId | aMediaId | ) | [virtual] |
TMediaId aMediaId |
IMPORT_C CMMFBuffer * | CreateSinkBufferL | ( | TMediaId | aMediaId, |
TBool & | aReference | |||
) | [virtual] |
IMPORT_C CMMFBuffer * | CreateSourceBufferL | ( | TMediaId | aMediaId | ) | [virtual] |
TMediaId aMediaId |
IMPORT_C CMMFBuffer * | CreateSourceBufferL | ( | TMediaId | aMediaId, |
TBool & | aReference | |||
) | [virtual] |
IMPORT_C void | DoCancel | ( | ) | [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().
IMPORT_C void | EmptyBufferL | ( | CMMFBuffer * | aBuffer, |
MDataSource * | aSupplier, | |||
TMediaId | aMediaId | |||
) | [virtual] |
CMMFBuffer * aBuffer | |
MDataSource * aSupplier | |
TMediaId aMediaId |
IMPORT_C void | FillBufferL | ( | CMMFBuffer * | aBuffer, |
MDataSink * | aConsumer, | |||
TMediaId | aMediaId | |||
) | [virtual] |
CMMFBuffer * aBuffer | |
MDataSink * aConsumer | |
TMediaId aMediaId |
IMPORT_C CMMFDataPath * | NewL | ( | MAsyncEventHandler & | aEventHandler | ) | [static] |
MAsyncEventHandler & aEventHandler |
IMPORT_C CMMFDataPath * | NewL | ( | TMediaId | aMediaId, |
MAsyncEventHandler & | aEventHandler | |||
) | [static] |
TMediaId aMediaId | |
MAsyncEventHandler & aEventHandler |
IMPORT_C CMMFDataPath * | NewL | ( | TUid | aCodecUid, |
MAsyncEventHandler & | aEventHandler | |||
) | [static] |
TUid aCodecUid | |
MAsyncEventHandler & aEventHandler |
IMPORT_C CMMFDataPath * | NewL | ( | TUid | aCodecUid, |
TMediaId | aMediaId, | |||
MAsyncEventHandler & | aEventHandler | |||
) | [static] |
TUid aCodecUid | |
TMediaId aMediaId | |
MAsyncEventHandler & aEventHandler |
IMPORT_C void | RunL | ( | ) | [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::WaitForAnyRequest
TRAPD
IMPORT_C TInt | SendEventToClient | ( | const TMMFEvent & | aEvent | ) | [private] |
const TMMFEvent & aEvent |
IMPORT_C void | SetPlayWindowL | ( | const TTimeIntervalMicroSeconds & | aStart, |
const TTimeIntervalMicroSeconds & | aEnd | |||
) | [virtual] |
const TTimeIntervalMicroSeconds & aStart | |
const TTimeIntervalMicroSeconds & aEnd |
IMPORT_C void | SetPositionL | ( | const TTimeIntervalMicroSeconds & | aPosition | ) | [virtual] |
const TTimeIntervalMicroSeconds & aPosition |
IMPORT_C TFourCC | SinkDataTypeCode | ( | TMediaId | aMediaId | ) | [virtual] |
TMediaId aMediaId |
IMPORT_C TFourCC | SourceDataTypeCode | ( | TMediaId | aMediaId | ) | [virtual] |
TMediaId aMediaId |
Indicates the state of the data path.
Mimics typical MultiMedia behaviour of stopped, primed and playing
EStopped |
Stopped. |
EPrimed |
Primed. |
EPlaying |
Playing. |
ERecording |
Recording. |
EConverting |
Converting. |
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.
ENoBuffers = 0x0 |
No buffers needed. |
ENeedSinkBuffer = 0x01 |
Sink buffer needed. |
ENeedSourceBuffer = 0x10 |
Source buffer needed. |
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.
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. |
TBool | iAllDataSentToSink | [protected] |
Indicates that all data has been sent to the sink.
TInt | iBuffersToUse | [protected] |
Holds the outcome of the call to DetermineBuffersToUseL
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.
TCodecProcessResult | iCodecProcessResult | [protected] |
Result of processing the codec.
CCompleteCallback * | iCompleteCallback | [protected] |
Pointer to internal callback completion class
TUint | iCurrentSinkFrameNumber | [protected] |
The sink's position in terms of frames or some other time fixed parameter.
TUint | iCurrentSourceFrameNumber | [protected] |
The source's position in terms of frames or some other time fixed parameter.
TUint | iDataPathCompletedErrorCode | [protected] |
Datapath completed because of an error; usually KErrNone.
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 | [protected] |
The sink of data for which the CMMFDataPath is a MDataSource for
MDataSource * | iDataSource | [protected] |
The source of data to which the CMMFDataPath is a MDataSink for.
TMediaId | iMediaId | [protected] |
Identifies which media type and stream within MDataSource.
TBool | iNoMoreSourceData | [protected] |
Indicates that all data has been obtained from the source (ETrue if there is no more source data).
TBool | iObtainingAsyncSinkBuffer | [protected] |
Indicates asynchrous buffers from AudioOutput.
TBool | iObtainingAsyncSourceBuffer | [protected] |
Indicates asynchrous buffers from AudioInput.
TTimeIntervalMicroSeconds | iPlayWindowEndPosition | [protected] |
End position of the play window.
TTimeIntervalMicroSeconds | iPlayWindowStartPosition | [protected] |
Start position of the play window.
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 | [protected] |
Holds the number of samples recorded from audio input at a point where we want to reference record duration from.
CMMFBuffer * | iSinkBuffer | [protected] |
This is set to point to whichever sink buffer is in use.
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 | [protected] |
Set to true when the sink is able to accept data. EFalse otherwise.
TFourCC | iSinkFourCC | [protected] |
The sink's data type. Same as the codec input data type.
TBool | iSnkBufRef | [protected] |
ETrue if sink buffer is reference to object owned by someone else
CMMFBuffer * | iSourceBuffer | [protected] |
This is the pointer to whichever source buffer is in use
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 | [protected] |
The source's data type. Same as the codec output data type.
TBool | iSrcBufRef | [protected] |
ETrue if the source buffer is reference to object owned by someone else.
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.
TTransferState | iTransferState | [protected] |
Current transfer state. TTransferState
TBool | iUseSuppliedCodecUid | [protected] |
Set to true if data path has to use a supplied codec in its construction.