1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // 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
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 #include <mmf/server/mmfdatasource.h>
20 #include <mmf/server/mmfdatasink.h>
21 #include <mmf/server/mmfbuffer.h>
22 #include <mmf/common/mmfutilities.h>
28 Abstract class to represent a source or sink that contains a multimedia clip (i.e. not a stream or hardware device).
30 Typical examples are a file or an area of memory (descriptor).
32 class CMMFClip : public CBase, public MDataSource, public MDataSink
35 //asynchronous Read/WriteBufferLs
38 Reads aLength number of bytes of data from the offset, aPosition into the buffer, aBuffer.
39 Intended for asynchronous usage.
41 This is a virtual function that each derived class must implement.
44 The number of bytes to read.
46 The buffer to read the data into.
48 The offset from which to start reading.
50 The sink of tha data read from the clip. Will be informed of read if not NULL.
52 virtual void ReadBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) = 0 ;
55 Writes aLength number of bytes of data from the offset, aPosition from the buffer, aBuffer.
56 Intended for asynchronous usage.
58 This is a virtual function that each derived class must implement.
61 The number of bytes to write.
63 The buffer to write the data into.
65 The offset from which to start writing.
67 The source of the data writen to the clip. Will be informed of write if not NULL.
69 virtual void WriteBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) = 0 ;
72 Reads the maximum number of bytes of data from the offset, aPosition into the buffer, aBuffer.
73 Intended for asynchronous usage.
75 This is a virtual function that each derived class must implement.
78 The buffer to read the data into.
80 The offset from which to start reading.
82 The sink of tha data read from the clip. Will be informed of read if not NULL.
84 virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) = 0 ;
87 Writes the maximum number of bytes of data from the offset, aPosition from the buffer, aBuffer.
88 Intended for asynchronous usage.
90 This is a virtual function that each derived class must implement.
93 The buffer to write the data into.
95 The offset from which to start writing.
97 The source of the data writen to the clip. Will be informed of write if not NULL.
99 virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) = 0 ;
101 //synchronous Read/WriteBufferLs
104 Reads the maximum number of bytes of data from the offset, aPosition into the buffer, aBuffer.
105 Intended for synchronous usage.
107 This is a virtual function that each derived class must implement.
110 The buffer to read the data into.
112 The offset from which to start reading.
114 virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition) = 0 ;
117 Writes the maximum number of bytes of data from the offset, aPosition from the buffer, aBuffer.
118 Intended for synchronous usage.
120 This is a virtual function that each derived class must implement.
123 The buffer to write the data into.
125 The offset from which to start writing.
127 virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition) = 0 ;
130 Returns the amount of space available for the clip.
132 This is a virtual function that each derived class must implement.
134 @return The amount of space available.
136 virtual TInt64 BytesFree() = 0 ;
139 Returns the size of the clip in bytes.
141 This is a virtual function that each derived class must implement.
143 @return The size of the clip.
145 virtual TInt Size() = 0 ;
150 This should be overriden in the derived classes, the default version returns KErrNotSupported.
152 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
153 another of the system-wide error codes.
155 virtual TInt Delete() {return KErrNotSupported;}
158 Sets the size of the clip. This should be overriden in the derived
159 classes, the default version returns KErrNotSupported.
162 The size of the clip.
164 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
165 another of the system-wide error codes.
167 inline virtual TInt SetSize(TInt aSize);
171 Protected constructor.
178 CMMFClip( TUid aSourceType, TUid aSinkType ) : MDataSource( aSourceType ), MDataSink( aSinkType ) {}
181 inline TInt CMMFClip::SetSize(TInt /*aSize*/)
183 return KErrNotSupported;