key_systems_common.cc revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
1// Copyright 2014 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/media/base/key_systems_common.h" 6 7#include <cstddef> 8 9#include "media/cdm/key_system_names.h" 10 11#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 12 13namespace chromecast { 14namespace media { 15 16const char kChromecastPlayreadyKeySystem[] = "com.chromecast.playready"; 17 18CastKeySystem GetKeySystemByName(const std::string& key_system_name) { 19#if defined(WIDEVINE_CDM_AVAILABLE) 20 if (key_system_name.compare(kWidevineKeySystem) == 0) { 21 return KEY_SYSTEM_WIDEVINE; 22 } 23#endif // defined(WIDEVINE_CDM_AVAILABLE) 24 25#if defined(PLAYREADY_CDM_AVAILABLE) 26 if (key_system_name.compare(kChromecastPlayreadyKeySystem) == 0) { 27 return KEY_SYSTEM_PLAYREADY; 28 } 29#endif // defined(PLAYREADY_CDM_AVAILABLE) 30 31 if (key_system_name.compare(::media::kClearKey) == 0) { 32 return KEY_SYSTEM_CLEAR_KEY; 33 } 34 35 return GetPlatformKeySystemByName(key_system_name); 36} 37 38} // namespace media 39} // namespace chromecast 40