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

Unified Diff: media/base/video_frame_metadata.h

Issue 955253002: Add metadata to media::VideoFrame and plumb it through IPC/MediaStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tommi's nits addressed Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/video_frame.h ('k') | media/base/video_frame_metadata.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame_metadata.h
diff --git a/media/base/video_frame_metadata.h b/media/base/video_frame_metadata.h
new file mode 100644
index 0000000000000000000000000000000000000000..31fbe74989253c92dab9dd0adc082a8223b2aa2d
--- /dev/null
+++ b/media/base/video_frame_metadata.h
@@ -0,0 +1,70 @@
+// Copyright 2015 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_VIDEO_FRAME_METADATA_H_
+#define MEDIA_BASE_VIDEO_FRAME_METADATA_H_
+
+#include "base/compiler_specific.h"
+#include "base/time/time.h"
+#include "base/values.h"
+#include "media/base/media_export.h"
+
+namespace media {
+
+class MEDIA_EXPORT VideoFrameMetadata {
+ public:
+ enum Key {
+ // Video capture begin/end timestamps. Consumers can use these values for
+ // dynamic optimizations, logging stats, etc. Use Get/SetTimeTicks() for
+ // these keys.
+ CAPTURE_BEGIN_TIME,
+ CAPTURE_END_TIME,
+
+ // Represents either the fixed frame rate, or the maximum frame rate to
+ // expect from a variable-rate source. Use Get/SetDouble() for this key.
+ FRAME_RATE,
+
+ NUM_KEYS
+ };
+
+ VideoFrameMetadata();
+ ~VideoFrameMetadata();
+
+ bool HasKey(Key key) const;
+
+ void Clear() { dictionary_.Clear(); }
+
+ // Setters. Overwrites existing value, if present.
+ void SetBoolean(Key key, bool value);
+ void SetInteger(Key key, int value);
+ void SetDouble(Key key, double value);
+ void SetString(Key key, const std::string& value);
+ void SetTimeTicks(Key key, const base::TimeTicks& value);
+ void SetValue(Key key, scoped_ptr<base::Value> value);
+
+ // Getters. Returns true if |key| was present and has the value has been set.
+ bool GetBoolean(Key key, bool* value) const WARN_UNUSED_RESULT;
+ bool GetInteger(Key key, int* value) const WARN_UNUSED_RESULT;
+ bool GetDouble(Key key, double* value) const WARN_UNUSED_RESULT;
+ bool GetString(Key key, std::string* value) const WARN_UNUSED_RESULT;
+ bool GetTimeTicks(Key key, base::TimeTicks* value) const WARN_UNUSED_RESULT;
+
+ // Returns null if |key| was not present.
+ const base::Value* GetValue(Key key) const WARN_UNUSED_RESULT;
+
+ // For serialization.
+ void MergeInternalValuesInto(base::DictionaryValue* out) const;
+ void MergeInternalValuesFrom(const base::DictionaryValue& in);
+
+ private:
+ const base::BinaryValue* GetBinaryValue(Key key) const;
+
+ base::DictionaryValue dictionary_;
+
+ DISALLOW_COPY_AND_ASSIGN(VideoFrameMetadata);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_VIDEO_FRAME_METADATA_H_
« no previous file with comments | « media/base/video_frame.h ('k') | media/base/video_frame_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698