diff options
-rw-r--r-- | gtk/src/audiohandler.c | 48 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 64 | ||||
-rw-r--r-- | gtk/src/internal_defaults.xml | 2 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 2 |
4 files changed, 44 insertions, 72 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 9364bd276..456458e29 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -283,8 +283,6 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud) const hb_title_t *title; gint track, acodec, select_acodec, mix; hb_audio_config_t *aconfig; - GtkWidget *widget; - GValue *gval; gint bitrate; gint sr = 48000; @@ -297,11 +295,7 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud) title_id = ghb_settings_get_int(ud->settings, "title"); title = ghb_lookup_title(title_id, &titleindex); - widget = GHB_WIDGET(ud->builder, "AudioTrack"); - gval = ghb_widget_value(widget); - track = ghb_lookup_combo_int("AudioTrack", gval); - ghb_value_free(gval); - + track = ghb_settings_get_int(ud->settings, "AudioTrack"); acodec = ghb_settings_audio_encoder_codec(ud->settings, "AudioEncoder"); mix = ghb_settings_mixdown_mix(ud->settings, "AudioMixdown"); bitrate = ghb_settings_audio_bitrate_rate(ud->settings, "AudioBitrate"); @@ -759,8 +753,8 @@ audio_refresh_list_row_ui( gchar *s_drc, *s_gain, *s_br_quality, *s_sr, *s_track_name; gdouble drc, gain; hb_audio_config_t *aconfig; - int titleindex, track, sr; - int title_id; + int track, sr; + int title_id, titleindex; const hb_title_t *title; const hb_encoder_t *encoder; @@ -774,7 +768,7 @@ audio_refresh_list_row_ui( } - s_track = ghb_settings_combo_option(settings, "AudioTrack"); + s_track = aconfig->lang.description; encoder = ghb_settings_audio_encoder(settings, "AudioEncoder"); double quality = ghb_settings_get_double(settings, "AudioTrackQuality"); @@ -809,9 +803,8 @@ audio_refresh_list_row_ui( s_track_name = ghb_settings_get_string(settings, "AudioTrackName"); - info_src = g_strdup_printf("%s (%.4gkHz)", - s_track, - (double)aconfig->in.samplerate / 1000); + info_src = g_strdup_printf("%d - %s (%.4gkHz)", + track + 1, s_track, (double)aconfig->in.samplerate / 1000); if (aconfig->in.bitrate > 0) { info_src_2 = g_strdup_printf( @@ -1068,14 +1061,29 @@ audio_track_changed_cb(GtkWidget *widget, signal_user_data_t *ud) asettings = audio_get_selected_settings(ud, NULL); if (asettings != NULL) { - const gchar *track; - ghb_widget_to_setting(asettings, widget); audio_deps(ud, asettings, widget); ghb_audio_list_refresh_selected(ud); - track = ghb_settings_combo_option(asettings, "AudioTrack"); - ghb_settings_set_string(asettings, "AudioTrackDescription", track); ghb_live_reset(ud); + + // Update the track description used by the queue + int title_id, titleindex; + const hb_title_t *title; + int track; + hb_audio_config_t *aconfig; + + title_id = ghb_settings_get_int(ud->settings, "title"); + title = ghb_lookup_title(title_id, &titleindex); + track = ghb_settings_get_int(ud->settings, "AudioTrack"); + aconfig = ghb_get_audio_info(title, track); + if (aconfig != NULL) + { + char *desc; + desc = g_strdup_printf("%d - %s", track + 1, + aconfig->lang.description); + ghb_settings_set_string(asettings, "AudioTrackDescription", desc); + g_free(desc); + } } } @@ -1387,8 +1395,10 @@ audio_add_to_settings(GValue *settings, GValue *asettings) aconfig = ghb_get_audio_info(title, track); if (aconfig != NULL) { - ghb_settings_set_string(asettings, "AudioTrackDescription", - aconfig->lang.description); + char *desc; + desc = g_strdup_printf("%d - %s", track + 1, aconfig->lang.description); + ghb_settings_set_string(asettings, "AudioTrackDescription", desc); + g_free(desc); } GValue *aname; diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 1ce5d7b3d..69847365e 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -369,12 +369,6 @@ combo_opts_t subtitle_opts = NULL }; -combo_opts_t audio_track_opts = -{ - 0, - NULL -}; - typedef struct { const gchar *name; @@ -406,7 +400,6 @@ combo_name_map_t combo_name_map[] = {"x264_analyse", &analyse_opts}, {"x264_trellis", &trellis_opts}, {"SubtitleTrack", &subtitle_opts}, - {"AudioTrack", &audio_track_opts}, {NULL, NULL} }; @@ -1091,21 +1084,14 @@ grey_mix_opts(signal_user_data_t *ud, gint acodec, gint64 layout) void ghb_grey_combo_options(signal_user_data_t *ud) { - GtkWidget *widget; gint track, title_id, titleindex, acodec, fallback; const hb_title_t *title; hb_audio_config_t *aconfig = NULL; - GValue *gval; title_id = ghb_settings_get_int(ud->settings, "title"); title = ghb_lookup_title(title_id, &titleindex); - widget = GHB_WIDGET (ud->builder, "title"); - gval = ghb_widget_value(widget); - ghb_value_free(gval); - widget = GHB_WIDGET (ud->builder, "AudioTrack"); - gval = ghb_widget_value(widget); - track = ghb_lookup_combo_int("AudioTrack", gval); - ghb_value_free(gval); + + track = ghb_settings_get_int(ud->settings, "AudioTrack"); aconfig = ghb_get_audio_info(title, track); const char *mux_id; @@ -2153,30 +2139,11 @@ audio_track_opts_set(GtkBuilder *builder, const gchar *name, const hb_title_t *t { count = hb_list_count( title->list_audio ); } - if (count > 100) count = 100; - if (audio_track_opts.map) - { - for (ii = 0; ii < audio_track_opts.count; ii++) - { - if (audio_track_opts.map[ii].option) - g_free(audio_track_opts.map[ii].option); - } - g_free(audio_track_opts.map); - } - if (count > 0) - { - audio_track_opts.count = count; - audio_track_opts.map = g_malloc(count*sizeof(options_map_t)); - } - else - { - audio_track_opts.count = 1; - audio_track_opts.map = g_malloc(sizeof(options_map_t)); - } if( count <= 0 ) { // No audio. set some default gtk_list_store_append(store, &iter); + str = g_strdup_printf("<small>%s</small>", _("No Audio")); gtk_list_store_set(store, &iter, 0, str, @@ -2186,32 +2153,25 @@ audio_track_opts_set(GtkBuilder *builder, const gchar *name, const hb_title_t *t 4, "none", -1); g_free(str); - audio_track_opts.map[0].option = g_strdup("No Audio"); - audio_track_opts.map[0].shortOpt = "none"; - audio_track_opts.map[0].ivalue = -1; - audio_track_opts.map[0].svalue = "none"; return; } - index_str_init(count-1); for (ii = 0; ii < count; ii++) { - audio = (hb_audio_config_t *) hb_list_audio_config_item( title->list_audio, ii ); gtk_list_store_append(store, &iter); - char *tmp = g_strdup_printf("%d - %s", ii + 1, audio->lang.description); - str = g_strdup_printf("<small>%s</small>", tmp); + + char idx[4]; + audio = hb_list_audio_config_item(title->list_audio, ii); + str = g_strdup_printf("<small>%d - %s</small>", + ii + 1, audio->lang.description); + snprintf(idx, 4, "%d", ii); gtk_list_store_set(store, &iter, 0, str, 1, TRUE, - 2, index_str[ii], + 2, idx, 3, (gdouble)ii, - 4, index_str[ii], + 4, idx, -1); g_free(str); - audio_track_opts.map[ii].option = g_strdup(tmp); - g_free(tmp); - audio_track_opts.map[ii].shortOpt = index_str[ii]; - audio_track_opts.map[ii].ivalue = ii; - audio_track_opts.map[ii].svalue = index_str[ii]; } gtk_combo_box_set_active (combo, 0); } @@ -4177,7 +4137,7 @@ ghb_validate_audio(GValue *settings) int track, codec; asettings = ghb_array_get_nth(audio_list, ii); - track = ghb_settings_combo_int(asettings, "AudioTrack"); + track = ghb_settings_get_int(asettings, "AudioTrack"); codec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder"); if (codec == HB_ACODEC_AUTO_PASS) continue; diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml index c8430fda4..2e87927d0 100644 --- a/gtk/src/internal_defaults.xml +++ b/gtk/src/internal_defaults.xml @@ -17,6 +17,8 @@ <string>192</string> <key>AudioEncoder</key> <string>copy:ac3</string> + <key>AudioTrack</key> + <integer>0</integer> <key>AudioTrackQualityEnable</key> <false /> <key>AudioTrackQuality</key> diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index 87853a836..2c5000891 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -574,7 +574,7 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter) if (audio_encoder->codec & HB_ACODEC_PASS_FLAG) { - XPRINT("<small>%s, Encoder: %s</small>\n", + XPRINT("<small>%s --> Encoder: %s</small>\n", track, audio_encoder->name); } else |