Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: webrtc/sdk/objc/Framework/Headers/WebRTC/RTCVideoCodec.h

Issue 2977213002: Reland of Injectable Obj-C video codecs (Closed)
Patch Set: Add checks to make sure destroy is called Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
13 #import <WebRTC/RTCMacros.h>
14
15 @class RTCVideoFrame;
16
17 NS_ASSUME_NONNULL_BEGIN
18
19 /** Represents an encoded frame's type. */
20 typedef NS_ENUM(NSUInteger, RTCFrameType) {
21 RTCFrameTypeEmptyFrame,
22 RTCFrameTypeVideoFrameKey,
23 RTCFrameTypeVideoFrameDelta,
24 };
25
26 /** Represents an encoded frame. Corresponds to webrtc::EncodedImage. */
27 RTC_EXPORT
28 @interface RTCEncodedImage : NSObject
29
30 @property(nonatomic, strong) NSData *buffer;
31 @property(nonatomic, assign) int encodedWidth;
32 @property(nonatomic, assign) int encodedHeight;
33 @property(nonatomic, assign) uint32_t timeStamp;
34 @property(nonatomic, assign) long captureTimeMs;
35 @property(nonatomic, assign) long ntpTimeMs;
36 @property(nonatomic, assign) BOOL isTimingFrame;
37 @property(nonatomic, assign) long encodeStartMs;
38 @property(nonatomic, assign) long encodeFinishMs;
39 @property(nonatomic, assign) RTCFrameType frameType;
40 @property(nonatomic, assign) int rotation;
41 @property(nonatomic, assign) BOOL completeFrame;
42 @property(nonatomic, retain) NSNumber *qp;
Chuck 2017/07/21 15:59:48 strong instead of retain
43
44 @end
45
46 /** Information for header. Corresponds to webrtc::RTPFragmentationHeader. */
47 RTC_EXPORT
48 @interface RTCRtpFragmentationHeader : NSObject
49
50 @property(nonatomic, strong) NSArray<NSNumber *> *fragmentationOffset;
51 @property(nonatomic, strong) NSArray<NSNumber *> *fragmentationLength;
52 @property(nonatomic, strong) NSArray<NSNumber *> *fragmentationTimeDiff;
53 @property(nonatomic, strong) NSArray<NSNumber *> *fragmentationPlType;
54
55 @end
56
57 /** Implement this protocol to pass codec specific info from the encoder.
58 * Corresponds to webrtc::CodecSpecificInfo.
59 */
60 RTC_EXPORT
61 @protocol RTCCodecSpecificInfo <NSObject>
62
63 @end
64
65 /** Callback block for encoder. */
66 typedef void (^RTCVideoEncoderCallback)(RTCEncodedImage *frame,
67 id<RTCCodecSpecificInfo> info,
68 RTCRtpFragmentationHeader *header);
69
70 /** Callback block for decoder. */
71 typedef void (^RTCVideoDecoderCallback)(RTCVideoFrame *frame);
72
73 /** Holds information to identify a codec. Corresponds to cricket::VideoCodec. * /
74 RTC_EXPORT
75 @interface RTCVideoCodecInfo : NSObject
76
77 - (instancetype)initWithPayload:(NSInteger)payload
78 name:(NSString *)name
79 parameters:(NSDictionary<NSString *, NSString *> *)paramete rs;
80
81 @property(nonatomic, readonly) NSInteger payload;
82 @property(nonatomic, readonly) NSString *name;
83 @property(nonatomic, readonly) NSDictionary<NSString *, NSString *> *parameters;
84
85 @end
86
87 /** Settings for encoder. Corresponds to webrtc::VideoCodec. */
88 RTC_EXPORT
89 @interface RTCVideoEncoderSettings : NSObject
90
91 @property(nonatomic, retain) NSString *name;
Chuck 2017/07/21 15:59:48 strong instead of retain
92
93 @property(nonatomic, assign) unsigned short width;
94 @property(nonatomic, assign) unsigned short height;
95
96 @property(nonatomic, assign) unsigned int startBitrate; // kilobits/sec.
97 @property(nonatomic, assign) unsigned int maxBitrate;
98 @property(nonatomic, assign) unsigned int minBitrate;
99 @property(nonatomic, assign) unsigned int targetBitrate;
100
101 @property(nonatomic, assign) uint32_t maxFramerate;
102
103 @property(nonatomic, assign) unsigned int qpMax;
104
105 @end
106
107 /** Protocol for encoder implementations. */
108 RTC_EXPORT
109 @protocol RTCVideoEncoder <NSObject>
110
111 - (void)setCallback:(RTCVideoEncoderCallback)callback;
112 - (NSInteger)startEncodeWithSettings:(RTCVideoEncoderSettings *)settings
113 numberOfCores:(int)numberOfCores;
114 - (NSInteger)releaseEncoder;
115 - (void)destroy;
116 - (NSInteger)encode:(RTCVideoFrame *)frame
117 codecSpecificInfo:(id<RTCCodecSpecificInfo>)info
118 frameTypes:(NSArray<NSNumber *> *)frameTypes;
119 - (BOOL)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate;
120
121 @end
122
123 /** Protocol for decoder implementations. */
124 RTC_EXPORT
125 @protocol RTCVideoDecoder <NSObject>
126
127 - (void)setCallback:(RTCVideoDecoderCallback)callback;
128 - (NSInteger)startDecodeWithSettings:(RTCVideoEncoderSettings *)settings
129 numberOfCores:(int)numberOfCores;
130 - (NSInteger)releaseDecoder;
131 - (void)destroy;
132 - (NSInteger)decode:(RTCEncodedImage *)encodedImage
133 missingFrames:(BOOL)missingFrames
134 fragmentationHeader:(RTCRtpFragmentationHeader *)fragmentationHeader
135 codecSpecificInfo:(__nullable id<RTCCodecSpecificInfo>)info
136 renderTimeMs:(int64_t)renderTimeMs;
137
138 @end
139
140 NS_ASSUME_NONNULL_END
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698