Chromium Code Reviews| Index: media/base/video_frame.h |
| diff --git a/media/base/video_frame.h b/media/base/video_frame.h |
| index ad7f4c01a4268651728ce71acba87c3ec0ac388e..0b9284c09f1daf010b66b9c39f161d1f8cd1b615 100644 |
| --- a/media/base/video_frame.h |
| +++ b/media/base/video_frame.h |
| @@ -73,7 +73,8 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
| STORAGE_HOLE = 6, |
| #endif |
| STORAGE_GPU_MEMORY_BUFFERS = 7, |
| - STORAGE_LAST = STORAGE_GPU_MEMORY_BUFFERS, |
| + STORAGE_MOJO_SHARED_MEMORY = 8, |
| + STORAGE_LAST = STORAGE_MOJO_SHARED_MEMORY, |
| }; |
| // CB to be called on the mailbox backing this frame when the frame is |
| @@ -413,28 +414,36 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
| // Returns a human-readable string describing |*this|. |
| std::string AsHumanReadableString(); |
| - private: |
| + protected: |
| friend class base::RefCountedThreadSafe<VideoFrame>; |
| - static scoped_refptr<VideoFrame> WrapExternalStorage( |
| - VideoPixelFormat format, |
| - StorageType storage_type, |
| - const gfx::Size& coded_size, |
| - const gfx::Rect& visible_rect, |
| - const gfx::Size& natural_size, |
| - uint8_t* data, |
| - size_t data_size, |
| - base::TimeDelta timestamp, |
| - base::SharedMemoryHandle handle, |
| - size_t data_offset); |
| - |
| // Clients must use the static factory/wrapping methods to create a new frame. |
| + // Derived classes should create their own factory/wrapping methods, and use |
| + // this constructor to do basic initialization. |
| VideoFrame(VideoPixelFormat format, |
| StorageType storage_type, |
| const gfx::Size& coded_size, |
| const gfx::Rect& visible_rect, |
| const gfx::Size& natural_size, |
| base::TimeDelta timestamp); |
| + |
| + virtual ~VideoFrame(); |
| + |
| + // Creates a summary of the configuration settings provided as parameters. |
| + static std::string ConfigToString(const VideoPixelFormat format, |
|
mcasas
2016/02/25 15:12:35
Since is only used in LOG(DFATAL)s I'd sandwich
i
jrummell
2016/02/25 21:51:47
Combined (AsHumanReadableString() now calls Config
|
| + const VideoFrame::StorageType storage_type, |
| + const gfx::Size& coded_size, |
| + const gfx::Rect& visible_rect, |
| + const gfx::Size& natural_size); |
| + |
| + // Returns true if |plane| is a valid plane index for the given |format|. |
| + static bool IsValidPlane(size_t plane, VideoPixelFormat format); |
| + |
| + void set_data(size_t plane, uint8_t* ptr); |
| + void set_stride(size_t plane, int stride); |
| + |
| + private: |
| + // Clients must use the static factory/wrapping methods to create a new frame. |
| VideoFrame(VideoPixelFormat format, |
| StorageType storage_type, |
| const gfx::Size& coded_size, |
| @@ -451,7 +460,18 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
| const gpu::MailboxHolder(&mailbox_holders)[kMaxPlanes], |
| const ReleaseMailboxCB& mailbox_holder_release_cb, |
| base::TimeDelta timestamp); |
| - virtual ~VideoFrame(); |
| + |
| + static scoped_refptr<VideoFrame> WrapExternalStorage( |
| + VideoPixelFormat format, |
| + StorageType storage_type, |
| + const gfx::Size& coded_size, |
| + const gfx::Rect& visible_rect, |
| + const gfx::Size& natural_size, |
| + uint8_t* data, |
| + size_t data_size, |
| + base::TimeDelta timestamp, |
| + base::SharedMemoryHandle handle, |
| + size_t data_offset); |
| static scoped_refptr<VideoFrame> CreateFrameInternal( |
| VideoPixelFormat format, |
| @@ -461,6 +481,17 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
| base::TimeDelta timestamp, |
| bool zero_initialize_memory); |
| + // Returns the pixel size of each subsample for a given |plane| and |format|. |
| + // E.g. 2x2 for the U-plane in PIXEL_FORMAT_I420. |
| + static gfx::Size SampleSize(VideoPixelFormat format, size_t plane); |
| + |
| + // Returns the number of bytes per element for given |plane| and |format|. |
| + static int BytesPerElement(VideoPixelFormat format, size_t plane); |
| + |
| + // Return the alignment for the whole frame, calculated as the max of the |
| + // alignment for each individual plane. |
| + static gfx::Size CommonAlignment(VideoPixelFormat format); |
|
mcasas
2016/02/25 15:12:35
Why did you change this file level static function
jrummell
2016/02/25 21:51:47
CommonAlignment() uses SampleSize(), which is now
|
| + |
| void AllocateYUV(bool zero_initialize_memory); |
| // Frame format. |