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" |
11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
13 | 13 |
14 class SkBitmap; | 14 class SkBitmap; |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
18 class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { | 18 class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
19 public: | 19 public: |
20 enum { | 20 enum { |
21 kFrameSizeAlignment = 16, | 21 kFrameSizeAlignment = 16, |
22 kFrameSizePadding = 16, | 22 kFrameSizePadding = 16, |
23 kFrameAddressAlignment = 32 | 23 kFrameAddressAlignment = 32 |
24 }; | 24 }; |
25 | 25 |
26 enum { | 26 enum { |
27 kMaxPlanes = 3, | 27 kMaxPlanes = 4, |
28 | 28 |
29 kRGBPlane = 0, | 29 kRGBPlane = 0, |
30 | 30 |
31 kYPlane = 0, | 31 kYPlane = 0, |
32 kUPlane = 1, | 32 kUPlane = 1, |
33 kVPlane = 2, | 33 kVPlane = 2, |
| 34 kAPlane = 3, |
34 }; | 35 }; |
35 | 36 |
36 // Surface formats roughly based on FOURCC labels, see: | 37 // Surface formats roughly based on FOURCC labels, see: |
37 // http://www.fourcc.org/rgb.php | 38 // http://www.fourcc.org/rgb.php |
38 // http://www.fourcc.org/yuv.php | 39 // http://www.fourcc.org/yuv.php |
39 enum Format { | 40 enum Format { |
40 INVALID = 0, // Invalid format value. Used for error reporting. | 41 INVALID = 0, // Invalid format value. Used for error reporting. |
41 RGB32 = 4, // 32bpp RGB packed with extra byte 8:8:8 | 42 RGB32 = 4, // 32bpp RGB packed with extra byte 8:8:8 |
42 YV12 = 6, // 12bpp YVU planar 1x1 Y, 2x2 VU samples | 43 YV12 = 6, // 12bpp YVU planar 1x1 Y, 2x2 VU samples |
43 YV16 = 7, // 16bpp YVU planar 1x1 Y, 2x1 VU samples | 44 YV16 = 7, // 16bpp YVU planar 1x1 Y, 2x1 VU samples |
44 EMPTY = 9, // An empty frame. | 45 EMPTY = 9, // An empty frame. |
45 I420 = 11, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. | 46 I420 = 11, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. |
46 NATIVE_TEXTURE = 12, // Native texture. Pixel-format agnostic. | 47 NATIVE_TEXTURE = 12, // Native texture. Pixel-format agnostic. |
47 #if defined(GOOGLE_TV) | 48 #if defined(GOOGLE_TV) |
48 HOLE = 13, // Hole frame. | 49 HOLE = 13, // Hole frame. |
49 #endif | 50 #endif |
| 51 YV12A = 14, // 20bpp YUVA planar 1x1 Y, 2x2 VU, 1x1 A samples. |
50 }; | 52 }; |
51 | 53 |
52 // Creates a new frame in system memory with given parameters. Buffers for | 54 // Creates a new frame in system memory with given parameters. Buffers for |
53 // the frame are allocated but not initialized. | 55 // the frame are allocated but not initialized. |
54 // |coded_size| is the width and height of the frame data in pixels. | 56 // |coded_size| is the width and height of the frame data in pixels. |
55 // |visible_rect| is the visible portion of |coded_size|, after cropping (if | 57 // |visible_rect| is the visible portion of |coded_size|, after cropping (if |
56 // any) is applied. | 58 // any) is applied. |
57 // |natural_size| is the width and height of the frame when the frame's aspect | 59 // |natural_size| is the width and height of the frame when the frame's aspect |
58 // ratio is applied to |visible_rect|. | 60 // ratio is applied to |visible_rect|. |
59 static scoped_refptr<VideoFrame> CreateFrame( | 61 static scoped_refptr<VideoFrame> CreateFrame( |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 base::Closure no_longer_needed_cb_; | 225 base::Closure no_longer_needed_cb_; |
224 | 226 |
225 base::TimeDelta timestamp_; | 227 base::TimeDelta timestamp_; |
226 | 228 |
227 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 229 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
228 }; | 230 }; |
229 | 231 |
230 } // namespace media | 232 } // namespace media |
231 | 233 |
232 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 234 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |