Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 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 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 11 | #import "RTCDefaultVideoDecoderFactory.h" |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 12 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 13 | #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 Bonadei | 8ef5793 | 2018-11-16 14:38:03 +0100 | [diff] [blame] | 18 | #if defined(RTC_ENABLE_VP9) |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 19 | #import "api/video_codec/RTCVideoDecoderVP9.h" |
Anders Carlsson | dd8c165 | 2018-01-30 10:32:13 +0100 | [diff] [blame] | 20 | #endif |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 21 | |
Anders Carlsson | 1d4c152 | 2017-10-30 13:07:07 +0100 | [diff] [blame] | 22 | @implementation RTCDefaultVideoDecoderFactory |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 23 | |
| 24 | - (id<RTCVideoDecoder>)createDecoder:(RTCVideoCodecInfo *)info { |
Anders Carlsson | 1d4c152 | 2017-10-30 13:07:07 +0100 | [diff] [blame] | 25 | if ([info.name isEqualToString:kRTCVideoCodecH264Name]) { |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 26 | return [[RTCVideoDecoderH264 alloc] init]; |
Anders Carlsson | 1d4c152 | 2017-10-30 13:07:07 +0100 | [diff] [blame] | 27 | } else if ([info.name isEqualToString:kRTCVideoCodecVp8Name]) { |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 28 | return [RTCVideoDecoderVP8 vp8Decoder]; |
Mirko Bonadei | 8ef5793 | 2018-11-16 14:38:03 +0100 | [diff] [blame] | 29 | #if defined(RTC_ENABLE_VP9) |
Anders Carlsson | 1d4c152 | 2017-10-30 13:07:07 +0100 | [diff] [blame] | 30 | } else if ([info.name isEqualToString:kRTCVideoCodecVp9Name]) { |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 31 | return [RTCVideoDecoderVP9 vp9Decoder]; |
Kári Tristan Helgason | 9555e67 | 2017-12-01 14:27:07 +0100 | [diff] [blame] | 32 | #endif |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | return nil; |
| 36 | } |
| 37 | |
| 38 | - (NSArray<RTCVideoCodecInfo *> *)supportedCodecs { |
| 39 | return @[ |
Anders Carlsson | 1d4c152 | 2017-10-30 13:07:07 +0100 | [diff] [blame] | 40 | [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH264Name], |
| 41 | [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp8Name], |
Mirko Bonadei | 8ef5793 | 2018-11-16 14:38:03 +0100 | [diff] [blame] | 42 | #if defined(RTC_ENABLE_VP9) |
Anders Carlsson | dd8c165 | 2018-01-30 10:32:13 +0100 | [diff] [blame] | 43 | [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name], |
| 44 | #endif |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 45 | ]; |
| 46 | } |
| 47 | |
| 48 | @end |