Chromium Code Reviews| 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..c61c49026257e6d4a4fa8c4cb07aaf60b1ad888a |
| --- /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/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( |
|
ddorwin
2013/09/16 17:58:10
This is already handled in AddWidevineWithCodecs()
qinmin
2013/09/17 21:26:23
Done.
|
| + const std::string& codec_type) { |
| + if (codec_type == "mp4v") |
|
ddorwin
2013/09/16 17:58:10
Most of Chrome uses AVC1. We should try to use the
qinmin
2013/09/17 21:26:23
Done.
|
| + 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( |
|
ddorwin
2013/09/16 17:58:10
As mentioned earlier, I don't think we need to con
qinmin
2013/09/17 21:26:23
removed
On 2013/09/16 17:58:10, ddorwin wrote:
|
| + 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 |