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

Side by Side 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, 9 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef MEDIA_BASE_VIDEO_FRAME_METADATA_H_
6 #define MEDIA_BASE_VIDEO_FRAME_METADATA_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/time/time.h"
10 #include "base/values.h"
11 #include "media/base/media_export.h"
12
13 namespace media {
14
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,
23
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,
27
28 NUM_KEYS
29 };
30
31 VideoFrameMetadata();
32 ~VideoFrameMetadata();
33
34 bool HasKey(Key key) const;
35
36 void Clear() { dictionary_.Clear(); }
37
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);
45
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;
52
53 // Returns null if |key| was not present.
54 const base::Value* GetValue(Key key) const WARN_UNUSED_RESULT;
55
56 // For serialization.
57 void MergeInternalValuesInto(base::DictionaryValue* out) const;
58 void MergeInternalValuesFrom(const base::DictionaryValue& in);
59
60 private:
61 const base::BinaryValue* GetBinaryValue(Key key) const;
62
63 base::DictionaryValue dictionary_;
64
65 DISALLOW_COPY_AND_ASSIGN(VideoFrameMetadata);
66 };
67
68 } // namespace media
69
70 #endif // MEDIA_BASE_VIDEO_FRAME_METADATA_H_
OLDNEW
« 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