Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: MmfFile.h
Link against: mmfstdsourceandsinkplugin.lib

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

Class CMMFFile

class CMMFFile : public CMMFClip;

Description

MultiMedia framework class. Represents a physical file.

This may be source file from which data is read or destination to which data is written.

Intended to be used by controller plugin developers for source and sink plugins.

Derivation

Members

Defined in CMMFFile:
BufferEmptiedL(), BufferFilledL(), BytesFree(), CanCreateSinkBuffer(), CanCreateSourceBuffer(), ConstructSinkL(), ConstructSourceL(), CreateSinkBufferL(), CreateSourceBufferL(), Data(), Delete(), ESinkMode, ESourceMode, EmptyBufferL(), EvaluateIntent(), ExecuteIntent(), Extension(), FileDrive(), FileL(), FileName(), FilePath(), FillBufferL(), FullName(), IsProtectedL(), ReadBufferL(), ReadBufferL(), ReadBufferL(), SetAgentProperty(), SetSize(), SinkDataTypeCode(), SinkPrimeL(), SinkStopL(), SinkStopped(), SinkThreadLogoff(), SinkThreadLogon(), Size(), SourceDataTypeCode(), SourcePauseL(), SourcePrimeL(), SourceStopL(), SourceThreadLogoff(), SourceThreadLogon(), TMMFileMode, UniqueId(), WriteBufferL(), WriteBufferL(), WriteBufferL(), ~CMMFFile()

Inherited from CBase:
Extension_(), operator new()

Inherited from MDataSink:
DataSinkType(), NegotiateL(), NewSinkL(), SetSinkDataTypeCode(), SetSinkPrioritySettings(), SinkCustomCommand(), SinkPauseL(), SinkPlayL()

Inherited from MDataSource:
DataSourceType(), NegotiateSourceL(), NewSourceL(), SetSourceDataTypeCode(), SetSourcePrioritySettings(), SourceCustomCommand(), SourcePlayL(), SourceSampleConvert()


Construction and destruction


~CMMFFile()

virtual ~CMMFFile();

Description

Destructor.

[Top]


Member functions


SourceDataTypeCode()

virtual TFourCC SourceDataTypeCode(TMediaId aMediaId);

Description

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

Parameters

TMediaId aMediaId

Return value

TFourCC

The data type fourCC code.


FillBufferL()

virtual void FillBufferL(CMMFBuffer *aBuffer, MDataSink *aConsumer, TMediaId aMediaId);

Description

Loads aBuffer from iFile.

The file must already be open for reading. File read is asynchronous. CReadRequest is created to respond to completion.

Parameters

CMMFBuffer *aBuffer

The buffer to be filled from the file.

MDataSink *aConsumer

The data sink consumer of the buffer.

TMediaId aMediaId


BufferEmptiedL()

virtual void BufferEmptiedL(CMMFBuffer *aBuffer);

Description

CMMFFile as a source is always passive so this function is not supported.

Parameters

CMMFBuffer *aBuffer

The emptied buffer.


CanCreateSourceBuffer()

virtual TBool CanCreateSourceBuffer();

Description

Tests whether a source buffer can be created.

Return value

TBool

A boolean indicating if if CMMFFile can create its own buffer. EFalse if CMMFFile cannot create it's own buffer.


CreateSourceBufferL()

virtual CMMFBuffer *CreateSourceBufferL(TMediaId aMediaId, TBool &aReference);

Description

Creates a source buffer.

Parameters

TMediaId aMediaId

The Media ID.

TBool &aReference

A boolean indicating if MDataSource owns the buffer. ETrue if it does, EFalse if the caller owns the buffer.

Return value

CMMFBuffer *

NULL as a CMMFFile cannot create it's own buffer


SourceThreadLogon()

virtual TInt SourceThreadLogon(MAsyncEventHandler &aEventHandler);

Description

Source thread logon.

Shares fsSession between threads

Parameters

MAsyncEventHandler &aEventHandler

This is an MAsyncEventHandler to handle asynchronous events that occur during the transfer of multimedia data.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


SourceThreadLogoff()

virtual void SourceThreadLogoff();

Description

Logs off source thread.


SourcePrimeL()

virtual void SourcePrimeL();

Description

Primes the source.

When used as a source, the file prime opens the file as read only.


SourceStopL()

virtual void SourceStopL();

Description

Stops the file source. When stopping close the file. If the source is a file handle, the position is reset, but the file handle remains open.


SinkDataTypeCode()

virtual TFourCC SinkDataTypeCode(TMediaId aMediaId);

Description

Returns the data type as a fourCC code of CMMFFile as a data sink.

Parameters

TMediaId aMediaId

Return value

TFourCC

The data type fourCC code


EmptyBufferL()

virtual void EmptyBufferL(CMMFBuffer *aBuffer, MDataSource *aSupplier, TMediaId aMediaId);

