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