Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8537)

Unified Diff: chrome/renderer/media/encrypted_media_utils_android.cc

Issue 23513055: Populate canPlayType to renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698