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 #ifndef MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_ | 5 #ifndef MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_ |
6 #define MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_ | 6 #define MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 20 matching lines...) Expand all Loading... |
31 TagDictionary tags; | 31 TagDictionary tags; |
32 }; | 32 }; |
33 | 33 |
34 typedef std::vector<StreamInfo> StreamInfoVector; | 34 typedef std::vector<StreamInfo> StreamInfoVector; |
35 | 35 |
36 AudioVideoMetadataExtractor(); | 36 AudioVideoMetadataExtractor(); |
37 ~AudioVideoMetadataExtractor(); | 37 ~AudioVideoMetadataExtractor(); |
38 | 38 |
39 // Returns whether or not the fields were successfully extracted. Should only | 39 // Returns whether or not the fields were successfully extracted. Should only |
40 // be called once. | 40 // be called once. |
41 bool Extract(DataSource* source); | 41 bool Extract(DataSource* source, bool extract_attached_pics); |
42 | 42 |
43 // Returns -1 if we cannot extract the duration. In seconds. | 43 // Returns -1 if we cannot extract the duration. In seconds. |
44 double duration() const; | 44 double duration() const; |
45 | 45 |
46 // Returns -1 for containers without video. | 46 // Returns -1 for containers without video. |
47 int width() const; | 47 int width() const; |
48 int height() const; | 48 int height() const; |
49 | 49 |
50 // Returns -1 if undefined. | 50 // Returns -1 if undefined. |
51 int rotation() const; | 51 int rotation() const; |
52 | 52 |
53 // Returns -1 or an empty string if the value is undefined. | 53 // Returns -1 or an empty string if the value is undefined. |
54 const std::string& album() const; | 54 const std::string& album() const; |
55 const std::string& artist() const; | 55 const std::string& artist() const; |
56 const std::string& comment() const; | 56 const std::string& comment() const; |
57 const std::string& copyright() const; | 57 const std::string& copyright() const; |
58 const std::string& date() const; | 58 const std::string& date() const; |
59 int disc() const; | 59 int disc() const; |
60 const std::string& encoder() const; | 60 const std::string& encoder() const; |
61 const std::string& encoded_by() const; | 61 const std::string& encoded_by() const; |
62 const std::string& genre() const; | 62 const std::string& genre() const; |
63 const std::string& language() const; | 63 const std::string& language() const; |
64 const std::string& title() const; | 64 const std::string& title() const; |
65 int track() const; | 65 int track() const; |
66 | 66 |
67 // First element is the container. Subsequent elements are the child streams. | 67 // First element is the container. Subsequent elements are the child streams. |
68 const StreamInfoVector& stream_infos() const; | 68 const StreamInfoVector& stream_infos() const; |
69 | 69 |
| 70 // Empty if Extract call did not request attached images, or if no attached |
| 71 // images were found. |
| 72 const std::vector<std::string>& attached_images_bytes() const; |
| 73 |
70 private: | 74 private: |
71 void ExtractDictionary(AVDictionary* metadata, TagDictionary* raw_tags); | 75 void ExtractDictionary(AVDictionary* metadata, TagDictionary* raw_tags); |
72 | 76 |
73 bool extracted_; | 77 bool extracted_; |
74 | 78 |
75 int duration_; | 79 int duration_; |
76 int width_; | 80 int width_; |
77 int height_; | 81 int height_; |
78 | 82 |
79 std::string album_; | 83 std::string album_; |
80 std::string artist_; | 84 std::string artist_; |
81 std::string comment_; | 85 std::string comment_; |
82 std::string copyright_; | 86 std::string copyright_; |
83 std::string date_; | 87 std::string date_; |
84 int disc_; | 88 int disc_; |
85 std::string encoder_; | 89 std::string encoder_; |
86 std::string encoded_by_; | 90 std::string encoded_by_; |
87 std::string genre_; | 91 std::string genre_; |
88 std::string language_; | 92 std::string language_; |
89 int rotation_; | 93 int rotation_; |
90 std::string title_; | 94 std::string title_; |
91 int track_; | 95 int track_; |
92 | 96 |
93 StreamInfoVector stream_infos_; | 97 StreamInfoVector stream_infos_; |
94 | 98 |
| 99 std::vector<std::string> attached_images_bytes_; |
| 100 |
95 DISALLOW_COPY_AND_ASSIGN(AudioVideoMetadataExtractor); | 101 DISALLOW_COPY_AND_ASSIGN(AudioVideoMetadataExtractor); |
96 }; | 102 }; |
97 | 103 |
98 } // namespace media | 104 } // namespace media |
99 | 105 |
100 #endif // MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_ | 106 #endif // MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_ |
OLD | NEW |