Chromium Code Reviews| OLD | NEW |
|---|---|
| 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). Use Get/SetTimeDelta() | |
| 26 // for this key. | |
| 27 FRAME_DURATION, | |
|
hubbe
2015/05/19 17:58:32
I think some additional explanation is needed.
I m
miu
2015/05/19 20:14:52
Done.
| |
| 28 | |
| 24 // Represents either the fixed frame rate, or the maximum frame rate to | 29 // 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. | 30 // expect from a variable-rate source. Use Get/SetDouble() for this key. |
| 26 FRAME_RATE, | 31 FRAME_RATE, |
| 27 | 32 |
| 28 NUM_KEYS | 33 NUM_KEYS |
| 29 }; | 34 }; |
| 30 | 35 |
| 31 VideoFrameMetadata(); | 36 VideoFrameMetadata(); |
| 32 ~VideoFrameMetadata(); | 37 ~VideoFrameMetadata(); |
| 33 | 38 |
| 34 bool HasKey(Key key) const; | 39 bool HasKey(Key key) const; |
| 35 | 40 |
| 36 void Clear() { dictionary_.Clear(); } | 41 void Clear() { dictionary_.Clear(); } |
| 37 | 42 |
| 38 // Setters. Overwrites existing value, if present. | 43 // Setters. Overwrites existing value, if present. |
| 39 void SetBoolean(Key key, bool value); | 44 void SetBoolean(Key key, bool value); |
| 40 void SetInteger(Key key, int value); | 45 void SetInteger(Key key, int value); |
| 41 void SetDouble(Key key, double value); | 46 void SetDouble(Key key, double value); |
| 42 void SetString(Key key, const std::string& value); | 47 void SetString(Key key, const std::string& value); |
| 48 void SetTimeDelta(Key key, const base::TimeDelta& value); | |
| 43 void SetTimeTicks(Key key, const base::TimeTicks& value); | 49 void SetTimeTicks(Key key, const base::TimeTicks& value); |
| 44 void SetValue(Key key, scoped_ptr<base::Value> value); | 50 void SetValue(Key key, scoped_ptr<base::Value> value); |
| 45 | 51 |
| 46 // Getters. Returns true if |key| was present and has the value has been set. | 52 // 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; | 53 bool GetBoolean(Key key, bool* value) const WARN_UNUSED_RESULT; |
| 48 bool GetInteger(Key key, int* value) const WARN_UNUSED_RESULT; | 54 bool GetInteger(Key key, int* value) const WARN_UNUSED_RESULT; |
| 49 bool GetDouble(Key key, double* value) const WARN_UNUSED_RESULT; | 55 bool GetDouble(Key key, double* value) const WARN_UNUSED_RESULT; |
| 50 bool GetString(Key key, std::string* value) const WARN_UNUSED_RESULT; | 56 bool GetString(Key key, std::string* value) const WARN_UNUSED_RESULT; |
| 57 bool GetTimeDelta(Key key, base::TimeDelta* value) const WARN_UNUSED_RESULT; | |
| 51 bool GetTimeTicks(Key key, base::TimeTicks* value) const WARN_UNUSED_RESULT; | 58 bool GetTimeTicks(Key key, base::TimeTicks* value) const WARN_UNUSED_RESULT; |
| 52 | 59 |
| 53 // Returns null if |key| was not present. | 60 // Returns null if |key| was not present. |
| 54 const base::Value* GetValue(Key key) const WARN_UNUSED_RESULT; | 61 const base::Value* GetValue(Key key) const WARN_UNUSED_RESULT; |
| 55 | 62 |
| 56 // For serialization. | 63 // For serialization. |
| 57 void MergeInternalValuesInto(base::DictionaryValue* out) const; | 64 void MergeInternalValuesInto(base::DictionaryValue* out) const; |
| 58 void MergeInternalValuesFrom(const base::DictionaryValue& in); | 65 void MergeInternalValuesFrom(const base::DictionaryValue& in); |
| 59 | 66 |
| 60 private: | 67 private: |
| 61 const base::BinaryValue* GetBinaryValue(Key key) const; | 68 const base::BinaryValue* GetBinaryValue(Key key) const; |
| 62 | 69 |
| 63 base::DictionaryValue dictionary_; | 70 base::DictionaryValue dictionary_; |
| 64 | 71 |
| 65 DISALLOW_COPY_AND_ASSIGN(VideoFrameMetadata); | 72 DISALLOW_COPY_AND_ASSIGN(VideoFrameMetadata); |
| 66 }; | 73 }; |
| 67 | 74 |
| 68 } // namespace media | 75 } // namespace media |
| 69 | 76 |
| 70 #endif // MEDIA_BASE_VIDEO_FRAME_METADATA_H_ | 77 #endif // MEDIA_BASE_VIDEO_FRAME_METADATA_H_ |
| OLD | NEW |