OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // usual. | 54 // usual. |
55 return true; | 55 return true; |
56 } | 56 } |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 ::media::IsCodecSupportedCB GetIsCodecSupportedOnChromecastCB() { | 60 ::media::IsCodecSupportedCB GetIsCodecSupportedOnChromecastCB() { |
61 return base::Bind(&IsCodecSupported); | 61 return base::Bind(&IsCodecSupported); |
62 } | 62 } |
63 | 63 |
| 64 AudioCodec ToCastAudioCodec(const ::media::AudioCodec codec) { |
| 65 switch (codec) { |
| 66 case ::media::kCodecAAC: |
| 67 return kCodecAAC; |
| 68 case ::media::kCodecMP3: |
| 69 return kCodecMP3; |
| 70 case ::media::kCodecPCM: |
| 71 return kCodecPCM; |
| 72 case ::media::kCodecPCM_S16BE: |
| 73 return kCodecPCM_S16BE; |
| 74 case ::media::kCodecVorbis: |
| 75 return kCodecVorbis; |
| 76 case ::media::kCodecOpus: |
| 77 return kCodecOpus; |
| 78 case ::media::kCodecEAC3: |
| 79 return kCodecEAC3; |
| 80 case ::media::kCodecAC3: |
| 81 return kCodecAC3; |
| 82 case ::media::kCodecFLAC: |
| 83 return kCodecFLAC; |
| 84 default: |
| 85 LOG(ERROR) << "Unsupported audio codec " << codec; |
| 86 } |
| 87 return kAudioCodecUnknown; |
| 88 } |
| 89 |
64 VideoCodec ToCastVideoCodec(const ::media::VideoCodec video_codec, | 90 VideoCodec ToCastVideoCodec(const ::media::VideoCodec video_codec, |
65 const ::media::VideoCodecProfile codec_profile) { | 91 const ::media::VideoCodecProfile codec_profile) { |
66 switch (video_codec) { | 92 switch (video_codec) { |
67 case ::media::kCodecH264: | 93 case ::media::kCodecH264: |
68 return kCodecH264; | 94 return kCodecH264; |
69 case ::media::kCodecVP8: | 95 case ::media::kCodecVP8: |
70 return kCodecVP8; | 96 return kCodecVP8; |
71 case ::media::kCodecVP9: | 97 case ::media::kCodecVP9: |
72 return kCodecVP9; | 98 return kCodecVP9; |
73 case ::media::kCodecHEVC: | 99 case ::media::kCodecHEVC: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 CodecProfileLevel result; | 174 CodecProfileLevel result; |
149 result.codec = | 175 result.codec = |
150 ToCastVideoCodec(codec_profile_level.codec, codec_profile_level.profile); | 176 ToCastVideoCodec(codec_profile_level.codec, codec_profile_level.profile); |
151 result.profile = ToCastVideoProfile(codec_profile_level.profile); | 177 result.profile = ToCastVideoProfile(codec_profile_level.profile); |
152 result.level = codec_profile_level.level; | 178 result.level = codec_profile_level.level; |
153 return result; | 179 return result; |
154 } | 180 } |
155 | 181 |
156 } // namespace media | 182 } // namespace media |
157 } // namespace chromecast | 183 } // namespace chromecast |
OLD | NEW |