CMMFAudioInput Class Reference

#include <mmf/server/mmfaudioinput.h>

class CMMFAudioInput : public CBase, public MMMFAudioInput, public MDevSoundObserver, public CBase, public MMMFAudioInput, public MDevSoundObserver
Public Attributes
TRequestStatus iBufferStatus
Public Member Functions
virtual ~CMMFAudioInput()
virtual voidBufferEmptiedL(CMMFBuffer *)
virtual TInt BytesPlayed()
virtual TBool CanCreateSourceBuffer()
voidConstructL()
virtual CMMFBuffer *CreateSourceBufferL(TMediaId)
virtual CMMFBuffer *CreateSourceBufferL(TMediaId, CMMFBuffer &)
virtual CMMFBuffer *CreateSourceBufferL(TMediaId, TBool &)
virtual CMMFBuffer *CreateSourceBufferL(TMediaId, CMMFBuffer &, TBool &)
virtual TFourCC DataType()
virtual voidFillBufferL(CMMFBuffer *, MDataSink *, TMediaId)
virtual voidHWFillBufferL(CMMFBuffer *, MDataSink *)
voidLoadL()
virtual voidNegotiateSourceL(MDataSink &)
MDataSource *NewSourceL()
virtual voidSetDataTypeL(TFourCC)
virtual TInt SetSourceDataTypeCode(TFourCC, TMediaId)
virtual voidSetSourcePrioritySettings(const TMMFPrioritySettings &)
virtual CMMFDevSound &SoundDevice()
virtual TFourCC SourceDataTypeCode(TMediaId)
virtual voidSourcePauseL()
virtual voidSourcePlayL()
virtual voidSourcePrimeL()
virtual voidSourceStopL()
virtual voidSourceThreadLogoff()
virtual TInt SourceThreadLogon(MAsyncEventHandler &)
Protected Member Functions
virtual voidConstructSourceL(const TDesC8 &)
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()
MDataSource::DataSourceType()const
MDataSource::MDataSource(TUid)
MDataSource::NewSourceL(TUid,const TDesC8 &)
MDataSource::NewSourceLC(TUid,const TDesC8 &)
MDataSource::SourceCustomCommand(TMMFMessage &)
MDataSource::SourceSampleConvert()
MDataSource::~MDataSource()
MMMFAudioInput::MMMFAudioInput()
MMMFAudioInput::NewAudioInputL(TUid,const TDesC8 &)

Detailed Description

Concrete data source to provide microphone support.

Intended to be used by controller plugin developers for source plugins. Uses CMMFDevSound to access hardware.

Member Attribute Documentation

iBufferStatus

TRequestStatus iBufferStatus

Buffer completion status.

Constructor & Destructor Documentation

~CMMFAudioInput ( )

~CMMFAudioInput()[virtual]

Member Function Documentation

BufferEmptiedL ( CMMFBuffer * )

voidBufferEmptiedL(CMMFBuffer *aBuffer)[virtual]

Function called by a data sink to pass back an emptied buffer to the source.

This is a pure virtual function that each derived class must implement. This method is used as the callback when the data source actively requests a consumer ie. a data sink to empty a buffer by calling the data sinks EmptyBufferL. When the data source gets this callback it knows that the buffer has been emptied and can be reused.

Parameters
aBufferThe buffer that has been emptied by a data sink and is now available for reuse.

BytesPlayed ( )

TInt BytesPlayed()[virtual]

Returns the number of bytes played.

Return Value
The number of bytes played. If 16-bit divide this number returned by 2 to get word length.

CanCreateSourceBuffer ( )

TBool CanCreateSourceBuffer()[virtual]

Deprecated

Function to indicate whether the data source can create a buffer.

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

Return Value
A boolean indicating if the data source can create a buffer. ETrue if it can otherwise EFalse.

ConstructL ( )

voidConstructL()

ConstructSourceL ( const TDesC8 & )

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

Performs any source construction dependant on the source construction initialisation data aInitData.

This is a pure virtual function that a derrived data source must implement

Parameters
aInitDataThe source specific initialisation data required for source construction.

CreateSourceBufferL ( TMediaId )

