X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=gtk%2Fsrc%2Faudiohandler.c;h=4a6c77fb688b0ec471b7743351ff2f7f91a602a1;hb=44946a6f8be82a70e65ca534541183a26fdb804b;hp=1ffbf8df5afd4b7de4faca6b88cc401200a5818c;hpb=07963491d912dd7dc4bcad86ae4139a339ca7777;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 1ffbf8df..4a6c77fb 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -63,6 +63,7 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud) ghb_ui_update(ud, "AudioSamplerate", ghb_int64_value(0)); ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(0)); } + ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_double_value(0)); } else if (acodec == HB_ACODEC_FAAC && mix != HB_AMIXDOWN_6CH) { @@ -88,11 +89,26 @@ free_audio_index_list(gpointer data) g_free(data); } +gchar* +ghb_get_user_audio_lang(signal_user_data_t *ud, gint titleindex, gint track) +{ + GValue *audio_list, *asettings; + gchar *lang = NULL; + + audio_list = ghb_settings_get_value(ud->settings, "audio_list"); + if (ghb_array_len(audio_list) <= track) + return NULL; + asettings = ghb_array_get_nth(audio_list, track); + track = ghb_settings_get_int(asettings, "AudioTrack"); + lang = ghb_get_source_audio_lang(titleindex, track); + return lang; +} + void ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud) { gint acodec_code, mix_code, track; - gchar *source_lang; + gchar *source_lang = NULL; GtkWidget *button; ghb_audio_info_t ainfo; GHashTable *track_indices; @@ -108,7 +124,12 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud) ghb_clear_audio_list(ud); // Find "best" audio based on audio preferences button = GHB_WIDGET (ud->builder, "audio_add"); - source_lang = ghb_settings_get_string(ud->settings, "SourceAudioLang"); + if (!ghb_settings_get_boolean(ud->settings, "AudioDUB")) + { + source_lang = ghb_get_source_audio_lang(titleindex, 0); + } + if (source_lang == NULL) + source_lang = ghb_settings_get_string(ud->settings, "PreferredLanguage"); pref_audio = ghb_settings_get_value(ud->settings, "AudioList"); @@ -135,7 +156,8 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud) if (ghb_get_audio_info (&ainfo, titleindex, track) && ghb_audio_is_passthru (acodec_code)) { - if (ainfo.codec != acodec_code) + // HB_ACODEC_* are bit fields. Treat acodec_code as mask + if (!(ainfo.codec & acodec_code)) { acodec_code = ghb_get_default_acodec(); // If there's more audio to process, or we've already @@ -146,6 +168,10 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud) acodec_code = 0; } } + else + { + acodec_code &= ainfo.codec; + } } if (titleindex >= 0 && track < 0) acodec_code = 0; @@ -225,8 +251,8 @@ audio_list_refresh_selected(signal_user_data_t *ud) if (gtk_tree_selection_get_selected(selection, &store, &iter)) { const gchar *track, *codec, *br, *sr, *mix; - gchar *drc, *s_track, *s_codec, *s_br, *s_sr, *s_mix; - gdouble s_drc; + gchar *s_drc, *s_track, *s_codec, *s_br, *s_sr, *s_mix; + gdouble drc; // Get the row number treepath = gtk_tree_model_get_path (store, &iter); indices = gtk_tree_path_get_indices (treepath); @@ -250,11 +276,11 @@ audio_list_refresh_selected(signal_user_data_t *ud) s_br = ghb_settings_get_string(asettings, "AudioBitrate"); s_sr = ghb_settings_get_string(asettings, "AudioSamplerate"); s_mix = ghb_settings_get_string(asettings, "AudioMixdown"); - s_drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider"); - if (s_drc < 0.1) - drc = g_strdup("Off"); + drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider"); + if (drc < 1.0) + s_drc = g_strdup("Off"); else - drc = g_strdup_printf("%.1f", s_drc); + s_drc = g_strdup_printf("%.1f", drc); gtk_list_store_set(GTK_LIST_STORE(store), &iter, // These are displayed in list @@ -263,16 +289,16 @@ audio_list_refresh_selected(signal_user_data_t *ud) 2, br, 3, sr, 4, mix, - 5, drc, + 5, s_drc, // These are used to set combo values when a list item is selected 6, s_track, 7, s_codec, 8, s_br, 9, s_sr, 10, s_mix, - 11, s_drc, + 11, drc, -1); - g_free(drc); + g_free(s_drc); g_free(s_track); g_free(s_codec); g_free(s_br); @@ -281,7 +307,7 @@ audio_list_refresh_selected(signal_user_data_t *ud) } } -void +G_MODULE_EXPORT void audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { static gint prev_acodec = 0; @@ -308,7 +334,6 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud) mix_code = ghb_lookup_combo_int("AudioMixdown", ghb_string_value("dpl2")); mix_code = ghb_get_best_mix( titleindex, track, acodec_code, mix_code); ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix_code)); - ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_double_value(1.0)); } ghb_adjust_audio_rate_combos(ud); ghb_grey_combo_options (ud->builder); @@ -320,24 +345,11 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud) ghb_widget_to_setting(asettings, widget); audio_list_refresh_selected(ud); } - - const GValue *audio_list; - audio_list = ghb_settings_get_value(ud->settings, "audio_list"); - if (ghb_ac3_in_audio_list (audio_list)) - { - gchar *container; - - container = ghb_settings_get_string(ud->settings, "FileFormat"); - if (strcmp(container, "mp4") == 0) - { - ghb_ui_update(ud, "FileFormat", ghb_string_value("m4v")); - } - g_free(container); - } + ghb_update_destination_extension(ud); ghb_live_reset(ud); } -void +G_MODULE_EXPORT void audio_track_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { GValue *asettings; @@ -359,7 +371,7 @@ audio_track_changed_cb(GtkWidget *widget, signal_user_data_t *ud) ghb_live_reset(ud); } -void +G_MODULE_EXPORT void audio_mix_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { GValue *asettings; @@ -376,7 +388,7 @@ audio_mix_changed_cb(GtkWidget *widget, signal_user_data_t *ud) ghb_live_reset(ud); } -void +G_MODULE_EXPORT void audio_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { GValue *asettings; @@ -392,18 +404,22 @@ audio_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud) ghb_live_reset(ud); } -void -drc_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +G_MODULE_EXPORT void +drc_widget_changed_cb(GtkWidget *widget, gdouble val, signal_user_data_t *ud) { GValue *asettings; - gdouble val; + GtkLabel *label; + gchar *drc; g_debug("drc_widget_changed_cb ()"); - val = gtk_range_get_value(GTK_RANGE(widget)); - if (val < 0.5) - gtk_range_set_value(GTK_RANGE(widget), 0.0); - else if (val < 1.0) - gtk_range_set_value(GTK_RANGE(widget), 1.0); + + label = GTK_LABEL(GHB_WIDGET(ud->builder, "drc_label")); + if (val < 1.0) + drc = g_strdup_printf("Off"); + else + drc = g_strdup_printf("%.1f", val); + gtk_label_set_text(label, drc); + g_free(drc); ghb_check_dependency(ud, widget); asettings = get_selected_asettings(ud); if (asettings != NULL) @@ -418,7 +434,7 @@ drc_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud) // the selection is updated automaitcally when the title // changes. I don't want the preset selection changed as // would happen for regular settings. -void +G_MODULE_EXPORT void subtitle_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { const gchar *name = gtk_widget_get_name(widget); @@ -457,8 +473,8 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings) GtkListStore *store; GtkTreeSelection *selection; const gchar *track, *codec, *br, *sr, *mix; - gchar *drc, *s_track, *s_codec, *s_br, *s_sr, *s_mix; - gdouble s_drc; + gchar *s_drc, *s_track, *s_codec, *s_br, *s_sr, *s_mix; + gdouble drc; g_debug("add_to_audio_list ()"); treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list")); @@ -476,11 +492,12 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings) s_br = ghb_settings_get_string(settings, "AudioBitrate"); s_sr = ghb_settings_get_string(settings, "AudioSamplerate"); s_mix = ghb_settings_get_string(settings, "AudioMixdown"); - s_drc = ghb_settings_get_double(settings, "AudioTrackDRCSlider"); - if (s_drc < 0.1) - drc = g_strdup("Off"); + drc = ghb_settings_get_double(settings, "AudioTrackDRCSlider"); + if (drc < 1.0) + s_drc = g_strdup("Off"); else - drc = g_strdup_printf("%.1f", s_drc); + s_drc = g_strdup_printf("%.1f", drc); + gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, @@ -490,17 +507,17 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings) 2, br, 3, sr, 4, mix, - 5, drc, + 5, s_drc, // These are used to set combo box values when a list item is selected 6, s_track, 7, s_codec, 8, s_br, 9, s_sr, 10, s_mix, - 11, s_drc, + 11, drc, -1); gtk_tree_selection_select_iter(selection, &iter); - g_free(drc); + g_free(s_drc); g_free(s_track); g_free(s_codec); g_free(s_br); @@ -508,7 +525,7 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings) g_free(s_mix); } -void +G_MODULE_EXPORT void audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud) { GtkTreeModel *store; @@ -545,7 +562,7 @@ audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t } } -void +G_MODULE_EXPORT void audio_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { // Add the current audio settings to the list. @@ -582,13 +599,13 @@ audio_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) ghb_array_append(audio_list, asettings); add_to_audio_list(ud, asettings); count = ghb_array_len(audio_list); - if (count >= 8) + if (count >= 99) { gtk_widget_set_sensitive(xwidget, FALSE); } } -void +G_MODULE_EXPORT void audio_remove_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) { GtkTreeView *treeview;