|
1 // Copyright (c) 2007-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <e32std.h> |
|
17 #include "videoframebuffer.h" |
|
18 |
|
19 const TInt TVideoFrameBuffer::iOffset = _FOFF(TVideoFrameBuffer, iDblQueLink); |
|
20 |
|
21 /** |
|
22 Constructor |
|
23 |
|
24 @publishedPartner |
|
25 @prototype |
|
26 @param aFormat Data format for the buffer. |
|
27 @param aStride Stride for the buffer, i.e. the number of bytes from the start |
|
28 of one pixel row to the next. |
|
29 @param aBufferId Buffer identifier, set by the buffer allocator. Buffer IDs |
|
30 are used to identify buffers in e.g. buffer rendering notifications. |
|
31 @param aChunk The chunk where the buffer is located. Note that the TVideoFrame |
|
32 Buffer does not take ownership of the RChunk. |
|
33 @param aOffsetInChunk Offset from the beginning of the chunk for this buffer, in bytes. |
|
34 */ |
|
35 EXPORT_C TVideoFrameBuffer::TVideoFrameBuffer(const TUncompressedVideoFormat& aFormat, |
|
36 TInt aStride, |
|
37 TInt aBufferId, |
|
38 const RChunk& aChunk, |
|
39 TInt aOffsetInChunk) |
|
40 : iFormat(aFormat), iStride(aStride), iBufferId(aBufferId), iChunk(aChunk), iOffsetInChunk(aOffsetInChunk) |
|
41 { |
|
42 } |
|
43 |
|
44 /** |
|
45 Returns the data format of the buffer. For YUV formats, typically only |
|
46 TUncompressedVideoFormat.iYuvFormat.iDataLayout and iPattern are valid. |
|
47 |
|
48 @publishedPartner |
|
49 @prototype |
|
50 @return The data format of the buffer. |
|
51 */ |
|
52 EXPORT_C TUncompressedVideoFormat TVideoFrameBuffer::Format() const |
|
53 { |
|
54 return iFormat; |
|
55 } |
|
56 |
|
57 /** |
|
58 Returns the stride of the buffer. This is the number of bytes from the start |
|
59 of one pixel row to the next. The stride is commonly equal to bytes_per_pixel*width, |
|
60 but can be larger if the buffer requires padding. With planar YUV data the |
|
61 stride refers to luminance (Y) stride. Chrominance (U & V) stride is iStride/2. |
|
62 |
|
63 @publishedPartner |
|
64 @prototype |
|
65 @return The stride of the buffer. |
|
66 */ |
|
67 EXPORT_C TUint TVideoFrameBuffer::Stride() const |
|
68 { |
|
69 return iStride; |
|
70 } |
|
71 |
|
72 /** |
|
73 Returns the buffer identifier of the buffer. Buffer IDs are used to identify buffers. |
|
74 |
|
75 @publishedPartner |
|
76 @prototype |
|
77 @return The buffer id of the buffer. |
|
78 */ |
|
79 EXPORT_C TInt TVideoFrameBuffer::BufferId() const |
|
80 { |
|
81 return iBufferId; |
|
82 } |
|
83 |
|
84 /** |
|
85 Returns the RChunk where the buffer is located. The RChunk can be shared |
|
86 between several TVideoFrameBuffers. |
|
87 |
|
88 @publishedPartner |
|
89 @prototype |
|
90 @return The RChunk where the buffer is located. |
|
91 */ |
|
92 EXPORT_C const RChunk& TVideoFrameBuffer::Chunk() const |
|
93 { |
|
94 return iChunk; |
|
95 } |
|
96 |
|
97 /** |
|
98 Returns a pointer to buffer data as mapped to the current process’s address space. |
|
99 |
|
100 @publishedPartner |
|
101 @prototype |
|
102 @return A pointer to the buffer data. |
|
103 */ |
|
104 EXPORT_C TUint8* TVideoFrameBuffer::Buffer() const |
|
105 { |
|
106 return iChunk.Base() + iOffsetInChunk; |
|
107 } |
|
108 |
|
109 /** |
|
110 Returns the buffer status. |
|
111 |
|
112 @internalComponent |
|
113 @return The buffer status. |
|
114 */ |
|
115 TVideoFrameBuffer::TBufferStatus TVideoFrameBuffer::BufferStatus() const |
|
116 { |
|
117 return iStatus; |
|
118 } |
|
119 |
|
120 /** |
|
121 Set buffer status. |
|
122 |
|
123 @internalComponent |
|
124 @param aStatus Buffer status set by video renderer |
|
125 */ |
|
126 void TVideoFrameBuffer::SetBufferStatus(TVideoFrameBuffer::TBufferStatus aStatus) |
|
127 { |
|
128 iStatus = aStatus; |
|
129 } |
|
130 |
|
131 /** |
|
132 Returns the queue link for use by video renderer. |
|
133 |
|
134 @internalComponent |
|
135 @return A reference to the queue link |
|
136 */ |
|
137 TDblQueLink& TVideoFrameBuffer::DblQueLink() |
|
138 { |
|
139 return iDblQueLink; |
|
140 } |
|
141 |
|
142 /** |
|
143 Set presentation time. |
|
144 |
|
145 @internalComponent |
|
146 @param aTime Presentation time |
|
147 */ |
|
148 void TVideoFrameBuffer::SetPresentationTime(const TTime& aTime) |
|
149 { |
|
150 iPresentationTime = aTime; |
|
151 } |
|
152 |
|
153 /** |
|
154 Returns presentation time. |
|
155 |
|
156 @internalComponent |
|
157 @return Presentation time |
|
158 */ |
|
159 TTime TVideoFrameBuffer::PresentationTime() const |
|
160 { |
|
161 return iPresentationTime; |
|
162 } |