Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: chromecast/media/base/media_codec_support.cc

Issue 2640113004: Introduce Dolby Vision video codec and Demuxer support (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/media/base/media_codec_support.h" 5 #include "chromecast/media/base/media_codec_support.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "chromecast/media/base/media_caps.h" 9 #include "chromecast/media/base/media_caps.h"
10 #include "chromecast/public/media_codec_support_shlib.h" 10 #include "chromecast/public/media_codec_support_shlib.h"
(...skipping 17 matching lines...) Expand all
28 28
29 if (codec == "aac51") { 29 if (codec == "aac51") {
30 return MediaCapabilities::HdmiSinkSupportsPcmSurroundSound(); 30 return MediaCapabilities::HdmiSinkSupportsPcmSurroundSound();
31 } 31 }
32 if (codec == "ac-3" || codec == "mp4a.a5" || codec == "mp4a.A5") { 32 if (codec == "ac-3" || codec == "mp4a.a5" || codec == "mp4a.A5") {
33 return MediaCapabilities::HdmiSinkSupportsAC3(); 33 return MediaCapabilities::HdmiSinkSupportsAC3();
34 } 34 }
35 if (codec == "ec-3" || codec == "mp4a.a6" || codec == "mp4a.A6") { 35 if (codec == "ec-3" || codec == "mp4a.a6" || codec == "mp4a.A6") {
36 return MediaCapabilities::HdmiSinkSupportsEAC3(); 36 return MediaCapabilities::HdmiSinkSupportsEAC3();
37 } 37 }
38 // Shared library should return kDefault if the platform depends on sink
wolenetz 2017/01/24 21:52:23 Is kDefault a bool? Or am I confused by this comme
erickung1 2017/02/03 18:18:30 Done.
39 // device capability to stream Dolby Vision.
40 if (base::StartsWith(codec, "dvav.", base::CompareCase::SENSITIVE) ||
41 base::StartsWith(codec, "dvhe.", base::CompareCase::SENSITIVE)) {
42 return MediaCapabilities::HdmiSinkSupportsDolbyVision();
43 }
38 44
39 // This function is invoked from MimeUtil::AreSupportedCodecs to check if a 45 // This function is invoked from MimeUtil::AreSupportedCodecs to check if a
40 // given codec id is supported by Chromecast or not. So by default we should 46 // given codec id is supported by Chromecast or not. So by default we should
41 // return true by default to indicate we have no reasons to believe this codec 47 // return true by default to indicate we have no reasons to believe this codec
42 // is unsupported. This will allow the rest of MimeUtil checks to proceed as 48 // is unsupported. This will allow the rest of MimeUtil checks to proceed as
43 // usual. 49 // usual.
44 return true; 50 return true;
45 } 51 }
46 52
47 } // namespace 53 } // namespace
48 54
49 ::media::IsCodecSupportedCB GetIsCodecSupportedOnChromecastCB() { 55 ::media::IsCodecSupportedCB GetIsCodecSupportedOnChromecastCB() {
50 return base::Bind(&IsCodecSupported); 56 return base::Bind(&IsCodecSupported);
51 } 57 }
52 58
53 // Converts ::media::VideoCodec to chromecast::media::VideoCodec. Any unknown or 59 // Converts ::media::VideoCodec to chromecast::media::VideoCodec. Any unknown or
wolenetz 2017/01/24 21:52:24 comments like this belong in .h instead of .cc Als
erickung1 2017/02/03 18:18:30 Done.
54 // unsupported codec will be converted to chromecast::media::kCodecUnknown. 60 // unsupported codec will be converted to chromecast::media::kCodecUnknown.
55 VideoCodec ToCastVideoCodec(const ::media::VideoCodec video_codec) { 61 VideoCodec ToCastVideoCodec(const ::media::VideoCodec video_codec,
62 const ::media::VideoCodecProfile codec_profile) {
56 switch (video_codec) { 63 switch (video_codec) {
57 case ::media::kCodecH264: 64 case ::media::kCodecH264:
58 return kCodecH264; 65 return kCodecH264;
59 case ::media::kCodecVP8: 66 case ::media::kCodecVP8:
60 return kCodecVP8; 67 return kCodecVP8;
61 case ::media::kCodecVP9: 68 case ::media::kCodecVP9:
62 return kCodecVP9; 69 return kCodecVP9;
63 case ::media::kCodecHEVC: 70 case ::media::kCodecHEVC:
64 return kCodecHEVC; 71 return kCodecHEVC;
72 case ::media::kCodecDolbyVision:
73 if (codec_profile == ::media::DOLBYVISION_PROFILE0)
wolenetz 2017/01/24 21:52:24 I'm unfamiliar with DV profiles, but compared to p
erickung1 2017/02/03 18:18:30 Yes, for the latest DV spec from Dolby, profile 1
74 return kCodecDolbyVisionH264;
75 else if (codec_profile == ::media::DOLBYVISION_PROFILE4 ||
wolenetz 2017/01/24 21:52:24 Ditto: is omission of check for DV profiles 3 and
erickung1 2017/02/03 18:18:31 ditto, the profile 3 and 6 will deprecated.
76 codec_profile == ::media::DOLBYVISION_PROFILE5 ||
77 codec_profile == ::media::DOLBYVISION_PROFILE7)
halliwell 2017/01/20 02:05:04 nit, prefer braces { } for multi-line conditions
wolenetz 2017/01/24 21:52:23 Chromium definitely needs { } here.
erickung1 2017/02/03 18:18:31 Done.
78 return kCodecDolbyVisionHEVC;
79 LOG(ERROR) << "Unsupported video codec profile " << codec_profile;
80 break;
65 default: 81 default:
66 LOG(ERROR) << "Unsupported video codec " << video_codec; 82 LOG(ERROR) << "Unsupported video codec " << video_codec;
67 } 83 }
68 return kVideoCodecUnknown; 84 return kVideoCodecUnknown;
69 } 85 }
70 86
71 // Converts ::media::VideoCodecProfile to chromecast::media::VideoProfile. 87 // Converts ::media::VideoCodecProfile to chromecast::media::VideoProfile.
wolenetz 2017/01/24 21:52:24 nit ditto: move comment to .h
erickung1 2017/02/03 18:18:30 Done.
72 VideoProfile ToCastVideoProfile( 88 VideoProfile ToCastVideoProfile(
73 const ::media::VideoCodecProfile codec_profile) { 89 const ::media::VideoCodecProfile codec_profile) {
74 switch (codec_profile) { 90 switch (codec_profile) {
75 case ::media::H264PROFILE_BASELINE: 91 case ::media::H264PROFILE_BASELINE:
76 return kH264Baseline; 92 return kH264Baseline;
77 case ::media::H264PROFILE_MAIN: 93 case ::media::H264PROFILE_MAIN:
78 return kH264Main; 94 return kH264Main;
79 case ::media::H264PROFILE_EXTENDED: 95 case ::media::H264PROFILE_EXTENDED:
80 return kH264Extended; 96 return kH264Extended;
81 case ::media::H264PROFILE_HIGH: 97 case ::media::H264PROFILE_HIGH:
(...skipping 21 matching lines...) Expand all
103 case ::media::VP8PROFILE_ANY: 119 case ::media::VP8PROFILE_ANY:
104 return kVP8ProfileAny; 120 return kVP8ProfileAny;
105 case ::media::VP9PROFILE_PROFILE0: 121 case ::media::VP9PROFILE_PROFILE0:
106 return kVP9Profile0; 122 return kVP9Profile0;
107 case ::media::VP9PROFILE_PROFILE1: 123 case ::media::VP9PROFILE_PROFILE1:
108 return kVP9Profile1; 124 return kVP9Profile1;
109 case ::media::VP9PROFILE_PROFILE2: 125 case ::media::VP9PROFILE_PROFILE2:
110 return kVP9Profile2; 126 return kVP9Profile2;
111 case ::media::VP9PROFILE_PROFILE3: 127 case ::media::VP9PROFILE_PROFILE3:
112 return kVP9Profile3; 128 return kVP9Profile3;
129 case ::media::DOLBYVISION_PROFILE0:
wolenetz 2017/01/24 21:52:24 (Ditto of above query about intentionality of omis
erickung1 2017/02/03 18:18:30 as mentioned above, profile 1 2 3 and 6 are deprec
130 return kDolbyVisionCompatible_EL_MD;
131 case ::media::DOLBYVISION_PROFILE4:
132 return kDolbyVisionCompatible_EL_MD;
133 case ::media::DOLBYVISION_PROFILE5:
134 return kDolbyVisionNonCompatible_BL_MD;
135 case ::media::DOLBYVISION_PROFILE7:
136 return kDolbyVisionNonCompatible_BL_EL_MD;
113 default: 137 default:
114 LOG(INFO) << "Unsupported video codec profile " << codec_profile; 138 LOG(INFO) << "Unsupported video codec profile " << codec_profile;
115 } 139 }
116 return kVideoProfileUnknown; 140 return kVideoProfileUnknown;
117 } 141 }
118 142
119 } // namespace media 143 } // namespace media
120 } // namespace chromecast 144 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698