Skip to content

Commit

Permalink
LinGui: switch quality type if the current one is not supported by th…
Browse files Browse the repository at this point in the history
…e selected encoder.
  • Loading branch information
samhutchins authored and galad87 committed Apr 8, 2024
1 parent 3b3e102 commit addef8e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gtk/src/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ static GhbBinding widget_bindings[] =
{"title", "active-id", "none", "angle", "sensitive", TRUE},
{"title", "active-id", "none", "angle_label", "sensitive", TRUE},
{"vquality_type_bitrate", "active", NULL, "VideoAvgBitrate", "sensitive"},
{"vquality_type_bitrate", "sensitive", NULL, "VideoAvgBitrate", "sensitive"},
{"vquality_type_constant", "active", NULL, "VideoQualitySlider", "sensitive"},
{"vquality_type_constant", "sensitive", NULL, "VideoQualitySlider", "sensitive"},
{"vquality_type_constant", "active", NULL, "video_quality_label", "sensitive"},
{"VideoFramerate", "active-id", "auto", "VideoFrameratePFR", "visible", TRUE},
{"VideoFramerate", "active-id", "auto", "VideoFramerateVFR", "visible"},
Expand Down
15 changes: 15 additions & 0 deletions gtk/src/videohandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,21 @@ vcodec_changed_cb (GtkWidget *widget, gpointer data)
ghb_set_video_preset(ud->settings, encoder, NULL);
GhbValue *gval = ghb_dict_get_value(ud->settings, "VideoPresetSlider");
ghb_ui_settings_update(ud, ud->settings, "VideoPresetSlider", gval);

// update quality type
GtkWidget *cqRadioButton = ghb_builder_widget("vquality_type_constant");
GtkWidget *abrRadioButton = ghb_builder_widget("vquality_type_bitrate");
gtk_widget_set_sensitive(cqRadioButton, hb_video_quality_is_supported(encoder));
gtk_widget_set_sensitive(abrRadioButton, hb_video_bitrate_is_supported(encoder));
if (ghb_widget_boolean(cqRadioButton) && ! hb_video_quality_is_supported(encoder))
{
ghb_update_widget(abrRadioButton, ghb_boolean_value(true));
}
if (ghb_widget_boolean(abrRadioButton) && ! hb_video_bitrate_is_supported(encoder))
{
ghb_update_widget(cqRadioButton, ghb_boolean_value(true));
}

if (ghb_check_name_template(ud, "{bit-depth}") ||
ghb_check_name_template(ud, "{codec}"))
ghb_set_destination(ud);
Expand Down

0 comments on commit addef8e

Please sign in to comment.