blob: bdb18517caf98a7be0cf9eebf0479269dd2f1b40 [file] [log] [blame]
Anders Carlsson7e042812017-10-05 16:55:38 +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
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020011#import "RTCDefaultVideoDecoderFactory.h"
Anders Carlsson7e042812017-10-05 16:55:38 +020012
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020013#import "RTCH264ProfileLevelId.h"
14#import "RTCVideoDecoderH264.h"
15#import "api/video_codec/RTCVideoCodecConstants.h"
16#import "api/video_codec/RTCVideoDecoderVP8.h"
17#import "base/RTCVideoCodecInfo.h"
Mirko Bonadei8ef57932018-11-16 14:38:03 +010018#if defined(RTC_ENABLE_VP9)
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020019#import "api/video_codec/RTCVideoDecoderVP9.h"
Anders Carlssondd8c1652018-01-30 10:32:13 +010020#endif
Anders Carlsson7e042812017-10-05 16:55:38 +020021
Anders Carlsson1d4c1522017-10-30 13:07:07 +010022@implementation RTCDefaultVideoDecoderFactory
Anders Carlsson7e042812017-10-05 16:55:38 +020023
24- (id<RTCVideoDecoder>)createDecoder:(RTCVideoCodecInfo *)info {
Anders Carlsson1d4c1522017-10-30 13:07:07 +010025 if ([info.name isEqualToString:kRTCVideoCodecH264Name]) {
Anders Carlsson7e042812017-10-05 16:55:38 +020026 return [[RTCVideoDecoderH264 alloc] init];
Anders Carlsson1d4c1522017-10-30 13:07:07 +010027 } else if ([info.name isEqualToString:kRTCVideoCodecVp8Name]) {
Anders Carlsson7e042812017-10-05 16:55:38 +020028 return [RTCVideoDecoderVP8 vp8Decoder];
Mirko Bonadei8ef57932018-11-16 14:38:03 +010029#if defined(RTC_ENABLE_VP9)
Anders Carlsson1d4c1522017-10-30 13:07:07 +010030 } else if ([info.name isEqualToString:kRTCVideoCodecVp9Name]) {
Anders Carlsson7e042812017-10-05 16:55:38 +020031 return [RTCVideoDecoderVP9 vp9Decoder];
Kári Tristan Helgason9555e672017-12-01 14:27:07 +010032#endif
Anders Carlsson7e042812017-10-05 16:55:38 +020033 }
34
35 return nil;
36}
37
38- (NSArray<RTCVideoCodecInfo *> *)supportedCodecs {
39 return @[
Anders Carlsson1d4c1522017-10-30 13:07:07 +010040 [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH264Name],
41 [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp8Name],
Mirko Bonadei8ef57932018-11-16 14:38:03 +010042#if defined(RTC_ENABLE_VP9)
Anders Carlssondd8c1652018-01-30 10:32:13 +010043 [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name],
44#endif
Anders Carlsson7e042812017-10-05 16:55:38 +020045 ];
46}
47
48@end