| Index: components/cdm/renderer/widevine_key_systems.cc
|
| diff --git a/components/cdm/renderer/widevine_key_systems.cc b/components/cdm/renderer/widevine_key_systems.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5120d8bc2928cfc9dee19357c721506f2238ae1a
|
| --- /dev/null
|
| +++ b/components/cdm/renderer/widevine_key_systems.cc
|
| @@ -0,0 +1,74 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/cdm/renderer/widevine_key_systems.h"
|
| +
|
| +#include <stddef.h>
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/logging.h"
|
| +#include "build/build_config.h"
|
| +#include "media/base/eme_constants.h"
|
| +
|
| +#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
|
| +
|
| +#if defined(WIDEVINE_CDM_AVAILABLE)
|
| +
|
| +using media::KeySystemInfo;
|
| +using media::SupportedCodecs;
|
| +
|
| +namespace cdm {
|
| +
|
| +void AddWidevineWithCodecs(
|
| + SupportedCodecs supported_codecs,
|
| +#if defined(OS_ANDROID)
|
| + SupportedCodecs supported_secure_codecs,
|
| +#endif // defined(OS_ANDROID)
|
| + media::EmeRobustness max_audio_robustness,
|
| + media::EmeRobustness max_video_robustness,
|
| + media::EmeSessionTypeSupport persistent_license_support,
|
| + media::EmeSessionTypeSupport persistent_release_message_support,
|
| + media::EmeFeatureSupport persistent_state_support,
|
| + media::EmeFeatureSupport distinctive_identifier_support,
|
| + std::vector<KeySystemInfo>* concrete_key_systems) {
|
| + KeySystemInfo info;
|
| + info.key_system = kWidevineKeySystem;
|
| +
|
| + // TODO(xhwang): A container or an initDataType may be supported even though
|
| + // there are no codecs supported in that container. Fix this when we support
|
| + // initDataType.
|
| + info.supported_codecs = supported_codecs;
|
| +#if defined(OS_ANDROID)
|
| + info.supported_secure_codecs = supported_secure_codecs;
|
| +#endif // defined(OS_ANDROID)
|
| +
|
| + // Here we assume that support for a container imples support for the
|
| + // associated initialization data type. KeySystems handles validating
|
| + // |init_data_type| x |container| pairings.
|
| + if (supported_codecs & media::EME_CODEC_WEBM_ALL)
|
| + info.supported_init_data_types |= media::kInitDataTypeMaskWebM;
|
| +#if defined(USE_PROPRIETARY_CODECS)
|
| + if (supported_codecs & media::EME_CODEC_MP4_ALL)
|
| + info.supported_init_data_types |= media::kInitDataTypeMaskCenc;
|
| +#endif // defined(USE_PROPRIETARY_CODECS)
|
| +
|
| + info.max_audio_robustness = max_audio_robustness;
|
| + info.max_video_robustness = max_video_robustness;
|
| + info.persistent_license_support = persistent_license_support;
|
| + info.persistent_release_message_support = persistent_release_message_support;
|
| + info.persistent_state_support = persistent_state_support;
|
| + info.distinctive_identifier_support = distinctive_identifier_support;
|
| +
|
| +#if defined(ENABLE_PEPPER_CDMS)
|
| + info.pepper_type = kWidevineCdmPluginMimeType;
|
| +#endif // defined(ENABLE_PEPPER_CDMS)
|
| +
|
| + concrete_key_systems->push_back(info);
|
| +}
|
| +
|
| +} // namespace cdm
|
| +
|
| +#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
|
|