williamr@2: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __MMFCLIP_H_ williamr@2: #define __MMFCLIP_H_ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Abstract class to represent a source or sink that contains a multimedia clip (i.e. not a stream or hardware device). williamr@2: williamr@2: Typical examples are a file or an area of memory (descriptor). williamr@2: */ williamr@2: class CMMFClip : public CBase, public MDataSource, public MDataSink williamr@2: { williamr@2: public : williamr@2: //asynchronous Read/WriteBufferLs williamr@2: williamr@2: /** williamr@2: Reads aLength number of bytes of data from the offset, aPosition into the buffer, aBuffer. williamr@2: Intended for asynchronous usage. williamr@2: williamr@2: This is a virtual function that each derived class must implement. williamr@2: williamr@2: @param aLength williamr@2: The number of bytes to read. williamr@2: @param aBuffer williamr@2: The buffer to read the data into. williamr@2: @param aPosition williamr@2: The offset from which to start reading. williamr@2: @param aConsumer williamr@2: The sink of tha data read from the clip. Will be informed of read if not NULL. williamr@2: */ williamr@2: virtual void ReadBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) = 0 ; williamr@2: williamr@2: /** williamr@2: Writes aLength number of bytes of data from the offset, aPosition from the buffer, aBuffer. williamr@2: Intended for asynchronous usage. williamr@2: williamr@2: This is a virtual function that each derived class must implement. williamr@2: williamr@2: @param aLength williamr@2: The number of bytes to write. williamr@2: @param aBuffer williamr@2: The buffer to write the data into. williamr@2: @param aPosition williamr@2: The offset from which to start writing. williamr@2: @param aSupplier williamr@2: The source of the data writen to the clip. Will be informed of write if not NULL. williamr@2: */ williamr@2: virtual void WriteBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) = 0 ; williamr@2: williamr@2: /** williamr@2: Reads the maximum number of bytes of data from the offset, aPosition into the buffer, aBuffer. williamr@2: Intended for asynchronous usage. williamr@2: williamr@2: This is a virtual function that each derived class must implement. williamr@2: williamr@2: @param aBuffer williamr@2: The buffer to read the data into. williamr@2: @param aPosition williamr@2: The offset from which to start reading. williamr@2: @param aConsumer williamr@2: The sink of tha data read from the clip. Will be informed of read if not NULL. williamr@2: */ williamr@2: virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) = 0 ; williamr@2: williamr@2: /** williamr@2: Writes the maximum number of bytes of data from the offset, aPosition from the buffer, aBuffer. williamr@2: Intended for asynchronous usage. williamr@2: williamr@2: This is a virtual function that each derived class must implement. williamr@2: williamr@2: @param aBuffer williamr@2: The buffer to write the data into. williamr@2: @param aPosition williamr@2: The offset from which to start writing. williamr@2: @param aSupplier williamr@2: The source of the data writen to the clip. Will be informed of write if not NULL. williamr@2: */ williamr@2: virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) = 0 ; williamr@2: williamr@2: //synchronous Read/WriteBufferLs williamr@2: williamr@2: /** williamr@2: Reads the maximum number of bytes of data from the offset, aPosition into the buffer, aBuffer. williamr@2: Intended for synchronous usage. williamr@2: williamr@2: This is a virtual function that each derived class must implement. williamr@2: williamr@2: @param aBuffer williamr@2: The buffer to read the data into. williamr@2: @param aPosition williamr@2: The offset from which to start reading. williamr@2: */ williamr@2: virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition) = 0 ; williamr@2: williamr@2: /** williamr@2: Writes the maximum number of bytes of data from the offset, aPosition from the buffer, aBuffer. williamr@2: Intended for synchronous usage. williamr@2: williamr@2: This is a virtual function that each derived class must implement. williamr@2: williamr@2: @param aBuffer williamr@2: The buffer to write the data into. williamr@2: @param aPosition williamr@2: The offset from which to start writing. williamr@2: */ williamr@2: virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition) = 0 ; williamr@2: williamr@2: /** williamr@2: Returns the amount of space available for the clip. williamr@2: williamr@2: This is a virtual function that each derived class must implement. williamr@2: williamr@2: @return The amount of space available. williamr@2: */ williamr@2: virtual TInt64 BytesFree() = 0 ; williamr@2: williamr@2: /** williamr@2: Returns the size of the clip in bytes. williamr@2: williamr@2: This is a virtual function that each derived class must implement. williamr@2: williamr@2: @return The size of the clip. williamr@2: */ williamr@2: virtual TInt Size() = 0 ; williamr@2: williamr@2: /** williamr@2: Deletes the clip. williamr@2: williamr@2: This should be overriden in the derived classes, the default version returns KErrNotSupported. williamr@2: williamr@2: @return An error code indicating if the function call was successful. KErrNone on success, otherwise williamr@2: another of the system-wide error codes. williamr@2: */ williamr@2: virtual TInt Delete() {return KErrNotSupported;} williamr@2: williamr@2: /** williamr@2: Sets the size of the clip. This should be overriden in the derived williamr@2: classes, the default version returns KErrNotSupported. williamr@2: williamr@2: @param aSize williamr@2: The size of the clip. williamr@2: williamr@2: @return An error code indicating if the function call was successful. KErrNone on success, otherwise williamr@2: another of the system-wide error codes. williamr@2: */ williamr@2: inline virtual TInt SetSize(TInt aSize); williamr@2: williamr@2: protected : williamr@2: /** williamr@2: Protected constructor. williamr@2: williamr@2: @param aSourceType williamr@2: The source type. williamr@2: @param aSinkType williamr@2: The sink type. williamr@2: */ williamr@2: CMMFClip( TUid aSourceType, TUid aSinkType ) : MDataSource( aSourceType ), MDataSink( aSinkType ) {} williamr@2: } ; williamr@2: williamr@2: inline TInt CMMFClip::SetSize(TInt /*aSize*/) williamr@2: { williamr@2: return KErrNotSupported; williamr@2: } williamr@2: williamr@2: williamr@2: #endif