Description

Empties aBuffer into iFile. The file must be already open for writing.

Parameters

CMMFBuffer *aBuffer

The buffer to be written to the file.

MDataSource *aSupplier

The data source supplier of the buffer.

TMediaId aMediaId


BufferFilledL()

virtual void BufferFilledL(CMMFBuffer *aBuffer);

Description

CMMFFile as a sink is always passive so this function is not supported.

Parameters

CMMFBuffer *aBuffer

The buffer.


CanCreateSinkBuffer()

virtual TBool CanCreateSinkBuffer();

Description

Tests whether a sink buffer can be created.

Return value

TBool

A boolean indicating if the sink buffer can be created. EFalse if CMMFFile cannot create it's own buffer


CreateSinkBufferL()

virtual CMMFBuffer *CreateSinkBufferL(TMediaId aMediaId, TBool &aReference);

Description

Creates a sink buffer.

Parameters

TMediaId aMediaId

The Media ID.

TBool &aReference

A boolean indicating if MDataSource owns the buffer. ETrue if MDataSource owns the buffer, EFalse if the caller owns the buffer.

Return value

CMMFBuffer *

NULL as a CMMFFile cannot create it's own buffer


SinkThreadLogon()

virtual TInt SinkThreadLogon(MAsyncEventHandler &aEventHandler);

Description

Sink thread logon.

Shares fsSession between threads.

Parameters

MAsyncEventHandler &aEventHandler

This is an MAsyncEventHandler to handle asynchronous events that occur during the transfer of multimedia data.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


SinkThreadLogoff()

virtual void SinkThreadLogoff();

Description

Sink thread log off.


SinkPrimeL()

virtual void SinkPrimeL();

Description

Primes the sink.

When used as a sink, the file prime opens the file for read/write access.


SinkStopL()

virtual void SinkStopL();

Description

Stops the file sink.

When stopping close the file. When the file sink is a file handle, the position is reset, but the file handle remains open


ReadBufferL()

virtual void ReadBufferL(TInt aLength, CMMFBuffer *aBuffer, TInt aPosition, MDataSink *aConsumer);

Description

Loads aLength number of bytes into aBuffer from specified point in iFile.

Parameters

TInt aLength

The number of bytes to be read into buffer.

CMMFBuffer *aBuffer

The buffer to be filled from the file.

TInt aPosition

The offset into the file at which to start reading.

MDataSink *aConsumer

The data sink consumer of the buffer.


WriteBufferL()

virtual void WriteBufferL(TInt aLength, CMMFBuffer *aBuffer, TInt aPosition, MDataSource *aSupplier);

Description

Empties aLength bytes from aBuffer into iFile at specified location.

Parameters

TInt aLength

The number of bytes to be emptied from buffer.

CMMFBuffer *aBuffer

The data buffer containing bytes to be written.

TInt aPosition

The offset into file at which to start writing.

MDataSource *aSupplier

The data source to be notified when the write has been completed.

Leave codes

KErrNotReady

SinkPrimeL() and SinkThreadLogon() have not been called.

KErrArgument

aLength<0 or aPosition<0 or aSupplier is NULL.

KErrNotSupported

aBuffer is not a supported CMMFDataBuffer


ReadBufferL()

virtual void ReadBufferL(CMMFBuffer *aBuffer, TInt aPosition, MDataSink *aConsumer);

Description

Loads aBuffer from specified point in iFile.

The file must already be open for reading.

Parameters

CMMFBuffer *aBuffer

The buffer to be filled from the file.

TInt aPosition

The offset into file at which to start reading.

MDataSink *aConsumer

The data sink consumer of the buffer.


WriteBufferL()

virtual void WriteBufferL(CMMFBuffer *aBuffer, TInt aPosition, MDataSource *aSupplier);

Description

Empties aBuffer into iFile at the specified location.

Parameters

CMMFBuffer *aBuffer

The data buffer containing bytes to be written.

TInt aPosition

The offset into file at which to start writing.

MDataSource *aSupplier

The data source to be notified when the write has been completed.

Leave codes

KErrNotReady

SinkPrimeL() and SinkThreadLogon() have not been called.

KErrArgument

aSupplier is NULL.

KErrNotSupported

The aBuffer is not of type KMMFDataBuffer.


ReadBufferL()

virtual void ReadBufferL(CMMFBuffer *aBuffer, TInt aPosition);

Description

Loads aBuffer from specified point in iFile. Note that this is a synchronous read.

Parameters

CMMFBuffer *aBuffer

The buffer to be filled from the file.

TInt aPosition

The offset into file at which to start reading.


WriteBufferL()

virtual void WriteBufferL(CMMFBuffer *aBuffer, TInt aPosition);

Description

