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