Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / media / base / video_frame_metadata.h
blob526383b42305d5d3c7961992e65a761eaab3ccf2
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 // The estimated duration of this frame (i.e., the amount of time between
25 // the media timestamp of this frame and the next). Note that this is not
26 // the same information provided by FRAME_RATE as the FRAME_DURATION can
27 // vary unpredictably for every frame. Consumers can use this to optimize
28 // playback scheduling, make encoding quality decisions, and/or compute
29 // frame-level resource utilization stats. Use Get/SetTimeDelta() for this
30 // key.
31 FRAME_DURATION,
33 // Represents either the fixed frame rate, or the maximum frame rate to
34 // expect from a variable-rate source. This value generally remains the
35 // same for all frames in the same session. Use Get/SetDouble() for this
36 // key.
37 FRAME_RATE,
39 // Some VideoFrames have an indication of the color space used. Use
40 // GetInteger()/SetInteger() and VideoFrame::ColorSpace enumeration.
41 COLOR_SPACE,
43 NUM_KEYS
46 VideoFrameMetadata();
47 ~VideoFrameMetadata();
49 bool HasKey(Key key) const;
51 void Clear() { dictionary_.Clear(); }
53 // Setters. Overwrites existing value, if present.
54 void SetBoolean(Key key, bool value);
55 void SetInteger(Key key, int value);
56 void SetDouble(Key key, double value);
57 void SetString(Key key, const std::string& value);
58 void SetTimeDelta(Key key, const base::TimeDelta& value);
59 void SetTimeTicks(Key key, const base::TimeTicks& value);
60 void SetValue(Key key, scoped_ptr<base::Value> value);
62 // Getters. Returns true if |key| is present, and its value has been set.
63 bool GetBoolean(Key key, bool* value) const WARN_UNUSED_RESULT;
64 bool GetInteger(Key key, int* value) const WARN_UNUSED_RESULT;
65 bool GetDouble(Key key, double* value) const WARN_UNUSED_RESULT;
66 bool GetString(Key key, std::string* value) const WARN_UNUSED_RESULT;
67 bool GetTimeDelta(Key key, base::TimeDelta* value) const WARN_UNUSED_RESULT;
68 bool GetTimeTicks(Key key, base::TimeTicks* value) const WARN_UNUSED_RESULT;
70 // Returns null if |key| was not present.
71 const base::Value* GetValue(Key key) const WARN_UNUSED_RESULT;
73 // For serialization.
74 void MergeInternalValuesInto(base::DictionaryValue* out) const;
75 void MergeInternalValuesFrom(const base::DictionaryValue& in);
77 private:
78 const base::BinaryValue* GetBinaryValue(Key key) const;
80 base::DictionaryValue dictionary_;
82 DISALLOW_COPY_AND_ASSIGN(VideoFrameMetadata);
85 } // namespace media
87 #endif // MEDIA_BASE_VIDEO_FRAME_METADATA_H_