Empties aBuffer into iFile at specified location. Note that this is a synchronous write.

Parameters

CMMFBuffer *aBuffer

The data buffer containing bytes to be written.

TInt aPosition

The offset into file at which to start writing.


BytesFree()

virtual TInt64 BytesFree();

Description

Gets the number of free bytes in the device's file system.

Return value

TInt64

The number of free bytes.


Size()

virtual TInt Size();

Description

Returns the size of the file in bytes.

Note: This is not the maximum length.

Return value

TInt

The size of the file in bytes.


Delete()

virtual TInt Delete();

Description

Deletes the file.

Closes the currently open file, then deletes it. If the file source is accessing a file handle, the file is truncated to 0 bytes instead.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


SetSize()

virtual TInt SetSize(TInt aSize);

Description

Sets the file size.

Parameters

TInt aSize

The size of the file.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


FileName()

virtual const TDesC &FileName() const;

Description

Returns the file name of the current file.

Note: This will give the wrong answer if the file is renamed!

Return value

const TDesC &

The FileName (without extension).


Extension()

virtual const TDesC &Extension() const;

Description

Returns the extension of the current file.

Note: This will give the wrong answer if the file is renamed!

Return value

const TDesC &

The File Extension.


FilePath()

virtual const TDesC &FilePath() const;

Description

Returns the path of the current file.

Note: This will give the wrong answer if the file is renamed!

Return value

const TDesC &

The FilePath (without filename and extension)


FileDrive()

virtual const TDesC &FileDrive() const;

Description

Returns the drive on which the current file is located.

Note: This will give the wrong answer if the file is renamed!

Return value

const TDesC &

The FileDrive (drive letter only, without path, filename and extension).


FullName()

virtual const TFileName FullName() const;

Description

Returns the full name of the current file.

Note: This will give the wrong answer if the file is renamed!

Return value

const TFileName

The file name (full filename including drive letter, without path, filename and extension).


FileL()

virtual RFile &FileL();

Description

Returns an RFile handle to the current file.

If there is no current file, one is created. If the file exists then it is opened with read access if it is read only, write access otherwise. If the file does not exist then it is opened with write access.

Return value

RFile &

A handle to the current file.

Leave codes

KErrNotReady

The file is not open.

See also:


SinkStopped()

virtual TBool SinkStopped();

Description

Returns a boolean indicating if the sink has been stopped.

Return value

TBool

A boolean indicating if the sink has stopped.


ConstructSourceL()

protected: virtual void ConstructSourceL(const TDesC8 &aInitData);

Description

Perform source construction dependant on the source construction initialisation data aInitData.

Parameters

const TDesC8 &aInitData

The TPckg<TMMFFileParams> descriptor package containing the file name and full path.


ConstructSinkL()

protected: virtual void ConstructSinkL(const TDesC8 &aInitData);

Description

Performs sink construction dependant on the sink construction initialisation data aInitData.

Parameters

const TDesC8 &aInitData

The TPckg<TMMFFileParams> descriptor package containing the file name and full path.


ExecuteIntent()

virtual TInt ExecuteIntent(ContentAccess::TIntent aIntent);

Description

Evaluates and executes a given intent against the rights associated with the file.

The rights object is updated after calling this function.

Parameters

ContentAccess::TIntent aIntent

The intent to evaluate.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


EvaluateIntent()

virtual TInt EvaluateIntent(ContentAccess::TIntent aIntent) const;

Description

Evaluates a given intent against the rights associated with the file.

The rights are not updated by this function call.

Parameters

ContentAccess::TIntent aIntent

The intent to evaluate.

Return value

TInt

An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.


IsProtectedL()

virtual TBool IsProtectedL() const;

Description

Returns whether the file is protected.

Return value

TBool

A boolean indicating if the file is protected. ETrue if the file is protected.


SetAgentProperty()

virtual TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue);

Description

Parameters

ContentAccess::TAgentProperty aProperty

TInt aValue

Return value

TInt


UniqueId()

virtual const TDesC &UniqueId() const;

Description

Returns the uniqueID associated with this content. If no uniqueID has been provided, a null descriptor will be provided

Return value

const TDesC &

The UniqueID


Data()

virtual TInt Data(ContentAccess::CData *&aData);

Description

Returns access to internal CData property

Returns: KErrNotReady if the file is not open/data object has not been created. KErrNotSupported if not supported (e.g. on data sink)

Parameters

ContentAccess::CData *&aData

On return, set to the internal CData property used to access file for reading.

Return value

TInt

Standard error code


SourcePauseL()

virtual void SourcePauseL();

Description

Pauses the file source

[Top]


Member enumerations


Enum TMMFileMode

protected: TMMFileMode

Description

Indicates for which purpose the object instance is being created

ESourceMode

The object is created for being a source

ESinkMode

The object is created for being a sink