CMMFBuffer *CreateSourceBufferL(TMediaIdaMediaId)[virtual]

CreateSourceBufferL ( TMediaId, CMMFBuffer & )

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

Intended for synchronous usage (returns buffer specific to a Media Type).

Parameters
aMediaIdThe Media ID.
aSinkBufferNot Used.
Return Value
A pointer to the CMMFBuffer source buffer.

CreateSourceBufferL ( TMediaId, TBool & )

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

Deprecated

Returns a buffer created by the data source

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

Parameters
aMediaIdThis identifies the type of media eg. audio or video and the stream ID. This parameter is required in cases where the source can supply data of more than one media type and/or multiple strams of data eg a multimedia file.
aReferenceThis must be written to by the method to indicate whether the created buffer is a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source and should be used in preference to the sink buffer provided the sink buffer is also not a reference buffer.
Return Value
A pointer to the created buffer.

CreateSourceBufferL ( TMediaId, CMMFBuffer &, TBool & )

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

Creates a source buffer.

Intended for asynchronous usage (returns buffer specific to a Media Type).

Parameters
aMediaIdThe Media ID.
aSinkBufferNot used.
aReferenceA boolean indicating if MDataSource owns the buffer. If EFalse the the caller owns the buffer.
Return Value
The source buffer.

DataType ( )

TFourCC DataType()const [virtual]

FillBufferL ( CMMFBuffer *, MDataSink *, TMediaId )

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

Function called by a MDataSink to request the data source to fill aBuffer with data.

This is a pure virtual function that each derived class must implement. This method is used when a data source is passively waiting for requests from a consumer ie. a data sink to fill a buffer. The data source must call the BufferFilledL member on aConsumer when it has filled the buffer with data. The data source can either make this callback synchronously or asynchronously.

The format should read the frame number of the buffer via the buffer's CMMFBuffer::FrameNumber() function. From this, the format should be able to determine the actual position of the data on the data source. The technique here depends on the nature of the format. For a linear audio format, the position can be obtained by a simple calculation of the frame size, the header size and where appropriate the datatype.

For non-linear formats, either an index table of frame number and location will need to be created in the NewL() or some form of approximating algorithm will be required. Some formats have an index table as part of the format eg. AVI. If no random access is required then no index table is required, the format can keep track of the current read position and increment it on each access, and reset it if the frame number is reset to 0 or 1. Given that for non-linear ie. variable bit rate formats, the size of the data read may vary from frame to frame, then the format should either set the request size of the buffer for the required frame or call the source's ReadBufferL() (either CMMFClip::ReadBufferL(), CMMFDescriptor ::ReadBufferL() or CMMFFile::ReadBufferL()) function that takes the aLength parameter.

It is the responsibility of the format decode to determine the size and position of the source data for each frame. For linear audio formats, the format decode should fill the buffer up to its maximum length. For multimedia formats e.g. mp4, AVI etc, the format decode is effectively acting as a demultiplexor, and must obtain the appropriate data from the source depending on the aMediaId.

Parameters
aBufferThe buffer that needs filling with data.
aConsumerThe data sink that consumes the data. The data source needs this to make the BufferFilledL callback on aConsumer when the data source has completed filling the aBuffer.
aMediaIdThis identifies the type of media eg. audio or video and the stream ID. This parameter is required in cases where the source can supply data of more than one media type and/or multiple strams of data eg. a multimedia file.

HWFillBufferL ( CMMFBuffer *, MDataSink * )

voidHWFillBufferL(CMMFBuffer *aBuffer,
MDataSink *aConsumer
)[virtual]

Deprecated

Gets audio from hardware device abstracted MMFDevsound (not used).

Parameters
aBufferThe data to read in from a Hardware Device
aConsumerThe MDataSink consuming the data contained in aBuffer.

LoadL ( )

voidLoadL()

NegotiateSourceL ( MDataSink & )

voidNegotiateSourceL(MDataSink &aDataSink)[virtual]

Function to allow the data source to negotiate with a data sink

This method is required in cases where the settings of data source are dependant on those of a data sink. This is a virtual function that a derrived data source can implement.

