OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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 "chrome/renderer/media/encrypted_media_utils_android.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "chrome/common/media/encrypted_media_messages_android.h" |
| 10 |
| 11 namespace chrome { |
| 12 |
| 13 // TODO(qinmin): the conversion is very rough and incomplete. There are multiple |
| 14 // container type for each codec. |
| 15 const std::string CodecTypeToContainerType( |
| 16 const std::string& codec_type) { |
| 17 if (codec_type == "mp4v") |
| 18 return "video/mp4"; |
| 19 if (codec_type == "avc1") |
| 20 return "video/mpeg"; |
| 21 if (codec_type == "vp8") |
| 22 return "video/webm"; |
| 23 if (codec_type == "vp9") |
| 24 return "video/webm"; |
| 25 if (codec_type == "mp4a") |
| 26 return "audio/mp4"; |
| 27 if (codec_type == "mp3") |
| 28 return "audio/mpeg"; |
| 29 if (codec_type == "vorbis") |
| 30 return "audio/webm"; |
| 31 return std::string(); |
| 32 } |
| 33 |
| 34 content::KeySystemInfo SupportedKeySystemToKeySystemInfo( |
| 35 const SupportedKeySystem& key_system) { |
| 36 content::KeySystemInfo key_system_info(key_system.key_system); |
| 37 key_system_info.uuid = key_system.uuid; |
| 38 key_system_info.parent_key_system = key_system.parent_key_system; |
| 39 for (unsigned i = 0; i < key_system.codecs.size(); ++i) { |
| 40 std::string container_type = CodecTypeToContainerType(key_system.codecs[i]); |
| 41 if (!container_type.empty()) { |
| 42 key_system_info.supported_types.push_back( |
| 43 content::KeySystemInfo::ContainerCodecsPair( |
| 44 container_type, key_system.codecs[i])); |
| 45 } |
| 46 } |
| 47 key_system_info.video_composition_enabled = |
| 48 key_system.video_composition_enabled; |
| 49 return key_system_info; |
| 50 } |
| 51 |
| 52 } // namespace chrome |
OLD | NEW |