| Index: chrome/renderer/media/encrypted_media_utils_android.cc
|
| diff --git a/chrome/renderer/media/encrypted_media_utils_android.cc b/chrome/renderer/media/encrypted_media_utils_android.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1ef8293aa4128064d27994035f5b440fc0fd486a
|
| --- /dev/null
|
| +++ b/chrome/renderer/media/encrypted_media_utils_android.cc
|
| @@ -0,0 +1,52 @@
|
| +// Copyright 2013 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 "chrome/renderer/media/encrypted_media_utils_android.h"
|
| +
|
| +#include <string>
|
| +
|
| +#include "chrome/common/media/encrypted_media_messages_android.h"
|
| +
|
| +namespace chrome {
|
| +
|
| +// TODO(qinmin): the conversion is very rough and incomplete. There are multiple
|
| +// container type for each codec.
|
| +const std::string CodecTypeToContainerType(
|
| + const std::string& codec_type) {
|
| + if (codec_type == "mp4v")
|
| + return "video/mp4";
|
| + if (codec_type == "avc1")
|
| + return "video/mpeg";
|
| + if (codec_type == "vp8")
|
| + return "video/webm";
|
| + if (codec_type == "vp9")
|
| + return "video/webm";
|
| + if (codec_type == "mp4a")
|
| + return "audio/mp4";
|
| + if (codec_type == "mp3")
|
| + return "audio/mpeg";
|
| + if (codec_type == "vorbis")
|
| + return "audio/webm";
|
| + return std::string();
|
| +}
|
| +
|
| +content::KeySystemInfo SupportedKeySystemToKeySystemInfo(
|
| + const SupportedKeySystem& key_system) {
|
| + content::KeySystemInfo key_system_info(key_system.key_system);
|
| + key_system_info.uuid = key_system.uuid;
|
| + key_system_info.parent_key_system = key_system.parent_key_system;
|
| + for (unsigned i = 0; i < key_system.codecs.size(); ++i) {
|
| + std::string container_type = CodecTypeToContainerType(key_system.codecs[i]);
|
| + if (!container_type.empty()) {
|
| + key_system_info.supported_types.push_back(
|
| + content::KeySystemInfo::ContainerCodecsPair(
|
| + container_type, key_system.codecs[i]));
|
| + }
|
| + }
|
| + key_system_info.video_composition_enabled =
|
| + key_system.video_composition_enabled;
|
| + return key_system_info;
|
| +}
|
| +
|
| +} // namespace chrome
|
|
|