Exemplo n.º 1
0
static AVS_VAlue import_d2v_jackie(avs_hnd_t *ah, LPSTR input)
{
    if (!ah->function_exists(ah->env, "MPEG2Dec3_MPEG2Source"))
        return avs_void;
    AVS_Value arg_arr[8] = {
        avs_new_value_string(input),
        avs_new_value_int(ah->d2v.idct),
        avs_new_value_int(ah->d2v.cpu),
        avs_new_value_int(ah->d2v.moderate_h),
        avs_new_value_int(ah->d2v.moderate_v),
        avs_new_value_string(ah->d2v.cpu2),
        avs_new_value_bool(ah->d2v.showq),
        avs_new_value_bool(ah->d2v.fastmc)
    };
    const char *name[8] = {
        NULL, "idct", "cpu", "moderate_h",
        "moderate_v", "cpu2", "showQ", "fastMC"
    };
    AVS_Value arg =avs_new_value_string(input);
    return ah->avs_invoke(ah->env, "MPEG2Dec3_MPEG2Source", avs_new_value_array(arg_arr, 8), name);
}
Exemplo n.º 2
0
static AVS_Value import_d2v_donald(avs_hnd_t *ah, LPSTR input)
{
    if (!ah->func.avs_function_exists(ah->env, "DGDecode_MPEG2Source") && load_dgdecode_dll(ah))
        return avs_void;

    AVS_Value arg_arr[10] = {
        avs_new_value_string(input),
        avs_new_value_int(ah->d2v.upconv),
        avs_new_value_int(ah->d2v.idct),
        avs_new_value_int(ah->d2v.cpu),
        avs_new_value_int(ah->d2v.moderate_h),
        avs_new_value_int(ah->d2v.moderate_v),
        avs_new_value_string(ah->d2v.cpu2),
        avs_new_value_int(ah->d2v.info),
        avs_new_value_bool(ah->d2v.showq),
        avs_new_value_bool(ah->d2v.fastmc)
    };
    const char *name[10] = {
        NULL, "upConv", "idct", "cpu", "moderate_h",
        "moderate_v", "cpu2", "info", "showQ", "fastMC"
    };
    return ah->func.avs_invoke(ah->env, "DGDecode_MPEG2Source", avs_new_value_array(arg_arr, 10), name);
}
Exemplo n.º 3
0
static AVS_Value initialize_avisynth(avs_hnd_t *ah, LPSTR input)
{
    if (load_avisynth_dll(ah))
        return avs_void;

    ah->env = ah->func.avs_create_script_environment(AVS_INTERFACE_25);
    if (ah->func.avs_get_error && ah->func.avs_get_error(ah->env))
        return avs_void;

    ah->version = get_avisynth_version(ah);

    AVS_Value res = avs_void;
    switch (ah->ext) {
    case TYPE_AVS:
        res = import_avs(ah, input);
        break;
    case TYPE_D2V_DONALD:
        res = import_d2v_donald(ah, input);
        break;
    case TYPE_D2V_JACKIE:
#ifdef D2V_DVD2AVI_ENABLED
        res = import_d2v_jackie(ah, input);
        break;
#endif
    default:
        break;
    }

    if (avs_is_error(res) || !avs_defined(res))
        return res;

    if (ah->ext == TYPE_D2V_DONALD && ah->d2v.keyframe_judge)
        create_index(ah, input);

    if (ah->adjust_audio_length) {
        AVS_Value arg_arr[3] = {res, avs_new_value_int(0), avs_new_value_int(0)};
        AVS_Value tmp = ah->func.avs_invoke(ah->env, "Trim", avs_new_value_array(arg_arr, 3), NULL);
        ah->func.avs_release_value(res);
        res = tmp;
    }

    AVS_Value mt_test = ah->func.avs_invoke(ah->env, "GetMTMode", avs_new_value_bool(0), NULL);
    int mt_mode = avs_is_int(mt_test) ? avs_as_int(mt_test) : 0;
    ah->func.avs_release_value(mt_test);
    if (mt_mode > 0 && mt_mode < 5) {
        AVS_Value temp = ah->func.avs_invoke(ah->env, "Distributor", res, NULL);
        ah->func.avs_release_value(res);
        res = temp;
    }

    ah->clip = ah->func.avs_take_clip(res, ah->env);
    ah->vi = ah->func.avs_get_video_info(ah->clip);

    if (ah->highbit_depth && ah->version >= 260 && avs_is_planar(ah->vi)) {
        if (avs_is_yv411(ah->vi) ||
            ((avs_is_yv24(ah->vi) || avs_is_y8(ah->vi)) && (ah->vi->width & 1)) ||
            ((avs_is_yv16(ah->vi) || avs_is_yv12(ah->vi)) && (ah->vi->width & 3))) {
            ah->func.avs_release_value(res);
            return avs_void;
        }
        if (avs_is_yv12(ah->vi))
            res = invoke_filter(ah, res, "ConvertToYV16");

    } else if (avs_is_yv12(ah->vi) || avs_is_yv16(ah->vi) || avs_is_yv411(ah->vi)) {
        if (ah->func.avs_function_exists(ah->env, ah->yuy2converter))
            res = invoke_filter(ah, res, ah->yuy2converter);
        else
            res = invoke_filter(ah, res, "ConvertToYUY2");
    }

    if (avs_is_rgb32(ah->vi))
        res = invoke_filter(ah, res, "ConvertToRGB24");

    if (ah->vi->sample_type & 0x1C)
        res = invoke_filter(ah, res, "ConvertAudioTo16bit");

    return res;
}
Exemplo n.º 4
0
struct AVS_Value* inline_avs_new_value_int(AVS_Value * ptr, int v0) 
{
    if(ptr)
	*ptr = avs_new_value_int(v0);
    return ptr;
}