sl@0
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef MDFVIDEODECODERBUFFERMANAGER_H
|
sl@0
|
17 |
#define MDFVIDEODECODERBUFFERMANAGER_H
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32base.h>
|
sl@0
|
20 |
#include <mmf/devvideo/videoplayhwdevice.h>
|
sl@0
|
21 |
#include <mmf/devvideo/devvideoplay.h>
|
sl@0
|
22 |
#include <mmf/server/mmfdatabuffer.h>
|
sl@0
|
23 |
|
sl@0
|
24 |
/**
|
sl@0
|
25 |
|
sl@0
|
26 |
*/
|
sl@0
|
27 |
class CVideoDataBuffer : public CBase
|
sl@0
|
28 |
{
|
sl@0
|
29 |
public:
|
sl@0
|
30 |
static CVideoDataBuffer* NewL(TUint aSize);
|
sl@0
|
31 |
static CVideoDataBuffer* NewL(CMMFBuffer* aBuffer);
|
sl@0
|
32 |
|
sl@0
|
33 |
operator CMMFBuffer*();
|
sl@0
|
34 |
operator TVideoInputBuffer&();
|
sl@0
|
35 |
|
sl@0
|
36 |
TBool operator ==(const CMMFBuffer* aBuffer) const;
|
sl@0
|
37 |
TBool operator ==(const TVideoInputBuffer& aVideoInputBuffer) const;
|
sl@0
|
38 |
|
sl@0
|
39 |
TUint Length();
|
sl@0
|
40 |
|
sl@0
|
41 |
~CVideoDataBuffer();
|
sl@0
|
42 |
private:
|
sl@0
|
43 |
CVideoDataBuffer();
|
sl@0
|
44 |
|
sl@0
|
45 |
void ConstructL(TUint aSize);
|
sl@0
|
46 |
void ConstructL(CMMFBuffer* aBuffer);
|
sl@0
|
47 |
|
sl@0
|
48 |
private:
|
sl@0
|
49 |
TUint iSize;
|
sl@0
|
50 |
CMMFBuffer* iMmfBuffer;
|
sl@0
|
51 |
TVideoInputBuffer iVideoInputBuffer;
|
sl@0
|
52 |
};
|
sl@0
|
53 |
|
sl@0
|
54 |
/**
|
sl@0
|
55 |
|
sl@0
|
56 |
*/
|
sl@0
|
57 |
class CVideoFrameBuffer : public CBase
|
sl@0
|
58 |
{
|
sl@0
|
59 |
public:
|
sl@0
|
60 |
enum TFrameBufferState
|
sl@0
|
61 |
{
|
sl@0
|
62 |
EEmptied,
|
sl@0
|
63 |
EFilled
|
sl@0
|
64 |
};
|
sl@0
|
65 |
public:
|
sl@0
|
66 |
static CVideoFrameBuffer* NewL(TSize aFrameSize, TUncompressedVideoFormat aVideoFormat, TDisplayMode aDisplayMode);
|
sl@0
|
67 |
|
sl@0
|
68 |
operator CMMFBuffer&();
|
sl@0
|
69 |
operator CMMFBuffer*();
|
sl@0
|
70 |
operator TVideoPicture&();
|
sl@0
|
71 |
operator TVideoPicture*();
|
sl@0
|
72 |
|
sl@0
|
73 |
TBool operator ==(const CMMFBuffer* aBuffer) const;
|
sl@0
|
74 |
TBool operator ==(const TVideoPicture& aVideoPicture) const;
|
sl@0
|
75 |
|
sl@0
|
76 |
void LockFrameBufferHeap();
|
sl@0
|
77 |
void UnlockFrameBufferHeap();
|
sl@0
|
78 |
void SetLastBuffer(TBool aLastBuffer);
|
sl@0
|
79 |
TBool LastBuffer();
|
sl@0
|
80 |
|
sl@0
|
81 |
~CVideoFrameBuffer();
|
sl@0
|
82 |
private:
|
sl@0
|
83 |
CVideoFrameBuffer(TSize aFrameSize, TUncompressedVideoFormat aVideoFormat, TDisplayMode aDisplayMode);
|
sl@0
|
84 |
|
sl@0
|
85 |
void ConstructL();
|
sl@0
|
86 |
|
sl@0
|
87 |
CMMFBuffer* iMmfBuffer;
|
sl@0
|
88 |
TVideoPicture iVideoPicture;
|
sl@0
|
89 |
CFbsBitmap* iBitmap;
|
sl@0
|
90 |
|
sl@0
|
91 |
HBufC8* iRawBuffer;
|
sl@0
|
92 |
TPtr8 iRawPtr;
|
sl@0
|
93 |
|
sl@0
|
94 |
TInt iFrameBufferSize; // still need to fill this in
|
sl@0
|
95 |
TSize iFrameSize;
|
sl@0
|
96 |
TUncompressedVideoFormat iVideoFormat;
|
sl@0
|
97 |
TDisplayMode iDisplayMode;
|
sl@0
|
98 |
TBool iHeapLocked;
|
sl@0
|
99 |
TBool iLastBuffer;
|
sl@0
|
100 |
};
|
sl@0
|
101 |
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
Buffer manager for video decoder hardware device.
|
sl@0
|
104 |
@internalComponent
|
sl@0
|
105 |
*/
|
sl@0
|
106 |
class CMdfVideoDecoderBufferManager : public CBase
|
sl@0
|
107 |
{
|
sl@0
|
108 |
|
sl@0
|
109 |
public:
|
sl@0
|
110 |
static CMdfVideoDecoderBufferManager* NewL();
|
sl@0
|
111 |
~CMdfVideoDecoderBufferManager();
|
sl@0
|
112 |
|
sl@0
|
113 |
void Init(const TUncompressedVideoFormat& aFormat);
|
sl@0
|
114 |
|
sl@0
|
115 |
// data buffers (input)
|
sl@0
|
116 |
CVideoDataBuffer& CreateDataBufferL(TUint aSize);
|
sl@0
|
117 |
TInt DataBuffersAvailable() const;
|
sl@0
|
118 |
CVideoDataBuffer& GetDataBufferL();
|
sl@0
|
119 |
|
sl@0
|
120 |
// for convenience, allow the return of the data buffer in all permutations
|
sl@0
|
121 |
void ReturnDataBufferL(TVideoInputBuffer& aBuffer);
|
sl@0
|
122 |
|
sl@0
|
123 |
// frame buffer management
|
sl@0
|
124 |
CVideoFrameBuffer& CreateFrameBufferL(TDisplayMode aDisplayMode);
|
sl@0
|
125 |
|
sl@0
|
126 |
CVideoFrameBuffer& GetEmptyFrameBufferL(TBool aLockHeap);
|
sl@0
|
127 |
CVideoFrameBuffer& GetFilledFrameBufferL(TBool aLockHeap);
|
sl@0
|
128 |
|
sl@0
|
129 |
void ReturnFrameBufferL(TVideoPicture& aPicture, CVideoFrameBuffer::TFrameBufferState aState);
|
sl@0
|
130 |
void ReturnFrameBufferL(CMMFBuffer* aBuffer,
|
sl@0
|
131 |
CVideoFrameBuffer::TFrameBufferState aState,
|
sl@0
|
132 |
TBool aLastBuffer);
|
sl@0
|
133 |
|
sl@0
|
134 |
TInt EmptyFrameBuffersAvailable() const;
|
sl@0
|
135 |
TInt FilledFrameBuffersAvailable() const;
|
sl@0
|
136 |
|
sl@0
|
137 |
const TPictureData& LastPictureL() const;
|
sl@0
|
138 |
|
sl@0
|
139 |
// getters/setters for frame attributes
|
sl@0
|
140 |
void SetFrameSize(const TSize& aSize);
|
sl@0
|
141 |
void SetFrameBufferSize(TInt aSize);
|
sl@0
|
142 |
const TSize& FrameSize() const;
|
sl@0
|
143 |
TInt FrameBufferSize() const;
|
sl@0
|
144 |
TInt MaxFrameBuffers() const;
|
sl@0
|
145 |
|
sl@0
|
146 |
private:
|
sl@0
|
147 |
CMdfVideoDecoderBufferManager();
|
sl@0
|
148 |
|
sl@0
|
149 |
TInt FindFrameBuffer(const CMMFBuffer* aBuffer) const;
|
sl@0
|
150 |
TInt FindFrameBuffer(const TVideoPicture& aVideoPicture) const;
|
sl@0
|
151 |
TInt FindFrameBuffer(const CVideoFrameBuffer& aFrameBuffer) const;
|
sl@0
|
152 |
|
sl@0
|
153 |
void ConstructL();
|
sl@0
|
154 |
private:
|
sl@0
|
155 |
// the format of the incoming video
|
sl@0
|
156 |
TUncompressedVideoFormat iFormat;
|
sl@0
|
157 |
|
sl@0
|
158 |
// input data buffers
|
sl@0
|
159 |
CVideoDataBuffer* iInputBuffer;
|
sl@0
|
160 |
TBool iInputBufferInUse;
|
sl@0
|
161 |
|
sl@0
|
162 |
// output frame buffers
|
sl@0
|
163 |
RPointerArray<CVideoFrameBuffer> iEmptyFrameBuffers;
|
sl@0
|
164 |
RPointerArray<CVideoFrameBuffer> iFilledFrameBuffers;
|
sl@0
|
165 |
|
sl@0
|
166 |
RPointerArray<CVideoFrameBuffer> iFrameBuffersInUse;
|
sl@0
|
167 |
|
sl@0
|
168 |
TSize iFrameSize;
|
sl@0
|
169 |
TInt iFrameBufferSize;
|
sl@0
|
170 |
TInt iMaxFrameBuffers;
|
sl@0
|
171 |
|
sl@0
|
172 |
// last displayed frame
|
sl@0
|
173 |
TPictureData iLastDisplayedFrame;
|
sl@0
|
174 |
|
sl@0
|
175 |
};
|
sl@0
|
176 |
|
sl@0
|
177 |
#endif // MDFVIDEODECODERBUFFERMANAGER_H
|