mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Camera: add webcam HAL@3.6 support
First CL to setup webcam HAL to support HIDL camera device 3.6. Follow up CL will add actual offline processing capability. Test: TestingCamera.apk Bug: 135142453 Change-Id: Ifcd1b22f42d08b0fa5dc6039125c1d979b8104c2
This commit is contained in:
@@ -105,7 +105,7 @@ protected:
|
||||
// Calls into virtual member function. Do not use it in constructor
|
||||
status_t initCameraCharacteristics();
|
||||
// Init available capabilities keys
|
||||
status_t initAvailableCapabilities(
|
||||
virtual status_t initAvailableCapabilities(
|
||||
::android::hardware::camera::common::V1_0::helper::CameraMetadata*);
|
||||
// Init non-device dependent keys
|
||||
virtual status_t initDefaultCharsKeys(
|
||||
|
||||
66
camera/device/3.6/default/Android.bp
Normal file
66
camera/device/3.6/default/Android.bp
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Copyright (C) 2020 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
cc_library_headers {
|
||||
name: "camera.device@3.6-external-impl_headers",
|
||||
vendor: true,
|
||||
export_include_dirs: ["include/ext_device_v3_6_impl"]
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "camera.device@3.6-external-impl",
|
||||
defaults: ["hidl_defaults"],
|
||||
proprietary: true,
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"ExternalCameraDevice.cpp",
|
||||
"ExternalCameraDeviceSession.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libhidlbase",
|
||||
"libutils",
|
||||
"libcutils",
|
||||
"camera.device@3.2-impl",
|
||||
"camera.device@3.3-impl",
|
||||
"camera.device@3.4-external-impl",
|
||||
"camera.device@3.5-external-impl",
|
||||
"android.hardware.camera.device@3.2",
|
||||
"android.hardware.camera.device@3.3",
|
||||
"android.hardware.camera.device@3.4",
|
||||
"android.hardware.camera.device@3.5",
|
||||
"android.hardware.camera.device@3.6",
|
||||
"android.hardware.camera.provider@2.4",
|
||||
"android.hardware.graphics.mapper@2.0",
|
||||
"android.hardware.graphics.mapper@3.0",
|
||||
"android.hardware.graphics.mapper@4.0",
|
||||
"liblog",
|
||||
"libhardware",
|
||||
"libcamera_metadata",
|
||||
"libfmq",
|
||||
"libsync",
|
||||
"libyuv",
|
||||
"libjpeg",
|
||||
"libexif",
|
||||
"libtinyxml2"
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.camera.common@1.0-helper",
|
||||
],
|
||||
local_include_dirs: ["include/ext_device_v3_6_impl"],
|
||||
export_shared_lib_headers: [
|
||||
"libfmq",
|
||||
],
|
||||
}
|
||||
91
camera/device/3.6/default/ExternalCameraDevice.cpp
Normal file
91
camera/device/3.6/default/ExternalCameraDevice.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "ExtCamDev@3.6"
|
||||
//#define LOG_NDEBUG 0
|
||||
#include <log/log.h>
|
||||
|
||||
#include "ExternalCameraDevice_3_6.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace device {
|
||||
namespace V3_6 {
|
||||
namespace implementation {
|
||||
|
||||
ExternalCameraDevice::ExternalCameraDevice(
|
||||
const std::string& cameraId, const ExternalCameraConfig& cfg) :
|
||||
V3_5::implementation::ExternalCameraDevice(cameraId, cfg) {}
|
||||
|
||||
ExternalCameraDevice::~ExternalCameraDevice() {}
|
||||
|
||||
sp<V3_4::implementation::ExternalCameraDeviceSession> ExternalCameraDevice::createSession(
|
||||
const sp<V3_2::ICameraDeviceCallback>& cb,
|
||||
const ExternalCameraConfig& cfg,
|
||||
const std::vector<SupportedV4L2Format>& sortedFormats,
|
||||
const CroppingType& croppingType,
|
||||
const common::V1_0::helper::CameraMetadata& chars,
|
||||
const std::string& cameraId,
|
||||
unique_fd v4l2Fd) {
|
||||
return new ExternalCameraDeviceSession(
|
||||
cb, cfg, sortedFormats, croppingType, chars, cameraId, std::move(v4l2Fd));
|
||||
}
|
||||
|
||||
#define UPDATE(tag, data, size) \
|
||||
do { \
|
||||
if (metadata->update((tag), (data), (size))) { \
|
||||
ALOGE("Update " #tag " failed!"); \
|
||||
return -EINVAL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
status_t ExternalCameraDevice::initAvailableCapabilities(
|
||||
::android::hardware::camera::common::V1_0::helper::CameraMetadata* metadata) {
|
||||
status_t res =
|
||||
V3_4::implementation::ExternalCameraDevice::initAvailableCapabilities(metadata);
|
||||
|
||||
if (res != OK) {
|
||||
return res;
|
||||
}
|
||||
|
||||
camera_metadata_entry caps = metadata->find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES);
|
||||
std::vector<uint8_t> availableCapabilities;
|
||||
|
||||
for (size_t i = 0; i < caps.count; i++) {
|
||||
uint8_t capability = caps.data.u8[i];
|
||||
availableCapabilities.push_back(capability);
|
||||
}
|
||||
|
||||
// Add OFFLINE_PROCESSING capability to device 3.6
|
||||
availableCapabilities.push_back(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING);
|
||||
|
||||
UPDATE(ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
|
||||
availableCapabilities.data(),
|
||||
availableCapabilities.size());
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#undef UPDATE
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V3_6
|
||||
} // namespace device
|
||||
} // namespace camera
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
100
camera/device/3.6/default/ExternalCameraDeviceSession.cpp
Normal file
100
camera/device/3.6/default/ExternalCameraDeviceSession.cpp
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "ExtCamDevSsn@3.6"
|
||||
#include <android/log.h>
|
||||
|
||||
#include <utils/Trace.h>
|
||||
#include "ExternalCameraDeviceSession.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace device {
|
||||
namespace V3_6 {
|
||||
namespace implementation {
|
||||
|
||||
ExternalCameraDeviceSession::ExternalCameraDeviceSession(
|
||||
const sp<V3_2::ICameraDeviceCallback>& callback,
|
||||
const ExternalCameraConfig& cfg,
|
||||
const std::vector<SupportedV4L2Format>& sortedFormats,
|
||||
const CroppingType& croppingType,
|
||||
const common::V1_0::helper::CameraMetadata& chars,
|
||||
const std::string& cameraId,
|
||||
unique_fd v4l2Fd) :
|
||||
V3_5::implementation::ExternalCameraDeviceSession(
|
||||
callback, cfg, sortedFormats, croppingType, chars, cameraId, std::move(v4l2Fd)) {
|
||||
}
|
||||
|
||||
ExternalCameraDeviceSession::~ExternalCameraDeviceSession() {}
|
||||
|
||||
|
||||
Return<void> ExternalCameraDeviceSession::configureStreams_3_6(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
ICameraDeviceSession::configureStreams_3_6_cb _hidl_cb) {
|
||||
V3_2::StreamConfiguration config_v32;
|
||||
V3_3::HalStreamConfiguration outStreams_v33;
|
||||
V3_6::HalStreamConfiguration outStreams;
|
||||
const V3_4::StreamConfiguration& requestedConfiguration_3_4 = requestedConfiguration.v3_4;
|
||||
Mutex::Autolock _il(mInterfaceLock);
|
||||
|
||||
config_v32.operationMode = requestedConfiguration_3_4.operationMode;
|
||||
config_v32.streams.resize(requestedConfiguration_3_4.streams.size());
|
||||
uint32_t blobBufferSize = 0;
|
||||
int numStallStream = 0;
|
||||
for (size_t i = 0; i < config_v32.streams.size(); i++) {
|
||||
config_v32.streams[i] = requestedConfiguration_3_4.streams[i].v3_2;
|
||||
if (config_v32.streams[i].format == PixelFormat::BLOB) {
|
||||
blobBufferSize = requestedConfiguration_3_4.streams[i].bufferSize;
|
||||
numStallStream++;
|
||||
}
|
||||
}
|
||||
|
||||
// Fail early if there are multiple BLOB streams
|
||||
if (numStallStream > kMaxStallStream) {
|
||||
ALOGE("%s: too many stall streams (expect <= %d, got %d)", __FUNCTION__,
|
||||
kMaxStallStream, numStallStream);
|
||||
_hidl_cb(Status::ILLEGAL_ARGUMENT, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Status status = configureStreams(config_v32, &outStreams_v33, blobBufferSize);
|
||||
|
||||
outStreams.streams.resize(outStreams_v33.streams.size());
|
||||
for (size_t i = 0; i < outStreams.streams.size(); i++) {
|
||||
outStreams.streams[i].v3_4.v3_3 = outStreams_v33.streams[i];
|
||||
// TODO: implement it later
|
||||
outStreams.streams[i].supportOffline = false;
|
||||
}
|
||||
_hidl_cb(status, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> ExternalCameraDeviceSession::switchToOffline(
|
||||
const hidl_vec<int32_t>& streamsToKeep,
|
||||
ICameraDeviceSession::switchToOffline_cb _hidl_cb) {
|
||||
// TODO: implement this
|
||||
(void) streamsToKeep;
|
||||
(void) _hidl_cb;
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V3_6
|
||||
} // namespace device
|
||||
} // namespace camera
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
1
camera/device/3.6/default/OWNERS
Normal file
1
camera/device/3.6/default/OWNERS
Normal file
@@ -0,0 +1 @@
|
||||
include platform/frameworks/av:/camera/OWNERS
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_CAMERA_DEVICE_V3_6_EXTCAMERADEVICE3SESSION_H
|
||||
#define ANDROID_HARDWARE_CAMERA_DEVICE_V3_6_EXTCAMERADEVICE3SESSION_H
|
||||
|
||||
#include <android/hardware/camera/device/3.5/ICameraDeviceCallback.h>
|
||||
#include <android/hardware/camera/device/3.6/ICameraDeviceSession.h>
|
||||
#include <../../3.5/default/include/ext_device_v3_5_impl/ExternalCameraDeviceSession.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace device {
|
||||
namespace V3_6 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::camera::device::V3_2::BufferCache;
|
||||
using ::android::hardware::camera::device::V3_2::CameraMetadata;
|
||||
using ::android::hardware::camera::device::V3_2::CaptureRequest;
|
||||
using ::android::hardware::camera::device::V3_2::CaptureResult;
|
||||
using ::android::hardware::camera::device::V3_5::ICameraDeviceCallback;
|
||||
using ::android::hardware::camera::device::V3_2::RequestTemplate;
|
||||
using ::android::hardware::camera::device::V3_2::Stream;
|
||||
using ::android::hardware::camera::device::V3_5::StreamConfiguration;
|
||||
using ::android::hardware::camera::device::V3_6::ICameraDeviceSession;
|
||||
using ::android::hardware::camera::common::V1_0::Status;
|
||||
using ::android::hardware::camera::external::common::ExternalCameraConfig;
|
||||
using ::android::hardware::graphics::common::V1_0::PixelFormat;
|
||||
using ::android::hardware::MQDescriptorSync;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
using ::android::Mutex;
|
||||
using ::android::base::unique_fd;
|
||||
|
||||
using ::android::hardware::camera::device::V3_4::implementation::SupportedV4L2Format;
|
||||
using ::android::hardware::camera::device::V3_4::implementation::CroppingType;
|
||||
|
||||
struct ExternalCameraDeviceSession : public V3_5::implementation::ExternalCameraDeviceSession {
|
||||
|
||||
ExternalCameraDeviceSession(const sp<V3_2::ICameraDeviceCallback>&,
|
||||
const ExternalCameraConfig& cfg,
|
||||
const std::vector<SupportedV4L2Format>& sortedFormats,
|
||||
const CroppingType& croppingType,
|
||||
const common::V1_0::helper::CameraMetadata& chars,
|
||||
const std::string& cameraId,
|
||||
unique_fd v4l2Fd);
|
||||
virtual ~ExternalCameraDeviceSession();
|
||||
|
||||
// Retrieve the HIDL interface, split into its own class to avoid inheritance issues when
|
||||
// dealing with minor version revs and simultaneous implementation and interface inheritance
|
||||
virtual sp<V3_4::ICameraDeviceSession> getInterface() override {
|
||||
return new TrampolineSessionInterface_3_6(this);
|
||||
}
|
||||
|
||||
static Status isStreamCombinationSupported(const V3_2::StreamConfiguration& config,
|
||||
const std::vector<SupportedV4L2Format>& supportedFormats,
|
||||
const ExternalCameraConfig& devCfg) {
|
||||
return V3_4::implementation::ExternalCameraDeviceSession::isStreamCombinationSupported(
|
||||
config, supportedFormats, devCfg);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Methods from v3.5 and earlier will trampoline to inherited implementation
|
||||
Return<void> configureStreams_3_6(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
ICameraDeviceSession::configureStreams_3_6_cb _hidl_cb);
|
||||
|
||||
Return<void> switchToOffline(
|
||||
const hidl_vec<int32_t>& streamsToKeep,
|
||||
ICameraDeviceSession::switchToOffline_cb _hidl_cb);
|
||||
|
||||
private:
|
||||
|
||||
struct TrampolineSessionInterface_3_6 : public ICameraDeviceSession {
|
||||
TrampolineSessionInterface_3_6(sp<ExternalCameraDeviceSession> parent) :
|
||||
mParent(parent) {}
|
||||
|
||||
virtual Return<void> constructDefaultRequestSettings(
|
||||
RequestTemplate type,
|
||||
V3_3::ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) override {
|
||||
return mParent->constructDefaultRequestSettings(type, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams(
|
||||
const V3_2::StreamConfiguration& requestedConfiguration,
|
||||
V3_3::ICameraDeviceSession::configureStreams_cb _hidl_cb) override {
|
||||
return mParent->configureStreams(requestedConfiguration, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> processCaptureRequest(const hidl_vec<V3_2::CaptureRequest>& requests,
|
||||
const hidl_vec<V3_2::BufferCache>& cachesToRemove,
|
||||
V3_3::ICameraDeviceSession::processCaptureRequest_cb _hidl_cb) override {
|
||||
return mParent->processCaptureRequest(requests, cachesToRemove, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> getCaptureRequestMetadataQueue(
|
||||
V3_3::ICameraDeviceSession::getCaptureRequestMetadataQueue_cb _hidl_cb) override {
|
||||
return mParent->getCaptureRequestMetadataQueue(_hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> getCaptureResultMetadataQueue(
|
||||
V3_3::ICameraDeviceSession::getCaptureResultMetadataQueue_cb _hidl_cb) override {
|
||||
return mParent->getCaptureResultMetadataQueue(_hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<Status> flush() override {
|
||||
return mParent->flush();
|
||||
}
|
||||
|
||||
virtual Return<void> close() override {
|
||||
return mParent->close();
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams_3_3(
|
||||
const V3_2::StreamConfiguration& requestedConfiguration,
|
||||
configureStreams_3_3_cb _hidl_cb) override {
|
||||
return mParent->configureStreams_3_3(requestedConfiguration, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams_3_4(
|
||||
const V3_4::StreamConfiguration& requestedConfiguration,
|
||||
configureStreams_3_4_cb _hidl_cb) override {
|
||||
return mParent->configureStreams_3_4(requestedConfiguration, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> processCaptureRequest_3_4(const hidl_vec<V3_4::CaptureRequest>& requests,
|
||||
const hidl_vec<V3_2::BufferCache>& cachesToRemove,
|
||||
ICameraDeviceSession::processCaptureRequest_3_4_cb _hidl_cb) override {
|
||||
return mParent->processCaptureRequest_3_4(requests, cachesToRemove, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams_3_5(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
configureStreams_3_5_cb _hidl_cb) override {
|
||||
return mParent->configureStreams_3_5(requestedConfiguration, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> signalStreamFlush(
|
||||
const hidl_vec<int32_t>& requests,
|
||||
uint32_t streamConfigCounter) override {
|
||||
return mParent->signalStreamFlush(requests, streamConfigCounter);
|
||||
}
|
||||
|
||||
virtual Return<void> isReconfigurationRequired(const V3_2::CameraMetadata& oldSessionParams,
|
||||
const V3_2::CameraMetadata& newSessionParams,
|
||||
ICameraDeviceSession::isReconfigurationRequired_cb _hidl_cb) override {
|
||||
return mParent->isReconfigurationRequired(oldSessionParams, newSessionParams, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams_3_6(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
configureStreams_3_6_cb _hidl_cb) override {
|
||||
return mParent->configureStreams_3_6(requestedConfiguration, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> switchToOffline(
|
||||
const hidl_vec<int32_t>& streamsToKeep,
|
||||
switchToOffline_cb _hidl_cb) override {
|
||||
return mParent->switchToOffline(streamsToKeep, _hidl_cb);
|
||||
}
|
||||
|
||||
private:
|
||||
sp<ExternalCameraDeviceSession> mParent;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V3_6
|
||||
} // namespace device
|
||||
} // namespace camera
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_CAMERA_DEVICE_V3_6_EXTCAMERADEVICE3SESSION_H
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_CAMERA_DEVICE_V3_6_EXTCAMERADEVICE_H
|
||||
#define ANDROID_HARDWARE_CAMERA_DEVICE_V3_6_EXTCAMERADEVICE_H
|
||||
|
||||
#include "ExternalCameraDeviceSession.h"
|
||||
#include <../../../../3.5/default/include/ext_device_v3_5_impl/ExternalCameraDevice_3_5.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace device {
|
||||
namespace V3_6 {
|
||||
namespace implementation {
|
||||
|
||||
using namespace ::android::hardware::camera::device;
|
||||
using ::android::hardware::camera::device::V3_5::ICameraDevice;
|
||||
using ::android::hardware::camera::common::V1_0::CameraResourceCost;
|
||||
using ::android::hardware::camera::common::V1_0::TorchMode;
|
||||
using ::android::hardware::camera::common::V1_0::Status;
|
||||
using ::android::hardware::camera::external::common::ExternalCameraConfig;
|
||||
using ::android::hardware::camera::external::common::Size;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
/*
|
||||
* The camera device HAL implementation is opened lazily (via the open call)
|
||||
*/
|
||||
struct ExternalCameraDevice : public V3_5::implementation::ExternalCameraDevice {
|
||||
|
||||
// Called by external camera provider HAL.
|
||||
// Provider HAL must ensure the uniqueness of CameraDevice object per cameraId, or there could
|
||||
// be multiple CameraDevice trying to access the same physical camera. Also, provider will have
|
||||
// to keep track of all CameraDevice objects in order to notify CameraDevice when the underlying
|
||||
// camera is detached.
|
||||
ExternalCameraDevice(const std::string& cameraId, const ExternalCameraConfig& cfg);
|
||||
virtual ~ExternalCameraDevice();
|
||||
|
||||
protected:
|
||||
virtual sp<V3_4::implementation::ExternalCameraDeviceSession> createSession(
|
||||
const sp<V3_2::ICameraDeviceCallback>&,
|
||||
const ExternalCameraConfig& cfg,
|
||||
const std::vector<SupportedV4L2Format>& sortedFormats,
|
||||
const CroppingType& croppingType,
|
||||
const common::V1_0::helper::CameraMetadata& chars,
|
||||
const std::string& cameraId,
|
||||
unique_fd v4l2Fd) override;
|
||||
|
||||
virtual status_t initAvailableCapabilities(
|
||||
::android::hardware::camera::common::V1_0::helper::CameraMetadata*) override;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V3_6
|
||||
} // namespace device
|
||||
} // namespace camera
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_CAMERA_DEVICE_V3_6_EXTCAMERADEVICE_H
|
||||
@@ -49,6 +49,7 @@ cc_library_shared {
|
||||
"android.hardware.camera.device@3.3",
|
||||
"android.hardware.camera.device@3.4",
|
||||
"android.hardware.camera.device@3.5",
|
||||
"android.hardware.camera.device@3.6",
|
||||
"android.hardware.camera.provider@2.4",
|
||||
"android.hardware.graphics.mapper@2.0",
|
||||
"android.hardware.graphics.mapper@3.0",
|
||||
@@ -60,6 +61,7 @@ cc_library_shared {
|
||||
"camera.device@3.4-impl",
|
||||
"camera.device@3.5-external-impl",
|
||||
"camera.device@3.5-impl",
|
||||
"camera.device@3.6-external-impl",
|
||||
"libcamera_metadata",
|
||||
"libcutils",
|
||||
"libhardware",
|
||||
@@ -73,7 +75,8 @@ cc_library_shared {
|
||||
],
|
||||
header_libs: [
|
||||
"camera.device@3.4-external-impl_headers",
|
||||
"camera.device@3.5-external-impl_headers"
|
||||
"camera.device@3.5-external-impl_headers",
|
||||
"camera.device@3.6-external-impl_headers"
|
||||
],
|
||||
export_include_dirs: ["."],
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "ExternalCameraProviderImpl_2_4.h"
|
||||
#include "ExternalCameraDevice_3_4.h"
|
||||
#include "ExternalCameraDevice_3_5.h"
|
||||
#include "ExternalCameraDevice_3_6.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
@@ -73,6 +74,7 @@ ExternalCameraProviderImpl_2_4::ExternalCameraProviderImpl_2_4() :
|
||||
switch(mPreferredHal3MinorVersion) {
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
// OK
|
||||
break;
|
||||
default:
|
||||
@@ -171,6 +173,12 @@ Return<void> ExternalCameraProviderImpl_2_4::getCameraDeviceInterface_V3_x(
|
||||
cameraId, mCfg);
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
ALOGV("Constructing v3.6 external camera device");
|
||||
deviceImpl = new device::V3_6::implementation::ExternalCameraDevice(
|
||||
cameraId, mCfg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ALOGE("%s: Unknown HAL minor version %d!", __FUNCTION__, mPreferredHal3MinorVersion);
|
||||
_hidl_cb(Status::INTERNAL_ERROR, nullptr);
|
||||
@@ -202,7 +210,9 @@ void ExternalCameraProviderImpl_2_4::addExternalCamera(const char* devName) {
|
||||
ALOGI("ExtCam: adding %s to External Camera HAL!", devName);
|
||||
Mutex::Autolock _l(mLock);
|
||||
std::string deviceName;
|
||||
if (mPreferredHal3MinorVersion == 5) {
|
||||
if (mPreferredHal3MinorVersion == 6) {
|
||||
deviceName = std::string("device@3.6/external/") + devName;
|
||||
} else if (mPreferredHal3MinorVersion == 5) {
|
||||
deviceName = std::string("device@3.5/external/") + devName;
|
||||
} else {
|
||||
deviceName = std::string("device@3.4/external/") + devName;
|
||||
@@ -249,7 +259,9 @@ void ExternalCameraProviderImpl_2_4::deviceAdded(const char* devName) {
|
||||
void ExternalCameraProviderImpl_2_4::deviceRemoved(const char* devName) {
|
||||
Mutex::Autolock _l(mLock);
|
||||
std::string deviceName;
|
||||
if (mPreferredHal3MinorVersion == 5) {
|
||||
if (mPreferredHal3MinorVersion == 6) {
|
||||
deviceName = std::string("device@3.6/external/") + devName;
|
||||
} else if (mPreferredHal3MinorVersion == 5) {
|
||||
deviceName = std::string("device@3.5/external/") + devName;
|
||||
} else {
|
||||
deviceName = std::string("device@3.4/external/") + devName;
|
||||
|
||||
Reference in New Issue
Block a user