| 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 10 matching lines...) Expand all Loading... |
| 21 public: | 21 public: |
| 22 enum { | 22 enum { |
| 23 kFrameSizeAlignment = 16, | 23 kFrameSizeAlignment = 16, |
| 24 kFrameSizePadding = 16, | 24 kFrameSizePadding = 16, |
| 25 kFrameAddressAlignment = 32 | 25 kFrameAddressAlignment = 32 |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 enum { | 28 enum { |
| 29 kMaxPlanes = 4, | 29 kMaxPlanes = 4, |
| 30 | 30 |
| 31 kRGBPlane = 0, | |
| 32 | |
| 33 kYPlane = 0, | 31 kYPlane = 0, |
| 34 kUPlane = 1, | 32 kUPlane = 1, |
| 35 kVPlane = 2, | 33 kVPlane = 2, |
| 36 kAPlane = 3, | 34 kAPlane = 3, |
| 37 }; | 35 }; |
| 38 | 36 |
| 39 // Surface formats roughly based on FOURCC labels, see: | 37 // Surface formats roughly based on FOURCC labels, see: |
| 40 // http://www.fourcc.org/rgb.php | 38 // http://www.fourcc.org/rgb.php |
| 41 // http://www.fourcc.org/yuv.php | 39 // http://www.fourcc.org/yuv.php |
| 42 enum Format { | 40 enum Format { |
| 43 UNKNOWN = 0, // Unknown format value. | 41 UNKNOWN = 0, // Unknown format value. |
| 44 RGB32 = 4, // 32bpp RGB packed with extra byte 8:8:8 | |
| 45 YV12 = 6, // 12bpp YVU planar 1x1 Y, 2x2 VU samples | 42 YV12 = 6, // 12bpp YVU planar 1x1 Y, 2x2 VU samples |
| 46 YV16 = 7, // 16bpp YVU planar 1x1 Y, 2x1 VU samples | 43 YV16 = 7, // 16bpp YVU planar 1x1 Y, 2x1 VU samples |
| 47 EMPTY = 9, // An empty frame. | 44 EMPTY = 9, // An empty frame. |
| 48 I420 = 11, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. | 45 I420 = 11, // 12bpp YVU planar 1x1 Y, 2x2 UV samples. |
| 49 NATIVE_TEXTURE = 12, // Native texture. Pixel-format agnostic. | 46 NATIVE_TEXTURE = 12, // Native texture. Pixel-format agnostic. |
| 50 #if defined(GOOGLE_TV) | 47 #if defined(GOOGLE_TV) |
| 51 HOLE = 13, // Hole frame. | 48 HOLE = 13, // Hole frame. |
| 52 #endif | 49 #endif |
| 53 YV12A = 14, // 20bpp YUVA planar 1x1 Y, 2x2 VU, 1x1 A samples. | 50 YV12A = 14, // 20bpp YUVA planar 1x1 Y, 2x2 VU, 1x1 A samples. |
| 54 }; | 51 }; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 private: | 241 private: |
| 245 friend class base::RefCountedThreadSafe<VideoFrame>; | 242 friend class base::RefCountedThreadSafe<VideoFrame>; |
| 246 // Clients must use the static CreateFrame() method to create a new frame. | 243 // Clients must use the static CreateFrame() method to create a new frame. |
| 247 VideoFrame(Format format, | 244 VideoFrame(Format format, |
| 248 const gfx::Size& coded_size, | 245 const gfx::Size& coded_size, |
| 249 const gfx::Rect& visible_rect, | 246 const gfx::Rect& visible_rect, |
| 250 const gfx::Size& natural_size, | 247 const gfx::Size& natural_size, |
| 251 base::TimeDelta timestamp); | 248 base::TimeDelta timestamp); |
| 252 virtual ~VideoFrame(); | 249 virtual ~VideoFrame(); |
| 253 | 250 |
| 254 // Used internally by CreateFrame(). | |
| 255 void AllocateRGB(size_t bytes_per_pixel); | |
| 256 void AllocateYUV(); | 251 void AllocateYUV(); |
| 257 | 252 |
| 258 // Used to DCHECK() plane parameters. | 253 // Used to DCHECK() plane parameters. |
| 259 bool IsValidPlane(size_t plane) const; | 254 bool IsValidPlane(size_t plane) const; |
| 260 | 255 |
| 261 // Frame format. | 256 // Frame format. |
| 262 Format format_; | 257 Format format_; |
| 263 | 258 |
| 264 // Width and height of the video frame. | 259 // Width and height of the video frame. |
| 265 gfx::Size coded_size_; | 260 gfx::Size coded_size_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 290 base::Closure no_longer_needed_cb_; | 285 base::Closure no_longer_needed_cb_; |
| 291 | 286 |
| 292 base::TimeDelta timestamp_; | 287 base::TimeDelta timestamp_; |
| 293 | 288 |
| 294 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 289 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 295 }; | 290 }; |
| 296 | 291 |
| 297 } // namespace media | 292 } // namespace media |
| 298 | 293 |
| 299 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 294 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |