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 #include "media/base/video_frame_metadata.h" | 5 #include "media/base/video_frame_metadata.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (!dictionary_.GetWithoutPathExpansion(ToInternalKey(key), &result)) | 144 if (!dictionary_.GetWithoutPathExpansion(ToInternalKey(key), &result)) |
145 return nullptr; | 145 return nullptr; |
146 return result; | 146 return result; |
147 } | 147 } |
148 | 148 |
149 bool VideoFrameMetadata::IsTrue(Key key) const { | 149 bool VideoFrameMetadata::IsTrue(Key key) const { |
150 bool value = false; | 150 bool value = false; |
151 return GetBoolean(key, &value) && value; | 151 return GetBoolean(key, &value) && value; |
152 } | 152 } |
153 | 153 |
154 std::unique_ptr<base::DictionaryValue> VideoFrameMetadata::CopyInternalValues() | 154 const base::DictionaryValue& VideoFrameMetadata::GetInternalValues() const { |
155 const { | 155 return dictionary_; |
156 return dictionary_.CreateDeepCopy(); | |
157 } | 156 } |
158 | 157 |
159 void VideoFrameMetadata::MergeInternalValuesFrom( | 158 void VideoFrameMetadata::MergeInternalValuesFrom( |
160 const base::DictionaryValue& in) { | 159 const base::DictionaryValue& in) { |
161 dictionary_.MergeDictionary(&in); | 160 dictionary_.MergeDictionary(&in); |
162 } | 161 } |
163 | 162 |
164 void VideoFrameMetadata::MergeMetadataFrom( | 163 void VideoFrameMetadata::MergeMetadataFrom( |
165 const VideoFrameMetadata* metadata_source) { | 164 const VideoFrameMetadata* metadata_source) { |
166 dictionary_.MergeDictionary(&metadata_source->dictionary_); | 165 dictionary_.MergeDictionary(&metadata_source->dictionary_); |
167 } | 166 } |
168 | 167 |
169 const base::BinaryValue* VideoFrameMetadata::GetBinaryValue(Key key) const { | 168 const base::BinaryValue* VideoFrameMetadata::GetBinaryValue(Key key) const { |
170 const base::Value* internal_value = nullptr; | 169 const base::Value* internal_value = nullptr; |
171 if (dictionary_.GetWithoutPathExpansion(ToInternalKey(key), | 170 if (dictionary_.GetWithoutPathExpansion(ToInternalKey(key), |
172 &internal_value) && | 171 &internal_value) && |
173 internal_value->GetType() == base::Value::Type::BINARY) { | 172 internal_value->GetType() == base::Value::Type::BINARY) { |
174 return internal_value; | 173 return internal_value; |
175 } | 174 } |
176 return nullptr; | 175 return nullptr; |
177 } | 176 } |
178 | 177 |
179 } // namespace media | 178 } // namespace media |
OLD | NEW |