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

Unified Diff: media/base/audio_video_metadata_extractor.h

Issue 121383002: Media Galleries API Metadata: Add audio video metadata extractor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: refine metadata extraction logic Created 6 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: media/base/audio_video_metadata_extractor.h
diff --git a/media/base/audio_video_metadata_extractor.h b/media/base/audio_video_metadata_extractor.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f6eaca3defab5d1a0674995abdb1532ab57c46e
--- /dev/null
+++ b/media/base/audio_video_metadata_extractor.h
@@ -0,0 +1,52 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BASE_MEDIA_FFMPEG_METADATA_EXTRACTOR_H_
+#define MEDIA_BASE_MEDIA_FFMPEG_METADATA_EXTRACTOR_H_
+
+#include <map>
+#include <string>
+
+#include "base/basictypes.h"
+#include "media/base/media_export.h"
+
+namespace media {
+
+class DataSource;
+
+// This class extracts a string dictionary of metadata tags for audio and video
+// files. It also provides the format name.
+class MEDIA_EXPORT AudioVideoMetadataExtractor {
+ public:
+ explicit AudioVideoMetadataExtractor(media::DataSource* source);
+ ~AudioVideoMetadataExtractor();
+
+ // Returns whether or not the fields were successfully extracted.
+ bool Extract();
+
+ const std::map<std::string, std::string>& GetTags();
+ const std::string& GetFormat();
acolwell GONE FROM CHROMIUM 2014/01/03 19:14:04 nit: I think this should be removed. It unnecessar
tommycli 2014/01/03 23:08:36 Done.
+ int GetDurationSeconds();
acolwell GONE FROM CHROMIUM 2014/01/03 19:14:04 Use double or TimeDelta for this like the other me
tommycli 2014/01/03 23:08:36 Done.
+
+ // These functions return zero for containers with no video streams.
+ int GetWidth();
acolwell GONE FROM CHROMIUM 2014/01/03 19:14:04 nit: s/GetWidth/width/ to match Chromium style for
tommycli 2014/01/03 23:08:36 Done.
+ int GetHeight();
+
+ private:
+ media::DataSource* source_;
+
+ bool extracted_;
+ std::map<std::string, std::string> tags_;
+ std::string format_;
+ int duration_;
+
+ int width_;
+ int height_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioVideoMetadataExtractor);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_MEDIA_FFMPEG_METADATA_EXTRACTOR_H_

Powered by Google App Engine
This is Rietveld 408576698