diff options
author | John Stebbins <[email protected]> | 2015-10-05 10:42:23 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2015-10-05 10:42:23 -0700 |
commit | 5c466ff03a3c5236d738ff914ece330457b7fefc (patch) | |
tree | 84c0691b948584d320f2276aaac13d8648597681 /gtk | |
parent | fe7cf56e8129d7376dde8857360652b39e514b28 (diff) |
LinGui: fix filter display in queue list
Under some circumstances, incorrect filter preset values might have been
shown.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/hb-backend.c | 34 | ||||
-rw-r--r-- | gtk/src/hb-backend.h | 1 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 88 |
3 files changed, 86 insertions, 37 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index f76574134..346b60e24 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -198,9 +198,9 @@ combo_opts_t vqual_granularity_opts = static options_map_t d_denoise_opts[] = { - {N_("Off"), "off", 0, ""}, - {N_("NLMeans"), "nlmeans", 1, ""}, - {N_("HQDN3D"), "hqdn3d", 2, ""}, + {N_("Off"), "off", HB_FILTER_INVALID, ""}, + {N_("NLMeans"), "nlmeans", HB_FILTER_NLMEANS, ""}, + {N_("HQDN3D"), "hqdn3d", HB_FILTER_HQDN3D, ""}, }; combo_opts_t denoise_opts = { @@ -3893,6 +3893,34 @@ get_preview_geometry(signal_user_data_t *ud, const hb_title_t *title, } } +const char* +ghb_lookup_filter_name(int filter_id, const char *short_name, int preset) +{ + hb_filter_param_t *map; + int ii; + + if (short_name == NULL) + { + return NULL; + } + if (preset) + { + map = hb_filter_param_get_presets(filter_id); + } + else + { + map = hb_filter_param_get_tunes(filter_id); + } + for (ii = 0; map[ii].name != NULL; ii++) + { + if (!strcasecmp(map[ii].short_name, short_name)) + { + return map[ii].name; + } + } + return NULL; +} + gboolean ghb_validate_filters(GhbValue *settings, GtkWindow *parent) { diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h index acb57ae7d..4f2ea310f 100644 --- a/gtk/src/hb-backend.h +++ b/gtk/src/hb-backend.h @@ -152,6 +152,7 @@ void ghb_hb_cleanup(gboolean partial); gint ghb_lookup_combo_int(const gchar *name, const GhbValue *gval); gdouble ghb_lookup_combo_double(const gchar *name, const GhbValue *gval); gchar* ghb_lookup_combo_option(const gchar *name, const GhbValue *gval); +const char* ghb_lookup_filter_name(int filter_id, const char *short_name, int preset); gchar* ghb_get_tmp_dir(); gint ghb_find_closest_audio_samplerate(gint rate); diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index d5833b0b0..4780dde9a 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -105,11 +105,12 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter two_pass = ghb_dict_get_bool(settings, "VideoTwoPass"); const gchar *points = _("Chapters"); - if (ghb_settings_combo_int(settings, "PtoPType") == 0) + const gchar *ptop = ghb_dict_get_string(settings, "PtoPType"); + if (!strcasecmp(ptop, "chapter")) points = _("Chapters"); - else if (ghb_settings_combo_int(settings, "PtoPType") == 1) + if (!strcasecmp(ptop, "time")) points = _("Seconds"); - else if (ghb_settings_combo_int(settings, "PtoPType") == 2) + if (!strcasecmp(ptop, "frame")) points = _("Frames"); if (!vqtype && two_pass) @@ -292,36 +293,54 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter // Next line in the display (Filter settings) // Filters: - Deinterlace - gint decomb, detel, deint, deblock, denoise; - gchar *deint_opt, *decomb_opt, *denoise_opt, *denoise_preset, *denoise_tune; + gint deblock, denoise; + gboolean decomb, deint, detel; + const gchar *decomb_opt, *deint_opt; + const gchar *decomb_preset, *deint_preset, *detel_preset; + const gchar *denoise_preset, *denoise_tune; const gchar *detel_cust, *deint_cust, *decomb_cust, *denoise_cust; + gchar *denoise_opt; gboolean decomb_deint; gboolean grayscale; gboolean filters; decomb_deint = ghb_dict_get_bool(settings, "PictureDecombDeinterlace"); - decomb = ghb_settings_combo_int(settings, "PictureDecomb"); - decomb_opt = ghb_settings_combo_option(settings, "PictureDecomb"); - decomb_cust = ghb_dict_get_string(settings, - "PictureDecombCustom"); - deint = ghb_settings_combo_int(settings, "PictureDeinterlace"); - deint_opt = ghb_settings_combo_option(settings, "PictureDeinterlace"); - deint_cust = ghb_dict_get_string(settings, - "PictureDeinterlaceCustom"); - detel = ghb_settings_combo_int(settings, "PictureDetelecine"); - detel_cust = ghb_dict_get_string(settings, - "PictureDetelecineCustom"); + decomb_preset = ghb_dict_get_string(settings, "PictureDecomb"); + decomb = decomb_preset != NULL && !!strcasecmp(decomb_preset, "off") && + decomb_deint; + decomb_opt = ghb_lookup_filter_name(HB_FILTER_DECOMB, + ghb_dict_get_string(settings, "PictureDecomb"), 1); + decomb_cust = ghb_dict_get_string(settings, "PictureDecombCustom"); + + deint_preset = ghb_dict_get_string(settings, "PictureDeinterlace"); + deint = deint_preset != NULL && !!strcasecmp(deint_preset, "off") && + !decomb_deint; + deint_opt = ghb_lookup_filter_name(HB_FILTER_DEINTERLACE, + ghb_dict_get_string(settings, "PictureDeinterlace"), 1); + deint_cust = ghb_dict_get_string(settings, "PictureDeinterlaceCustom"); + + detel_preset = ghb_dict_get_string(settings, "PictureDetelecine"); + detel = detel_preset != NULL && !!strcasecmp(detel_preset, "off"); + detel_cust = ghb_dict_get_string(settings, "PictureDetelecineCustom"); + deblock = ghb_dict_get_int(settings, "PictureDeblock"); + denoise = ghb_settings_combo_int(settings, "PictureDenoiseFilter"); denoise_opt = ghb_settings_combo_option(settings, "PictureDenoiseFilter"); - denoise_preset = ghb_settings_combo_option(settings, "PictureDenoisePreset"); - denoise_tune = ghb_settings_combo_option(settings, "PictureDenoiseTune"); - denoise_cust = ghb_dict_get_string(settings, - "PictureDenoiseCustom"); + if (denoise != HB_FILTER_INVALID) + { + denoise_preset = ghb_lookup_filter_name(denoise, + ghb_dict_get_string(settings, "PictureDenoisePreset"), 1); + denoise_tune = ghb_lookup_filter_name(denoise, + ghb_dict_get_string(settings, "PictureDenoiseTune"), 0); + + denoise_cust = ghb_dict_get_string(settings, "PictureDenoiseCustom"); + } + grayscale = ghb_dict_get_bool(settings, "VideoGrayScale"); - filters = detel || (decomb_deint && decomb) || (!decomb_deint && deint) || - denoise || (deblock >= 5) || grayscale; + filters = detel || decomb || deint || grayscale || + denoise != HB_FILTER_INVALID || (deblock >= 5); if (filters) { const char *prefix = " "; @@ -329,16 +348,16 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter if (detel) { XPRINT(_("%sDetelecine"), prefix); - if (detel == 1) + if (!strcasecmp(detel_preset, "custom")) { XPRINT(": %s", detel_cust); } prefix = " - "; } - if (decomb_deint && decomb) + if (decomb) { XPRINT(_("%sDecomb"), prefix); - if (decomb == 1) + if (!strcasecmp(decomb_preset, "custom")) { XPRINT(": %s", decomb_cust); } @@ -348,10 +367,10 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter } prefix = " - "; } - else if (!decomb_deint && deint) + if (deint) { XPRINT(_("%sDeinterlace"), prefix); - if (deint == 1) + if (!strcasecmp(deint_preset, "custom")) { XPRINT(": %s", deint_cust); } @@ -361,17 +380,22 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter } prefix = " - "; } - if (denoise) + if (denoise != HB_FILTER_INVALID) { XPRINT(_("%sDenoise Filter %s:"), prefix, denoise_opt); - if (ghb_settings_combo_int(settings, "PictureDenoisePreset") == 1) + const char *preset; + preset = ghb_dict_get_string(settings, "PictureDenoisePreset"); + if (preset && !strcasecmp(preset, "custom")) { XPRINT(" %s", denoise_cust); } else { XPRINT(" %s", denoise_preset); - if (denoise == 1 && strcmp(denoise_tune, "None")) + const char *tune; + tune = ghb_dict_get_string(settings, "PictureDenoiseTune"); + if (denoise == HB_FILTER_NLMEANS && + tune != NULL && strcasecmp(tune, "none")) { XPRINT(",%s", denoise_tune); } @@ -390,11 +414,7 @@ add_to_queue_list(signal_user_data_t *ud, GhbValue *settings, GtkTreeIter *piter } XPRINT("</small>\n"); } - free(deint_opt); - free(decomb_opt); free(denoise_opt); - free(denoise_preset); - free(denoise_tune); // Next line in the display (Video Encoder) // Video: Encoder, Framerate: fps, RF/Bitrate/QP |