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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 const std::string& AudioVideoMetadataExtractor::title() const { | 188 const std::string& AudioVideoMetadataExtractor::title() const { |
189 DCHECK(extracted_); | 189 DCHECK(extracted_); |
190 return title_; | 190 return title_; |
191 } | 191 } |
192 | 192 |
193 int AudioVideoMetadataExtractor::track() const { | 193 int AudioVideoMetadataExtractor::track() const { |
194 DCHECK(extracted_); | 194 DCHECK(extracted_); |
195 return track_; | 195 return track_; |
196 } | 196 } |
197 | 197 |
| 198 const std::map<std::string, std::string>& |
| 199 AudioVideoMetadataExtractor::raw_tags() const { |
| 200 DCHECK(extracted_); |
| 201 return raw_tags_; |
| 202 } |
| 203 |
198 void AudioVideoMetadataExtractor::ExtractDictionary(AVDictionary* metadata) { | 204 void AudioVideoMetadataExtractor::ExtractDictionary(AVDictionary* metadata) { |
199 if (!metadata) | 205 if (!metadata) |
200 return; | 206 return; |
201 | 207 |
202 AVDictionaryEntry* tag = NULL; | 208 AVDictionaryEntry* tag = NULL; |
203 while ((tag = av_dict_get(metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { | 209 while ((tag = av_dict_get(metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { |
| 210 if (raw_tags_.find(tag->key) == raw_tags_.end()) |
| 211 raw_tags_[tag->key] = tag->value; |
| 212 |
204 if (ExtractInt(tag, "rotate", &rotation_)) continue; | 213 if (ExtractInt(tag, "rotate", &rotation_)) continue; |
205 if (ExtractString(tag, "album", &album_)) continue; | 214 if (ExtractString(tag, "album", &album_)) continue; |
206 if (ExtractString(tag, "artist", &artist_)) continue; | 215 if (ExtractString(tag, "artist", &artist_)) continue; |
207 if (ExtractString(tag, "comment", &comment_)) continue; | 216 if (ExtractString(tag, "comment", &comment_)) continue; |
208 if (ExtractString(tag, "copyright", ©right_)) continue; | 217 if (ExtractString(tag, "copyright", ©right_)) continue; |
209 if (ExtractString(tag, "date", &date_)) continue; | 218 if (ExtractString(tag, "date", &date_)) continue; |
210 if (ExtractInt(tag, "disc", &disc_)) continue; | 219 if (ExtractInt(tag, "disc", &disc_)) continue; |
211 if (ExtractString(tag, "encoder", &encoder_)) continue; | 220 if (ExtractString(tag, "encoder", &encoder_)) continue; |
212 if (ExtractString(tag, "encoded_by", &encoded_by_)) continue; | 221 if (ExtractString(tag, "encoded_by", &encoded_by_)) continue; |
213 if (ExtractString(tag, "genre", &genre_)) continue; | 222 if (ExtractString(tag, "genre", &genre_)) continue; |
214 if (ExtractString(tag, "language", &language_)) continue; | 223 if (ExtractString(tag, "language", &language_)) continue; |
215 if (ExtractString(tag, "title", &title_)) continue; | 224 if (ExtractString(tag, "title", &title_)) continue; |
216 if (ExtractInt(tag, "track", &track_)) continue; | 225 if (ExtractInt(tag, "track", &track_)) continue; |
217 } | 226 } |
218 } | 227 } |
219 | 228 |
220 } // namespace media | 229 } // namespace media |
OLD | NEW |