OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_ |
| 6 #define MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "media/base/media_export.h" |
| 12 |
| 13 struct AVDictionary; |
| 14 |
| 15 namespace media { |
| 16 |
| 17 class DataSource; |
| 18 |
| 19 // This class extracts a string dictionary of metadata tags for audio and video |
| 20 // files. It also provides the format name. |
| 21 class MEDIA_EXPORT AudioVideoMetadataExtractor { |
| 22 public: |
| 23 AudioVideoMetadataExtractor(); |
| 24 ~AudioVideoMetadataExtractor(); |
| 25 |
| 26 // Returns whether or not the fields were successfully extracted. Should only |
| 27 // be called once. |
| 28 bool Extract(DataSource* source); |
| 29 |
| 30 // Returns -1 if we cannot extract the duration. In seconds. |
| 31 double duration() const; |
| 32 |
| 33 // Returns -1 for containers without video. |
| 34 int width() const; |
| 35 int height() const; |
| 36 |
| 37 // Returns -1 or an empty string if the value is undefined. |
| 38 const std::string& album() const; |
| 39 const std::string& artist() const; |
| 40 const std::string& comment() const; |
| 41 const std::string& copyright() const; |
| 42 const std::string& date() const; |
| 43 int disc() const; |
| 44 const std::string& encoder() const; |
| 45 const std::string& encoded_by() const; |
| 46 const std::string& genre() const; |
| 47 const std::string& language() const; |
| 48 const std::string& title() const; |
| 49 int track() const; |
| 50 |
| 51 private: |
| 52 void ExtractDictionary(AVDictionary* metadata); |
| 53 |
| 54 bool extracted_; |
| 55 |
| 56 int duration_; |
| 57 int width_; |
| 58 int height_; |
| 59 |
| 60 std::string album_; |
| 61 std::string artist_; |
| 62 std::string comment_; |
| 63 std::string copyright_; |
| 64 std::string date_; |
| 65 int disc_; |
| 66 std::string encoder_; |
| 67 std::string encoded_by_; |
| 68 std::string genre_; |
| 69 std::string language_; |
| 70 std::string title_; |
| 71 int track_; |
| 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(AudioVideoMetadataExtractor); |
| 74 }; |
| 75 |
| 76 } // namespace media |
| 77 |
| 78 #endif // MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_ |
OLD | NEW |