kthelgason | fb14312 | 2017-07-25 07:55:58 -0700 | [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 | |
| 11 | #import "WebRTC/RTCVideoCodec.h" |
| 12 | |
| 13 | #import "NSString+StdString.h" |
| 14 | #import "RTCVideoCodec+Private.h" |
| 15 | #import "WebRTC/RTCVideoCodecFactory.h" |
| 16 | |
| 17 | @implementation RTCVideoEncoderSettings |
| 18 | |
| 19 | @synthesize name = _name; |
| 20 | @synthesize width = _width; |
| 21 | @synthesize height = _height; |
| 22 | @synthesize startBitrate = _startBitrate; |
| 23 | @synthesize maxBitrate = _maxBitrate; |
| 24 | @synthesize minBitrate = _minBitrate; |
| 25 | @synthesize targetBitrate = _targetBitrate; |
| 26 | @synthesize maxFramerate = _maxFramerate; |
| 27 | @synthesize qpMax = _qpMax; |
magjed | 73c0eb5 | 2017-08-07 06:55:28 -0700 | [diff] [blame] | 28 | @synthesize mode = _mode; |
kthelgason | fb14312 | 2017-07-25 07:55:58 -0700 | [diff] [blame] | 29 | |
magjed | 8eab09c | 2017-07-31 02:56:35 -0700 | [diff] [blame] | 30 | - (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *)videoCodec { |
kthelgason | fb14312 | 2017-07-25 07:55:58 -0700 | [diff] [blame] | 31 | if (self = [super init]) { |
| 32 | if (videoCodec) { |
kthelgason | 1cdddc9 | 2017-08-24 03:52:48 -0700 | [diff] [blame] | 33 | const char *codecName = CodecTypeToPayloadString(videoCodec->codecType); |
| 34 | _name = [NSString stringWithUTF8String:codecName]; |
kthelgason | fb14312 | 2017-07-25 07:55:58 -0700 | [diff] [blame] | 35 | |
| 36 | _width = videoCodec->width; |
| 37 | _height = videoCodec->height; |
| 38 | _startBitrate = videoCodec->startBitrate; |
| 39 | _maxBitrate = videoCodec->maxBitrate; |
| 40 | _minBitrate = videoCodec->minBitrate; |
| 41 | _targetBitrate = videoCodec->targetBitrate; |
| 42 | _maxFramerate = videoCodec->maxFramerate; |
| 43 | _qpMax = videoCodec->qpMax; |
magjed | 73c0eb5 | 2017-08-07 06:55:28 -0700 | [diff] [blame] | 44 | _mode = (RTCVideoCodecMode)videoCodec->mode; |
kthelgason | fb14312 | 2017-07-25 07:55:58 -0700 | [diff] [blame] | 45 | } |
| 46 | } |
| 47 | |
| 48 | return self; |
| 49 | } |
| 50 | |
Anders Carlsson | 7e04281 | 2017-10-05 16:55:38 +0200 | [diff] [blame^] | 51 | - (webrtc::VideoCodec)nativeVideoCodec { |
| 52 | webrtc::VideoCodec videoCodec; |
| 53 | videoCodec.width = _width; |
| 54 | videoCodec.height = _height; |
| 55 | videoCodec.startBitrate = _startBitrate; |
| 56 | videoCodec.maxBitrate = _maxBitrate; |
| 57 | videoCodec.minBitrate = _minBitrate; |
| 58 | videoCodec.targetBitrate = _targetBitrate; |
| 59 | videoCodec.maxBitrate = _maxBitrate; |
| 60 | videoCodec.qpMax = _qpMax; |
| 61 | videoCodec.mode = (webrtc::VideoCodecMode)_mode; |
| 62 | |
| 63 | return videoCodec; |
| 64 | } |
| 65 | |
kthelgason | fb14312 | 2017-07-25 07:55:58 -0700 | [diff] [blame] | 66 | @end |