Message ID | 20200804214711.177645-12-kieran.bingham@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Kieran, Thank you for the patch. On Tue, Aug 04, 2020 at 10:47:09PM +0100, Kieran Bingham wrote: > Generate the ResultMetadata before performing JPEG compression so that > JPEG specific metadata can be added to the metadata when it has been > processed. > > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/android/camera_device.cpp | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > index 4178db952846..c529246e115c 100644 > --- a/src/android/camera_device.cpp > +++ b/src/android/camera_device.cpp > @@ -1198,6 +1198,8 @@ void CameraDevice::requestComplete(Request *request) > const std::map<Stream *, FrameBuffer *> &buffers = request->buffers(); > camera3_buffer_status status = CAMERA3_BUFFER_STATUS_OK; > std::unique_ptr<CameraMetadata> resultMetadata; > + Camera3RequestDescriptor *descriptor = > + reinterpret_cast<Camera3RequestDescriptor *>(request->cookie()); > > if (request->status() != Request::RequestComplete) { > LOG(HAL, Error) << "Request not successfully completed: " > @@ -1205,9 +1207,17 @@ void CameraDevice::requestComplete(Request *request) > status = CAMERA3_BUFFER_STATUS_ERROR; > } > > + /* > + * \todo The timestamp used for the metadata is currently always taken > + * from the first buffer (which may be the first stream) in the Request. > + * It might be appropriate to return a 'correct' (as determined by > + * pipeline handlers) timestamp in the Request itself. > + */ > + FrameBuffer *buffer = buffers.begin()->second; > + resultMetadata = getResultMetadata(descriptor->frameNumber, > + buffer->metadata().timestamp); > + > /* Prepare to call back the Android camera stack. */ > - Camera3RequestDescriptor *descriptor = > - reinterpret_cast<Camera3RequestDescriptor *>(request->cookie()); > > camera3_capture_result_t captureResult = {}; > captureResult.frame_number = descriptor->frameNumber; > @@ -1220,21 +1230,12 @@ void CameraDevice::requestComplete(Request *request) > captureResult.output_buffers = > const_cast<const camera3_stream_buffer_t *>(descriptor->buffers); > > - /* > - * \todo The timestamp used for the metadata is currently always taken > - * from the first buffer (which may be the first stream) in the Request. > - * It might be appropriate to return a 'correct' (as determined by > - * pipeline handlers) timestamp in the Request itself. > - */ > - FrameBuffer *buffer = buffers.begin()->second; > > if (status == CAMERA3_BUFFER_STATUS_OK) { > notifyShutter(descriptor->frameNumber, > buffer->metadata().timestamp); > > captureResult.partial_result = 1; > - resultMetadata = getResultMetadata(descriptor->frameNumber, > - buffer->metadata().timestamp); > captureResult.result = resultMetadata->get(); > } >
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 4178db952846..c529246e115c 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1198,6 +1198,8 @@ void CameraDevice::requestComplete(Request *request) const std::map<Stream *, FrameBuffer *> &buffers = request->buffers(); camera3_buffer_status status = CAMERA3_BUFFER_STATUS_OK; std::unique_ptr<CameraMetadata> resultMetadata; + Camera3RequestDescriptor *descriptor = + reinterpret_cast<Camera3RequestDescriptor *>(request->cookie()); if (request->status() != Request::RequestComplete) { LOG(HAL, Error) << "Request not successfully completed: " @@ -1205,9 +1207,17 @@ void CameraDevice::requestComplete(Request *request) status = CAMERA3_BUFFER_STATUS_ERROR; } + /* + * \todo The timestamp used for the metadata is currently always taken + * from the first buffer (which may be the first stream) in the Request. + * It might be appropriate to return a 'correct' (as determined by + * pipeline handlers) timestamp in the Request itself. + */ + FrameBuffer *buffer = buffers.begin()->second; + resultMetadata = getResultMetadata(descriptor->frameNumber, + buffer->metadata().timestamp); + /* Prepare to call back the Android camera stack. */ - Camera3RequestDescriptor *descriptor = - reinterpret_cast<Camera3RequestDescriptor *>(request->cookie()); camera3_capture_result_t captureResult = {}; captureResult.frame_number = descriptor->frameNumber; @@ -1220,21 +1230,12 @@ void CameraDevice::requestComplete(Request *request) captureResult.output_buffers = const_cast<const camera3_stream_buffer_t *>(descriptor->buffers); - /* - * \todo The timestamp used for the metadata is currently always taken - * from the first buffer (which may be the first stream) in the Request. - * It might be appropriate to return a 'correct' (as determined by - * pipeline handlers) timestamp in the Request itself. - */ - FrameBuffer *buffer = buffers.begin()->second; if (status == CAMERA3_BUFFER_STATUS_OK) { notifyShutter(descriptor->frameNumber, buffer->metadata().timestamp); captureResult.partial_result = 1; - resultMetadata = getResultMetadata(descriptor->frameNumber, - buffer->metadata().timestamp); captureResult.result = resultMetadata->get(); }