Fix video recording

This commit is contained in:
Valera1978 2017-01-13 20:52:43 +03:00
parent 4a3722f898
commit 41f0c0db20

View File

@ -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());