Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: webrtc/common_video/include/video_frame_buffer.h

Issue 1878623002: Added new VideoFrameBuffer methods Data[YUV]() etc. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/common_video/i420_video_frame_unittest.cc ('k') | webrtc/common_video/video_frame_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/include/video_frame_buffer.h
diff --git a/webrtc/common_video/include/video_frame_buffer.h b/webrtc/common_video/include/video_frame_buffer.h
index e78a1d696884354ec4021f3c58fc9da9949eebf2..6f082dee9bae928fbb005027b7262f03bdde3053 100644
--- a/webrtc/common_video/include/video_frame_buffer.h
+++ b/webrtc/common_video/include/video_frame_buffer.h
@@ -50,16 +50,36 @@ class VideoFrameBuffer : public rtc::RefCountInterface {
virtual int width() const = 0;
virtual int height() const = 0;
+ // TODO(nisse): For the transition, we use default implementations
+ // of the stride and data methods where the new methods calls the
+ // old method, and the old method calls the new methods. Subclasses
+ // must override either the new methods or the old method, to break
+ // infinite recursion. And similarly for the strides. When
+ // applications, in particular Chrome, are updated, delete the old
+ // method and delete the default implementation of the new methods.
+
// Returns pointer to the pixel data for a given plane. The memory is owned by
// the VideoFrameBuffer object and must not be freed by the caller.
- virtual const uint8_t* data(PlaneType type) const = 0;
-
- // Non-const data access is disallowed by default. You need to make sure you
- // have exclusive access and a writable buffer before calling this function.
+ virtual const uint8_t* DataY() const;
+ virtual const uint8_t* DataU() const;
+ virtual const uint8_t* DataV() const;
+ // Deprecated method.
+ // TODO(nisse): Delete after all users are updated.
+ virtual const uint8_t* data(PlaneType type) const;
+
+ // Non-const data access is allowed only if HasOneRef() is true.
+ virtual uint8_t* MutableDataY();
+ virtual uint8_t* MutableDataU();
+ virtual uint8_t* MutableDataV();
+ // Deprecated method. TODO(nisse): Delete after all users are updated.
virtual uint8_t* MutableData(PlaneType type);
// Returns the number of bytes between successive rows for a given plane.
- virtual int stride(PlaneType type) const = 0;
+ virtual int StrideY() const;
+ virtual int StrideU() const;
+ virtual int StrideV() const;
+ // Deprecated method. TODO(nisse): Delete after all users are updated.
+ virtual int stride(PlaneType type) const;
// Return the handle of the underlying video frame. This is used when the
// frame is backed by a texture.
@@ -82,12 +102,19 @@ class I420Buffer : public VideoFrameBuffer {
int width() const override;
int height() const override;
- const uint8_t* data(PlaneType type) const override;
- // Non-const data access is only allowed if HasOneRef() is true to protect
+ const uint8_t* DataY() const override;
+ const uint8_t* DataU() const override;
+ const uint8_t* DataV() const override;
+ // Non-const data access is only allowed if IsMutable() is true, to protect
// against unexpected overwrites.
bool IsMutable() override;
- uint8_t* MutableData(PlaneType type) override;
- int stride(PlaneType type) const override;
+ uint8_t* MutableDataY() override;
+ uint8_t* MutableDataU() override;
+ uint8_t* MutableDataV() override;
+ int StrideY() const override;
+ int StrideU() const override;
+ int StrideV() const override;
+
void* native_handle() const override;
rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
@@ -117,8 +144,13 @@ class NativeHandleBuffer : public VideoFrameBuffer {
int width() const override;
int height() const override;
- const uint8_t* data(PlaneType type) const override;
- int stride(PlaneType type) const override;
+ const uint8_t* DataY() const override;
+ const uint8_t* DataU() const override;
+ const uint8_t* DataV() const override;
+ int StrideY() const override;
+ int StrideU() const override;
+ int StrideV() const override;
+
void* native_handle() const override;
bool IsMutable() override;
@@ -144,9 +176,13 @@ class WrappedI420Buffer : public webrtc::VideoFrameBuffer {
bool IsMutable() override;
- const uint8_t* data(PlaneType type) const override;
+ const uint8_t* DataY() const override;
+ const uint8_t* DataU() const override;
+ const uint8_t* DataV() const override;
+ int StrideY() const override;
+ int StrideU() const override;
+ int StrideV() const override;
- int stride(PlaneType type) const override;
void* native_handle() const override;
rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
« no previous file with comments | « webrtc/common_video/i420_video_frame_unittest.cc ('k') | webrtc/common_video/video_frame_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698