| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/md5.h" | 11 #include "base/md5.h" |
| 12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "base/values.h" |
| 14 #include "media/base/buffers.h" | 15 #include "media/base/buffers.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 | 18 |
| 18 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
| 19 #include <CoreVideo/CVPixelBuffer.h> | 20 #include <CoreVideo/CVPixelBuffer.h> |
| 20 #include "base/mac/scoped_cftyperef.h" | 21 #include "base/mac/scoped_cftyperef.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 namespace gpu { | 24 namespace gpu { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 NATIVE_TEXTURE = 6, // Native texture. Pixel-format agnostic. | 62 NATIVE_TEXTURE = 6, // Native texture. Pixel-format agnostic. |
| 62 YV12J = 7, // JPEG color range version of YV12 | 63 YV12J = 7, // JPEG color range version of YV12 |
| 63 NV12 = 8, // 12bpp 1x1 Y plane followed by an interleaved 2x2 UV plane. | 64 NV12 = 8, // 12bpp 1x1 Y plane followed by an interleaved 2x2 UV plane. |
| 64 YV24 = 9, // 24bpp YUV planar, no subsampling. | 65 YV24 = 9, // 24bpp YUV planar, no subsampling. |
| 65 ARGB = 10, // 32bpp ARGB, 1 plane. | 66 ARGB = 10, // 32bpp ARGB, 1 plane. |
| 66 YV12HD = 11, // Rec709 "HD" color space version of YV12 | 67 YV12HD = 11, // Rec709 "HD" color space version of YV12 |
| 67 // Please update UMA histogram enumeration when adding new formats here. | 68 // Please update UMA histogram enumeration when adding new formats here. |
| 68 FORMAT_MAX = YV12HD, // Must always be equal to largest entry logged. | 69 FORMAT_MAX = YV12HD, // Must always be equal to largest entry logged. |
| 69 }; | 70 }; |
| 70 | 71 |
| 72 // Key for getting/setting the frame rate value (of type DoubleValue) in the |
| 73 // metadata dictionary. The value represents either the fixed frame rate, or |
| 74 // the maximum frame rate to expect from a variable-rate source. |
| 75 static const char kFrameRateMetadataKey[]; |
| 76 |
| 71 // Returns the name of a Format as a string. | 77 // Returns the name of a Format as a string. |
| 72 static std::string FormatToString(Format format); | 78 static std::string FormatToString(Format format); |
| 73 | 79 |
| 74 // Creates a new frame in system memory with given parameters. Buffers for | 80 // Creates a new frame in system memory with given parameters. Buffers for |
| 75 // the frame are allocated but not initialized. | 81 // the frame are allocated but not initialized. |
| 76 static scoped_refptr<VideoFrame> CreateFrame( | 82 static scoped_refptr<VideoFrame> CreateFrame( |
| 77 Format format, | 83 Format format, |
| 78 const gfx::Size& coded_size, | 84 const gfx::Size& coded_size, |
| 79 const gfx::Rect& visible_rect, | 85 const gfx::Rect& visible_rect, |
| 80 const gfx::Size& natural_size, | 86 const gfx::Size& natural_size, |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the | 287 // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the |
| 282 // mailbox, the caller must wait for the included sync point. | 288 // mailbox, the caller must wait for the included sync point. |
| 283 const gpu::MailboxHolder* mailbox_holder() const; | 289 const gpu::MailboxHolder* mailbox_holder() const; |
| 284 | 290 |
| 285 // Returns the shared-memory handle, if present | 291 // Returns the shared-memory handle, if present |
| 286 base::SharedMemoryHandle shared_memory_handle() const; | 292 base::SharedMemoryHandle shared_memory_handle() const; |
| 287 | 293 |
| 288 // Returns the offset into the shared memory where the frame data begins. | 294 // Returns the offset into the shared memory where the frame data begins. |
| 289 size_t shared_memory_offset() const; | 295 size_t shared_memory_offset() const; |
| 290 | 296 |
| 297 // Returns a dictionary of optional metadata. This contains information |
| 298 // associated with the frame that downstream clients might use for frame-level |
| 299 // logging, quality/performance optimizations, signaling, etc. |
| 300 // |
| 301 // TODO(miu): Move some of the "extra" members of VideoFrame (below) into |
| 302 // here as a later clean-up step. |
| 303 const base::DictionaryValue& metadata() const { return metadata_; } |
| 304 base::DictionaryValue& metadata() { return metadata_; } |
| 305 |
| 291 bool allow_overlay() const { return allow_overlay_; } | 306 bool allow_overlay() const { return allow_overlay_; } |
| 292 | 307 |
| 293 #if defined(OS_POSIX) | 308 #if defined(OS_POSIX) |
| 294 // Returns backing dmabuf file descriptor for given |plane|, if present. | 309 // Returns backing dmabuf file descriptor for given |plane|, if present. |
| 295 int dmabuf_fd(size_t plane) const; | 310 int dmabuf_fd(size_t plane) const; |
| 296 #endif | 311 #endif |
| 297 | 312 |
| 298 #if defined(OS_MACOSX) | 313 #if defined(OS_MACOSX) |
| 299 // Returns the backing CVPixelBuffer, if present. | 314 // Returns the backing CVPixelBuffer, if present. |
| 300 CVPixelBufferRef cv_pixel_buffer() const; | 315 CVPixelBufferRef cv_pixel_buffer() const; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 411 |
| 397 base::Closure no_longer_needed_cb_; | 412 base::Closure no_longer_needed_cb_; |
| 398 | 413 |
| 399 base::TimeDelta timestamp_; | 414 base::TimeDelta timestamp_; |
| 400 | 415 |
| 401 base::Lock release_sync_point_lock_; | 416 base::Lock release_sync_point_lock_; |
| 402 uint32 release_sync_point_; | 417 uint32 release_sync_point_; |
| 403 | 418 |
| 404 const bool end_of_stream_; | 419 const bool end_of_stream_; |
| 405 | 420 |
| 421 base::DictionaryValue metadata_; |
| 422 |
| 406 bool allow_overlay_; | 423 bool allow_overlay_; |
| 407 | 424 |
| 408 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 425 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
| 409 }; | 426 }; |
| 410 | 427 |
| 411 } // namespace media | 428 } // namespace media |
| 412 | 429 |
| 413 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 430 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
| OLD | NEW |