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 // TODO(gunsch/servolk): delete this file once a solution exists upstream. | 7 #include "base/bind.h" |
| 8 #include "chromecast/media/base/media_caps.h" |
| 9 #include "chromecast/public/media_codec_support_shlib.h" |
| 10 #include "net/base/mime_util.h" |
8 | 11 |
| 12 // TODO(gunsch/servolk): delete this definition once a solution exists upstream. |
9 namespace net { | 13 namespace net { |
10 | |
11 bool DefaultIsCodecSupported(const std::string&) { | 14 bool DefaultIsCodecSupported(const std::string&) { |
12 return true; | 15 return true; |
13 } | 16 } |
| 17 } |
14 | 18 |
15 } // namespace net | 19 namespace chromecast { |
| 20 namespace media { |
| 21 namespace { |
16 | 22 |
| 23 bool IsCodecSupported(const std::string& codec) { |
| 24 MediaCodecSupportShlib::CodecSupport platform_support = |
| 25 MediaCodecSupportShlib::IsSupported(codec); |
| 26 if (platform_support == MediaCodecSupportShlib::kSupported) |
| 27 return true; |
| 28 else if (platform_support == MediaCodecSupportShlib::kNotSupported) |
| 29 return false; |
| 30 |
| 31 if (codec == "aac51") { |
| 32 return ::media::HdmiSinkSupportsPcmSurroundSound(); |
| 33 } |
| 34 if (codec == "ac-3" || codec == "mp4a.a5") { |
| 35 return ::media::HdmiSinkSupportsAC3(); |
| 36 } |
| 37 if (codec == "ec-3" || codec == "mp4a.a6") { |
| 38 return ::media::HdmiSinkSupportsEAC3(); |
| 39 } |
| 40 |
| 41 return net::DefaultIsCodecSupported(codec); |
| 42 } |
| 43 |
| 44 } // namespace |
| 45 |
| 46 net::IsCodecSupportedCB GetIsCodecSupportedOnChromecastCB() { |
| 47 return base::Bind(&IsCodecSupported); |
| 48 } |
| 49 |
| 50 } // namespace media |
| 51 } // namespace chromecast |
OLD | NEW |