OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/base/audio_video_metadata_extractor.h" | 5 #include "media/base/audio_video_metadata_extractor.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "media/base/test_data_util.h" | 12 #include "media/base/test_data_util.h" |
13 #include "media/filters/file_data_source.h" | 13 #include "media/filters/file_data_source.h" |
14 #include "media/media_features.h" | |
15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
16 | 15 |
17 namespace media { | 16 namespace media { |
18 | 17 |
19 std::unique_ptr<AudioVideoMetadataExtractor> GetExtractor( | 18 std::unique_ptr<AudioVideoMetadataExtractor> GetExtractor( |
20 const std::string& filename, | 19 const std::string& filename, |
21 bool extract_attached_images, | 20 bool extract_attached_images, |
22 bool expected_result, | 21 bool expected_result, |
23 double expected_duration, | 22 double expected_duration, |
24 int expected_width, | 23 int expected_width, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 EXPECT_EQ(0u, extractor->stream_infos()[4].tags.size()); | 116 EXPECT_EQ(0u, extractor->stream_infos()[4].tags.size()); |
118 | 117 |
119 EXPECT_EQ("pcm_s16le", extractor->stream_infos()[5].type); | 118 EXPECT_EQ("pcm_s16le", extractor->stream_infos()[5].type); |
120 EXPECT_EQ(1u, extractor->stream_infos()[5].tags.size()); | 119 EXPECT_EQ(1u, extractor->stream_infos()[5].tags.size()); |
121 EXPECT_EQ("Lavc52.32.0", | 120 EXPECT_EQ("Lavc52.32.0", |
122 GetTagValue(extractor->stream_infos()[5].tags, "ENCODER")); | 121 GetTagValue(extractor->stream_infos()[5].tags, "ENCODER")); |
123 | 122 |
124 EXPECT_EQ(0u, extractor->attached_images_bytes().size()); | 123 EXPECT_EQ(0u, extractor->attached_images_bytes().size()); |
125 } | 124 } |
126 | 125 |
127 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 126 #if defined(USE_PROPRIETARY_CODECS) |
128 TEST(AudioVideoMetadataExtractorTest, AndroidRotatedMP4Video) { | 127 TEST(AudioVideoMetadataExtractorTest, AndroidRotatedMP4Video) { |
129 std::unique_ptr<AudioVideoMetadataExtractor> extractor = | 128 std::unique_ptr<AudioVideoMetadataExtractor> extractor = |
130 GetExtractor("90rotation.mp4", true, true, 0, 1920, 1080); | 129 GetExtractor("90rotation.mp4", true, true, 0, 1920, 1080); |
131 | 130 |
132 EXPECT_EQ(90, extractor->rotation()); | 131 EXPECT_EQ(90, extractor->rotation()); |
133 | 132 |
134 EXPECT_EQ(3u, extractor->stream_infos().size()); | 133 EXPECT_EQ(3u, extractor->stream_infos().size()); |
135 | 134 |
136 EXPECT_EQ("mov,mp4,m4a,3gp,3g2,mj2", extractor->stream_infos()[0].type); | 135 EXPECT_EQ("mov,mp4,m4a,3gp,3g2,mj2", extractor->stream_infos()[0].type); |
137 EXPECT_EQ(4u, extractor->stream_infos()[0].tags.size()); | 136 EXPECT_EQ(4u, extractor->stream_infos()[0].tags.size()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 extractor->attached_images_bytes()[0].substr(0, 8)); | 205 extractor->attached_images_bytes()[0].substr(0, 8)); |
207 EXPECT_EQ("IEND\xae\x42\x60\x82", | 206 EXPECT_EQ("IEND\xae\x42\x60\x82", |
208 extractor->attached_images_bytes()[0].substr( | 207 extractor->attached_images_bytes()[0].substr( |
209 extractor->attached_images_bytes()[0].size() - 8, 8)); | 208 extractor->attached_images_bytes()[0].size() - 8, 8)); |
210 EXPECT_EQ("\xF3\xED\x8F\xC7\xC7\x98\xB9V|p\xC0u!\xB5\x82\xCF\x95\xF0\xCD\xCE", | 209 EXPECT_EQ("\xF3\xED\x8F\xC7\xC7\x98\xB9V|p\xC0u!\xB5\x82\xCF\x95\xF0\xCD\xCE", |
211 base::SHA1HashString(extractor->attached_images_bytes()[0])); | 210 base::SHA1HashString(extractor->attached_images_bytes()[0])); |
212 } | 211 } |
213 #endif | 212 #endif |
214 | 213 |
215 } // namespace media | 214 } // namespace media |
OLD | NEW |