1 /* 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef SDK_OBJC_NATIVE_SRC_OBJC_FRAME_BUFFER_H_ 12 #define SDK_OBJC_NATIVE_SRC_OBJC_FRAME_BUFFER_H_ 13 14 #import <CoreVideo/CoreVideo.h> 15 16 #import "base/RTCMacros.h" 17 18 #include "common_video/include/video_frame_buffer.h" 19 20 @protocol RTC_OBJC_TYPE 21 (RTCVideoFrameBuffer); 22 23 namespace webrtc { 24 25 class ObjCFrameBuffer : public VideoFrameBuffer { 26 public: 27 explicit ObjCFrameBuffer(id<RTC_OBJC_TYPE(RTCVideoFrameBuffer)>); 28 ~ObjCFrameBuffer() override; 29 30 Type type() const override; 31 32 int width() const override; 33 int height() const override; 34 35 rtc::scoped_refptr<I420BufferInterface> ToI420() override; 36 rtc::scoped_refptr<VideoFrameBuffer> CropAndScale(int offset_x, 37 int offset_y, 38 int crop_width, 39 int crop_height, 40 int scaled_width, 41 int scaled_height) override; 42 43 id<RTC_OBJC_TYPE(RTCVideoFrameBuffer)> wrapped_frame_buffer() const; 44 45 private: 46 id<RTC_OBJC_TYPE(RTCVideoFrameBuffer)> frame_buffer_; 47 int width_; 48 int height_; 49 }; 50 51 id<RTC_OBJC_TYPE(RTCVideoFrameBuffer)> ToObjCVideoFrameBuffer( 52 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); 53 54 } // namespace webrtc 55 56 #endif // SDK_OBJC_NATIVE_SRC_OBJC_FRAME_BUFFER_H_ 57