Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_COREVIDEO_FRAME_BUFFER_H_ | 11 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_COREVIDEO_FRAME_BUFFER_H_ |
| 12 #define WEBRTC_COMMON_VIDEO_INCLUDE_COREVIDEO_FRAME_BUFFER_H_ | 12 #define WEBRTC_COMMON_VIDEO_INCLUDE_COREVIDEO_FRAME_BUFFER_H_ |
| 13 | 13 |
| 14 #include <CoreVideo/CoreVideo.h> | 14 #include <CoreVideo/CoreVideo.h> |
| 15 | 15 |
| 16 #include <vector> | |
| 17 | |
| 16 #include "webrtc/common_video/include/video_frame_buffer.h" | 18 #include "webrtc/common_video/include/video_frame_buffer.h" |
| 17 | 19 |
| 18 namespace webrtc { | 20 namespace webrtc { |
| 19 | 21 |
| 20 class CoreVideoFrameBuffer : public NativeHandleBuffer { | 22 class CoreVideoFrameBuffer : public NativeHandleBuffer { |
| 21 public: | 23 public: |
| 22 explicit CoreVideoFrameBuffer(CVPixelBufferRef pixel_buffer); | 24 explicit CoreVideoFrameBuffer(CVPixelBufferRef pixel_buffer); |
| 25 CoreVideoFrameBuffer(CVPixelBufferRef pixel_buffer, | |
| 26 int adapted_width, | |
| 27 int adapted_height, | |
| 28 int crop_width, | |
| 29 int crop_height, | |
| 30 int crop_x, | |
| 31 int crop_y); | |
| 23 ~CoreVideoFrameBuffer() override; | 32 ~CoreVideoFrameBuffer() override; |
| 24 | 33 |
| 25 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; | 34 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
| 35 // Returns true if the internal pixel buffer needs to be cropped. | |
| 36 bool RequiresCropping() const; | |
| 37 // Crop and scales the internal pixel buffer to the output pixel buffer. The | |
| 38 // tmp buffer is used for intermediary splitting the UV channels. This | |
| 39 // function returns true if successful. | |
| 40 bool CropAndScaleTo(std::vector<uint8_t>* tmp_buffer, | |
| 41 CVPixelBufferRef output_pixel_buffer) const; | |
| 26 | 42 |
| 27 private: | 43 private: |
| 28 CVPixelBufferRef pixel_buffer_; | 44 CVPixelBufferRef pixel_buffer_; |
| 45 const int buffer_width_; | |
|
tkchin_webrtc
2016/10/19 00:48:32
how is buffer width different from width/height of
magjed_webrtc
2016/10/19 13:19:34
I agree this is a bit confusing, but I don't see h
tkchin_webrtc
2016/10/19 22:50:17
gotcha. Maybe short comment along those lines some
| |
| 46 const int buffer_height_; | |
| 47 const int crop_width_; | |
| 48 const int crop_height_; | |
| 49 const int crop_x_; | |
| 50 const int crop_y_; | |
| 29 }; | 51 }; |
| 30 | 52 |
| 31 } // namespace webrtc | 53 } // namespace webrtc |
| 32 | 54 |
| 33 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_COREVIDEO_FRAME_BUFFER_H_ | 55 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_COREVIDEO_FRAME_BUFFER_H_ |
| 34 | 56 |
| OLD | NEW |