blob: 95233ec4ba487ebdfcbf7ef02909037f8b4db50e [file] [log] [blame]
kthelgasonfb143122017-07-25 07:55:58 -07001/*
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;
magjed73c0eb52017-08-07 06:55:28 -070028@synthesize mode = _mode;
kthelgasonfb143122017-07-25 07:55:58 -070029
magjed8eab09c2017-07-31 02:56:35 -070030- (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *)videoCodec {
kthelgasonfb143122017-07-25 07:55:58 -070031 if (self = [super init]) {
32 if (videoCodec) {
kthelgason1cdddc92017-08-24 03:52:48 -070033 const char *codecName = CodecTypeToPayloadString(videoCodec->codecType);
34 _name = [NSString stringWithUTF8String:codecName];
kthelgasonfb143122017-07-25 07:55:58 -070035
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;
magjed73c0eb52017-08-07 06:55:28 -070044 _mode = (RTCVideoCodecMode)videoCodec->mode;
kthelgasonfb143122017-07-25 07:55:58 -070045 }
46 }
47
48 return self;
49}
50
Anders Carlsson7e042812017-10-05 16:55:38 +020051- (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
kthelgasonfb143122017-07-25 07:55:58 -070066@end