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" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 GetExtractor("90rotation.mp4", true, true, 0, 1920, 1080); | 129 GetExtractor("90rotation.mp4", true, true, 0, 1920, 1080); |
130 | 130 |
131 EXPECT_EQ(90, extractor->rotation()); | 131 EXPECT_EQ(90, extractor->rotation()); |
132 | 132 |
133 EXPECT_EQ(3u, extractor->stream_infos().size()); | 133 EXPECT_EQ(3u, extractor->stream_infos().size()); |
134 | 134 |
135 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); |
136 EXPECT_EQ(4u, extractor->stream_infos()[0].tags.size()); | 136 EXPECT_EQ(4u, extractor->stream_infos()[0].tags.size()); |
137 EXPECT_EQ("isom3gp4", GetTagValue(extractor->stream_infos()[0].tags, | 137 EXPECT_EQ("isom3gp4", GetTagValue(extractor->stream_infos()[0].tags, |
138 "compatible_brands")); | 138 "compatible_brands")); |
139 EXPECT_EQ("2014-02-11 00:39:25", | 139 EXPECT_EQ("2014-02-11T00:39:25.000000Z", |
140 GetTagValue(extractor->stream_infos()[0].tags, "creation_time")); | 140 GetTagValue(extractor->stream_infos()[0].tags, "creation_time")); |
141 EXPECT_EQ("isom", | 141 EXPECT_EQ("isom", |
142 GetTagValue(extractor->stream_infos()[0].tags, "major_brand")); | 142 GetTagValue(extractor->stream_infos()[0].tags, "major_brand")); |
143 EXPECT_EQ("0", | 143 EXPECT_EQ("0", |
144 GetTagValue(extractor->stream_infos()[0].tags, "minor_version")); | 144 GetTagValue(extractor->stream_infos()[0].tags, "minor_version")); |
145 | 145 |
146 EXPECT_EQ("h264", extractor->stream_infos()[1].type); | 146 EXPECT_EQ("h264", extractor->stream_infos()[1].type); |
147 EXPECT_EQ(5u, extractor->stream_infos()[1].tags.size()); | 147 EXPECT_EQ(5u, extractor->stream_infos()[1].tags.size()); |
148 EXPECT_EQ("2014-02-11 00:39:25", | 148 EXPECT_EQ("2014-02-11T00:39:25.000000Z", |
149 GetTagValue(extractor->stream_infos()[1].tags, "creation_time")); | 149 GetTagValue(extractor->stream_infos()[1].tags, "creation_time")); |
150 EXPECT_EQ("VideoHandle", | 150 EXPECT_EQ("VideoHandle", |
151 GetTagValue(extractor->stream_infos()[1].tags, "handler_name")); | 151 GetTagValue(extractor->stream_infos()[1].tags, "handler_name")); |
152 EXPECT_EQ("eng", GetTagValue(extractor->stream_infos()[1].tags, "language")); | 152 EXPECT_EQ("eng", GetTagValue(extractor->stream_infos()[1].tags, "language")); |
153 EXPECT_EQ("90", GetTagValue(extractor->stream_infos()[1].tags, "rotate")); | 153 EXPECT_EQ("90", GetTagValue(extractor->stream_infos()[1].tags, "rotate")); |
154 | 154 |
155 EXPECT_EQ("aac", extractor->stream_infos()[2].type); | 155 EXPECT_EQ("aac", extractor->stream_infos()[2].type); |
156 EXPECT_EQ(3u, extractor->stream_infos()[2].tags.size()); | 156 EXPECT_EQ(3u, extractor->stream_infos()[2].tags.size()); |
157 EXPECT_EQ("2014-02-11 00:39:25", | 157 EXPECT_EQ("2014-02-11T00:39:25.000000Z", |
158 GetTagValue(extractor->stream_infos()[2].tags, "creation_time")); | 158 GetTagValue(extractor->stream_infos()[2].tags, "creation_time")); |
159 EXPECT_EQ("SoundHandle", | 159 EXPECT_EQ("SoundHandle", |
160 GetTagValue(extractor->stream_infos()[2].tags, "handler_name")); | 160 GetTagValue(extractor->stream_infos()[2].tags, "handler_name")); |
161 EXPECT_EQ("eng", GetTagValue(extractor->stream_infos()[2].tags, "language")); | 161 EXPECT_EQ("eng", GetTagValue(extractor->stream_infos()[2].tags, "language")); |
162 | 162 |
163 EXPECT_EQ(0u, extractor->attached_images_bytes().size()); | 163 EXPECT_EQ(0u, extractor->attached_images_bytes().size()); |
164 } | 164 } |
165 | 165 |
166 TEST(AudioVideoMetadataExtractorTest, AudioMP3) { | 166 TEST(AudioVideoMetadataExtractorTest, AudioMP3) { |
167 std::unique_ptr<AudioVideoMetadataExtractor> extractor = | 167 std::unique_ptr<AudioVideoMetadataExtractor> extractor = |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 extractor->attached_images_bytes()[0].substr(0, 8)); | 205 extractor->attached_images_bytes()[0].substr(0, 8)); |
206 EXPECT_EQ("IEND\xae\x42\x60\x82", | 206 EXPECT_EQ("IEND\xae\x42\x60\x82", |
207 extractor->attached_images_bytes()[0].substr( | 207 extractor->attached_images_bytes()[0].substr( |
208 extractor->attached_images_bytes()[0].size() - 8, 8)); | 208 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", | 209 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])); | 210 base::SHA1HashString(extractor->attached_images_bytes()[0])); |
211 } | 211 } |
212 #endif | 212 #endif |
213 | 213 |
214 } // namespace media | 214 } // namespace media |
OLD | NEW |