OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <iterator> | 6 #include <iterator> |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/base/mime_util.h" | 10 #include "net/base/mime_util.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // Refer to http://wiki.whatwg.org/wiki/Video_type_parameters#Browser_Support | 301 // Refer to http://wiki.whatwg.org/wiki/Video_type_parameters#Browser_Support |
302 // for more information. | 302 // for more information. |
303 // | 303 // |
304 // The codecs for WAV are integers as defined in Appendix A of RFC2361: | 304 // The codecs for WAV are integers as defined in Appendix A of RFC2361: |
305 // http://tools.ietf.org/html/rfc2361 | 305 // http://tools.ietf.org/html/rfc2361 |
306 static const char* const common_media_codecs[] = { | 306 static const char* const common_media_codecs[] = { |
307 #if defined(ENABLE_MEDIA_CODEC_THEORA) | 307 #if defined(ENABLE_MEDIA_CODEC_THEORA) |
308 "theora", | 308 "theora", |
309 #endif | 309 #endif |
310 "vorbis", | 310 "vorbis", |
| 311 "opus", |
311 "vp8", | 312 "vp8", |
312 "1" // WAVE_FORMAT_PCM. | 313 "1" // WAVE_FORMAT_PCM. |
313 }; | 314 }; |
314 | 315 |
315 // List of proprietary codecs only supported by Google Chrome. | 316 // List of proprietary codecs only supported by Google Chrome. |
316 static const char* const proprietary_media_codecs[] = { | 317 static const char* const proprietary_media_codecs[] = { |
317 "avc1", | 318 "avc1", |
318 "mp4a" | 319 "mp4a" |
319 }; | 320 }; |
320 | 321 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 "application/atom+xml", | 401 "application/atom+xml", |
401 "image/svg+xml" | 402 "image/svg+xml" |
402 }; | 403 }; |
403 | 404 |
404 struct MediaFormatStrict { | 405 struct MediaFormatStrict { |
405 const char* mime_type; | 406 const char* mime_type; |
406 const char* codecs_list; | 407 const char* codecs_list; |
407 }; | 408 }; |
408 | 409 |
409 static const MediaFormatStrict format_codec_mappings[] = { | 410 static const MediaFormatStrict format_codec_mappings[] = { |
410 { "video/webm", "vorbis,vp8,vp8.0" }, | 411 { "video/webm", "vorbis,opus,vp8,vp8.0" }, |
411 { "audio/webm", "vorbis" }, | 412 { "audio/webm", "vorbis,opus" }, |
412 { "audio/wav", "1" } | 413 { "audio/wav", "1" } |
413 }; | 414 }; |
414 | 415 |
415 MimeUtil::MimeUtil() { | 416 MimeUtil::MimeUtil() { |
416 InitializeMimeTypeMaps(); | 417 InitializeMimeTypeMaps(); |
417 } | 418 } |
418 | 419 |
419 // static | 420 // static |
420 bool MimeUtil::AreSupportedCodecs(const MimeMappings& supported_codecs, | 421 bool MimeUtil::AreSupportedCodecs(const MimeMappings& supported_codecs, |
421 const std::vector<std::string>& codecs) { | 422 const std::vector<std::string>& codecs) { |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 "audio/aiff", | 790 "audio/aiff", |
790 "audio/amr", | 791 "audio/amr", |
791 "audio/basic", | 792 "audio/basic", |
792 "audio/midi", | 793 "audio/midi", |
793 "audio/mp3", | 794 "audio/mp3", |
794 "audio/mp4", | 795 "audio/mp4", |
795 "audio/mpeg", | 796 "audio/mpeg", |
796 "audio/mpeg3", | 797 "audio/mpeg3", |
797 "audio/ogg", | 798 "audio/ogg", |
798 "audio/vorbis", | 799 "audio/vorbis", |
| 800 "audio/opus", |
799 "audio/wav", | 801 "audio/wav", |
800 "audio/webm", | 802 "audio/webm", |
801 "audio/x-m4a", | 803 "audio/x-m4a", |
802 "audio/x-ms-wma", | 804 "audio/x-ms-wma", |
803 "audio/vnd.rn-realaudio", | 805 "audio/vnd.rn-realaudio", |
804 "audio/vnd.wave" | 806 "audio/vnd.wave" |
805 }; | 807 }; |
806 static const char* const kStandardVideoTypes[] = { | 808 static const char* const kStandardVideoTypes[] = { |
807 "video/avi", | 809 "video/avi", |
808 "video/divx", | 810 "video/divx", |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 const std::string GetIANAMediaType(const std::string& mime_type) { | 964 const std::string GetIANAMediaType(const std::string& mime_type) { |
963 for (size_t i = 0; i < arraysize(kIanaMediaTypes); ++i) { | 965 for (size_t i = 0; i < arraysize(kIanaMediaTypes); ++i) { |
964 if (StartsWithASCII(mime_type, kIanaMediaTypes[i].matcher, true)) { | 966 if (StartsWithASCII(mime_type, kIanaMediaTypes[i].matcher, true)) { |
965 return kIanaMediaTypes[i].name; | 967 return kIanaMediaTypes[i].name; |
966 } | 968 } |
967 } | 969 } |
968 return ""; | 970 return ""; |
969 } | 971 } |
970 | 972 |
971 } // namespace net | 973 } // namespace net |
OLD | NEW |