Plug in metadata refactor.
Replaces metadata usage in Camera/V4L2Camera with the
new Metadata class.
Switches Camera from camera_metadata_t to android::CameraMetadata
where appropriate for ease of use/clarity of ownership.
Also cleaned up some "error" logs that were potentially expected,
leaving it to the caller to log if something goes wrong, since
they were numerous and cluttering the log feed.
BUG: https://b/30140438, https://b/29335262
TEST: unit tests pass, test picture program still works,
tested setting a V4L2 control to a non-default value.
Change-Id: I24e50c9b71736dfc576debf8d09dbe36b9bbf23a
diff --git a/modules/camera/3_4/v4l2_wrapper.cpp b/modules/camera/3_4/v4l2_wrapper.cpp
index b88faaf..3d7ba85 100644
--- a/modules/camera/3_4/v4l2_wrapper.cpp
+++ b/modules/camera/3_4/v4l2_wrapper.cpp
@@ -17,6 +17,7 @@
#include "v4l2_wrapper.h"
#include <algorithm>
+#include <array>
#include <limits>
#include <vector>
@@ -36,8 +37,8 @@
namespace v4l2_camera_hal {
-const std::vector<std::array<int32_t, 2>> kStandardSizes(
- {{{1920, 1080}}, {{1280, 720}}, {{640, 480}}, {{320, 240}}});
+const int32_t kStandardSizes[][2] = {
+ {1920, 1080}, {1280, 720}, {640, 480}, {320, 240}};
V4L2Wrapper* V4L2Wrapper::NewV4L2Wrapper(const std::string device_path) {
HAL_LOG_ENTER();
@@ -103,16 +104,14 @@
if (connection_count_ == 0) {
// Not connected.
HAL_LOGE("Camera device %s is not connected, cannot disconnect.",
- device_path_.c_str(),
- connection_count_);
+ device_path_.c_str());
return;
}
--connection_count_;
if (connection_count_ > 0) {
HAL_LOGV("Disconnected from camera device %s. %d connections remain.",
- device_path_.c_str(),
- connection_count_);
+ device_path_.c_str());
return;
}
@@ -368,7 +367,7 @@
// closest to a set of standard sizes plus largest possible.
sizes->insert({{{static_cast<int32_t>(size_query.stepwise.max_width),
static_cast<int32_t>(size_query.stepwise.max_height)}}});
- for (const auto& size : kStandardSizes) {
+ for (const auto size : kStandardSizes) {
// Find the closest size, rounding up.
uint32_t desired_width = size[0];
uint32_t desired_height = size[1];