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..2e23c245c75613597190cc35cfbaa75a429337ee 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,9 +414,31 @@ 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>; |
| + virtual ~VideoFrame(); |
| + |
| + // Clients must use the static factory/wrapping methods to create a new frame. |
|
xhwang
2016/02/23 21:27:36
except for derived classes?
jrummell
2016/02/25 02:18:26
Done.
|
| + VideoFrame(VideoPixelFormat format, |
| + StorageType storage_type, |
| + const gfx::Size& coded_size, |
| + const gfx::Rect& visible_rect, |
| + const gfx::Size& natural_size, |
| + base::TimeDelta timestamp); |
| + |
| + void set_data(size_t plane, uint8_t* ptr); |
| + void set_stride(size_t plane, int stride); |
| + |
| + static std::string ConfigToString(const VideoPixelFormat format, |
|
xhwang
2016/02/23 21:27:36
what does this function do? Add a comment?
jrummell
2016/02/25 02:18:26
Done.
|
| + 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); |
| + |
| + private: |
| static scoped_refptr<VideoFrame> WrapExternalStorage( |
| VideoPixelFormat format, |
| StorageType storage_type, |
| @@ -434,12 +457,6 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
| const gfx::Size& coded_size, |
| const gfx::Rect& visible_rect, |
| const gfx::Size& natural_size, |
| - base::TimeDelta timestamp); |
| - VideoFrame(VideoPixelFormat format, |
| - StorageType storage_type, |
| - const gfx::Size& coded_size, |
| - const gfx::Rect& visible_rect, |
| - const gfx::Size& natural_size, |
| base::TimeDelta timestamp, |
| base::SharedMemoryHandle handle, |
| size_t shared_memory_offset); |
| @@ -451,7 +468,6 @@ 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> CreateFrameInternal( |
| VideoPixelFormat format, |
| @@ -463,6 +479,17 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { |
| void AllocateYUV(bool zero_initialize_memory); |
| + // Returns the pixel size per element for given |plane| and |format|. E.g. 2x2 |
| + // for the U-plane in PIXEL_FORMAT_I420. |
|
xhwang
2016/02/23 21:27:36
This is copied from existing code, but it would be
jrummell
2016/02/25 02:18:26
Done (I think).
|
| + 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); |
| + |
|
xhwang
2016/02/23 21:27:36
Move these to the top of the "private" section?
jrummell
2016/02/25 02:18:26
Done.
|
| // Frame format. |
| const VideoPixelFormat format_; |