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