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 |
| 41 @property(nonatomic, assign) unsigned short width; |
| 42 @property(nonatomic, assign) unsigned short height; |
| 43 |
| 44 @property(nonatomic, assign) unsigned int startBitrate; // kilobits/sec. |
| 45 @property(nonatomic, assign) unsigned int maxBitrate; |
| 46 @property(nonatomic, assign) unsigned int minBitrate; |
| 47 @property(nonatomic, assign) unsigned int targetBitrate; |
| 48 |
| 49 @property(nonatomic, assign) uint32_t maxFramerate; |
| 50 |
| 51 @property(nonatomic, assign) unsigned int qpMax; |
| 52 |
| 53 @end |
| 54 |
| 55 // Holds information to identify a codec |
| 56 RTC_EXPORT |
| 57 @interface RTCVideoCodecInfo : NSObject |
| 58 |
| 59 - (instancetype)initWithPayload:(int)payload |
| 60 name:(NSString *)name |
| 61 parameters:(NSDictionary<NSString *, NSString *> *)paramete
rs; |
| 62 |
| 63 @property(nonatomic, readonly) int payload; |
| 64 @property(nonatomic, readonly) NSString *name; |
| 65 @property(nonatomic, readonly) NSDictionary<NSString *, NSString *> *parameters; |
| 66 |
| 67 @end |
| 68 |
| 69 // Protocol for encoder implementations |
| 70 RTC_EXPORT |
| 71 @protocol RTCVideoEncoder <NSObject> |
| 72 |
| 73 - (instancetype)initWithCodecInfo:(RTCVideoCodecInfo *)codecInfo; |
| 74 - (void)setCallback:(RTCVideoEncoderCallback)callback; |
| 75 - (void)initEncodeWithSettings:(RTCVideoEncoderSettings *)settings numberOfCores
:(int)numberOfCores; |
| 76 - (void)releaseEncode; |
| 77 - (void)encode:(RTCVideoFrame *)frame |
| 78 codecSpecificInfo:(id<RTCCodecSpecificInfo>)info |
| 79 frameTypes:(NSArray<NSNumber *> *)frameTypes; |
| 80 - (BOOL)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate; |
| 81 |
| 82 @end |
| 83 |
| 84 // Protocol for decoder implementations |
| 85 RTC_EXPORT |
| 86 @protocol RTCVideoDecoder <NSObject> |
| 87 |
| 88 - (void)setCallback:(RTCVideoDecoderCallback)callback; |
| 89 - (int)initDecodeWithSettings:(RTCVideoEncoderSettings *)settings numberOfCores:
(int)numberOfCores; |
| 90 - (int32_t)releaseDecode; |
| 91 - (int)decode:(RTCEncodedImage *)encodedImage |
| 92 missingFrames:(BOOL)missingFrames |
| 93 fragmentationHeader:(RTCRtpFragmentationHeader *)fragmentationHeader |
| 94 codecSpecificInfo:(__nullable id<RTCCodecSpecificInfo>)info |
| 95 renderTimeMs:(int64_t)renderTimeMs; |
| 96 |
| 97 @end |
| 98 |
| 99 NS_ASSUME_NONNULL_END |
OLD | NEW |