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 | |
Oskar Sundbom | 4556f3c | 2017-10-26 11:55:45 +0000 | [diff] [blame] | 11 | #import "ARDVideoDecoderFactory.h" |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 12 | |
| 13 | #import "WebRTC/RTCVideoCodecH264.h" |
| 14 | #import "WebRTC/RTCVideoDecoderVP8.h" |
| 15 | #import "WebRTC/RTCVideoDecoderVP9.h" |
| 16 | |
Oskar Sundbom | 4556f3c | 2017-10-26 11:55:45 +0000 | [diff] [blame] | 17 | @implementation ARDVideoDecoderFactory |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 18 | |
| 19 | - (id<RTCVideoDecoder>)createDecoder:(RTCVideoCodecInfo *)info { |
Oskar Sundbom | 4556f3c | 2017-10-26 11:55:45 +0000 | [diff] [blame] | 20 | if ([info.name isEqualToString:@"H264"]) { |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 21 | return [[RTCVideoDecoderH264 alloc] init]; |
Oskar Sundbom | 4556f3c | 2017-10-26 11:55:45 +0000 | [diff] [blame] | 22 | } else if ([info.name isEqualToString:@"VP8"]) { |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 23 | return [RTCVideoDecoderVP8 vp8Decoder]; |
Oskar Sundbom | 4556f3c | 2017-10-26 11:55:45 +0000 | [diff] [blame] | 24 | } else if ([info.name isEqualToString:@"VP9"]) { |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 25 | return [RTCVideoDecoderVP9 vp9Decoder]; |
| 26 | } |
| 27 | |
| 28 | return nil; |
| 29 | } |
| 30 | |
| 31 | - (NSArray<RTCVideoCodecInfo *> *)supportedCodecs { |
| 32 | return @[ |
Oskar Sundbom | 4556f3c | 2017-10-26 11:55:45 +0000 | [diff] [blame] | 33 | [[RTCVideoCodecInfo alloc] initWithName:@"H264" parameters:nil], |
| 34 | [[RTCVideoCodecInfo alloc] initWithName:@"VP8" parameters:nil], |
| 35 | [[RTCVideoCodecInfo alloc] initWithName:@"VP9" parameters:nil] |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame] | 36 | ]; |
| 37 | } |
| 38 | |
| 39 | @end |