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 #import <Foundation/Foundation.h> 12 13 #import "RTCCodecSpecificInfo.h" 14 #import "RTCEncodedImage.h" 15 #import "RTCMacros.h" 16 #import "RTCRtpFragmentationHeader.h" 17 #import "RTCVideoEncoderQpThresholds.h" 18 #import "RTCVideoEncoderSettings.h" 19 #import "RTCVideoFrame.h" 20 21 NS_ASSUME_NONNULL_BEGIN 22 23 /** Callback block for encoder. */ 24 typedef BOOL (^RTCVideoEncoderCallback)(RTC_OBJC_TYPE(RTCEncodedImage) * frame, 25 id<RTC_OBJC_TYPE(RTCCodecSpecificInfo)> info, 26 RTC_OBJC_TYPE(RTCRtpFragmentationHeader) * header); 27 28 /** Protocol for encoder implementations. */ 29 RTC_OBJC_EXPORT 30 @protocol RTC_OBJC_TYPE 31 (RTCVideoEncoder)<NSObject> 32 33 - (void)setCallback : (RTCVideoEncoderCallback)callback; 34 - (NSInteger)startEncodeWithSettings:(RTC_OBJC_TYPE(RTCVideoEncoderSettings) *)settings 35 numberOfCores:(int)numberOfCores; 36 - (NSInteger)releaseEncoder; 37 - (NSInteger)encode:(RTC_OBJC_TYPE(RTCVideoFrame) *)frame 38 codecSpecificInfo:(nullable id<RTC_OBJC_TYPE(RTCCodecSpecificInfo)>)info 39 frameTypes:(NSArray<NSNumber *> *)frameTypes; 40 - (int)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate; 41 - (NSString *)implementationName; 42 43 /** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to 44 * keep the QP from the encoded images within the given range. Returning nil from this function 45 * disables quality scaling. */ 46 - (nullable RTC_OBJC_TYPE(RTCVideoEncoderQpThresholds) *)scalingSettings; 47 48 @end 49 50 NS_ASSUME_NONNULL_END 51