| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chromecast/common/media/cast_media_client.h" | |
| 6 | |
| 7 #include "chromecast/media/base/media_codec_support.h" | |
| 8 #include "chromecast/media/base/supported_codec_profile_levels_memo.h" | |
| 9 #include "chromecast/public/media/media_capabilities_shlib.h" | |
| 10 | |
| 11 // TODO(servolk): Is there a better way to override just IsSupportedVideoConfig | |
| 12 // without duplicating content::RenderMediaClient implementation? | |
| 13 // For now use this to allow access to the ::media::GetMediaClient. | |
| 14 namespace media { | |
| 15 MEDIA_EXPORT MediaClient* GetMediaClient(); | |
| 16 } | |
| 17 | |
| 18 namespace chromecast { | |
| 19 namespace media { | |
| 20 | |
| 21 void CastMediaClient::Initialize( | |
| 22 SupportedCodecProfileLevelsMemo* supported_profiles) { | |
| 23 ::media::SetMediaClient( | |
| 24 new CastMediaClient(::media::GetMediaClient(), supported_profiles)); | |
| 25 } | |
| 26 | |
| 27 CastMediaClient::CastMediaClient( | |
| 28 ::media::MediaClient* content_media_client, | |
| 29 SupportedCodecProfileLevelsMemo* supported_profiles) { | |
| 30 // Ensure that CastMediaClient gets initialized after the | |
| 31 // content::RenderMediaClient. | |
| 32 DCHECK(content_media_client); | |
| 33 content_media_client_ = content_media_client; | |
| 34 supported_profiles_ = supported_profiles; | |
| 35 } | |
| 36 | |
| 37 CastMediaClient::~CastMediaClient() {} | |
| 38 | |
| 39 void CastMediaClient::AddKeySystemsInfoForUMA( | |
| 40 std::vector<::media::KeySystemInfoForUMA>* key_systems_info_for_uma) { | |
| 41 content_media_client_->AddKeySystemsInfoForUMA(key_systems_info_for_uma); | |
| 42 } | |
| 43 | |
| 44 bool CastMediaClient::IsKeySystemsUpdateNeeded() { | |
| 45 return content_media_client_->IsKeySystemsUpdateNeeded(); | |
| 46 } | |
| 47 | |
| 48 void CastMediaClient::AddSupportedKeySystems( | |
| 49 std::vector<std::unique_ptr<::media::KeySystemProperties>>* | |
| 50 key_systems_properties) { | |
| 51 content_media_client_->AddSupportedKeySystems(key_systems_properties); | |
| 52 } | |
| 53 | |
| 54 void CastMediaClient::RecordRapporURL(const std::string& metric, | |
| 55 const GURL& url) { | |
| 56 content_media_client_->RecordRapporURL(metric, url); | |
| 57 } | |
| 58 | |
| 59 // static | |
| 60 bool CastMediaClient::IsSupportedVideoConfig( | |
| 61 const ::media::VideoConfig& config) { | |
| 62 // TODO(servolk): make use of eotf. | |
| 63 #if defined(OS_ANDROID) | |
| 64 return supported_profiles_->IsSupportedVideoConfig( | |
| 65 ToCastVideoCodec(config.codec, config.profile), | |
| 66 ToCastVideoProfile(config.profile), config.level); | |
| 67 #else | |
| 68 return MediaCapabilitiesShlib::IsSupportedVideoConfig( | |
| 69 ToCastVideoCodec(config.codec, config.profile), | |
| 70 ToCastVideoProfile(config.profile), config.level); | |
| 71 #endif | |
| 72 } | |
| 73 | |
| 74 } // namespace media | |
| 75 } // namespace chromecast | |
| OLD | NEW |