| Index: webrtc/common_video/include/corevideo_frame_buffer.h
|
| diff --git a/webrtc/common_video/include/corevideo_frame_buffer.h b/webrtc/common_video/include/corevideo_frame_buffer.h
|
| index ed5361d5cf1f281ad26969fc1f98ee2123fc4f9d..c925cbfc97c5c1da06b25d460e161c6139356c9c 100644
|
| --- a/webrtc/common_video/include/corevideo_frame_buffer.h
|
| +++ b/webrtc/common_video/include/corevideo_frame_buffer.h
|
| @@ -13,6 +13,8 @@
|
|
|
| #include <CoreVideo/CoreVideo.h>
|
|
|
| +#include <vector>
|
| +
|
| #include "webrtc/common_video/include/video_frame_buffer.h"
|
|
|
| namespace webrtc {
|
| @@ -20,12 +22,36 @@ namespace webrtc {
|
| class CoreVideoFrameBuffer : public NativeHandleBuffer {
|
| public:
|
| explicit CoreVideoFrameBuffer(CVPixelBufferRef pixel_buffer);
|
| + CoreVideoFrameBuffer(CVPixelBufferRef pixel_buffer,
|
| + int adapted_width,
|
| + int adapted_height,
|
| + int crop_width,
|
| + int crop_height,
|
| + int crop_x,
|
| + int crop_y);
|
| ~CoreVideoFrameBuffer() override;
|
|
|
| rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
|
| + // Returns true if the internal pixel buffer needs to be cropped.
|
| + bool RequiresCropping() const;
|
| + // Crop and scales the internal pixel buffer to the output pixel buffer. The
|
| + // tmp buffer is used for intermediary splitting the UV channels. This
|
| + // function returns true if successful.
|
| + bool CropAndScaleTo(std::vector<uint8_t>* tmp_buffer,
|
| + CVPixelBufferRef output_pixel_buffer) const;
|
|
|
| private:
|
| CVPixelBufferRef pixel_buffer_;
|
| + // buffer_width/height is the actual pixel buffer resolution. The width/height
|
| + // in NativeHandleBuffer, i.e. width()/height(), is the resolution we will
|
| + // scale to in NativeToI420Buffer(). Cropping happens before scaling, so:
|
| + // buffer_width >= crop_width >= width().
|
| + const int buffer_width_;
|
| + const int buffer_height_;
|
| + const int crop_width_;
|
| + const int crop_height_;
|
| + const int crop_x_;
|
| + const int crop_y_;
|
| };
|
|
|
| } // namespace webrtc
|
|
|