Florent Castelli | abe301f | 2018-06-12 18:33:49 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2018 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 "RTCRtpHeaderExtension+Private.h" |
| 12 | |
| 13 | #import "NSString+StdString.h" |
| 14 | |
| 15 | @implementation RTCRtpHeaderExtension |
| 16 | |
| 17 | @synthesize uri = _uri; |
| 18 | @synthesize id = _id; |
| 19 | @synthesize encrypted = _encrypted; |
| 20 | |
| 21 | - (instancetype)init { |
| 22 | return [super init]; |
| 23 | } |
| 24 | |
| 25 | - (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters { |
| 26 | if (self = [self init]) { |
| 27 | _uri = [NSString stringForStdString:nativeParameters.uri]; |
| 28 | _id = nativeParameters.id; |
| 29 | _encrypted = nativeParameters.encrypt; |
| 30 | } |
| 31 | return self; |
| 32 | } |
| 33 | |
| 34 | - (webrtc::RtpExtension)nativeParameters { |
| 35 | webrtc::RtpExtension extension; |
| 36 | extension.uri = [NSString stdStringForString:_uri]; |
| 37 | extension.id = _id; |
| 38 | extension.encrypt = _encrypted; |
| 39 | return extension; |
| 40 | } |
| 41 | |
| 42 | @end |