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 "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // http://www.fourcc.org/yuv.php | 36 // http://www.fourcc.org/yuv.php |
37 // Keep in sync with WebKit::WebVideoFrame! | 37 // Keep in sync with WebKit::WebVideoFrame! |
38 enum Format { | 38 enum Format { |
39 INVALID = 0, // Invalid format value. Used for error reporting. | 39 INVALID = 0, // Invalid format value. Used for error reporting. |
40 RGB32 = 4, // 32bpp RGB packed with extra byte 8:8:8 | 40 RGB32 = 4, // 32bpp RGB packed with extra byte 8:8:8 |
41 YV12 = 6, // 12bpp YVU planar 1x1 Y, 2x2 VU samples | 41 YV12 = 6, // 12bpp YVU planar 1x1 Y, 2x2 VU samples |
42 YV16 = 7, // 16bpp YVU planar 1x1 Y, 2x1 VU samples | 42 YV16 = 7, // 16bpp YVU planar 1x1 Y, 2x1 VU samples |
43 EMPTY = 9, // An empty frame. | 43 EMPTY = 9, // An empty frame. |
44 I420 = 11, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. | 44 I420 = 11, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. |
45 NATIVE_TEXTURE = 12, // Native texture. Pixel-format agnostic. | 45 NATIVE_TEXTURE = 12, // Native texture. Pixel-format agnostic. |
| 46 #if defined(GOOGLE_TV) |
| 47 HOLE = 13, // Hole frame. |
| 48 #endif |
46 }; | 49 }; |
47 | 50 |
48 // Creates a new frame in system memory with given parameters. Buffers for | 51 // Creates a new frame in system memory with given parameters. Buffers for |
49 // the frame are allocated but not initialized. | 52 // the frame are allocated but not initialized. |
50 // |coded_size| is the width and height of the frame data in pixels. | 53 // |coded_size| is the width and height of the frame data in pixels. |
51 // |visible_rect| is the visible portion of |coded_size|, after cropping (if | 54 // |visible_rect| is the visible portion of |coded_size|, after cropping (if |
52 // any) is applied. | 55 // any) is applied. |
53 // |natural_size| is the width and height of the frame when the frame's aspect | 56 // |natural_size| is the width and height of the frame when the frame's aspect |
54 // ratio is applied to |visible_rect|. | 57 // ratio is applied to |visible_rect|. |
55 static scoped_refptr<VideoFrame> CreateFrame( | 58 static scoped_refptr<VideoFrame> CreateFrame( |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // Allocates YV12 frame based on |size|, and sets its data to the YUV(y,u,v). | 121 // Allocates YV12 frame based on |size|, and sets its data to the YUV(y,u,v). |
119 static scoped_refptr<VideoFrame> CreateColorFrame( | 122 static scoped_refptr<VideoFrame> CreateColorFrame( |
120 const gfx::Size& size, | 123 const gfx::Size& size, |
121 uint8 y, uint8 u, uint8 v, | 124 uint8 y, uint8 u, uint8 v, |
122 base::TimeDelta timestamp); | 125 base::TimeDelta timestamp); |
123 | 126 |
124 // Allocates YV12 frame based on |size|, and sets its data to the YUV | 127 // Allocates YV12 frame based on |size|, and sets its data to the YUV |
125 // equivalent of RGB(0,0,0). | 128 // equivalent of RGB(0,0,0). |
126 static scoped_refptr<VideoFrame> CreateBlackFrame(const gfx::Size& size); | 129 static scoped_refptr<VideoFrame> CreateBlackFrame(const gfx::Size& size); |
127 | 130 |
| 131 #if defined(GOOGLE_TV) |
| 132 // Allocates a hole frame. |
| 133 static scoped_refptr<VideoFrame> CreateHoleFrame(const gfx::Size& size); |
| 134 #endif |
| 135 |
128 Format format() const { return format_; } | 136 Format format() const { return format_; } |
129 | 137 |
130 const gfx::Size& coded_size() const { return coded_size_; } | 138 const gfx::Size& coded_size() const { return coded_size_; } |
131 const gfx::Rect& visible_rect() const { return visible_rect_; } | 139 const gfx::Rect& visible_rect() const { return visible_rect_; } |
132 const gfx::Size& natural_size() const { return natural_size_; } | 140 const gfx::Size& natural_size() const { return natural_size_; } |
133 | 141 |
134 int stride(size_t plane) const; | 142 int stride(size_t plane) const; |
135 | 143 |
136 // Returns the number of bytes per row and number of rows for a given plane. | 144 // Returns the number of bytes per row and number of rows for a given plane. |
137 // | 145 // |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 base::Closure no_longer_needed_cb_; | 219 base::Closure no_longer_needed_cb_; |
212 | 220 |
213 base::TimeDelta timestamp_; | 221 base::TimeDelta timestamp_; |
214 | 222 |
215 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 223 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
216 }; | 224 }; |
217 | 225 |
218 } // namespace media | 226 } // namespace media |
219 | 227 |
220 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 228 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |