| 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 "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 const char* codecs_list; | 523 const char* codecs_list; |
| 524 }; | 524 }; |
| 525 | 525 |
| 526 // Following is the list of RFC 6381 compliant codecs: | 526 // Following is the list of RFC 6381 compliant codecs: |
| 527 // mp4a.66 - MPEG-2 AAC MAIN | 527 // mp4a.66 - MPEG-2 AAC MAIN |
| 528 // mp4a.67 - MPEG-2 AAC LC | 528 // mp4a.67 - MPEG-2 AAC LC |
| 529 // mp4a.68 - MPEG-2 AAC SSR | 529 // mp4a.68 - MPEG-2 AAC SSR |
| 530 // mp4a.69 - MPEG-2 extension to MPEG-1 | 530 // mp4a.69 - MPEG-2 extension to MPEG-1 |
| 531 // mp4a.6B - MPEG-1 audio | 531 // mp4a.6B - MPEG-1 audio |
| 532 // mp4a.40.2 - MPEG-4 AAC LC | 532 // mp4a.40.2 - MPEG-4 AAC LC |
| 533 // mp4a.40.02 - MPEG-4 AAC LC (leading 0 in aud-oti for compatibility) |
| 533 // mp4a.40.5 - MPEG-4 HE-AAC v1 (AAC LC + SBR) | 534 // mp4a.40.5 - MPEG-4 HE-AAC v1 (AAC LC + SBR) |
| 535 // mp4a.40.05 - MPEG-4 HE-AAC v1 (AAC LC + SBR) (leading 0 in aud-oti for |
| 536 // compatibility) |
| 534 // mp4a.40.29 - MPEG-4 HE-AAC v2 (AAC LC + SBR + PS) | 537 // mp4a.40.29 - MPEG-4 HE-AAC v2 (AAC LC + SBR + PS) |
| 535 // | 538 // |
| 536 // avc1.42E0xx - H.264 Baseline | 539 // avc1.42E0xx - H.264 Baseline |
| 537 // avc1.4D40xx - H.264 Main | 540 // avc1.4D40xx - H.264 Main |
| 538 // avc1.6400xx - H.264 High | 541 // avc1.6400xx - H.264 High |
| 539 static const char kMP4AudioCodecsExpression[] = | 542 static const char kMP4AudioCodecsExpression[] = |
| 540 "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.5,mp4a.40.29"; | 543 "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5," |
| 544 "mp4a.40.05,mp4a.40.29"; |
| 541 static const char kMP4VideoCodecsExpression[] = | 545 static const char kMP4VideoCodecsExpression[] = |
| 542 "avc1.42E00A,avc1.4D400A,avc1.64000A," \ | 546 "avc1.42E00A,avc1.4D400A,avc1.64000A," |
| 543 "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.5,mp4a.40.29"; | 547 "mp4a.66,mp4a.67,mp4a.68,mp4a.69,mp4a.6B,mp4a.40.2,mp4a.40.02,mp4a.40.5," |
| 548 "mp4a.40.05,mp4a.40.29"; |
| 544 | 549 |
| 545 static const MediaFormatStrict format_codec_mappings[] = { | 550 static const MediaFormatStrict format_codec_mappings[] = { |
| 546 { "video/webm", "opus,vorbis,vp8,vp8.0,vp9,vp9.0" }, | 551 { "video/webm", "opus,vorbis,vp8,vp8.0,vp9,vp9.0" }, |
| 547 { "audio/webm", "opus,vorbis" }, | 552 { "audio/webm", "opus,vorbis" }, |
| 548 { "audio/wav", "1" }, | 553 { "audio/wav", "1" }, |
| 549 { "audio/x-wav", "1" }, | 554 { "audio/x-wav", "1" }, |
| 550 { "video/ogg", "opus,theora,vorbis" }, | 555 { "video/ogg", "opus,theora,vorbis" }, |
| 551 { "audio/ogg", "opus,vorbis" }, | 556 { "audio/ogg", "opus,vorbis" }, |
| 552 { "application/ogg", "opus,theora,vorbis" }, | 557 { "application/ogg", "opus,theora,vorbis" }, |
| 553 { "audio/mpeg", "mp3" }, | 558 { "audio/mpeg", "mp3" }, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 564 struct CodecIDMappings { | 569 struct CodecIDMappings { |
| 565 const char* const codec_id; | 570 const char* const codec_id; |
| 566 MimeUtil::Codec codec; | 571 MimeUtil::Codec codec; |
| 567 }; | 572 }; |
| 568 | 573 |
| 569 // List of codec IDs that provide enough information to determine the | 574 // List of codec IDs that provide enough information to determine the |
| 570 // codec and profile being requested. | 575 // codec and profile being requested. |
| 571 // | 576 // |
| 572 // The "mp4a" strings come from RFC 6381. | 577 // The "mp4a" strings come from RFC 6381. |
| 573 static const CodecIDMappings kUnambiguousCodecIDs[] = { | 578 static const CodecIDMappings kUnambiguousCodecIDs[] = { |
| 574 { "1", MimeUtil::PCM }, // We only allow this for WAV so it isn't ambiguous. | 579 {"1", MimeUtil::PCM}, // We only allow this for WAV so it isn't ambiguous. |
| 575 { "mp3", MimeUtil::MP3 }, | 580 {"mp3", MimeUtil::MP3}, |
| 576 { "mp4a.66", MimeUtil::MPEG2_AAC_MAIN }, | 581 {"mp4a.66", MimeUtil::MPEG2_AAC_MAIN}, |
| 577 { "mp4a.67", MimeUtil::MPEG2_AAC_LC }, | 582 {"mp4a.67", MimeUtil::MPEG2_AAC_LC}, |
| 578 { "mp4a.68", MimeUtil::MPEG2_AAC_SSR }, | 583 {"mp4a.68", MimeUtil::MPEG2_AAC_SSR}, |
| 579 { "mp4a.69", MimeUtil::MP3 }, | 584 {"mp4a.69", MimeUtil::MP3}, |
| 580 { "mp4a.6B", MimeUtil::MP3 }, | 585 {"mp4a.6B", MimeUtil::MP3}, |
| 581 { "mp4a.40.2", MimeUtil::MPEG4_AAC_LC }, | 586 {"mp4a.40.2", MimeUtil::MPEG4_AAC_LC}, |
| 582 { "mp4a.40.5", MimeUtil::MPEG4_AAC_SBR_v1 }, | 587 {"mp4a.40.02", MimeUtil::MPEG4_AAC_LC}, |
| 583 { "mp4a.40.29", MimeUtil::MPEG4_AAC_SBR_PS_v2 }, | 588 {"mp4a.40.5", MimeUtil::MPEG4_AAC_SBR_v1}, |
| 584 { "vorbis", MimeUtil::VORBIS }, | 589 {"mp4a.40.05", MimeUtil::MPEG4_AAC_SBR_v1}, |
| 585 { "opus", MimeUtil::OPUS }, | 590 {"mp4a.40.29", MimeUtil::MPEG4_AAC_SBR_PS_v2}, |
| 586 { "vp8", MimeUtil::VP8 }, | 591 {"vorbis", MimeUtil::VORBIS}, |
| 587 { "vp8.0", MimeUtil::VP8 }, | 592 {"opus", MimeUtil::OPUS}, |
| 588 { "vp9", MimeUtil::VP9 }, | 593 {"vp8", MimeUtil::VP8}, |
| 589 { "vp9.0", MimeUtil::VP9 }, | 594 {"vp8.0", MimeUtil::VP8}, |
| 590 { "theora", MimeUtil::THEORA } | 595 {"vp9", MimeUtil::VP9}, |
| 591 }; | 596 {"vp9.0", MimeUtil::VP9}, |
| 597 {"theora", MimeUtil::THEORA}}; |
| 592 | 598 |
| 593 // List of codec IDs that are ambiguous and don't provide | 599 // List of codec IDs that are ambiguous and don't provide |
| 594 // enough information to determine the codec and profile. | 600 // enough information to determine the codec and profile. |
| 595 // The codec in these entries indicate the codec and profile | 601 // The codec in these entries indicate the codec and profile |
| 596 // we assume the user is trying to indicate. | 602 // we assume the user is trying to indicate. |
| 597 static const CodecIDMappings kAmbiguousCodecIDs[] = { | 603 static const CodecIDMappings kAmbiguousCodecIDs[] = { |
| 598 { "mp4a.40", MimeUtil::MPEG4_AAC_LC }, | 604 { "mp4a.40", MimeUtil::MPEG4_AAC_LC }, |
| 599 { "avc1", MimeUtil::H264_BASELINE }, | 605 { "avc1", MimeUtil::H264_BASELINE }, |
| 600 { "avc3", MimeUtil::H264_BASELINE }, | 606 { "avc3", MimeUtil::H264_BASELINE }, |
| 601 }; | 607 }; |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 post_data->append("\r\n" + value + "\r\n"); | 1409 post_data->append("\r\n" + value + "\r\n"); |
| 1404 } | 1410 } |
| 1405 | 1411 |
| 1406 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, | 1412 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, |
| 1407 std::string* post_data) { | 1413 std::string* post_data) { |
| 1408 DCHECK(post_data); | 1414 DCHECK(post_data); |
| 1409 post_data->append("--" + mime_boundary + "--\r\n"); | 1415 post_data->append("--" + mime_boundary + "--\r\n"); |
| 1410 } | 1416 } |
| 1411 | 1417 |
| 1412 } // namespace net | 1418 } // namespace net |
| OLD | NEW |