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.
5 #ifndef MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_
6 #define MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_
12 #include "base/basictypes.h"
13 #include "media/base/media_export.h"
21 // This class extracts a string dictionary of metadata tags for audio and video
22 // files. It also provides the format name.
23 class MEDIA_EXPORT AudioVideoMetadataExtractor
{
25 typedef std::map
<std::string
, std::string
> TagDictionary
;
34 typedef std::vector
<StreamInfo
> StreamInfoVector
;
36 AudioVideoMetadataExtractor();
37 ~AudioVideoMetadataExtractor();
39 // Returns whether or not the fields were successfully extracted. Should only
41 bool Extract(DataSource
* source
, bool extract_attached_pics
);
43 // Returns -1 if we cannot extract the duration. In seconds.
44 double duration() const;
46 // Returns -1 for containers without video.
50 // Returns -1 if undefined.
53 // Returns -1 or an empty string if the value is undefined.
54 const std::string
& album() const;
55 const std::string
& artist() const;
56 const std::string
& comment() const;
57 const std::string
& copyright() const;
58 const std::string
& date() const;
60 const std::string
& encoder() const;
61 const std::string
& encoded_by() const;
62 const std::string
& genre() const;
63 const std::string
& language() const;
64 const std::string
& title() const;
67 // First element is the container. Subsequent elements are the child streams.
68 const StreamInfoVector
& stream_infos() const;
70 // Empty if Extract call did not request attached images, or if no attached
72 const std::vector
<std::string
>& attached_images_bytes() const;
75 void ExtractDictionary(AVDictionary
* metadata
, TagDictionary
* raw_tags
);
86 std::string copyright_
;
90 std::string encoded_by_
;
92 std::string language_
;
97 StreamInfoVector stream_infos_
;
99 std::vector
<std::string
> attached_images_bytes_
;
101 DISALLOW_COPY_AND_ASSIGN(AudioVideoMetadataExtractor
);
106 #endif // MEDIA_BASE_AUDIO_VIDEO_METADATA_EXTRACTOR_H_