Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: media/base/audio_video_metadata_extractor.cc

Issue 148113012: Media: AudioVideoMetadataParser - Parse rotation metadata. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 AudioVideoMetadataExtractor::AudioVideoMetadataExtractor() 52 AudioVideoMetadataExtractor::AudioVideoMetadataExtractor()
53 : extracted_(false), 53 : extracted_(false),
54 duration_(-1), 54 duration_(-1),
55 width_(-1), 55 width_(-1),
56 height_(-1), 56 height_(-1),
57 disc_(-1), 57 disc_(-1),
58 rotation_(-1),
58 track_(-1) { 59 track_(-1) {
59 } 60 }
60 61
61 AudioVideoMetadataExtractor::~AudioVideoMetadataExtractor() { 62 AudioVideoMetadataExtractor::~AudioVideoMetadataExtractor() {
62 } 63 }
63 64
64 bool AudioVideoMetadataExtractor::Extract(DataSource* source) { 65 bool AudioVideoMetadataExtractor::Extract(DataSource* source) {
65 DCHECK(!extracted_); 66 DCHECK(!extracted_);
66 67
67 bool read_ok = true; 68 bool read_ok = true;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const std::string& AudioVideoMetadataExtractor::genre() const { 173 const std::string& AudioVideoMetadataExtractor::genre() const {
173 DCHECK(extracted_); 174 DCHECK(extracted_);
174 return genre_; 175 return genre_;
175 } 176 }
176 177
177 const std::string& AudioVideoMetadataExtractor::language() const { 178 const std::string& AudioVideoMetadataExtractor::language() const {
178 DCHECK(extracted_); 179 DCHECK(extracted_);
179 return language_; 180 return language_;
180 } 181 }
181 182
183 int AudioVideoMetadataExtractor::rotation() const {
184 DCHECK(extracted_);
185 return rotation_;
186 }
187
182 const std::string& AudioVideoMetadataExtractor::title() const { 188 const std::string& AudioVideoMetadataExtractor::title() const {
183 DCHECK(extracted_); 189 DCHECK(extracted_);
184 return title_; 190 return title_;
185 } 191 }
186 192
187 int AudioVideoMetadataExtractor::track() const { 193 int AudioVideoMetadataExtractor::track() const {
188 DCHECK(extracted_); 194 DCHECK(extracted_);
189 return track_; 195 return track_;
190 } 196 }
191 197
192 void AudioVideoMetadataExtractor::ExtractDictionary(AVDictionary* metadata) { 198 void AudioVideoMetadataExtractor::ExtractDictionary(AVDictionary* metadata) {
193 if (!metadata) 199 if (!metadata)
194 return; 200 return;
195 201
196 AVDictionaryEntry* tag = NULL; 202 AVDictionaryEntry* tag = NULL;
197 while ((tag = av_dict_get(metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { 203 while ((tag = av_dict_get(metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
198 if (ExtractString(tag, "album", &album_)) continue; 204 if (ExtractString(tag, "album", &album_)) continue;
199 if (ExtractString(tag, "artist", &artist_)) continue; 205 if (ExtractString(tag, "artist", &artist_)) continue;
200 if (ExtractString(tag, "comment", &comment_)) continue; 206 if (ExtractString(tag, "comment", &comment_)) continue;
201 if (ExtractString(tag, "copyright", &copyright_)) continue; 207 if (ExtractString(tag, "copyright", &copyright_)) continue;
202 if (ExtractString(tag, "date", &date_)) continue; 208 if (ExtractString(tag, "date", &date_)) continue;
203 if (ExtractInt(tag, "disc", &disc_)) continue; 209 if (ExtractInt(tag, "disc", &disc_)) continue;
204 if (ExtractString(tag, "encoder", &encoder_)) continue; 210 if (ExtractString(tag, "encoder", &encoder_)) continue;
205 if (ExtractString(tag, "encoded_by", &encoded_by_)) continue; 211 if (ExtractString(tag, "encoded_by", &encoded_by_)) continue;
206 if (ExtractString(tag, "genre", &genre_)) continue; 212 if (ExtractString(tag, "genre", &genre_)) continue;
207 if (ExtractString(tag, "language", &language_)) continue; 213 if (ExtractString(tag, "language", &language_)) continue;
214 if (ExtractInt(tag, "rotate", &rotation_)) continue;
208 if (ExtractString(tag, "title", &title_)) continue; 215 if (ExtractString(tag, "title", &title_)) continue;
209 if (ExtractInt(tag, "track", &track_)) continue; 216 if (ExtractInt(tag, "track", &track_)) continue;
210 } 217 }
211 } 218 }
212 219
213 } // namespace media 220 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698