Revert of Reland of crrev.com/1100173002 (Add a WinHeap dump provider to the memory...
[chromium-blink-merge.git] / media / base / video_frame_metadata.h
blob31fbe74989253c92dab9dd0adc082a8223b2aa2d
1 // Copyright 2015 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_VIDEO_FRAME_METADATA_H_
6 #define MEDIA_BASE_VIDEO_FRAME_METADATA_H_
8 #include "base/compiler_specific.h"
9 #include "base/time/time.h"
10 #include "base/values.h"
11 #include "media/base/media_export.h"
13 namespace media {
15 class MEDIA_EXPORT VideoFrameMetadata {
16 public:
17 enum Key {
18 // Video capture begin/end timestamps. Consumers can use these values for
19 // dynamic optimizations, logging stats, etc. Use Get/SetTimeTicks() for
20 // these keys.
21 CAPTURE_BEGIN_TIME,
22 CAPTURE_END_TIME,
24 // Represents either the fixed frame rate, or the maximum frame rate to
25 // expect from a variable-rate source. Use Get/SetDouble() for this key.
26 FRAME_RATE,
28 NUM_KEYS
31 VideoFrameMetadata();
32 ~VideoFrameMetadata();
34 bool HasKey(Key key) const;
36 void Clear() { dictionary_.Clear(); }
38 // Setters. Overwrites existing value, if present.
39 void SetBoolean(Key key, bool value);
40 void SetInteger(Key key, int value);
41 void SetDouble(Key key, double value);
42 void SetString(Key key, const std::string& value);
43 void SetTimeTicks(Key key, const base::TimeTicks& value);
44 void SetValue(Key key, scoped_ptr<base::Value> value);
46 // Getters. Returns true if |key| was present and has the value has been set.
47 bool GetBoolean(Key key, bool* value) const WARN_UNUSED_RESULT;
48 bool GetInteger(Key key, int* value) const WARN_UNUSED_RESULT;
49 bool GetDouble(Key key, double* value) const WARN_UNUSED_RESULT;
50 bool GetString(Key key, std::string* value) const WARN_UNUSED_RESULT;
51 bool GetTimeTicks(Key key, base::TimeTicks* value) const WARN_UNUSED_RESULT;
53 // Returns null if |key| was not present.
54 const base::Value* GetValue(Key key) const WARN_UNUSED_RESULT;
56 // For serialization.
57 void MergeInternalValuesInto(base::DictionaryValue* out) const;
58 void MergeInternalValuesFrom(const base::DictionaryValue& in);
60 private:
61 const base::BinaryValue* GetBinaryValue(Key key) const;
63 base::DictionaryValue dictionary_;
65 DISALLOW_COPY_AND_ASSIGN(VideoFrameMetadata);
68 } // namespace media
70 #endif // MEDIA_BASE_VIDEO_FRAME_METADATA_H_