Anders Carlsson a0349c138d Injectable Obj-C video codecs
Initial CL for this effort, with a working RTCVideoEncoder/Decoder for H264
(wrapping the VideoToolbox codec).

Some notes / things left to do:
  - There are some hard-coded references to codec types that are supported by
    webrtc::VideoCodec, cricket::VideoCodec, webrtc::CodecSpecificInfo etc
    since we need to convert to/from these types in ObjCVideoEncoder/Decoder.
    These types would need to be more codec agnostic to avoid this.
  - Most interfaces are borrowed from the design document for injectable
    codecs in Android. Some data in the corresponding C++ classes is discarded
    when converting to the Obj-C version, since it has fewer fields. I have not
    verified whether all data that we do keep is needed, or whether we might be
    losing anything useful in these conversions.
  - Implement the VideoToolbox codec code directly in the RTCVideoEncoderH264
    classes, instead of wrapping webrtc::H264VideoToolboxEncoder / decoder.
    Eliminates converting between ObjC/C++ types outside the ObjCVideoEncoder/
    Decoder wrapper classes.
  - List the injected codec factory's supported codecs in the list of codecs in
    AppRTCMobile.

BUG=webrtc:7924
R=magjed@webrtc.org

Review-Url: https://codereview.webrtc.org/2966023002 .
Cr-Commit-Position: refs/heads/master@{#18928}
2017-07-07 11:19:14 +00:00

48 lines
1.3 KiB
Objective-C

/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#import <Foundation/Foundation.h>
#import <WebRTC/RTCMacros.h>
#import <WebRTC/RTCVideoCodecFactory.h>
/** Class for H264 specific config. */
typedef NS_ENUM(NSUInteger, RTCH264PacketizationMode) {
NonInterleaved = 0, // Mode 1 - STAP-A, FU-A is allowed
SingleNalUnit // Mode 0 - only single NALU allowed
};
RTC_EXPORT
@interface RTCCodecSpecificInfoH264 : NSObject<RTCCodecSpecificInfo>
@property(nonatomic, assign) RTCH264PacketizationMode packetizationMode;
@end
/** Encoder. */
RTC_EXPORT
@interface RTCVideoEncoderH264 : NSObject<RTCVideoEncoder>
@end
/** Decoder. */
RTC_EXPORT
@interface RTCVideoDecoderH264 : NSObject<RTCVideoDecoder>
@end
/** Encoder factory. */
RTC_EXPORT
@interface RTCVideoEncoderFactoryH264 : NSObject<RTCVideoEncoderFactory>
@end
/** Decoder factory. */
RTC_EXPORT
@interface RTCVideoDecoderFactoryH264 : NSObject<RTCVideoDecoderFactory>
@end