diff options
author | John Stebbins <[email protected]> | 2017-09-06 10:09:43 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2017-09-06 10:10:29 -0700 |
commit | bb3235e43de4c8bafd24fb25391e506005c796e2 (patch) | |
tree | 4ba5b3e3536cb71dae479032b320c0d244a602fe | |
parent | 526e7a18f1c7f0dfff0854dc1bc513f6c56e3853 (diff) |
LinGui: Add filter validation for sharpen and comb detect
-rw-r--r-- | gtk/src/hb-backend.c | 143 |
1 files changed, 102 insertions, 41 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 07f3a7248..7332f9770 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -3903,37 +3903,31 @@ ghb_validate_filters(GhbValue *settings, GtkWindow *parent) { gchar *message; - // Deinterlace - int filter_id; - filter_id = ghb_settings_combo_int(settings, "PictureDeinterlaceFilter"); - if (filter_id != HB_FILTER_INVALID) + // Detelecine + const char *detel_preset; + detel_preset = ghb_dict_get_string(settings, "PictureDetelecine"); + if (strcasecmp(detel_preset, "off")) { - const char *deint_filter, *deint_preset, *deint_custom = NULL; + const char *detel_custom = NULL; + int filter_id; - deint_filter = ghb_dict_get_string(settings, - "PictureDeinterlaceFilter"); - deint_preset = ghb_dict_get_string(settings, - "PictureDeinterlacePreset"); - deint_custom = ghb_dict_get_string(settings, - "PictureDeinterlaceCustom"); - if (hb_validate_filter_preset(filter_id, deint_preset, NULL, - deint_custom)) + filter_id = HB_FILTER_DETELECINE; + detel_custom = ghb_dict_get_string(settings, "PictureDetelecineCustom"); + if (hb_validate_filter_preset(filter_id, detel_preset, NULL, + detel_custom)) { - if (deint_custom != NULL) + if (detel_custom != NULL) { message = g_strdup_printf( - _("Invalid Deinterlace Settings:\n\n" - "Filter: %s\n" - "Preset: %s\n" - "Custom: %s\n"), deint_filter, deint_preset, - deint_custom); + _("Invalid Detelecine Settings:\n\n" + "Preset:\t%s\n" + "Custom:\t%s\n"), detel_preset, detel_custom); } else { message = g_strdup_printf( - _("Invalid Deinterlace Settings:\n\n" - "Filter: %s\n" - "Preset: %s\n"), deint_filter, deint_preset); + _("Invalid Detelecine Settings:\n\n" + "Preset:\t%s\n"), detel_preset); } ghb_message_dialog(parent, GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); @@ -3942,31 +3936,70 @@ ghb_validate_filters(GhbValue *settings, GtkWindow *parent) } } - // Detelecine - const char *detel_preset; - detel_preset = ghb_dict_get_string(settings, "PictureDetelecine"); - if (strcasecmp(detel_preset, "off")) + // Comb Detect + const char *comb_preset; + comb_preset = ghb_dict_get_string(settings, "PictureCombDetectPreset"); + if (strcasecmp(comb_preset, "off")) { - const char *detel_custom = NULL; + const char *comb_custom = NULL; int filter_id; - filter_id = HB_FILTER_DETELECINE; - detel_custom = ghb_dict_get_string(settings, "PictureDetelecineCustom"); - if (hb_validate_filter_preset(filter_id, detel_preset, NULL, - detel_custom)) + filter_id = HB_FILTER_COMB_DETECT; + comb_custom = ghb_dict_get_string(settings, "PictureCombDetectCustom"); + if (hb_validate_filter_preset(filter_id, comb_preset, NULL, + comb_custom)) { - if (detel_custom != NULL) + if (comb_custom != NULL && comb_custom[0] != 0) { message = g_strdup_printf( - _("Invalid Detelecine Settings:\n\n" - "Preset: %s\n" - "Custom: %s\n"), detel_preset, detel_custom); + _("Invalid Comb Detect Settings:\n\n" + "Preset:\t%s\n" + "Custom:\t%s\n"), comb_preset, comb_custom); } else { message = g_strdup_printf( - _("Invalid Detelecine Settings:\n\n" - "Preset: %s\n"), detel_preset); + _("Invalid Comb Detect Settings:\n\n" + "Preset:\t%s\n"), comb_preset); + } + ghb_message_dialog(parent, GTK_MESSAGE_ERROR, + message, _("Cancel"), NULL); + g_free(message); + return FALSE; + } + } + + // Deinterlace + int filter_id; + filter_id = ghb_settings_combo_int(settings, "PictureDeinterlaceFilter"); + if (filter_id != HB_FILTER_INVALID) + { + const char *deint_filter, *deint_preset, *deint_custom = NULL; + + deint_filter = ghb_dict_get_string(settings, + "PictureDeinterlaceFilter"); + deint_preset = ghb_dict_get_string(settings, + "PictureDeinterlacePreset"); + deint_custom = ghb_dict_get_string(settings, + "PictureDeinterlaceCustom"); + if (hb_validate_filter_preset(filter_id, deint_preset, NULL, + deint_custom)) + { + if (deint_custom != NULL) + { + message = g_strdup_printf( + _("Invalid Deinterlace Settings:\n\n" + "Filter:\t%s\n" + "Preset:\t%s\n" + "Custom:\t%s\n"), deint_filter, deint_preset, + deint_custom); + } + else + { + message = g_strdup_printf( + _("Invalid Deinterlace Settings:\n\n" + "Filter:\t%s\n" + "Preset:\t%s\n"), deint_filter, deint_preset); } ghb_message_dialog(parent, GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); @@ -3994,10 +4027,10 @@ ghb_validate_filters(GhbValue *settings, GtkWindow *parent) { message = g_strdup_printf( _("Invalid Denoise Settings:\n\n" - "Filter: %s\n" - "Preset: %s\n" - "Tune: %s\n" - "Custom: %s\n"), denoise_filter, denoise_preset, + "Filter:\t%s\n" + "Preset:\t%s\n" + "Tune:\t%s\n" + "Custom:\t%s\n"), denoise_filter, denoise_preset, denoise_tune, denoise_custom); ghb_message_dialog(parent, GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); @@ -4006,6 +4039,34 @@ ghb_validate_filters(GhbValue *settings, GtkWindow *parent) } } + // Sharpen + filter_id = ghb_settings_combo_int(settings, "PictureSharpenFilter"); + if (filter_id != HB_FILTER_INVALID) + { + const char *sharpen_filter, *sharpen_preset; + const char *sharpen_tune = NULL, *sharpen_custom = NULL; + + sharpen_filter = ghb_dict_get_string(settings, "PictureSharpenFilter"); + sharpen_preset = ghb_dict_get_string(settings, "PictureSharpenPreset"); + sharpen_tune = ghb_dict_get_string(settings, "PictureSharpenTune"); + sharpen_custom = ghb_dict_get_string(settings, "PictureSharpenCustom"); + if (hb_validate_filter_preset(filter_id, sharpen_preset, sharpen_tune, + sharpen_custom)) + { + message = g_strdup_printf( + _("Invalid Sharpen Settings:\n\n" + "Filter:\t%s\n" + "Preset:\t%s\n" + "Tune:\t%s\n" + "Custom:\t%s\n"), sharpen_filter, sharpen_preset, + sharpen_tune, sharpen_custom); + ghb_message_dialog(parent, GTK_MESSAGE_ERROR, + message, _("Cancel"), NULL); + g_free(message); + return FALSE; + } + } + return TRUE; } |