diff options
Diffstat (limited to 'camera/device/3.2/default/convert.cpp')
-rw-r--r-- | camera/device/3.2/default/convert.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/camera/device/3.2/default/convert.cpp b/camera/device/3.2/default/convert.cpp index 06ad7e963c..628b7af912 100644 --- a/camera/device/3.2/default/convert.cpp +++ b/camera/device/3.2/default/convert.cpp @@ -66,6 +66,8 @@ void convertFromHidl(const Stream &src, Camera3Stream* dst) { dst->data_space = (android_dataspace_t) src.dataSpace; dst->rotation = (int) src.rotation; dst->usage = (uint32_t) src.usage; + dst->reserved[0] = NULL; + dst->reserved[1] = NULL; // Fields to be filled by HAL (max_buffers, priv) are initialized to 0 dst->max_buffers = 0; dst->priv = 0; @@ -88,6 +90,23 @@ void convertToHidl(const Camera3Stream* src, HalStream* dst) { ALOGW("%s: Stream type %d is not currently supported!", __FUNCTION__, src->stream_type); } + + HalStream* halStream = NULL; + if (src->reserved[0] != NULL) { + halStream = (HalStream*)(src->reserved[0]); + } else if (src->reserved[1] != NULL) { + halStream = (HalStream*)(src->reserved[1]); + } + + // Check if overrideFormat is set and honor it + if (halStream != NULL) { + dst->overrideFormat = (PixelFormat) halStream->overrideFormat; + if (src->stream_type == CAMERA3_STREAM_OUTPUT) { + dst->producerUsage = (BufferUsageFlags)halStream->producerUsage; + } else if (src->stream_type == CAMERA3_STREAM_INPUT) { + dst->consumerUsage = (BufferUsageFlags)halStream->consumerUsage; + } + } } void convertToHidl(const camera3_stream_configuration_t& src, HalStreamConfiguration* dst) { |