1 // Copyright (c) 2002-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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // include\mmf\server\mmfbuffer.h
19 #ifndef __MMF_SERVER_BUFFER_H__
20 #define __MMF_SERVER_BUFFER_H__
23 #include <mmf/server/mmfbuffer.hrh>
30 Flag reflecting the current buffer status.
34 /** The buffer is available for use */
37 /** The buffer is currently being filled */
40 /** The buffer is full */
43 /** The buffer is currently being emptied */
46 /** The buffer is currently unavailable */
55 Abstract representation of a buffer to contain multimedia data.
57 class CMMFBuffer : public CBase
60 IMPORT_C static TBool IsSupportedDataBuffer(TUid aUid);
61 IMPORT_C static TBool IsFileServerSafe(TUid aUid);
63 Returns the buffer type.
65 @return The buffer type.
67 TUid Type() const {return iType;};
69 Sets the buffer's status.
74 virtual void SetStatus(TBufferStatus aStatus)
75 {iStatus = aStatus; if (iStatus == EAvailable) iPosition = 0;}
77 Returns the buffer's status.
79 @return The buffer's status.
81 TBufferStatus Status() {return iStatus;};
84 Returns the size of the data in the buffer.
86 This is a virtual function that each derived class must implement.
88 @return The buffer size.
90 virtual TUint BufferSize() const = 0;
95 virtual ~CMMFBuffer() {};
96 inline TTimeIntervalMicroSeconds TimeToPlay() const;
97 inline void SetTimeToPlay (TTimeIntervalMicroSeconds aTime);
98 inline TUint FrameNumber() const;
99 inline void SetFrameNumber(TUint aFrame);
100 inline void NextFrame();
101 inline virtual void SetPosition (TUint aPosition);
102 inline virtual TUint Position() const;
103 inline virtual TInt RequestSize() const;
104 inline void SetLastBuffer(TBool aLastBuffer);
105 inline TBool LastBuffer() const;
107 CMMFBuffer(TUid aType): iType(aType), iStatus(EAvailable) {};
116 The current buffer status.
118 @see enum TBufferStatus
120 TBufferStatus iStatus;
123 The buffer timestamp, in microseconds.
125 TTimeIntervalMicroSeconds iTimeToPlay;
128 Used to store the current read/write position. Required when the codec and data path
129 may have to read and write the buffer in more than one pass.
139 Stores Request size, needed for dynamic buffer length.
144 Indicates if this is the last buffer. ETrue if it is.
150 Returns the buffer timestamp, in microseconds.
152 @return The buffer timestamp, in microseconds.
154 inline TTimeIntervalMicroSeconds CMMFBuffer::TimeToPlay() const
160 Sets the buffer timestamp, in microseconds.
163 The buffer timestamp, in microseconds.
165 inline void CMMFBuffer::SetTimeToPlay (TTimeIntervalMicroSeconds aTime)
171 Returns the frame number.
173 @return The frame number.
175 inline TUint CMMFBuffer::FrameNumber() const
181 Sets the frame number. This is used for repositioning.
186 inline void CMMFBuffer::SetFrameNumber (TUint aFrameNumber)
188 iFrameNumber = aFrameNumber;
192 Sets the buffer as the next frame.
194 inline void CMMFBuffer::NextFrame()
201 Sets the current buffer read/write position.
202 Used as read/write position on a buffer where a codec may need
203 several passes on the same buffer.
208 inline void CMMFBuffer::SetPosition (TUint aPosition)
210 iPosition = aPosition;
214 Returns the current buffer read/write position.
215 Used as read/write position on a buffer where a codec may need
216 several passes on the same buffer.
218 @return The buffer's number.
220 inline TUint CMMFBuffer::Position() const
226 Tests whether the buffer is the last buffer.
228 @return A boolean indicating if the buffer is the last one. ETrue if it is the last buffer,
231 inline TBool CMMFBuffer::LastBuffer() const
237 Sets the buffer as the last buffer.
240 A boolean indicating if the buffer is the last buffer. ETrue if it is the last buffer,
243 inline void CMMFBuffer::SetLastBuffer(TBool aLastBuffer)
245 iLastBuffer = aLastBuffer;
249 Returns the size of data processed by sink or data needed by source.
251 @return The size of data
253 inline TInt CMMFBuffer::RequestSize() const