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"
15 class MEDIA_EXPORT VideoFrameMetadata
{
18 // Video capture begin/end timestamps. Consumers can use these values for
19 // dynamic optimizations, logging stats, etc. Use Get/SetTimeTicks() for
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.
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
;
57 void MergeInternalValuesInto(base::DictionaryValue
* out
) const;
58 void MergeInternalValuesFrom(const base::DictionaryValue
& in
);
61 const base::BinaryValue
* GetBinaryValue(Key key
) const;
63 base::DictionaryValue dictionary_
;
65 DISALLOW_COPY_AND_ASSIGN(VideoFrameMetadata
);
70 #endif // MEDIA_BASE_VIDEO_FRAME_METADATA_H_