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

Unified Diff: media/capture/video/chromeos/camera_metadata_utils.cc

Issue 2837273004: media: add video capture device for ARC++ camera HAL v3 (Closed)
Patch Set: RELAND: media: add video capture device for ARC++ camera HAL v3 Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: media/capture/video/chromeos/camera_metadata_utils.cc
diff --git a/media/capture/video/chromeos/camera_metadata_utils.cc b/media/capture/video/chromeos/camera_metadata_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6b7c150882e8e22f25bb9185a17f632f472491dc
--- /dev/null
+++ b/media/capture/video/chromeos/camera_metadata_utils.cc
@@ -0,0 +1,55 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/capture/video/chromeos/camera_metadata_utils.h"
+
+#include <set>
+
+namespace media {
+
+const arc::mojom::CameraMetadataEntryPtr* GetMetadataEntry(
+ const arc::mojom::CameraMetadataPtr& camera_metadata,
+ arc::mojom::CameraMetadataTag tag) {
+ if (!camera_metadata->entries.has_value()) {
+ return nullptr;
+ }
+ for (const auto& entry : camera_metadata->entries.value()) {
+ if (entry->tag == tag) {
+ return &entry;
+ }
+ }
+ return nullptr;
+}
+
+void MergeMetadata(arc::mojom::CameraMetadataPtr* to,
+ const arc::mojom::CameraMetadataPtr& from) {
+ DCHECK(to);
+ (*to)->entry_count += from->entry_count;
+ (*to)->entry_capacity += from->entry_count;
+ (*to)->data_count += from->data_count;
+ (*to)->data_capacity += from->data_count;
+
+ if (!from->entries) {
+ return;
+ }
+
+ std::set<arc::mojom::CameraMetadataTag> tags;
+ if ((*to)->entries) {
+ for (const auto& entry : (*to)->entries.value()) {
+ tags.insert(entry->tag);
+ }
+ } else {
+ (*to)->entries = std::vector<arc::mojom::CameraMetadataEntryPtr>();
+ }
+ for (const auto& entry : from->entries.value()) {
+ if (tags.find(entry->tag) != tags.end()) {
+ LOG(ERROR) << "Found duplicated entries for tag " << entry->tag;
+ continue;
+ }
+ tags.insert(entry->tag);
+ (*to)->entries->push_back(entry->Clone());
+ }
+}
+
+} // namespace media
« no previous file with comments | « media/capture/video/chromeos/camera_metadata_utils.h ('k') | media/capture/video/chromeos/display_rotation_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698