Revert "Revert "Revert "Extend EVS interfaces and data types"""
This reverts commit 47b45af32cdea1788a1fd3e316f97d89aeddac2b.
diff --git a/automotive/evs/1.1/default/EvsCamera.cpp b/automotive/evs/1.1/default/EvsCamera.cpp
index 5ba753d..2d55566 100644
--- a/automotive/evs/1.1/default/EvsCamera.cpp
+++ b/automotive/evs/1.1/default/EvsCamera.cpp
@@ -40,21 +40,28 @@
const unsigned MAX_BUFFERS_IN_FLIGHT = 100;
-EvsCamera::EvsCamera(const char *id,
- unique_ptr<ConfigManager::CameraInfo> &camInfo) :
+EvsCamera::EvsCamera(const char *id) :
mFramesAllowed(0),
mFramesInUse(0),
- mStreamState(STOPPED),
- mCameraInfo(camInfo) {
+ mStreamState(STOPPED) {
ALOGD("EvsCamera instantiated");
- /* set a camera id */
- mDescription.v1.cameraId = id;
+ mDescription.cameraId = id;
- /* set camera metadata */
- mDescription.metadata.setToExternal((uint8_t *)camInfo->characteristics,
- get_camera_metadata_size(camInfo->characteristics));
+ // Set up dummy data for testing
+ if (mDescription.cameraId == kCameraName_Backup) {
+ mWidth = 640; // full NTSC/VGA
+ mHeight = 480; // full NTSC/VGA
+ mDescription.vendorFlags = 0xFFFFFFFF; // Arbitrary value
+ } else {
+ mWidth = 320; // 1/2 NTSC/VGA
+ mHeight = 240; // 1/2 NTSC/VGA
+ }
+
+ mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
+ mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE |
+ GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY;
}
@@ -102,7 +109,7 @@
ALOGD("getCameraInfo");
// Send back our self description
- _hidl_cb(mDescription.v1);
+ _hidl_cb(mDescription);
return Void();
}
@@ -187,7 +194,7 @@
// Block outside the mutex until the "stop" flag has been acknowledged
// We won't send any more frames, but the client might still get some already in flight
- ALOGD("Waiting for stream thread to end...");
+ ALOGD("Waiting for stream thread to end..");
lock.unlock();
mCaptureThread.join();
lock.lock();
@@ -231,15 +238,6 @@
// Methods from ::android::hardware::automotive::evs::V1_1::IEvsCamera follow.
-Return<void> EvsCamera::getCameraInfo_1_1(getCameraInfo_1_1_cb _hidl_cb) {
- ALOGD("getCameraInfo_1_1");
-
- // Send back our self description
- _hidl_cb(mDescription);
- return Void();
-}
-
-
Return<EvsResult> EvsCamera::doneWithFrame_1_1(const BufferDesc_1_1& bufDesc) {
std::lock_guard <std::mutex> lock(mAccessLock);
returnBuffer(bufDesc.bufferId, bufDesc.buffer.nativeHandle);
@@ -280,29 +278,8 @@
}
-Return<void> EvsCamera::getParameterList(getParameterList_cb _hidl_cb) {
- hidl_vec<CameraParam> hidlCtrls;
- hidlCtrls.resize(mCameraInfo->controls.size());
- unsigned idx = 0;
- for (auto& [cid, cfg] : mCameraInfo->controls) {
- hidlCtrls[idx++] = cid;
- }
-
- _hidl_cb(hidlCtrls);
- return Void();
-}
-
-
-Return<void> EvsCamera::getIntParameterRange(CameraParam id,
- getIntParameterRange_cb _hidl_cb) {
- auto range = mCameraInfo->controls[id];
- _hidl_cb(get<0>(range), get<1>(range), get<2>(range));
- return Void();
-}
-
-
-Return<void> EvsCamera::setIntParameter(CameraParam id, int32_t value,
- setIntParameter_cb _hidl_cb) {
+Return<void> EvsCamera::setParameter(CameraParam id, int32_t value,
+ setParameter_cb _hidl_cb) {
// Default implementation does not support this.
(void)id;
(void)value;
@@ -311,8 +288,7 @@
}
-Return<void> EvsCamera::getIntParameter(CameraParam id,
- getIntParameter_cb _hidl_cb) {
+Return<void> EvsCamera::getParameter(CameraParam id, getParameter_cb _hidl_cb) {
// Default implementation does not support this.
(void)id;
_hidl_cb(EvsResult::INVALID_ARG, 0);
@@ -495,7 +471,9 @@
fillTestFrame(newBuffer);
// Issue the (asynchronous) callback to the client -- can't be holding the lock
- auto result = mStream->deliverFrame_1_1(newBuffer);
+ EvsEvent event;
+ event.buffer(newBuffer);
+ auto result = mStream->notifyEvent(event);
if (result.isOk()) {
ALOGD("Delivered %p as id %d",
newBuffer.buffer.nativeHandle.getNativeHandle(), newBuffer.bufferId);
@@ -528,8 +506,10 @@
// If we've been asked to stop, send an event to signal the actual end of stream
EvsEvent event;
- event.aType = EvsEventType::STREAM_STOPPED;
- auto result = mStream->notify(event);
+ InfoEventDesc desc = {};
+ desc.aType = InfoEventType::STREAM_STOPPED;
+ event.info(desc);
+ auto result = mStream->notifyEvent(event);
if (!result.isOk()) {
ALOGE("Error delivering end of stream marker");
}
@@ -636,38 +616,6 @@
}
-sp<EvsCamera> EvsCamera::Create(const char *deviceName) {
- unique_ptr<ConfigManager::CameraInfo> nullCamInfo = nullptr;
-
- return Create(deviceName, nullCamInfo);
-}
-
-
-sp<EvsCamera> EvsCamera::Create(const char *deviceName,
- unique_ptr<ConfigManager::CameraInfo> &camInfo,
- const Stream *streamCfg) {
- sp<EvsCamera> evsCamera = new EvsCamera(deviceName, camInfo);
- if (evsCamera == nullptr) {
- return nullptr;
- }
-
- /* default implementation does not use a given configuration */
- (void)streamCfg;
-
- /* Use the first resolution from the list for the testing */
- auto it = camInfo->streamConfigurations.begin();
- evsCamera->mWidth = it->second[1];
- evsCamera->mHeight = it->second[2];
- evsCamera->mDescription.v1.vendorFlags = 0xFFFFFFFF; // Arbitrary test value
-
- evsCamera->mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
- evsCamera->mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE |
- GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY;
-
- return evsCamera;
-}
-
-
} // namespace implementation
} // namespace V1_0
} // namespace evs