Index: net/base/mime_util.cc |
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc |
index 85f5d15b9411898e9fac2d44ef33f8a8307c4253..941cfb6767208a610b549f52130a867dd94cae36 100644 |
--- a/net/base/mime_util.cc |
+++ b/net/base/mime_util.cc |
@@ -234,7 +234,8 @@ static const char* const supported_image_types[] = { |
// A list of media types: http://en.wikipedia.org/wiki/Internet_media_type |
// A comprehensive mime type list: http://plugindoc.mozdev.org/winmime.php |
-static const char* const supported_media_types[] = { |
+// This set of codecs is supported by all variations of Chromium. |
+static const char* const common_media_types[] = { |
// Ogg. |
"audio/ogg", |
"application/ogg", |
@@ -247,8 +248,10 @@ static const char* const supported_media_types[] = { |
"audio/webm", |
"audio/wav", |
"audio/x-wav", |
+}; |
-#if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
+// List of proprietary types only supported by Google Chrome. |
+static const char* const proprietary_media_types[] = { |
// MPEG-4. |
"video/mp4", |
"video/x-m4v", |
@@ -259,21 +262,17 @@ static const char* const supported_media_types[] = { |
"audio/mp3", |
"audio/x-mp3", |
"audio/mpeg", |
-#endif |
}; |
// List of supported codecs when passed in with <source type="...">. |
+// This set of codecs is supported by all variations of Chromium. |
// |
// Refer to http://wiki.whatwg.org/wiki/Video_type_parameters#Browser_Support |
// for more information. |
// |
// The codecs for WAV are integers as defined in Appendix A of RFC2361: |
// http://tools.ietf.org/html/rfc2361 |
-static const char* const supported_media_codecs[] = { |
-#if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
- "avc1", |
- "mp4a", |
-#endif |
+static const char* const common_media_codecs[] = { |
#if defined(ENABLE_MEDIA_CODEC_THEORA) |
"theora", |
#endif |
@@ -282,6 +281,12 @@ static const char* const supported_media_codecs[] = { |
"1" // WAVE_FORMAT_PCM. |
}; |
+// List of proprietary codecs only supported by Google Chrome. |
+static const char* const proprietary_media_codecs[] = { |
+ "avc1", |
+ "mp4a" |
+}; |
+ |
// Note: does not include javascript types list (see supported_javascript_types) |
static const char* const supported_non_image_types[] = { |
"text/cache-manifest", |
@@ -376,12 +381,20 @@ void MimeUtil::InitializeMimeTypeMaps() { |
non_image_map_.insert(supported_non_image_types[i]); |
for (size_t i = 0; i < arraysize(supported_javascript_types); ++i) |
non_image_map_.insert(supported_javascript_types[i]); |
- for (size_t i = 0; i < arraysize(supported_media_types); ++i) |
- non_image_map_.insert(supported_media_types[i]); |
+ for (size_t i = 0; i < arraysize(common_media_types); ++i) |
+ non_image_map_.insert(common_media_types[i]); |
+#if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
+ for (size_t i = 0; i < arraysize(proprietary_media_types); ++i) |
+ non_image_map_.insert(proprietary_media_types[i]); |
+#endif |
// Initialize the supported media types. |
- for (size_t i = 0; i < arraysize(supported_media_types); ++i) |
- media_map_.insert(supported_media_types[i]); |
+ for (size_t i = 0; i < arraysize(common_media_types); ++i) |
+ media_map_.insert(common_media_types[i]); |
+#if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
+ for (size_t i = 0; i < arraysize(proprietary_media_types); ++i) |
+ media_map_.insert(proprietary_media_types[i]); |
+#endif |
for (size_t i = 0; i < arraysize(supported_javascript_types); ++i) |
javascript_map_.insert(supported_javascript_types[i]); |
@@ -389,8 +402,12 @@ void MimeUtil::InitializeMimeTypeMaps() { |
for (size_t i = 0; i < arraysize(view_source_types); ++i) |
view_source_map_.insert(view_source_types[i]); |
- for (size_t i = 0; i < arraysize(supported_media_codecs); ++i) |
- codecs_map_.insert(supported_media_codecs[i]); |
+ for (size_t i = 0; i < arraysize(common_media_codecs); ++i) |
+ codecs_map_.insert(common_media_codecs[i]); |
+#if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
+ for (size_t i = 0; i < arraysize(proprietary_media_codecs); ++i) |
+ codecs_map_.insert(proprietary_media_codecs[i]); |
+#endif |
// Initialize the strict supported media types. |
for (size_t i = 0; i < arraysize(format_codec_mappings); ++i) { |
@@ -748,4 +765,28 @@ void GetExtensionsForMimeType(const std::string& mime_type, |
HashSetToVector(&unique_extensions, extensions); |
} |
+std::vector<std::string> GetProprietaryMediaTypes() { |
+ std::vector<std::string> proprietary_types; |
+// Unless/until WebM files are added to the media layout tests, we need to avoid |
+// blacklisting mp4 and H.264 when Theora is not supported (and proprietary |
+// codecs are) so that the media tests can still run. |
+#if defined(ENABLE_MEDIA_CODEC_THEORA) || !defined(USE_PROPRIETARY_CODECS) |
+ for (size_t i = 0; i < arraysize(proprietary_media_types); ++i) |
+ proprietary_types.push_back(proprietary_media_types[i]); |
+#endif |
+ return proprietary_types; |
qinmin
2012/04/06 23:36:59
if we do this, does that mean video/ogg is not bla
ddorwin
2012/04/07 02:40:41
It is not blacklisted for layout tests. In the #el
qinmin
2012/04/07 02:46:53
Is it possible this will cause some layout test to
ddorwin
2012/04/07 03:15:31
No. The layout test will have nothing blacklisted
|
+} |
+ |
+std::vector<std::string> GetProprietaryMediaCodecs() { |
+ std::vector<std::string> proprietary_codecs; |
+// Unless/until WebM files are added to the media layout tests, we need to avoid |
+// blacklisting mp4 and H.264 when Theora is not supported (and proprietary |
+// codecs are) so that the media tests can still run. |
+#if defined(ENABLE_MEDIA_CODEC_THEORA) || !defined(USE_PROPRIETARY_CODECS) |
+ for (size_t i = 0; i < arraysize(proprietary_media_codecs); ++i) |
+ proprietary_codecs.push_back(proprietary_media_codecs[i]); |
+#endif |
+ return proprietary_codecs; |
qinmin
2012/04/06 23:36:59
same here, what about theora for android.
ddorwin
2012/04/07 02:40:41
Same.
|
+} |
+ |
} // namespace net |