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

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: 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
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 9cf57a43591b1da66f82ed9d59ffde5794fdc212..3e08d01a9440a585c5d051f3a662c66d10935dac 100644
--- a/webrtc/common_video/include/video_frame_buffer.h
+++ b/webrtc/common_video/include/video_frame_buffer.h
@@ -43,14 +43,25 @@ class VideoFrameBuffer : public rtc::RefCountInterface {
// 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 uint8_t* MutableData(PlaneType type);
+ virtual const uint8_t* DataY() const = 0;
+ virtual const uint8_t* DataU() const = 0;
+ virtual const uint8_t* DataV() const = 0;
+ // Deprecated method. TODO(nisse): Delete after all users are updated.
+ const uint8_t* data(PlaneType type) const final;
+
+ // 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.
+ uint8_t* MutableData(PlaneType type) final;
// Returns the number of bytes between successive rows for a given plane.
- virtual int stride(PlaneType type) const = 0;
+ virtual int StrideY() const = 0;
+ virtual int StrideU() const = 0;
+ virtual int StrideV() const = 0;
+ // Deprecated method. TODO(nisse): Delete after all users are updated.
+ int stride(PlaneType type) const final;
// Return the handle of the underlying video frame. This is used when the
// frame is backed by a texture.
@@ -73,11 +84,18 @@ class I420Buffer : public VideoFrameBuffer {
int width() const override;
int height() const 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;
// Non-const data access is only allowed if HasOneRef() is true to protect
// against unexpected overwrites.
- 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;
@@ -107,8 +125,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;
protected:
@@ -131,9 +154,13 @@ class WrappedI420Buffer : public webrtc::VideoFrameBuffer {
int width() const override;
int height() const 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;

Powered by Google App Engine
This is Rietveld 408576698