OLD | NEW |
(Empty) | |
| 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 #import <WebRTC/RTCEncodedImage.h> |
| 13 #import <WebRTC/RTCMacros.h> |
| 14 |
| 15 @class RTCVideoFrame; |
| 16 @class RTCEncodedImage; |
| 17 @class RTCRtpFragmentationHeader; |
| 18 |
| 19 NS_ASSUME_NONNULL_BEGIN |
| 20 |
| 21 // Implement this protocol to pass codec specific info from the encoder |
| 22 RTC_EXPORT |
| 23 @protocol RTCCodecSpecificInfo <NSObject> |
| 24 |
| 25 @end |
| 26 |
| 27 // Callback block for encoder |
| 28 typedef void (^RTCVideoEncoderCallback)(RTCEncodedImage *frame, |
| 29 id<RTCCodecSpecificInfo> info, |
| 30 RTCRtpFragmentationHeader *header); |
| 31 |
| 32 // Callback block for decoder |
| 33 typedef void (^RTCVideoDecoderCallback)(RTCVideoFrame *frame); |
| 34 |
| 35 // Settings for encoder |
| 36 RTC_EXPORT |
| 37 @interface RTCVideoEncoderSettings : NSObject |
| 38 |
| 39 @property(nonatomic, retain) NSString *name; |
| 40 @property(nonatomic, assign) int numberOfCores; |
| 41 |
| 42 @property(nonatomic, assign) unsigned short width; |
| 43 @property(nonatomic, assign) unsigned short height; |
| 44 |
| 45 @property(nonatomic, assign) unsigned int startBitrate; // kilobits/sec. |
| 46 @property(nonatomic, assign) unsigned int maxBitrate; |
| 47 @property(nonatomic, assign) unsigned int minBitrate; |
| 48 @property(nonatomic, assign) unsigned int targetBitrate; |
| 49 |
| 50 @property(nonatomic, assign) uint32_t maxFramerate; |
| 51 |
| 52 @property(nonatomic, assign) unsigned int qpMax; |
| 53 |
| 54 @end |
| 55 |
| 56 // Holds information to identify a codec |
| 57 RTC_EXPORT |
| 58 @interface RTCVideoCodecInfo : NSObject |
| 59 |
| 60 - (instancetype)initWithPayload:(int)payload |
| 61 name:(NSString *)name |
| 62 parameters:(NSDictionary<NSString *, NSString *> *)paramete
rs; |
| 63 |
| 64 @property(nonatomic, readonly) int payload; |
| 65 @property(nonatomic, readonly) NSString *name; |
| 66 @property(nonatomic, readonly) NSDictionary<NSString *, NSString *> *parameters; |
| 67 |
| 68 @end |
| 69 |
| 70 // Protocol for encoder implementations |
| 71 RTC_EXPORT |
| 72 @protocol RTCVideoEncoder <NSObject> |
| 73 |
| 74 - (instancetype)initWithCodecInfo:(RTCVideoCodecInfo *)codecInfo; |
| 75 - (void)setCallback:(RTCVideoEncoderCallback)callback; |
| 76 - (void)initEncodeWithSettings:(RTCVideoEncoderSettings *)settings |
| 77 callback:(__nullable RTCVideoEncoderCallback)callback; |
| 78 - (void)releaseEncode; |
| 79 - (void)encode:(RTCVideoFrame *)frame |
| 80 codecSpecificInfo:(id<RTCCodecSpecificInfo>)info |
| 81 frameTypes:(NSArray<NSNumber *> *)frameTypes; |
| 82 - (BOOL)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate; |
| 83 |
| 84 @end |
| 85 |
| 86 // Protocol for decoder implementations |
| 87 RTC_EXPORT |
| 88 @protocol RTCVideoDecoder <NSObject> |
| 89 |
| 90 - (void)setCallback:(RTCVideoDecoderCallback)callback; |
| 91 - (int)initDecodeWithSettings:(RTCVideoEncoderSettings *)settings numberOfCores:
(int)numberOfCores; |
| 92 - (int32_t)releaseDecode; |
| 93 - (int)decode:(RTCEncodedImage *)encodedImage |
| 94 missingFrames:(BOOL)missingFrames |
| 95 fragmentationHeader:(RTCRtpFragmentationHeader *)fragmentationHeader |
| 96 codecSpecificInfo:(__nullable id<RTCCodecSpecificInfo>)info |
| 97 renderTimeMs:(int64_t)renderTimeMs; |
| 98 |
| 99 @end |
| 100 |
| 101 NS_ASSUME_NONNULL_END |
OLD | NEW |