diff --git a/camera/CameraWrapper.cpp b/camera/CameraWrapper.cpp index bcf50af..e806a09 100755 --- a/camera/CameraWrapper.cpp +++ b/camera/CameraWrapper.cpp @@ -53,7 +53,7 @@ static struct hw_module_methods_t camera_module_methods = { camera_module_t HAL_MODULE_INFO_SYM = { .common = { - tag: HARDWARE_MODULE_TAG, + .tag = HARDWARE_MODULE_TAG, .module_api_version = CAMERA_MODULE_API_VERSION_1_0, .hal_api_version = HARDWARE_HAL_API_VERSION, .id = CAMERA_HARDWARE_MODULE_ID, @@ -104,6 +104,10 @@ static int check_vendor_module() #define KEY_VIDEO_HFR_VALUES "video-hfr-values" +// nv12-venus is needed for blobs, but +// framework has no idea what it is +#define PIXEL_FORMAT_NV12_VENUS "nv12-venus" + static char *camera_fixup_getparams(int __attribute__((unused)) id, const char *settings) { @@ -120,6 +124,12 @@ static char *camera_fixup_getparams(int __attribute__((unused)) id, * that it really is okay to turn it off. */ + const char *recordHint = params.get(android::CameraParameters::KEY_RECORDING_HINT); + bool videoMode = recordHint ? !strcmp(recordHint, "true") : false; + + if (strcmp (params.getPreviewFormat(), PIXEL_FORMAT_NV12_VENUS) == 0) + params.setPreviewFormat(params.PIXEL_FORMAT_YUV420SP); + const char* hfrValues = params.get(KEY_VIDEO_HFR_VALUES); if (hfrValues && *hfrValues && ! strstr(hfrValues, "off")) { char tmp[strlen(hfrValues) + 4 + 1]; @@ -127,6 +137,9 @@ static char *camera_fixup_getparams(int __attribute__((unused)) id, params.set(KEY_VIDEO_HFR_VALUES, tmp); } + if (videoMode) + params.set(android::CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED, "true"); + android::String8 strParams = params.flatten(); char *ret = strdup(strParams.string());