Update contrib.
1 // Copyright (c) 2006-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.
16 #ifndef MDFVIDEODECODERBUFFERMANAGER_H
17 #define MDFVIDEODECODERBUFFERMANAGER_H
20 #include <mmf/devvideo/videoplayhwdevice.h>
21 #include <mmf/devvideo/devvideoplay.h>
22 #include <mmf/server/mmfdatabuffer.h>
27 class CVideoDataBuffer : public CBase
30 static CVideoDataBuffer* NewL(TUint aSize);
31 static CVideoDataBuffer* NewL(CMMFBuffer* aBuffer);
33 operator CMMFBuffer*();
34 operator TVideoInputBuffer&();
36 TBool operator ==(const CMMFBuffer* aBuffer) const;
37 TBool operator ==(const TVideoInputBuffer& aVideoInputBuffer) const;
45 void ConstructL(TUint aSize);
46 void ConstructL(CMMFBuffer* aBuffer);
50 CMMFBuffer* iMmfBuffer;
51 TVideoInputBuffer iVideoInputBuffer;
57 class CVideoFrameBuffer : public CBase
60 enum TFrameBufferState
66 static CVideoFrameBuffer* NewL(TSize aFrameSize, TUncompressedVideoFormat aVideoFormat, TDisplayMode aDisplayMode);
68 operator CMMFBuffer&();
69 operator CMMFBuffer*();
70 operator TVideoPicture&();
71 operator TVideoPicture*();
73 TBool operator ==(const CMMFBuffer* aBuffer) const;
74 TBool operator ==(const TVideoPicture& aVideoPicture) const;
76 void LockFrameBufferHeap();
77 void UnlockFrameBufferHeap();
78 void SetLastBuffer(TBool aLastBuffer);
83 CVideoFrameBuffer(TSize aFrameSize, TUncompressedVideoFormat aVideoFormat, TDisplayMode aDisplayMode);
87 CMMFBuffer* iMmfBuffer;
88 TVideoPicture iVideoPicture;
94 TInt iFrameBufferSize; // still need to fill this in
96 TUncompressedVideoFormat iVideoFormat;
97 TDisplayMode iDisplayMode;
103 Buffer manager for video decoder hardware device.
106 class CMdfVideoDecoderBufferManager : public CBase
110 static CMdfVideoDecoderBufferManager* NewL();
111 ~CMdfVideoDecoderBufferManager();
113 void Init(const TUncompressedVideoFormat& aFormat);
115 // data buffers (input)
116 CVideoDataBuffer& CreateDataBufferL(TUint aSize);
117 TInt DataBuffersAvailable() const;
118 CVideoDataBuffer& GetDataBufferL();
120 // for convenience, allow the return of the data buffer in all permutations
121 void ReturnDataBufferL(TVideoInputBuffer& aBuffer);
123 // frame buffer management
124 CVideoFrameBuffer& CreateFrameBufferL(TDisplayMode aDisplayMode);
126 CVideoFrameBuffer& GetEmptyFrameBufferL(TBool aLockHeap);
127 CVideoFrameBuffer& GetFilledFrameBufferL(TBool aLockHeap);
129 void ReturnFrameBufferL(TVideoPicture& aPicture, CVideoFrameBuffer::TFrameBufferState aState);
130 void ReturnFrameBufferL(CMMFBuffer* aBuffer,
131 CVideoFrameBuffer::TFrameBufferState aState,
134 TInt EmptyFrameBuffersAvailable() const;
135 TInt FilledFrameBuffersAvailable() const;
137 const TPictureData& LastPictureL() const;
139 // getters/setters for frame attributes
140 void SetFrameSize(const TSize& aSize);
141 void SetFrameBufferSize(TInt aSize);
142 const TSize& FrameSize() const;
143 TInt FrameBufferSize() const;
144 TInt MaxFrameBuffers() const;
147 CMdfVideoDecoderBufferManager();
149 TInt FindFrameBuffer(const CMMFBuffer* aBuffer) const;
150 TInt FindFrameBuffer(const TVideoPicture& aVideoPicture) const;
151 TInt FindFrameBuffer(const CVideoFrameBuffer& aFrameBuffer) const;
155 // the format of the incoming video
156 TUncompressedVideoFormat iFormat;
158 // input data buffers
159 CVideoDataBuffer* iInputBuffer;
160 TBool iInputBufferInUse;
162 // output frame buffers
163 RPointerArray<CVideoFrameBuffer> iEmptyFrameBuffers;
164 RPointerArray<CVideoFrameBuffer> iFilledFrameBuffers;
166 RPointerArray<CVideoFrameBuffer> iFrameBuffersInUse;
169 TInt iFrameBufferSize;
170 TInt iMaxFrameBuffers;
172 // last displayed frame
173 TPictureData iLastDisplayedFrame;
177 #endif // MDFVIDEODECODERBUFFERMANAGER_H