static int camera_set_parameters(struct camera_device *device,
        const char *params)
{
    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
            (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));

    if (!device)
        return -EINVAL;

    char *tmp = NULL;
    tmp = camera_fixup_setparams(CAMERA_ID(device), params);

#ifdef LOG_NDEBUG
    __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, tmp);
#endif

    if (flipZsl) {
        camera_stop_preview(device);
    }
    int ret = VENDOR_CALL(device, set_parameters, tmp);
    if (flipZsl) {
        camera_start_preview(device);
        flipZsl = false;
    }
    return ret;
}
Ejemplo n.º 2
0
int camera_set_parameters(struct camera_device * device, const char *params)
{
    if(!device)
        return -EINVAL;

    char *tmp = NULL;
    tmp = camera_fixup_setparams(CAMERA_ID(device), params);

    int ret = VENDOR_CALL(device, set_parameters, tmp);
    return ret;
}
static char *camera_fixup_setparams(struct camera_device *device,
        const char *settings)
{
    int id = CAMERA_ID(device);
    android::CameraParameters params;
    params.unflatten(android::String8(settings));

    const char* recordingHint = params.get(android::CameraParameters::KEY_RECORDING_HINT);
    bool isVideo = recordingHint && !strcmp(recordingHint, "true");

    if (isVideo) {
        params.set("dis", "disable");
        params.set(android::CameraParameters::KEY_ZSL, "off");
    } else {
        params.set(android::CameraParameters::KEY_ZSL, "on");
    }

#if !LOG_NDEBUG
    ALOGV("%s: original parameters:", __FUNCTION__);
    params.dump();
#endif

    // fix params here
    // No need to fix-up ISO_HJR, it is the same for userspace and the camera lib
    if (params.get("iso")) {
        const char *isoMode = params.get(android::CameraParameters::KEY_ISO_MODE);
        if (strcmp(isoMode, "ISO100") == 0)
            params.set(android::CameraParameters::KEY_ISO_MODE, "100");
        else if (strcmp(isoMode, "ISO200") == 0)
            params.set(android::CameraParameters::KEY_ISO_MODE, "200");
        else if (strcmp(isoMode, "ISO400") == 0)
            params.set(android::CameraParameters::KEY_ISO_MODE, "400");
        else if (strcmp(isoMode, "ISO800") == 0)
            params.set(android::CameraParameters::KEY_ISO_MODE, "800");
        else if (strcmp(isoMode, "ISO1600") == 0)
            params.set(android::CameraParameters::KEY_ISO_MODE, "1600");
    }

#if !LOG_NDEBUG
    ALOGV("%s: fixed parameters:", __FUNCTION__);
    params.dump();
#endif

    android::String8 strParams = params.flatten();

    if (fixed_set_params[id])
        free(fixed_set_params[id]);
    fixed_set_params[id] = strdup(strParams.string());
    char *ret = fixed_set_params[id];

    return ret;
}
Ejemplo n.º 4
0
char* camera_get_parameters(struct camera_device * device)
{
    if(!device)
        return NULL;

    char* params = VENDOR_CALL(device, get_parameters);

    char * tmp = camera_fixup_getparams(CAMERA_ID(device), params);
    VENDOR_CALL(device, put_parameters, params);
    params = tmp;

    return params;
}
static int camera_set_parameters(struct camera_device *device,
	const char *params)
{
    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
	    (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));

    if (!device)
	return -EINVAL;

    char *tmp = NULL;
    tmp = camera_fixup_setparams(CAMERA_ID(device), params, device);

    int ret = VENDOR_CALL(device, set_parameters, tmp);
    return ret;
}
static char *camera_get_parameters(struct camera_device *device)
{
    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
            (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));

    if (!device)
        return NULL;

    char *params = VENDOR_CALL(device, get_parameters);

    char *tmp = camera_fixup_getparams(CAMERA_ID(device), params);
    VENDOR_CALL(device, put_parameters, params);
    params = tmp;

    return params;
}
static char *camera_get_parameters(struct camera_device *device)
{
    ALOGV("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device,
            (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));

    if (!device)
        return NULL;

    char *params = VENDOR_CALL(device, get_parameters);

#ifdef LOG_NDEBUG
    __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params);
#endif

    char *tmp = camera_fixup_getparams(CAMERA_ID(device), params);
    VENDOR_CALL(device, put_parameters, params);
    params = tmp;

#ifdef LOG_NDEBUG
    __android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params);
#endif

    return params;
}