Anders Carlsson | 6bf43d2 | 2017-10-16 13:51:43 +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 | |
| 11 | #import "RTCVideoCodecInfo+HumanReadable.h" |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 12 | |
Mirko Bonadei | 19640aa | 2020-10-19 16:12:43 +0200 | [diff] [blame] | 13 | #import "sdk/objc/components/video_codec/RTCH264ProfileLevelId.h" |
Anders Carlsson | 6bf43d2 | 2017-10-16 13:51:43 +0200 | [diff] [blame] | 14 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 15 | @implementation RTC_OBJC_TYPE (RTCVideoCodecInfo) |
| 16 | (HumanReadable) |
Anders Carlsson | 6bf43d2 | 2017-10-16 13:51:43 +0200 | [diff] [blame] | 17 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 18 | - (NSString *)humanReadableDescription { |
Anders Carlsson | 6bf43d2 | 2017-10-16 13:51:43 +0200 | [diff] [blame] | 19 | if ([self.name isEqualToString:@"H264"]) { |
| 20 | NSString *profileId = self.parameters[@"profile-level-id"]; |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 21 | RTC_OBJC_TYPE(RTCH264ProfileLevelId) *profileLevelId = |
| 22 | [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc] initWithHexString:profileId]; |
Piasy Xu | 69b03e9 | 2018-08-28 00:44:51 +0800 | [diff] [blame] | 23 | if (profileLevelId.profile == RTCH264ProfileConstrainedHigh || |
| 24 | profileLevelId.profile == RTCH264ProfileHigh) { |
Anders Carlsson | 6bf43d2 | 2017-10-16 13:51:43 +0200 | [diff] [blame] | 25 | return @"H264 (High)"; |
Piasy Xu | 69b03e9 | 2018-08-28 00:44:51 +0800 | [diff] [blame] | 26 | } else if (profileLevelId.profile == RTCH264ProfileConstrainedBaseline || |
| 27 | profileLevelId.profile == RTCH264ProfileBaseline) { |
Anders Carlsson | 6bf43d2 | 2017-10-16 13:51:43 +0200 | [diff] [blame] | 28 | return @"H264 (Baseline)"; |
| 29 | } else { |
| 30 | return [NSString stringWithFormat:@"H264 (%@)", profileId]; |
| 31 | } |
| 32 | } else { |
| 33 | return self.name; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | @end |