Parameters
aDataSinkThe data sink whose settings can affect the data source.

NewSourceL ( )

MDataSource *NewSourceL()[static]

SetDataTypeL ( TFourCC )

voidSetDataTypeL(TFourCCaAudioType)[virtual]

SetSourceDataTypeCode ( TFourCC, TMediaId )

TInt SetSourceDataTypeCode(TFourCCaSourceFourCC,
TMediaIdaMediaId
)[virtual]

Sets the data type as a fourCC code for the data source.

This is a virtual function that each derived class can implement if the data source supports the ability to have its data type set.

Parameters
aSourceFourCCThis specifies the data type as a fourCC code to set the source to.
aMediaIdThis identifies the type of media eg. audio or video and the stream ID. This parameter is required in cases where the source can supply data of more than one media type and/or multiple strams of data eg a multimedia file.
Return Value
KErrNone if successful, KErrNotSupported if the source does not support having it's data type set, otherwise a system wide error code.

SetSourcePrioritySettings ( const TMMFPrioritySettings & )

voidSetSourcePrioritySettings(const TMMFPrioritySettings &aPrioritySettings)[virtual]

Function to set the source priority settings.

This is a virtual function that a derrived data source can implement if a priority mechanism is required to arbitrate between multiple clients trying to access the same resource.

Parameters
aPrioritySettingsThe source priority settings.

SoundDevice ( )

CMMFDevSound &SoundDevice()[virtual]

Returns the sound device.

Return Value
A reference to a CMMFDevSound objector. Accessor function exposing public CMMFDevsound methods.

SourceDataTypeCode ( TMediaId )

TFourCC SourceDataTypeCode(TMediaIdaMediaId)[virtual]

Returns the data type as a fourCC code of the data source.

This is a pure virtual function that each derrived class must implement.

Parameters
aMediaIdThis identifies the type of media eg. audio or video and the stream ID. This parameter is required in cases where the source can supply data of more than one media type and/or multiple streams of data.
Return Value
The fourCC code identifying the source datatype for the specified aMediaId.

SourcePauseL ( )

voidSourcePauseL()[virtual]

Reimplemented from MDataSource::SourcePauseL()

Function to 'pause' the data source.

This is a virtual function that a derrived data source can implement if any data source specific action is required to 'pause'

SourcePlayL ( )

voidSourcePlayL()[virtual]

Reimplemented from MDataSource::SourcePlayL()

Function to 'play' the data source.

This is a virtual function that a derrived data source can implement if any data source specific action is required prior to 'playing' ie. the start of data transfer.

SourcePrimeL ( )

voidSourcePrimeL()[virtual]

Reimplemented from MDataSource::SourcePrimeL()

Function to 'prime' the data source.

This is a virtual function that a derrived data source can implement if any data source specific 'priming' is required.

SourceStopL ( )

voidSourceStopL()[virtual]

Reimplemented from MDataSource::SourceStopL()

Function to 'stop' the data source.

This is a virtual function that a derrived data source can implement if any data source specific action is required to 'stop'.

SourceThreadLogoff ( )

voidSourceThreadLogoff()[virtual]

Function to 'logoff' the data source from the same thread that source supplies data in.

This method may be required as the thread that the data source is deleted in may not be the same thread that the data transfer took place in. Therefore any thread specific releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor.

This is a virtual function that a derrived data source can implement if any thread specific releasing of resources is required.

SourceThreadLogon ( MAsyncEventHandler & )

TInt SourceThreadLogon(MAsyncEventHandler &aEventHandler)[virtual]

Function to 'logon' the data source to the same thread that source will be supplying data in.

This method may be required as the thread that the data source was created in is not always the same thread that the data transfer will take place in. Therefore any thread specific initialisation needs to be performed in the SourceThreadLogon rather than in the creation of the data source.

This is a virtual function that a derrived data source can implement if any thread specific initialisation is required and/or the data source can create any asynchronous events.

Parameters
aEventHandlerThis is an MAsyncEventHandler to handle asynchronous events that occur during the transfer of multimedia data. The event handler must be in the same thread as the data transfer thread. Hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor.
Return Value
An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.