diff options
author | John Stebbins <[email protected]> | 2016-08-25 10:43:53 -0700 |
---|---|---|
committer | Bradley Sepos <[email protected]> | 2016-09-02 03:33:06 -0400 |
commit | 59803dafcc75c4a2364faf172d93ffef3985e300 (patch) | |
tree | d46e1248d2e0e4e60dbfed8f4ec409f4fa746c05 /gtk | |
parent | fb78eca4a49077c171ad78177c1615c205adc642 (diff) |
LinGui: disable invalid audio samplerates
opus only supports a limited set of samplerates. disable those that do
not apply.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/audiohandler.c | 6 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 22 | ||||
-rw-r--r-- | gtk/src/hb-backend.h | 1 |
3 files changed, 29 insertions, 0 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 8e434964f..ba35ef972 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -199,6 +199,10 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud, GhbValue *asettings) GtkWidget *w = GHB_WIDGET(ud->builder, "AudioBitrate"); ghb_audio_bitrate_opts_filter(GTK_COMBO_BOX(w), low, high); + w = GHB_WIDGET(ud->builder, "AudioMixdown"); + ghb_mix_opts_filter(GTK_COMBO_BOX(w), acodec); + w = GHB_WIDGET(ud->builder, "AudioSamplerate"); + ghb_audio_samplerate_opts_filter(GTK_COMBO_BOX(w), acodec); ghb_ui_update(ud, "AudioEncoder", ghb_dict_get_value(asettings, "Encoder")); @@ -2138,6 +2142,8 @@ void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget, gboolean se ghb_audio_bitrate_opts_filter(GTK_COMBO_BOX(w), low, high); w = find_widget(GTK_WIDGET(row), "AudioMixdown"); ghb_mix_opts_filter(GTK_COMBO_BOX(w), enc); + w = find_widget(GTK_WIDGET(row), "AudioSamplerate"); + ghb_audio_samplerate_opts_filter(GTK_COMBO_BOX(w), enc); } void audio_def_set_all_limits_cb(GtkWidget *widget, gpointer data) diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 1df18e703..3eef1fede 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -1355,6 +1355,28 @@ audio_samplerate_opts_set(signal_user_data_t *ud, const gchar *name, ghb_audio_samplerate_opts_set(combo); } +void +ghb_audio_samplerate_opts_filter(GtkComboBox *combo, gint acodec) +{ + GtkTreeIter iter; + GtkListStore *store; + gdouble irate; + + store = GTK_LIST_STORE(gtk_combo_box_get_model(combo)); + if (!gtk_tree_model_get_iter_first( GTK_TREE_MODEL(store), &iter)) + return; + + do + { + gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 3, &irate, -1); + // If irate == 0.0, the item is the "Same as Source" item, + // so set to TRUE. Otherwise, ask libhb + gtk_list_store_set(store, &iter, 1, irate == 0.0 ? TRUE : + hb_audio_samplerate_is_supported(irate, acodec), -1); + } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); +} + + const hb_rate_t sas_rate = { .name = N_("Same as source"), diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h index 4c321e823..050b6e118 100644 --- a/gtk/src/hb-backend.h +++ b/gtk/src/hb-backend.h @@ -172,6 +172,7 @@ void ghb_audio_bitrate_opts_filter(GtkComboBox *combo, gint first_rate, gint las void ghb_mix_opts_set(GtkComboBox *combo); void ghb_mix_opts_filter(GtkComboBox *combo, gint acodec); void ghb_audio_samplerate_opts_set(GtkComboBox *combo); +void ghb_audio_samplerate_opts_filter(GtkComboBox *combo, gint acodec); int ghb_lookup_lang(const GhbValue *glang); const iso639_lang_t* ghb_iso639_lookup_by_int(int idx); |