Chromium Code Reviews| 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..8bd548552b9e14defbf7a94c134dd8599d3c526e 100644 |
| --- a/webrtc/common_video/include/video_frame_buffer.h |
| +++ b/webrtc/common_video/include/video_frame_buffer.h |
| @@ -43,14 +43,29 @@ 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. Use virtual final, to ensure we get warnings |
|
pbos-webrtc
2016/04/14 13:06:39
Should this use RTC_DEPRECATED instead? (webrtc/ba
nisse-webrtc
2016/04/14 14:08:47
That will break Chrome, if it uses them. So I thin
|
| + // if any subclass tries to override it. cpplint thinks virtual is |
| + // redundant, but it isn't, since this is the base class. Hence the |
| + // use of NOLINT. |
| + // TODO(nisse): Delete after all users are updated. |
| + virtual const uint8_t* data(PlaneType type) const final; // NOLINT |
| + |
| + // 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) final; // NOLINT |
| // 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. |
| + virtual int stride(PlaneType type) const final; // NOLINT |
| // Return the handle of the underlying video frame. This is used when the |
| // frame is backed by a texture. |
| @@ -73,11 +88,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 +129,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 +158,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; |