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

Side by Side Diff: media/base/video_frame_metadata.h

Issue 1146723002: New FRAME_DURATION VideoFrameMetadata, with Cast Streaming use case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expanded comments for VideoFrameMetadata::FRAME_DURATION. Created 5 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_VIDEO_FRAME_METADATA_H_ 5 #ifndef MEDIA_BASE_VIDEO_FRAME_METADATA_H_
6 #define MEDIA_BASE_VIDEO_FRAME_METADATA_H_ 6 #define MEDIA_BASE_VIDEO_FRAME_METADATA_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 class MEDIA_EXPORT VideoFrameMetadata { 15 class MEDIA_EXPORT VideoFrameMetadata {
16 public: 16 public:
17 enum Key { 17 enum Key {
18 // Video capture begin/end timestamps. Consumers can use these values for 18 // Video capture begin/end timestamps. Consumers can use these values for
19 // dynamic optimizations, logging stats, etc. Use Get/SetTimeTicks() for 19 // dynamic optimizations, logging stats, etc. Use Get/SetTimeTicks() for
20 // these keys. 20 // these keys.
21 CAPTURE_BEGIN_TIME, 21 CAPTURE_BEGIN_TIME,
22 CAPTURE_END_TIME, 22 CAPTURE_END_TIME,
23 23
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,
32
24 // Represents either the fixed frame rate, or the maximum frame rate to 33 // 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. 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.
26 FRAME_RATE, 37 FRAME_RATE,
27 38
28 NUM_KEYS 39 NUM_KEYS
29 }; 40 };
30 41
31 VideoFrameMetadata(); 42 VideoFrameMetadata();
32 ~VideoFrameMetadata(); 43 ~VideoFrameMetadata();
33 44
34 bool HasKey(Key key) const; 45 bool HasKey(Key key) const;
35 46
36 void Clear() { dictionary_.Clear(); } 47 void Clear() { dictionary_.Clear(); }
37 48
38 // Setters. Overwrites existing value, if present. 49 // Setters. Overwrites existing value, if present.
39 void SetBoolean(Key key, bool value); 50 void SetBoolean(Key key, bool value);
40 void SetInteger(Key key, int value); 51 void SetInteger(Key key, int value);
41 void SetDouble(Key key, double value); 52 void SetDouble(Key key, double value);
42 void SetString(Key key, const std::string& value); 53 void SetString(Key key, const std::string& value);
54 void SetTimeDelta(Key key, const base::TimeDelta& value);
43 void SetTimeTicks(Key key, const base::TimeTicks& value); 55 void SetTimeTicks(Key key, const base::TimeTicks& value);
44 void SetValue(Key key, scoped_ptr<base::Value> value); 56 void SetValue(Key key, scoped_ptr<base::Value> value);
45 57
46 // Getters. Returns true if |key| was present and has the value has been set. 58 // 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; 59 bool GetBoolean(Key key, bool* value) const WARN_UNUSED_RESULT;
48 bool GetInteger(Key key, int* value) const WARN_UNUSED_RESULT; 60 bool GetInteger(Key key, int* value) const WARN_UNUSED_RESULT;
49 bool GetDouble(Key key, double* value) const WARN_UNUSED_RESULT; 61 bool GetDouble(Key key, double* value) const WARN_UNUSED_RESULT;
50 bool GetString(Key key, std::string* value) const WARN_UNUSED_RESULT; 62 bool GetString(Key key, std::string* value) const WARN_UNUSED_RESULT;
63 bool GetTimeDelta(Key key, base::TimeDelta* value) const WARN_UNUSED_RESULT;
51 bool GetTimeTicks(Key key, base::TimeTicks* value) const WARN_UNUSED_RESULT; 64 bool GetTimeTicks(Key key, base::TimeTicks* value) const WARN_UNUSED_RESULT;
52 65
53 // Returns null if |key| was not present. 66 // Returns null if |key| was not present.
54 const base::Value* GetValue(Key key) const WARN_UNUSED_RESULT; 67 const base::Value* GetValue(Key key) const WARN_UNUSED_RESULT;
55 68
56 // For serialization. 69 // For serialization.
57 void MergeInternalValuesInto(base::DictionaryValue* out) const; 70 void MergeInternalValuesInto(base::DictionaryValue* out) const;
58 void MergeInternalValuesFrom(const base::DictionaryValue& in); 71 void MergeInternalValuesFrom(const base::DictionaryValue& in);
59 72
60 private: 73 private:
61 const base::BinaryValue* GetBinaryValue(Key key) const; 74 const base::BinaryValue* GetBinaryValue(Key key) const;
62 75
63 base::DictionaryValue dictionary_; 76 base::DictionaryValue dictionary_;
64 77
65 DISALLOW_COPY_AND_ASSIGN(VideoFrameMetadata); 78 DISALLOW_COPY_AND_ASSIGN(VideoFrameMetadata);
66 }; 79 };
67 80
68 } // namespace media 81 } // namespace media
69 82
70 #endif // MEDIA_BASE_VIDEO_FRAME_METADATA_H_ 83 #endif // MEDIA_BASE_VIDEO_FRAME_METADATA_H_
OLDNEW
« no previous file with comments | « content/browser/media/capture/video_capture_oracle_unittest.cc ('k') | media/base/video_frame_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698