OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_VIDEO_FRAME_H_ | 5 #ifndef MEDIA_BASE_VIDEO_FRAME_H_ |
6 #define MEDIA_BASE_VIDEO_FRAME_H_ | 6 #define MEDIA_BASE_VIDEO_FRAME_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/md5.h" | 9 #include "base/md5.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Surface formats roughly based on FOURCC labels, see: | 37 // Surface formats roughly based on FOURCC labels, see: |
38 // http://www.fourcc.org/rgb.php | 38 // http://www.fourcc.org/rgb.php |
39 // http://www.fourcc.org/yuv.php | 39 // http://www.fourcc.org/yuv.php |
40 // Logged to UMA, so never reuse values. | 40 // Logged to UMA, so never reuse values. |
41 enum Format { | 41 enum Format { |
42 UNKNOWN = 0, // Unknown format value. | 42 UNKNOWN = 0, // Unknown format value. |
43 YV12 = 1, // 12bpp YVU planar 1x1 Y, 2x2 VU samples | 43 YV12 = 1, // 12bpp YVU planar 1x1 Y, 2x2 VU samples |
44 YV16 = 2, // 16bpp YVU planar 1x1 Y, 2x1 VU samples | 44 YV16 = 2, // 16bpp YVU planar 1x1 Y, 2x1 VU samples |
45 I420 = 3, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. | 45 I420 = 3, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. |
46 YV12A = 4, // 20bpp YUVA planar 1x1 Y, 2x2 VU, 1x1 A samples. | 46 YV12A = 4, // 20bpp YUVA planar 1x1 Y, 2x2 VU, 1x1 A samples. |
47 #if defined(GOOGLE_TV) | 47 #if defined(VIDEO_HOLE) |
48 HOLE = 5, // Hole frame. | 48 HOLE = 5, // Hole frame. |
49 #endif | 49 #endif // defined(VIDEO_HOLE) |
50 NATIVE_TEXTURE = 6, // Native texture. Pixel-format agnostic. | 50 NATIVE_TEXTURE = 6, // Native texture. Pixel-format agnostic. |
51 YV12J = 7, // JPEG color range version of YV12 | 51 YV12J = 7, // JPEG color range version of YV12 |
52 HISTOGRAM_MAX, // Must always be greatest. | 52 HISTOGRAM_MAX, // Must always be greatest. |
53 }; | 53 }; |
54 | 54 |
55 // Returns the name of a Format as a string. | 55 // Returns the name of a Format as a string. |
56 static std::string FormatToString(Format format); | 56 static std::string FormatToString(Format format); |
57 | 57 |
58 // This class calls the TextureNoLongerNeededCallback when this class is | 58 // This class calls the TextureNoLongerNeededCallback when this class is |
59 // destroyed. Users can query the current sync point associated with this | 59 // destroyed. Users can query the current sync point associated with this |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // Allocates YV12 frame based on |size|, and sets its data to the YUV(y,u,v). | 181 // Allocates YV12 frame based on |size|, and sets its data to the YUV(y,u,v). |
182 static scoped_refptr<VideoFrame> CreateColorFrame( | 182 static scoped_refptr<VideoFrame> CreateColorFrame( |
183 const gfx::Size& size, | 183 const gfx::Size& size, |
184 uint8 y, uint8 u, uint8 v, | 184 uint8 y, uint8 u, uint8 v, |
185 base::TimeDelta timestamp); | 185 base::TimeDelta timestamp); |
186 | 186 |
187 // Allocates YV12 frame based on |size|, and sets its data to the YUV | 187 // Allocates YV12 frame based on |size|, and sets its data to the YUV |
188 // equivalent of RGB(0,0,0). | 188 // equivalent of RGB(0,0,0). |
189 static scoped_refptr<VideoFrame> CreateBlackFrame(const gfx::Size& size); | 189 static scoped_refptr<VideoFrame> CreateBlackFrame(const gfx::Size& size); |
190 | 190 |
191 #if defined(GOOGLE_TV) | 191 #if defined(VIDEO_HOLE) |
192 // Allocates a hole frame. | 192 // Allocates a hole frame. |
193 static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size); | 193 static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size); |
194 #endif | 194 #endif // defined(VIDEO_HOLE) |
195 | 195 |
196 static size_t NumPlanes(Format format); | 196 static size_t NumPlanes(Format format); |
197 | 197 |
198 // Returns the required allocation size for a (tightly packed) frame of the | 198 // Returns the required allocation size for a (tightly packed) frame of the |
199 // given coded size and format. | 199 // given coded size and format. |
200 static size_t AllocationSize(Format format, const gfx::Size& coded_size); | 200 static size_t AllocationSize(Format format, const gfx::Size& coded_size); |
201 | 201 |
202 // Returns the required allocation size for a (tightly packed) plane of the | 202 // Returns the required allocation size for a (tightly packed) plane of the |
203 // given coded size and format. | 203 // given coded size and format. |
204 static size_t PlaneAllocationSize(Format format, | 204 static size_t PlaneAllocationSize(Format format, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 base::TimeDelta timestamp_; | 299 base::TimeDelta timestamp_; |
300 | 300 |
301 const bool end_of_stream_; | 301 const bool end_of_stream_; |
302 | 302 |
303 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 303 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
304 }; | 304 }; |
305 | 305 |
306 } // namespace media | 306 } // namespace media |
307 | 307 |
308 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 308 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |