Merge changes Ib7227f18,I96926932,I46476112,I2c17b1e4,I47ee9e39, ... am: c809601217 am: 534edb5808
am: cf5c9d616c
Change-Id: I7adf6faf859354ddd1cb93b143514c2ae16152ea
This commit is contained in:
@@ -36,7 +36,7 @@ v4l2_static_libs := \
|
||||
libyuv_static \
|
||||
libjpeg_static_ndk \
|
||||
|
||||
v4l2_cflags := -fno-short-enums -Wall -Wno-error -Wextra -fvisibility=hidden -DHAVE_JPEG
|
||||
v4l2_cflags := -fno-short-enums -Wall -Wextra -Werror -fvisibility=hidden -DHAVE_JPEG
|
||||
|
||||
v4l2_c_includes := $(call include-path-for, camera) \
|
||||
external/libyuv/files/include \
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
// Modified from hardware/libhardware/modules/camera/Camera.cpp
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "Camera"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -28,8 +31,6 @@
|
||||
|
||||
#include "metadata/metadata_common.h"
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "Camera"
|
||||
#include <cutils/log.h>
|
||||
|
||||
#define ATRACE_TAG (ATRACE_TAG_CAMERA | ATRACE_TAG_HAL)
|
||||
@@ -343,7 +344,7 @@ int Camera::processCaptureRequest(camera3_capture_request_t *temp_request)
|
||||
|
||||
// Pre-process output buffers.
|
||||
if (request->output_buffers.size() <= 0) {
|
||||
ALOGE("%s:%d: Invalid number of output buffers: %d", __func__, mId,
|
||||
ALOGE("%s:%d: Invalid number of output buffers: %zu", __func__, mId,
|
||||
request->output_buffers.size());
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -433,7 +434,7 @@ int Camera::flush()
|
||||
completeRequestWithError(request);
|
||||
}
|
||||
|
||||
ALOGV("%s:%d: Flushed %u requests.", __func__, mId, requests.size());
|
||||
ALOGV("%s:%d: Flushed %zu requests.", __func__, mId, requests.size());
|
||||
|
||||
// Call down into the device flushing.
|
||||
return flushBuffers();
|
||||
@@ -503,7 +504,10 @@ void Camera::sendResult(std::shared_ptr<CaptureRequest> request) {
|
||||
static_cast<uint32_t>(request->output_buffers.size()),
|
||||
request->output_buffers.data(),
|
||||
request->input_buffer.get(),
|
||||
1 // Total result; only 1 part.
|
||||
1, // Total result; only 1 part.
|
||||
0, // Number of physical camera metadata.
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
// Make the framework callback.
|
||||
mCallbackOps->process_capture_result(mCallbackOps, &result);
|
||||
|
||||
@@ -17,11 +17,8 @@
|
||||
#ifndef V4L2_CAMERA_HAL_COMMON_H_
|
||||
#define V4L2_CAMERA_HAL_COMMON_H_
|
||||
|
||||
// #define LOG_NDEBUG 0
|
||||
#include <cutils/log.h>
|
||||
|
||||
#define LOG_TAG "V4L2CameraHAL"
|
||||
|
||||
// Helpers of logging (showing function name and line number).
|
||||
#define HAL_LOGE(fmt, args...) do { \
|
||||
ALOGE("%s:%d: " fmt, __func__, __LINE__, ##args); \
|
||||
@@ -59,11 +56,4 @@
|
||||
#define HAL_LOG_ENTER() HAL_LOGV("enter")
|
||||
#define HAL_LOG_EXIT() HAL_LOGV("exit")
|
||||
|
||||
// Fix confliction in case it's defined elsewhere.
|
||||
#ifndef DISALLOW_COPY_AND_ASSIGN
|
||||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
TypeName(const TypeName&); \
|
||||
void operator=(const TypeName&);
|
||||
#endif
|
||||
|
||||
#endif // V4L2_CAMERA_HAL_COMMON_H_
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "FormatMetadataFactory"
|
||||
|
||||
#include "format_metadata_factory.h"
|
||||
|
||||
#include "arc/image_processor.h"
|
||||
@@ -101,7 +104,7 @@ int AddFormatComponents(
|
||||
return res;
|
||||
}
|
||||
|
||||
HAL_LOGI("Supports %d qualified formats.", qualified_formats.size());
|
||||
HAL_LOGI("Supports %zu qualified formats.", qualified_formats.size());
|
||||
|
||||
// Find sizes and frame/stall durations for all formats.
|
||||
// We also want to find the smallest max frame duration amongst all formats,
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "BoottimeStateDelegate"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <android-base/macros.h>
|
||||
#include <system/camera_metadata.h>
|
||||
|
||||
#include "../common.h"
|
||||
#include "metadata_common.h"
|
||||
#include "partial_metadata_interface.h"
|
||||
#include "tagged_control_delegate.h"
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "EnumConverter"
|
||||
|
||||
#include "enum_converter.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "../common.h"
|
||||
#include <android-base/macros.h>
|
||||
|
||||
#include "converter_interface.h"
|
||||
|
||||
namespace v4l2_camera_hal {
|
||||
|
||||
@@ -32,7 +32,7 @@ class IgnoredControlDelegate : public ControlDelegateInterface<T> {
|
||||
*value = value_;
|
||||
return 0;
|
||||
};
|
||||
int SetValue(const T& value) override { return 0; };
|
||||
int SetValue(const T& /*value*/) override { return 0; };
|
||||
|
||||
private:
|
||||
const T value_;
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include "../common.h"
|
||||
#include <android-base/macros.h>
|
||||
|
||||
#include "converter_interface.h"
|
||||
|
||||
namespace v4l2_camera_hal {
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "Metadata"
|
||||
|
||||
#include "metadata.h"
|
||||
|
||||
#include <camera/CameraMetadata.h>
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <android-base/macros.h>
|
||||
#include <camera/CameraMetadata.h>
|
||||
#include <hardware/camera3.h>
|
||||
|
||||
#include "../common.h"
|
||||
#include "metadata_common.h"
|
||||
|
||||
namespace v4l2_camera_hal {
|
||||
|
||||
@@ -120,32 +120,41 @@ static int UpdateMetadata(android::CameraMetadata* metadata,
|
||||
// A helper for other methods in this file.
|
||||
// Gets the data pointer of a given metadata entry into |*val|.
|
||||
|
||||
static void GetDataPointer(camera_metadata_ro_entry_t& entry,
|
||||
template <typename T>
|
||||
inline void GetDataPointer(camera_metadata_ro_entry_t&, const T**);
|
||||
|
||||
template <>
|
||||
inline void GetDataPointer<uint8_t>(camera_metadata_ro_entry_t& entry,
|
||||
const uint8_t** val) {
|
||||
*val = entry.data.u8;
|
||||
}
|
||||
|
||||
static void GetDataPointer(camera_metadata_ro_entry_t& entry,
|
||||
template <>
|
||||
inline void GetDataPointer<int32_t>(camera_metadata_ro_entry_t& entry,
|
||||
const int32_t** val) {
|
||||
*val = entry.data.i32;
|
||||
}
|
||||
|
||||
static void GetDataPointer(camera_metadata_ro_entry_t& entry,
|
||||
template <>
|
||||
inline void GetDataPointer<float>(camera_metadata_ro_entry_t& entry,
|
||||
const float** val) {
|
||||
*val = entry.data.f;
|
||||
}
|
||||
|
||||
static void GetDataPointer(camera_metadata_ro_entry_t& entry,
|
||||
template <>
|
||||
inline void GetDataPointer<int64_t>(camera_metadata_ro_entry_t& entry,
|
||||
const int64_t** val) {
|
||||
*val = entry.data.i64;
|
||||
}
|
||||
|
||||
static void GetDataPointer(camera_metadata_ro_entry_t& entry,
|
||||
template <>
|
||||
inline void GetDataPointer<double>(camera_metadata_ro_entry_t& entry,
|
||||
const double** val) {
|
||||
*val = entry.data.d;
|
||||
}
|
||||
|
||||
static void GetDataPointer(camera_metadata_ro_entry_t& entry,
|
||||
template <>
|
||||
inline void GetDataPointer<camera_metadata_rational_t>(camera_metadata_ro_entry_t& entry,
|
||||
const camera_metadata_rational_t** val) {
|
||||
*val = entry.data.r;
|
||||
}
|
||||
@@ -180,7 +189,7 @@ static int SingleTagValue(const android::CameraMetadata& metadata,
|
||||
} else if (entry.count != 1) {
|
||||
HAL_LOGE(
|
||||
"Error: expected metadata tag %d to contain exactly 1 value "
|
||||
"(had %d).",
|
||||
"(had %zu).",
|
||||
tag,
|
||||
entry.count);
|
||||
return -EINVAL;
|
||||
@@ -211,7 +220,7 @@ static int SingleTagValue(const android::CameraMetadata& metadata,
|
||||
} else if (entry.count != N) {
|
||||
HAL_LOGE(
|
||||
"Error: expected metadata tag %d to contain a single array of "
|
||||
"exactly %d values (had %d).",
|
||||
"exactly %zu values (had %zu).",
|
||||
tag,
|
||||
N,
|
||||
entry.count);
|
||||
@@ -284,7 +293,7 @@ static int VectorTagValue(const android::CameraMetadata& metadata,
|
||||
if (entry.count % N != 0) {
|
||||
HAL_LOGE(
|
||||
"Error: expected metadata tag %d to contain a vector of arrays of "
|
||||
"length %d (had %d entries, which is not divisible by %d).",
|
||||
"length %zu (had %zu entries, which is not divisible by %zu).",
|
||||
tag,
|
||||
N,
|
||||
entry.count,
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "metadata_reader.h"
|
||||
|
||||
// #define LOG_NDEBUG 0
|
||||
#define LOG_TAG "MetadataReader"
|
||||
|
||||
#include "metadata_reader.h"
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <system/camera.h>
|
||||
|
||||
@@ -200,9 +201,9 @@ int MetadataReader::StreamStallDurations(
|
||||
}
|
||||
// Must have a non-negative stall.
|
||||
if (stall.duration < 0) {
|
||||
ALOGE("%s: Invalid stall duration: negative stall %d.",
|
||||
ALOGE("%s: Invalid stall duration: negative stall %lld.",
|
||||
__func__,
|
||||
stall.duration);
|
||||
static_cast<long long>(stall.duration));
|
||||
return -EINVAL;
|
||||
}
|
||||
// TODO(b/31384253): YUV_420_888, RAW10, RAW12, RAW_OPAQUE,
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include <android-base/macros.h>
|
||||
#include <camera/CameraMetadata.h>
|
||||
|
||||
#include "../common.h"
|
||||
#include "types.h"
|
||||
|
||||
namespace default_camera_hal {
|
||||
|
||||
@@ -41,22 +41,22 @@ class Property : public PartialMetadataInterface {
|
||||
};
|
||||
|
||||
virtual int PopulateDynamicFields(
|
||||
android::CameraMetadata* metadata) const override {
|
||||
android::CameraMetadata* /*metadata*/) const override {
|
||||
return 0;
|
||||
};
|
||||
|
||||
virtual int PopulateTemplateRequest(
|
||||
int template_type, android::CameraMetadata* metadata) const override {
|
||||
int /*template_type*/, android::CameraMetadata* /*metadata*/) const override {
|
||||
return 0;
|
||||
};
|
||||
|
||||
virtual bool SupportsRequestValues(
|
||||
const android::CameraMetadata& metadata) const override {
|
||||
const android::CameraMetadata& /*metadata*/) const override {
|
||||
return true;
|
||||
};
|
||||
|
||||
virtual int SetRequestValues(
|
||||
const android::CameraMetadata& metadata) override {
|
||||
const android::CameraMetadata& /*metadata*/) override {
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "../common.h"
|
||||
#include <android-base/macros.h>
|
||||
|
||||
#include "converter_interface.h"
|
||||
|
||||
namespace v4l2_camera_hal {
|
||||
|
||||
@@ -54,7 +54,7 @@ class State : public PartialMetadataInterface {
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
template <typename T>
|
||||
int State<T>::PopulateStaticFields(android::CameraMetadata* metadata) const {
|
||||
int State<T>::PopulateStaticFields(android::CameraMetadata* /*metadata*/) const {
|
||||
HAL_LOG_ENTER();
|
||||
return 0;
|
||||
}
|
||||
@@ -72,21 +72,21 @@ int State<T>::PopulateDynamicFields(android::CameraMetadata* metadata) const {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
int State<T>::PopulateTemplateRequest(int template_type,
|
||||
android::CameraMetadata* metadata) const {
|
||||
int State<T>::PopulateTemplateRequest(int /*template_type*/,
|
||||
android::CameraMetadata* /*metadata*/) const {
|
||||
HAL_LOG_ENTER();
|
||||
return 0;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool State<T>::SupportsRequestValues(
|
||||
const android::CameraMetadata& metadata) const {
|
||||
const android::CameraMetadata& /*metadata*/) const {
|
||||
HAL_LOG_ENTER();
|
||||
return true;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
int State<T>::SetRequestValues(const android::CameraMetadata& metadata) {
|
||||
int State<T>::SetRequestValues(const android::CameraMetadata& /*metadata*/) {
|
||||
HAL_LOG_ENTER();
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "request_tracker.h"
|
||||
|
||||
// #define LOG_NDEBUG 0
|
||||
#define LOG_TAG "RequestTracker"
|
||||
|
||||
#include "request_tracker.h"
|
||||
|
||||
#include <cutils/log.h>
|
||||
|
||||
namespace default_camera_hal {
|
||||
@@ -50,7 +51,7 @@ std::set<camera3_stream_t*> RequestStreams(const CaptureRequest& request) {
|
||||
for (const auto& output_buffer : request.output_buffers) {
|
||||
result.insert(output_buffer.stream);
|
||||
}
|
||||
return std::move(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool RequestTracker::Add(std::shared_ptr<CaptureRequest> request) {
|
||||
@@ -127,7 +128,6 @@ bool RequestTracker::CanAddRequest(const CaptureRequest& request) const {
|
||||
|
||||
// Check that each stream has space
|
||||
// (which implicitly checks if it is configured).
|
||||
bool result = true;
|
||||
for (const auto stream : RequestStreams(request)) {
|
||||
if (StreamFull(stream)) {
|
||||
ALOGE("%s: Stream %p is full.", __func__, stream);
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#include <set>
|
||||
|
||||
#include <hardware/camera3.h>
|
||||
#include <android-base/macros.h>
|
||||
|
||||
#include "capture_request.h"
|
||||
#include "common.h"
|
||||
|
||||
namespace default_camera_hal {
|
||||
|
||||
|
||||
@@ -35,7 +35,11 @@ class RequestTrackerTest : public Test {
|
||||
stream2_.max_buffers = 3;
|
||||
dut_.reset(new RequestTracker());
|
||||
streams_ = {&stream1_, &stream2_};
|
||||
camera3_stream_configuration_t config{static_cast<uint32_t>(streams_.size()), streams_.data(), 0};
|
||||
camera3_stream_configuration_t config{
|
||||
static_cast<uint32_t>(streams_.size()),
|
||||
streams_.data(),
|
||||
0,
|
||||
nullptr};
|
||||
dut_->SetStreamConfiguration(config);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "static_properties.h"
|
||||
|
||||
// #define LOG_NDEBUG 0
|
||||
#define LOG_TAG "StaticProperties"
|
||||
|
||||
#include "static_properties.h"
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <hardware/camera3.h>
|
||||
#include <system/camera.h>
|
||||
@@ -276,11 +277,11 @@ bool StaticProperties::SanityCheckStreamConfiguration(
|
||||
for (size_t i = 0; i < stream_config->num_streams; ++i) {
|
||||
const camera3_stream_t* stream = stream_config->streams[i];
|
||||
if (stream == nullptr) {
|
||||
ALOGE("%s: Stream %d is null", __func__, i);
|
||||
ALOGE("%s: Stream %zu is null", __func__, i);
|
||||
return false;
|
||||
} else if (!IsInputType(stream->stream_type) &&
|
||||
!IsOutputType(stream->stream_type)) {
|
||||
ALOGE("%s: Stream %d type %d is neither an input nor an output type",
|
||||
ALOGE("%s: Stream %zu type %d is neither an input nor an output type",
|
||||
__func__,
|
||||
i,
|
||||
stream->stream_type);
|
||||
@@ -294,7 +295,7 @@ bool StaticProperties::SanityCheckStreamConfiguration(
|
||||
bool StaticProperties::InputStreamsSupported(
|
||||
const camera3_stream_configuration_t* stream_config) {
|
||||
// Find the input stream(s).
|
||||
size_t num_input_streams = 0;
|
||||
int32_t num_input_streams = 0;
|
||||
int input_format = -1;
|
||||
for (size_t i = 0; i < stream_config->num_streams; ++i) {
|
||||
const camera3_stream_t* stream = stream_config->streams[i];
|
||||
@@ -370,10 +371,10 @@ bool StaticProperties::InputStreamsSupported(
|
||||
bool StaticProperties::OutputStreamsSupported(
|
||||
const camera3_stream_configuration_t* stream_config) {
|
||||
// Find and count output streams.
|
||||
size_t num_raw = 0;
|
||||
size_t num_stalling = 0;
|
||||
size_t num_non_stalling = 0;
|
||||
for (int i = 0; i < stream_config->num_streams; ++i) {
|
||||
int32_t num_raw = 0;
|
||||
int32_t num_stalling = 0;
|
||||
int32_t num_non_stalling = 0;
|
||||
for (size_t i = 0; i < stream_config->num_streams; ++i) {
|
||||
const camera3_stream_t* stream = stream_config->streams[i];
|
||||
if (IsOutputType(stream->stream_type)) {
|
||||
// Check that this stream is valid as an output.
|
||||
@@ -413,7 +414,7 @@ bool StaticProperties::OutputStreamsSupported(
|
||||
} else if (num_stalling > max_stalling_output_streams_) {
|
||||
ALOGE(
|
||||
"%s: Requested stream configuration exceeds maximum supported "
|
||||
"stalling output streams %d (requested %d).",
|
||||
"stalling output streams %d (requested %u).",
|
||||
__func__,
|
||||
max_stalling_output_streams_,
|
||||
num_stalling);
|
||||
|
||||
@@ -94,10 +94,12 @@ class StaticPropertiesTest : public Test {
|
||||
} else if (input) {
|
||||
type = CAMERA3_STREAM_INPUT;
|
||||
}
|
||||
return {static_cast<int>(type),
|
||||
static_cast<uint32_t>(width),
|
||||
static_cast<uint32_t>(height),
|
||||
static_cast<int>(format)};
|
||||
camera3_stream_t stream;
|
||||
stream.stream_type = type;
|
||||
stream.width = width;
|
||||
stream.height = height;
|
||||
stream.format = format;
|
||||
return stream;
|
||||
}
|
||||
|
||||
void ExpectConfigurationSupported(std::vector<camera3_stream_t>& streams,
|
||||
@@ -109,7 +111,8 @@ class StaticPropertiesTest : public Test {
|
||||
camera3_stream_configuration_t config = {
|
||||
static_cast<uint32_t>(stream_addresses.size()),
|
||||
stream_addresses.data(),
|
||||
CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
|
||||
CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE,
|
||||
nullptr};
|
||||
PrepareDefaultDUT();
|
||||
EXPECT_EQ(dut_->StreamConfigurationSupported(&config), expected);
|
||||
}
|
||||
@@ -435,7 +438,7 @@ TEST_F(StaticPropertiesTest, ConfigureNull) {
|
||||
TEST_F(StaticPropertiesTest, ConfigureEmptyStreams) {
|
||||
std::vector<camera3_stream_t*> streams(1);
|
||||
camera3_stream_configuration_t config = {
|
||||
0, streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
|
||||
0, streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE, nullptr};
|
||||
PrepareDefaultDUT();
|
||||
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
|
||||
}
|
||||
@@ -443,7 +446,10 @@ TEST_F(StaticPropertiesTest, ConfigureEmptyStreams) {
|
||||
TEST_F(StaticPropertiesTest, ConfigureNullStreams) {
|
||||
std::vector<camera3_stream_t*> streams(2, nullptr);
|
||||
camera3_stream_configuration_t config = {
|
||||
static_cast<uint32_t>(streams.size()), streams.data(), CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
|
||||
static_cast<uint32_t>(streams.size()),
|
||||
streams.data(),
|
||||
CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE,
|
||||
nullptr};
|
||||
PrepareDefaultDUT();
|
||||
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
|
||||
}
|
||||
@@ -451,7 +457,7 @@ TEST_F(StaticPropertiesTest, ConfigureNullStreams) {
|
||||
TEST_F(StaticPropertiesTest, ConfigureNullStreamVector) {
|
||||
// Even if the camera claims to have multiple streams, check for null.
|
||||
camera3_stream_configuration_t config = {
|
||||
3, nullptr, CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE};
|
||||
3, nullptr, CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE, nullptr};
|
||||
PrepareDefaultDUT();
|
||||
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
|
||||
}
|
||||
@@ -616,7 +622,8 @@ TEST_F(StaticPropertiesTest, ConfigureBadOperationMode) {
|
||||
camera3_stream_configuration_t config = {
|
||||
1,
|
||||
&stream_address,
|
||||
99 // Not a valid operation mode.
|
||||
99, // Not a valid operation mode.
|
||||
nullptr
|
||||
};
|
||||
PrepareDefaultDUT();
|
||||
EXPECT_FALSE(dut_->StreamConfigurationSupported(&config));
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "StreamFormat"
|
||||
|
||||
#include "stream_format.h"
|
||||
|
||||
#include <linux/videodev2.h>
|
||||
@@ -41,8 +44,7 @@ StreamFormat::StreamFormat(int format, uint32_t width, uint32_t height)
|
||||
v4l2_pixel_format_(StreamFormat::HalToV4L2PixelFormat(format)),
|
||||
width_(width),
|
||||
height_(height),
|
||||
bytes_per_line_(0),
|
||||
min_buffer_size_(0) {}
|
||||
bytes_per_line_(0) {}
|
||||
|
||||
StreamFormat::StreamFormat(const v4l2_format& format)
|
||||
: type_(format.type),
|
||||
@@ -50,16 +52,14 @@ StreamFormat::StreamFormat(const v4l2_format& format)
|
||||
v4l2_pixel_format_(format.fmt.pix.pixelformat),
|
||||
width_(format.fmt.pix.width),
|
||||
height_(format.fmt.pix.height),
|
||||
bytes_per_line_(format.fmt.pix.bytesperline),
|
||||
min_buffer_size_(format.fmt.pix.sizeimage) {}
|
||||
bytes_per_line_(format.fmt.pix.bytesperline) {}
|
||||
|
||||
StreamFormat::StreamFormat(const arc::SupportedFormat& format)
|
||||
: type_(V4L2_BUF_TYPE_VIDEO_CAPTURE),
|
||||
v4l2_pixel_format_(format.fourcc),
|
||||
width_(format.width),
|
||||
height_(format.height),
|
||||
bytes_per_line_(0),
|
||||
min_buffer_size_(0) {}
|
||||
bytes_per_line_(0) {}
|
||||
|
||||
void StreamFormat::FillFormatRequest(v4l2_format* format) const {
|
||||
memset(format, 0, sizeof(*format));
|
||||
|
||||
@@ -78,7 +78,6 @@ class StreamFormat {
|
||||
uint32_t width_;
|
||||
uint32_t height_;
|
||||
uint32_t bytes_per_line_;
|
||||
uint32_t min_buffer_size_;
|
||||
};
|
||||
|
||||
} // namespace v4l2_camera_hal
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "V4L2Camera"
|
||||
|
||||
#include "v4l2_camera.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
@@ -36,18 +39,6 @@
|
||||
|
||||
namespace v4l2_camera_hal {
|
||||
|
||||
// Helper function for managing metadata.
|
||||
static std::vector<int32_t> getMetadataKeys(const camera_metadata_t* metadata) {
|
||||
std::vector<int32_t> keys;
|
||||
size_t num_entries = get_camera_metadata_entry_count(metadata);
|
||||
for (size_t i = 0; i < num_entries; ++i) {
|
||||
camera_metadata_ro_entry_t entry;
|
||||
get_camera_metadata_ro_entry(metadata, i, &entry);
|
||||
keys.push_back(entry.tag);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
V4L2Camera* V4L2Camera::NewV4L2Camera(int id, const std::string path) {
|
||||
HAL_LOG_ENTER();
|
||||
|
||||
@@ -73,12 +64,12 @@ V4L2Camera::V4L2Camera(int id,
|
||||
: default_camera_hal::Camera(id),
|
||||
device_(std::move(v4l2_wrapper)),
|
||||
metadata_(std::move(metadata)),
|
||||
max_input_streams_(0),
|
||||
max_output_streams_({{0, 0, 0}}),
|
||||
buffer_enqueuer_(new FunctionThread(
|
||||
std::bind(&V4L2Camera::enqueueRequestBuffers, this))),
|
||||
buffer_dequeuer_(new FunctionThread(
|
||||
std::bind(&V4L2Camera::dequeueRequestBuffers, this))) {
|
||||
std::bind(&V4L2Camera::dequeueRequestBuffers, this))),
|
||||
max_input_streams_(0),
|
||||
max_output_streams_({{0, 0, 0}}) {
|
||||
HAL_LOG_ENTER();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
// Modified from hardware/libhardware/modules/camera/CameraHAL.cpp
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "V4L2CameraHAL"
|
||||
|
||||
#include "v4l2_camera_hal.h"
|
||||
|
||||
#include <dirent.h>
|
||||
@@ -112,13 +115,13 @@ V4L2CameraHAL::~V4L2CameraHAL() {
|
||||
}
|
||||
|
||||
int V4L2CameraHAL::getNumberOfCameras() {
|
||||
HAL_LOGV("returns %d", mCameras.size());
|
||||
HAL_LOGV("returns %zu", mCameras.size());
|
||||
return mCameras.size();
|
||||
}
|
||||
|
||||
int V4L2CameraHAL::getCameraInfo(int id, camera_info_t* info) {
|
||||
HAL_LOG_ENTER();
|
||||
if (id < 0 || id >= mCameras.size()) {
|
||||
if (id < 0 || static_cast<size_t>(id) >= mCameras.size()) {
|
||||
return -EINVAL;
|
||||
}
|
||||
// TODO(b/29185945): Hotplugging: return -EINVAL if unplugged.
|
||||
@@ -131,22 +134,22 @@ int V4L2CameraHAL::setCallbacks(const camera_module_callbacks_t* callbacks) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void V4L2CameraHAL::getVendorTagOps(vendor_tag_ops_t* ops) {
|
||||
void V4L2CameraHAL::getVendorTagOps(vendor_tag_ops_t* /*ops*/) {
|
||||
HAL_LOG_ENTER();
|
||||
// No vendor ops for this HAL. From <hardware/camera_common.h>:
|
||||
// "leave ops unchanged if no vendor tags are defined."
|
||||
}
|
||||
|
||||
int V4L2CameraHAL::openLegacy(const hw_module_t* module,
|
||||
const char* id,
|
||||
uint32_t halVersion,
|
||||
hw_device_t** device) {
|
||||
int V4L2CameraHAL::openLegacy(const hw_module_t* /*module*/,
|
||||
const char* /*id*/,
|
||||
uint32_t /*halVersion*/,
|
||||
hw_device_t** /*device*/) {
|
||||
HAL_LOG_ENTER();
|
||||
// Not supported.
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int V4L2CameraHAL::setTorchMode(const char* camera_id, bool enabled) {
|
||||
int V4L2CameraHAL::setTorchMode(const char* /*camera_id*/, bool /*enabled*/) {
|
||||
HAL_LOG_ENTER();
|
||||
// TODO(b/29158098): HAL is required to respond appropriately if
|
||||
// the desired camera actually does support flash.
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "V4L2MetadataFactory"
|
||||
|
||||
#include "v4l2_metadata_factory.h"
|
||||
|
||||
#include <camera/CameraMetadata.h>
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "V4L2Wrapper"
|
||||
|
||||
#include "v4l2_wrapper.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
Reference in New Issue
Block a user