blob: b566615bd942dd5cdb575fafbd998725f5e23b57 [file] [log] [blame]
Anders Carlsson7bca8ca2018-08-30 09:30:29 +02001/*
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
21NS_ASSUME_NONNULL_BEGIN
22
23/** Callback block for encoder. */
24typedef BOOL (^RTCVideoEncoderCallback)(RTCEncodedImage *frame,
25 id<RTCCodecSpecificInfo> info,
26 RTCRtpFragmentationHeader *header);
27
28/** Protocol for encoder implementations. */
29RTC_EXPORT
30@protocol RTCVideoEncoder <NSObject>
31
32- (void)setCallback:(RTCVideoEncoderCallback)callback;
33- (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings
34 numberOfCores:(int)numberOfCores;
35- (NSInteger)releaseEncoder;
36- (NSInteger)encode:(RTCVideoFrame *)frame
37 codecSpecificInfo:(nullable id<RTCCodecSpecificInfo>)info
38 frameTypes:(NSArray<NSNumber *> *)frameTypes;
39- (int)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate;
40- (NSString *)implementationName;
41
42/** Returns QP scaling settings for encoder. The quality scaler adjusts the resolution in order to
43 * keep the QP from the encoded images within the given range. Returning nil from this function
44 * disables quality scaling. */
Anders Carlsson2ac27392018-09-03 14:17:03 +020045- (nullable RTCVideoEncoderQpThresholds *)scalingSettings;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020046
47@end
48
49NS_ASSUME_NONNULL_END