diff options
author | jstebbins <[email protected]> | 2008-08-08 17:53:44 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2008-08-08 17:53:44 +0000 |
commit | e5bfe9599b4f572c43f8508199f2731e58edec5c (patch) | |
tree | 8f324e4e56368686f72dc58bf32689622a6220af /gtk | |
parent | 2b82b98c040ab7579e5c5c07e20aa017c23d0fef (diff) |
LinGui: address scott's complaint that the way i handle audio presets
is confusing. Eliminated the extra audio settings tab. consolidated
everything in the Audio/Subtitles tab. up to 8 audios can be stored in a
preset now. limit was 2 before, even though up to 8 audios could be
added manually for an encode.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1620 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/callbacks.c | 238 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 380 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 186 | ||||
-rw-r--r-- | gtk/src/hb-backend.h | 7 | ||||
-rw-r--r-- | gtk/src/internal_defaults | 15 | ||||
-rw-r--r-- | gtk/src/internal_defaults.h | 15 | ||||
-rw-r--r-- | gtk/src/settings.c | 124 | ||||
-rw-r--r-- | gtk/src/settings.h | 6 | ||||
-rwxr-xr-x | gtk/src/standard_presets | 73 |
9 files changed, 420 insertions, 624 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 8c1088f0b..8a95722d8 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -59,8 +59,6 @@ static dependency_t dep_map[] = {"title", "preview_frame", "none", TRUE}, {"title", "picture_label", "none", TRUE}, {"title", "picture_tab", "none", TRUE}, - {"title", "audio_label", "none", TRUE}, - {"title", "audio_tab", "none", TRUE}, {"title", "chapters_label", "none", TRUE}, {"title", "chapters_tab", "none", TRUE}, {"title", "title", "none", TRUE}, @@ -92,14 +90,8 @@ static dependency_t dep_map[] = {"video_codec", "x264_tab", "x264", FALSE}, {"video_codec", "x264_tab_label", "x264", FALSE}, {"video_codec", "ipod_file", "x264", FALSE}, - {"audio_track", "audio_add", "none", TRUE}, - {"audio_track", "audio_codec", "none", TRUE}, - {"audio_track", "audio_bitrate", "none", TRUE}, - {"audio_track", "audio_sample_rate", "none", TRUE}, - {"audio_track", "audio_mix", "none", TRUE}, - {"audio_track", "audio_drc", "none", TRUE}, {"audio_codec", "audio_bitrate", "ac3", TRUE}, - {"audio_codec", "audio_sample_rate", "ac3", TRUE}, + {"audio_codec", "audio_rate", "ac3", TRUE}, {"audio_codec", "audio_mix", "ac3", TRUE}, {"audio_codec", "audio_drc", "ac3", TRUE}, {"x264_bframes", "x264_weighted_bframes", "0", TRUE}, @@ -112,16 +104,6 @@ static dependency_t dep_map[] = {"x264_subme", "x264_brdo", "<6", TRUE}, {"x264_analyse", "x264_direct", "none", TRUE}, {"x264_me", "x264_merange", "umh|esa", FALSE}, - {"pref_audio_codec1", "pref_audio_bitrate1", "none", TRUE}, - {"pref_audio_codec1", "pref_audio_rate1", "none", TRUE}, - {"pref_audio_codec1", "pref_audio_mix1", "none", TRUE}, - {"pref_audio_codec1", "pref_audio_codec2", "none", TRUE}, - {"pref_audio_codec1", "pref_audio_bitrate2", "none", TRUE}, - {"pref_audio_codec1", "pref_audio_rate2", "none", TRUE}, - {"pref_audio_codec1", "pref_audio_mix2", "none", TRUE}, - {"pref_audio_codec2", "pref_audio_bitrate2", "none", TRUE}, - {"pref_audio_codec2", "pref_audio_rate2", "none", TRUE}, - {"pref_audio_codec2", "pref_audio_mix2", "none", TRUE}, {"chapter_markers", "chapters_list", "enable", FALSE}, }; @@ -953,7 +935,7 @@ adjust_audio_rate_combos(signal_user_data_t *ud) // Set the values for bitrate and samplerate to the input rates ghb_set_passthru_rate_opts (ud->builder, ainfo.bitrate); ghb_ui_update_int (ud, "audio_bitrate", ainfo.bitrate); - ghb_ui_update_int (ud, "audio_sample_rate", 0); + ghb_ui_update_int (ud, "audio_rate", 0); ghb_ui_update_int (ud, "audio_mix", 0); } else @@ -969,104 +951,75 @@ set_pref_audio(gint titleindex, signal_user_data_t *ud) const gchar *svalue; GtkWidget *button; ghb_audio_info_t ainfo; - gboolean skipped_1st = FALSE; + gchar* drcstr; + gint index; + GHashTable *track_indicies; + gint *iptr; + track_indicies = g_hash_table_new(g_int_hash, g_int_equal); // Clear the audio list clear_audio_list(ud); - // Find "best" audio based on audio preferences button = GHB_WIDGET (ud->builder, "audio_add"); - svalue = ghb_settings_get_short_opt(ud->settings, "pref_source_audio_lang"); - acodec = ghb_settings_get_int(ud->settings, "pref_source_audio_codec"); - track = ghb_find_audio_track(titleindex, svalue, acodec); - ghb_ui_update_int(ud, "audio_track", track); - // Get the resulting track, it may not be what was asked for. - track = ghb_settings_get_int(ud->settings, "audio_track"); - if (track == -1) - { - // No audio tracks. Perhaps no source dvd yet - // Just initialize the audio controls and do not add anything to - // the audio list - acodec = ghb_settings_get_int(ud->settings, "pref_audio_codec1"); - ghb_ui_update_int(ud, "audio_codec", acodec); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_bitrate1"); - ghb_ui_update_int(ud, "audio_bitrate", ivalue); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_rate1"); - ghb_ui_update_int(ud, "audio_sample_rate", ivalue); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_mix1"); - ghb_ui_update_int(ud, "audio_mix", ivalue); - svalue = ghb_settings_get_string(ud->settings, "pref_audio_drc"); - ghb_ui_update(ud, "audio_drc", svalue); - return; - } - acodec = ghb_settings_get_int(ud->settings, "pref_audio_codec1"); - // Check to see if: - // 1. pref codec is ac3 - // 2. source codec is not ac3 - // 3. 2nd pref is enabled - if (ghb_get_audio_info (&ainfo, titleindex, track) && ghb_audio_is_passthru (acodec)) + svalue = ghb_settings_get_short_opt(ud->settings, "source_audio_lang"); + gint acount = ghb_pref_acount(); + gint ii; + gint list_count = 0; + for (ii = 0; ii < acount; ii++) { - if (!ghb_audio_is_passthru(ainfo.codec)) + acodec = ghb_pref_acodec(ii); + iptr = g_hash_table_lookup(track_indicies, &acodec); + if (iptr == NULL) + index = 0; + else + index = *(gint*)iptr; + + track = ghb_find_audio_track(titleindex, svalue, index); + // Check to see if: + // 1. pref codec is ac3 + // 2. source codec is not ac3 + // 3. next pref is enabled + if (ghb_get_audio_info (&ainfo, titleindex, track) && + ghb_audio_is_passthru (acodec)) { - acodec = ghb_get_default_acodec(); - if (ghb_settings_get_int(ud->settings, "pref_audio_codec2") != 0) + if (!ghb_audio_is_passthru(ainfo.codec)) { - // Skip first pref audio - acodec = 0; - skipped_1st = TRUE; + acodec = ghb_get_default_acodec(); + if ((ii + 1 < acount) || (list_count != 0)) + { + // Skip this audio + acodec = 0; + } } } - } - ghb_ui_update_int(ud, "audio_codec", acodec); - if (!ghb_audio_is_passthru (acodec)) - { - // This gets set autimatically if the codec is passthru - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_bitrate1"); - ghb_ui_update_int(ud, "audio_bitrate", ivalue); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_rate1"); - ghb_ui_update_int(ud, "audio_sample_rate", ivalue); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_mix1"); - ivalue = ghb_get_best_mix(titleindex, track, acodec, ivalue); - ghb_ui_update_int(ud, "audio_mix", ivalue); - } - svalue = ghb_settings_get_string(ud->settings, "pref_audio_drc"); - ghb_ui_update(ud, "audio_drc", svalue); - if (acodec != 0) // 0 is none - { - // Add to audio list - g_signal_emit_by_name(button, "clicked", ud); - } - acodec = ghb_settings_get_int(ud->settings, "pref_audio_codec2"); - // Check to see if: - // 1. pref codec is ac3 - // 2. source codec is not ac3 - if (ghb_audio_is_passthru (acodec)) - { - if (!ghb_audio_is_passthru(ainfo.codec) && skipped_1st) - { - acodec = ghb_get_default_acodec(); - } - else - { + if (titleindex >= 0 && track < 0) acodec = 0; + if (acodec != 0) + { + // Add to audio list + g_signal_emit_by_name(button, "clicked", ud); + list_count++; + ghb_ui_update_int(ud, "audio_track", track); + ghb_ui_update_int(ud, "audio_codec", acodec); + if (!ghb_audio_is_passthru (acodec)) + { + // This gets set autimatically if the codec is passthru + ivalue = ghb_pref_bitrate(ii); + ghb_ui_update_int(ud, "audio_bitrate", ivalue); + ivalue = ghb_pref_rate(ii); + ghb_ui_update_int(ud, "audio_rate", ivalue); + ivalue = ghb_pref_mix(ii); + ivalue = ghb_get_best_mix(titleindex, track, acodec, ivalue); + ghb_ui_update_int(ud, "audio_mix", ivalue); + } + drcstr = g_strdup_printf("%.2g", ghb_pref_drc(ii)); + ghb_ui_update(ud, "audio_drc", drcstr); + g_free(drcstr); + index++; + g_hash_table_insert(track_indicies, &acodec, &index); } } - if (acodec != 0) - { - ghb_ui_update_int(ud, "audio_codec", acodec); - // Do the second prefs track - if (!ghb_audio_is_passthru (acodec)) - { - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_bitrate2"); - ghb_ui_update_int(ud, "audio_bitrate", ivalue); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_rate2"); - ghb_ui_update_int(ud, "audio_sample_rate", ivalue); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_mix2"); - ivalue = ghb_get_best_mix(titleindex, track, acodec, ivalue); - ghb_ui_update_int(ud, "audio_mix", ivalue); - } - g_signal_emit_by_name(button, "clicked", ud); - } + g_hash_table_destroy(track_indicies); } static gint preview_button_width; @@ -1171,11 +1124,11 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud) gint titleindex = ghb_settings_get_int(ud->settings, "title"); gint track = ghb_settings_get_int(ud->settings, "audio_track"); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_bitrate1"); + ivalue = ghb_pref_bitrate(0); ghb_ui_update_int (ud, "audio_bitrate", ivalue); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_rate1"); - ghb_ui_update_int (ud, "audio_sample_rate", ivalue); - ivalue = ghb_settings_get_int(ud->settings, "pref_audio_mix1"); + ivalue = ghb_pref_rate(0); + ghb_ui_update_int (ud, "audio_rate", ivalue); + ivalue = ghb_pref_mix(0); ivalue = ghb_get_best_mix(titleindex, track, acodec, ivalue); ghb_ui_update_int (ud, "audio_mix", ivalue); } @@ -1571,14 +1524,14 @@ add_to_audio_list(signal_user_data_t *ud, GHashTable *settings) 0, ghb_settings_get_option(settings, "audio_track"), 1, ghb_settings_get_option(settings, "audio_codec"), 2, ghb_settings_get_option(settings, "audio_bitrate"), - 3, ghb_settings_get_option(settings, "audio_sample_rate"), + 3, ghb_settings_get_option(settings, "audio_rate"), 4, ghb_settings_get_option(settings, "audio_mix"), // These are used to set combo box values when a list item is selected 5, ghb_settings_get_string(settings, "audio_drc"), 6, ghb_settings_get_short_opt(settings, "audio_track"), 7, ghb_settings_get_short_opt(settings, "audio_codec"), 8, ghb_settings_get_short_opt(settings, "audio_bitrate"), - 9, ghb_settings_get_short_opt(settings, "audio_sample_rate"), + 9, ghb_settings_get_short_opt(settings, "audio_rate"), 10, ghb_settings_get_short_opt(settings, "audio_mix"), -1); gtk_tree_selection_select_iter(selection, &iter); @@ -1617,14 +1570,14 @@ audio_list_refresh_selected(signal_user_data_t *ud) 0, ghb_settings_get_option(asettings, "audio_track"), 1, ghb_settings_get_option(asettings, "audio_codec"), 2, ghb_settings_get_option(asettings, "audio_bitrate"), - 3, ghb_settings_get_option(asettings, "audio_sample_rate"), + 3, ghb_settings_get_option(asettings, "audio_rate"), 4, ghb_settings_get_option(asettings, "audio_mix"), // These are used to set combo box values when a list item is selected 5, ghb_settings_get_string(asettings, "audio_drc"), 6, ghb_settings_get_short_opt(asettings, "audio_track"), 7, ghb_settings_get_short_opt(asettings, "audio_codec"), 8, ghb_settings_get_short_opt(asettings, "audio_bitrate"), - 9, ghb_settings_get_short_opt(asettings, "audio_sample_rate"), + 9, ghb_settings_get_short_opt(asettings, "audio_rate"), 10, ghb_settings_get_short_opt(asettings, "audio_mix"), -1); } @@ -1684,7 +1637,7 @@ audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t ghb_ui_update(ud, "audio_track", track); ghb_ui_update(ud, "audio_codec", codec); ghb_ui_update(ud, "audio_bitrate", bitrate); - ghb_ui_update(ud, "audio_sample_rate", sample_rate); + ghb_ui_update(ud, "audio_rate", sample_rate); ghb_ui_update(ud, "audio_mix", mix); ghb_ui_update(ud, "audio_drc", drc); widget = GHB_WIDGET (ud->builder, "audio_remove"); @@ -1718,8 +1671,8 @@ audio_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) ghb_settings_set(asettings, "audio_codec", ghb_widget_value(widget)); widget = GHB_WIDGET(ud->builder, "audio_bitrate"); ghb_settings_set(asettings, "audio_bitrate", ghb_widget_value(widget)); - widget = GHB_WIDGET(ud->builder, "audio_sample_rate"); - ghb_settings_set(asettings, "audio_sample_rate", ghb_widget_value(widget)); + widget = GHB_WIDGET(ud->builder, "audio_rate"); + ghb_settings_set(asettings, "audio_rate", ghb_widget_value(widget)); widget = GHB_WIDGET(ud->builder, "audio_mix"); ghb_settings_set(asettings, "audio_mix", ghb_widget_value(widget)); widget = GHB_WIDGET(ud->builder, "audio_drc"); @@ -1808,14 +1761,14 @@ audio_list_refresh(signal_user_data_t *ud) 0, ghb_settings_get_option(asettings, "audio_track"), 1, ghb_settings_get_option(asettings, "audio_codec"), 2, ghb_settings_get_option(asettings, "audio_bitrate"), - 3, ghb_settings_get_option(asettings, "audio_sample_rate"), + 3, ghb_settings_get_option(asettings, "audio_rate"), 4, ghb_settings_get_option(asettings, "audio_mix"), // These are used to set combo box values when a list item is selected 5, ghb_settings_get_string(asettings, "audio_drc"), 6, ghb_settings_get_short_opt(asettings, "audio_track"), 7, ghb_settings_get_short_opt(asettings, "audio_codec"), 8, ghb_settings_get_short_opt(asettings, "audio_bitrate"), - 9, ghb_settings_get_short_opt(asettings, "audio_sample_rate"), + 9, ghb_settings_get_short_opt(asettings, "audio_rate"), 10, ghb_settings_get_short_opt(asettings, "audio_mix"), -1); done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter); @@ -1920,6 +1873,51 @@ ghb_select_preset(GtkBuilder *builder, const gchar *preset) } } +static void +update_audio_presets(signal_user_data_t *ud) +{ + GSList *link = ud->audio_settings; + GHashTable *asettings; + gchar *acodec, *bitrate, *rate, *mix, *drc; + GString *pref_acodec, *pref_bitrate, *pref_rate, *pref_mix, *pref_drc; + pref_acodec = g_string_new(""); + pref_bitrate = g_string_new(""); + pref_rate = g_string_new(""); + pref_mix = g_string_new(""); + pref_drc = g_string_new(""); + while (link) + { + gchar *format = link->next ? "%s," : "%s"; + asettings = (GHashTable*)link->data; + acodec = (gchar*)ghb_settings_get_short_opt(asettings, "audio_codec"); + g_string_append_printf( pref_acodec, format, acodec); + bitrate = (gchar*)ghb_settings_get_string(asettings, "audio_bitrate"); + g_string_append_printf( pref_bitrate, format, bitrate); + rate = (gchar*)ghb_settings_get_string(asettings, "audio_rate"); + g_string_append_printf( pref_rate, format, rate); + mix = (gchar*)ghb_settings_get_short_opt(asettings, "audio_mix"); + g_string_append_printf( pref_mix, format, mix); + drc = (gchar*)ghb_settings_get_string(asettings, "audio_drc"); + g_string_append_printf( pref_drc, format, drc); + link = link->next; + } + acodec = g_string_free(pref_acodec, FALSE); + bitrate = g_string_free(pref_bitrate, FALSE); + rate = g_string_free(pref_rate, FALSE); + mix = g_string_free(pref_mix, FALSE); + drc = g_string_free(pref_drc, FALSE); + ghb_settings_set_string(ud->settings, "pref_audio_codec", acodec); + ghb_settings_set_string(ud->settings, "pref_audio_bitrate", bitrate); + ghb_settings_set_string(ud->settings, "pref_audio_rate", rate); + ghb_settings_set_string(ud->settings, "pref_audio_mix", mix); + ghb_settings_set_string(ud->settings, "pref_audio_drc", drc); + g_free(acodec); + g_free(bitrate); + g_free(rate); + g_free(mix); + g_free(drc); +} + void presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { @@ -1930,6 +1928,7 @@ presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) const gchar *preset = ""; g_debug("presets_save_clicked_cb ()\n"); + // Construct the audio settings presets from the current audio list preset = ghb_settings_get_string (ud->settings, "preset"); // Clear the description desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "preset_description")); @@ -1945,6 +1944,7 @@ presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) const gchar *name = gtk_entry_get_text(entry); g_debug("description to settings\n"); ghb_widget_to_setting(ud->settings, GTK_WIDGET(desc)); + update_audio_presets(ud); ghb_settings_save(ud, name); ghb_presets_list_update(ud); // Make the new preset the selected item @@ -2280,7 +2280,7 @@ add_to_queue_list(signal_user_data_t *ud, job_settings_t *item) GHashTable *asettings = (GHashTable*)link->data; const gchar *acodec = ghb_settings_get_option(asettings, "audio_codec"); const gchar *bitrate = ghb_settings_get_string(asettings, "audio_bitrate"); - const gchar *samplerate = ghb_settings_get_string(asettings, "audio_sample_rate"); + const gchar *samplerate = ghb_settings_get_string(asettings, "audio_rate"); gint track = ghb_settings_get_int(asettings, "audio_track"); const gchar *mix = ghb_settings_get_option(asettings, "audio_mix"); g_string_append_printf(pass, diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index d84352911..6af322955 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -125,9 +125,9 @@ <property name="upper">4</property> <property name="lower">1</property> <property name="page_increment">1</property> - <property name="step_increment">0.20000000000000001</property> + <property name="step_increment">0.2</property> <property name="page_size">0</property> - <property name="value">2.6000000000000001</property> + <property name="value">2.6</property> </object> <object class="GtkAdjustment" id="adjustment7"> <property name="upper">4</property> @@ -2047,7 +2047,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="audio_sample_rate"> + <object class="GtkComboBox" id="audio_rate"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <signal handler="audio_widget_changed_cb" name="changed"/> @@ -2180,34 +2180,19 @@ </child> </object> </child> - </object> - </child> - <child type="tab"> - <object class="GtkLabel" id="audio_label"> - <property name="visible">True</property> - <property name="label" translatable="yes">Audio List</property> - </object> - <packing> - <property name="position">2</property> - <property name="tab_fill">False</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox25"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkVBox" id="vbox19"> + <object class="GtkHBox" id="hboxj01"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">5</property> <child> - <object class="GtkFrame" id="frame8"> + <object class="GtkFrame" id="framej01"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="label_xalign">0</property> <property name="shadow_type">GTK_SHADOW_ETCHED_OUT</property> <child> - <object class="GtkAlignment" id="alignment19"> + <object class="GtkAlignment" id="alignmentj01"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="top_padding">2</property> @@ -2215,302 +2200,41 @@ <property name="left_padding">12</property> <property name="right_padding">2</property> <child> - <object class="GtkVBox" id="vbox30"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="spacing">2</property> - <child> - <object class="GtkTable" id="table4"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <child> - <object class="GtkComboBox" id="pref_source_audio_lang"> - <property name="width_request">150</property> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="pref_source_audio_codec"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label42"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Language</property> - </object> - <packing> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label43"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Codec</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="x_options">GTK_FILL</property> - </packing> - </child> - </object> - </child> - </object> - </child> - </object> - </child> - <child type="label"> - <object class="GtkLabel" id="label47"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes"><b>Audio Source</b></property> - <property name="use_markup">True</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="padding">2</property> - </packing> - </child> - <child> - <object class="GtkFrame" id="frame18"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label_xalign">0</property> - <property name="shadow_type">GTK_SHADOW_ETCHED_OUT</property> - <child> - <object class="GtkAlignment" id="alignment20"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="left_padding">12</property> - <child> - <object class="GtkVBox" id="vbox35"> + <object class="GtkHBox" id="hboxj02"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">5</property> + <child> - <object class="GtkTable" id="table3"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="n_rows">3</property> - <property name="n_columns">4</property> - <child> - <object class="GtkComboBox" id="pref_audio_codec1"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="pref_audio_bitrate1"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="pref_audio_rate1"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="pref_audio_mix1"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="pref_audio_codec2"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="pref_audio_bitrate2"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="pref_audio_rate2"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="pref_audio_mix2"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="setting_widget_changed_cb" name="changed"/> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label44"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Codec</property> - </object> - </child> - <child> - <object class="GtkLabel" id="label45"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Bitrate</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label46"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Sample Rate</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label78"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Mix Down</property> - </object> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - </packing> - </child> - </object> - </child> - <child> - <object class="GtkVBox" id="vbox36"> + <object class="GtkComboBox" id="source_audio_lang"> + <property name="width_request">150</property> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <child> - <object class="GtkLabel" id="label79"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Dynamic Range Compression</property> - </object> - </child> - <child> - <object class="GtkHScale" id="pref_audio_drc"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="adjustment">adjustment7</property> - <property name="value_pos">GTK_POS_RIGHT</property> - <signal handler="setting_widget_changed_cb" name="value_changed"/> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> + <signal handler="setting_widget_changed_cb" name="changed"/> </object> - <packing> - <property name="position">1</property> - </packing> </child> </object> </child> </object> </child> <child type="label"> - <object class="GtkLabel" id="label75"> + <object class="GtkLabel" id="labelj01"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes"><b>Audio Encoding Defaults</b></property> + <property name="label" translatable="yes"><b>Preferred Audio Language</b></property> <property name="use_markup">True</property> </object> </child> </object> - <packing> - <property name="position">1</property> - </packing> </child> <child> - <object class="GtkFrame" id="frame17"> + <object class="GtkFrame" id="framej02"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="label_xalign">0</property> <property name="shadow_type">GTK_SHADOW_ETCHED_OUT</property> <child> - <object class="GtkAlignment" id="alignment40"> + <object class="GtkAlignment" id="alignmentj02"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="top_padding">2</property> @@ -2518,41 +2242,18 @@ <property name="left_padding">12</property> <property name="right_padding">2</property> <child> - <object class="GtkVBox" id="vbox33"> + <object class="GtkHBox" id="hboxj03"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">5</property> + <child> - <object class="GtkHBox" id="hbox44"> + <object class="GtkComboBox" id="subtitle_lang"> + <property name="width_request">150</property> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <child> - <object class="GtkLabel" id="label71"> - <property name="width_request">80</property> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Language:</property> - </object> - <packing> - <property name="expand">False</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="subtitle_lang"> - <property name="width_request">150</property> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <signal handler="subtitle_changed_cb" name="changed"/> - </object> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> + <signal handler="subtitle_changed_cb" name="changed"/> </object> - <packing> - <property name="expand">False</property> - </packing> </child> <child> <object class="GtkCheckButton" id="forced_subtitles"> @@ -2568,15 +2269,12 @@ <property name="position">1</property> </packing> </child> - <child> - <placeholder/> - </child> </object> </child> </object> </child> <child type="label"> - <object class="GtkLabel" id="label70"> + <object class="GtkLabel" id="labelj02"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="label" translatable="yes"><b>Subtitles</b></property> @@ -2585,33 +2283,13 @@ </child> </object> <packing> - <property name="position">2</property> + <property name="position">1</property> </packing> </child> </object> <packing> <property name="expand">False</property> - <property name="padding">2</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox20"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <child> - <object class="GtkVBox" id="vbox23"> - <property name="visible">True</property> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - </object> - </child> - </object> - <packing> - <property name="position">1</property> + <property name="position">3</property> </packing> </child> </object> @@ -2622,7 +2300,7 @@ <property name="label" translatable="yes">Audio/Subtitles</property> </object> <packing> - <property name="position">3</property> + <property name="position">2</property> <property name="tab_fill">False</property> </packing> </child> @@ -3361,7 +3039,7 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1</property> <property name="label" translatable="yes">H.264</property> </object> <packing> - <property name="position">4</property> + <property name="position">3</property> <property name="tab_fill">False</property> </packing> </child> @@ -3425,7 +3103,7 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1</property> <property name="label" translatable="yes">Chapters</property> </object> <packing> - <property name="position">5</property> + <property name="position">4</property> <property name="tab_fill">False</property> </packing> </child> diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index dd63ccf16..57e1a857c 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -103,10 +103,10 @@ combo_opts_t vcodec_opts = static options_map_t d_acodec_opts[] = { - {"AAC (faac)", "faac", HB_ACODEC_FAAC, 0.0, ""}, - {"MP3 (lame)", "lame", HB_ACODEC_LAME, 0.0, ""}, - {"Vorbis", "vorbis", HB_ACODEC_VORBIS, 0.0, ""}, - {"AC3 (pass-thru)", "ac3", HB_ACODEC_AC3, 0.0, ""}, + {"AAC (faac)", "faac", HB_ACODEC_FAAC, 0.0, "faac"}, + {"MP3 (lame)", "lame", HB_ACODEC_LAME, 0.0, "lame"}, + {"Vorbis", "vorbis", HB_ACODEC_VORBIS, 0.0, "vorbis"}, + {"AC3 (pass-thru)", "ac3", HB_ACODEC_AC3, 0.0, "ac3"}, }; combo_opts_t acodec_opts = { @@ -114,33 +114,6 @@ combo_opts_t acodec_opts = d_acodec_opts }; -static options_map_t d_pref_acodec_opts[] = -{ - {"None", "none", 0, 0.0, ""}, - {"AAC (faac)", "faac", HB_ACODEC_FAAC, 0.0, ""}, - {"MP3 (lame)", "lame", HB_ACODEC_LAME, 0.0, ""}, - {"Vorbis", "vorbis", HB_ACODEC_VORBIS, 0.0, ""}, - {"AC3 (pass-thru)", "ac3", HB_ACODEC_AC3, 0.0, ""}, -}; -combo_opts_t pref_acodec_opts = -{ - sizeof(d_pref_acodec_opts)/sizeof(options_map_t), - d_pref_acodec_opts -}; - -static options_map_t d_source_acodec_opts[] = -{ - {"AC3", "ac3", HB_ACODEC_AC3, 0.0, ""}, - {"DTS", "dca", HB_ACODEC_DCA, 0.0, ""}, - {"MP2", "mpga", HB_ACODEC_MPGA, 0.0, ""}, - {"LPCM", "lpcm", HB_ACODEC_LPCM, 0.0, ""}, -}; -combo_opts_t source_acodec_opts = -{ - sizeof(d_source_acodec_opts)/sizeof(options_map_t), - d_source_acodec_opts -}; - static options_map_t d_direct_opts[] = { {"None", "none", 0, 0.0, "none"}, @@ -470,6 +443,78 @@ ghb_vquality_range(signal_user_data_t *ud, gint *min, gint *max) } } +gint +ghb_lookup_acodec(const gchar *acodec) +{ + gint ii; + + for (ii = 0; ii < acodec_opts.count; ii++) + { + if (strcmp(acodec_opts.map[ii].shortOpt, acodec) == 0) + { + return acodec_opts.map[ii].ivalue; + } + } + return HB_ACODEC_FAAC; +} + +gint +ghb_lookup_bitrate(const gchar *bitrate) +{ + gint ii; + + for (ii = 0; ii < hb_audio_bitrates_count; ii++) + { + if (strcmp(hb_audio_bitrates[ii].string, bitrate) == 0) + { + return hb_audio_bitrates[ii].rate * 1000; + } + } + return 160 * 1000; +} + +gint +ghb_lookup_rate(const gchar *rate) +{ + gint ii; + + for (ii = 0; ii < hb_audio_rates_count; ii++) + { + if (strcmp(hb_audio_rates[ii].string, rate) == 0) + { + return hb_audio_rates[ii].rate; + } + } + // Coincidentally, the string "source" will return 0 + // which is our flag to use "same as source" + return 0; +} + +gint +ghb_lookup_mix(const gchar *mix) +{ + gint ii; + + for (ii = 0; ii < hb_audio_mixdowns_count; ii++) + { + if (strcmp(hb_audio_mixdowns[ii].short_name, mix) == 0) + { + return hb_audio_mixdowns[ii].amixdown; + } + } + return HB_AMIXDOWN_DOLBYPLII; +} + +gdouble +ghb_lookup_drc(const gchar *drc) +{ + gdouble dval; + dval = g_strtod(drc, NULL); + if (dval < 1.0) dval = 1.0; + if (dval > 4.0) dval = 4.0; + return dval; +} + static setting_value_t* get_acodec_value(gint val) { @@ -615,14 +660,8 @@ ghb_grey_combo_options(GtkBuilder *builder) httpopt = ghb_widget_int(widget); grey_combo_box_item(builder, "audio_codec", HB_ACODEC_FAAC, FALSE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_FAAC, FALSE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_FAAC, FALSE); grey_combo_box_item(builder, "audio_codec", HB_ACODEC_LAME, FALSE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_LAME, FALSE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_LAME, FALSE); grey_combo_box_item(builder, "audio_codec", HB_ACODEC_VORBIS, FALSE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_VORBIS, FALSE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_VORBIS, FALSE); gboolean allow_ac3 = TRUE; allow_ac3 = @@ -632,14 +671,10 @@ ghb_grey_combo_options(GtkBuilder *builder) if (allow_ac3) { grey_combo_box_item(builder, "audio_codec", HB_ACODEC_AC3, FALSE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_AC3, FALSE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_AC3, FALSE); } else { grey_combo_box_item(builder, "audio_codec", HB_ACODEC_AC3, TRUE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_AC3, TRUE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_AC3, TRUE); } if (audio && audio->in.codec != HB_ACODEC_AC3) { @@ -656,28 +691,18 @@ ghb_grey_combo_options(GtkBuilder *builder) if (container == HB_MUX_MP4) { grey_combo_box_item(builder, "audio_codec", HB_ACODEC_LAME, TRUE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_LAME, TRUE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_LAME, TRUE); grey_combo_box_item(builder, "audio_codec", HB_ACODEC_VORBIS, TRUE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_VORBIS, TRUE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_VORBIS, TRUE); grey_combo_box_item(builder, "video_codec", HB_VCODEC_THEORA, TRUE); } else if (container == HB_MUX_AVI) { grey_combo_box_item(builder, "audio_codec", HB_ACODEC_FAAC, TRUE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_FAAC, TRUE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_FAAC, TRUE); grey_combo_box_item(builder, "audio_codec", HB_ACODEC_VORBIS, TRUE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_VORBIS, TRUE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_VORBIS, TRUE); grey_combo_box_item(builder, "video_codec", HB_VCODEC_THEORA, TRUE); } else if (container == HB_MUX_OGM) { grey_combo_box_item(builder, "audio_codec", HB_ACODEC_FAAC, TRUE); - grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_FAAC, TRUE); - grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_FAAC, TRUE); } gboolean allow_mono = TRUE; @@ -952,7 +977,7 @@ mix_opts_set(GtkBuilder *builder, const gchar *name) GtkListStore *store; gint ii; - g_debug("audio_bitrate_opts_set ()\n"); + g_debug("mix_opts_set ()\n"); store = get_combo_box_store(builder, name); gtk_list_store_clear(store); gtk_list_store_append(store, &iter); @@ -983,7 +1008,7 @@ language_opts_set(GtkBuilder *builder, const gchar *name) GtkListStore *store; gint ii; - g_debug("audio_bitrate_opts_set ()\n"); + g_debug("language_opts_set ()\n"); store = get_combo_box_store(builder, name); gtk_list_store_clear(store); for (ii = 0; ii < LANG_TABLE_SIZE; ii++) @@ -1250,14 +1275,15 @@ ghb_longest_title() } gint -ghb_find_audio_track(gint titleindex, const gchar *lang, gint acodec) +ghb_find_audio_track(gint titleindex, const gchar *lang, gint index) { hb_list_t * list; hb_title_t * title; hb_audio_config_t * audio; gint ii; gint count = 0; - gint track = 0; + gint track = -1; + gint match = 0; g_debug("find_audio_track ()\n"); if (h != NULL) @@ -1276,13 +1302,12 @@ ghb_find_audio_track(gint titleindex, const gchar *lang, gint acodec) if ((strcmp(lang, audio->lang.iso639_2) == 0) || (strcmp(lang, "und") == 0)) { - // Candidate track. Will use if no better match found - track = ii; - if (audio->in.codec == acodec) + if (index == match) { - // Perfect match - return track; + track = ii; + break; } + match++; } } return track; @@ -1340,26 +1365,14 @@ ghb_update_ui_combo_box(GtkBuilder *builder, const gchar *name, gint user_data, } if (all || strcmp(name, "audio_bitrate") == 0) audio_bitrate_opts_set(builder, "audio_bitrate", hb_audio_bitrates, hb_audio_bitrates_count); - if (all || strcmp(name, "pref_audio_bitrate1") == 0) - audio_bitrate_opts_set(builder, "pref_audio_bitrate1", hb_audio_bitrates, hb_audio_bitrates_count); - if (all || strcmp(name, "pref_audio_bitrate2") == 0) - audio_bitrate_opts_set(builder, "pref_audio_bitrate2", hb_audio_bitrates, hb_audio_bitrates_count); - if (all || strcmp(name, "audio_sample_rate") == 0) - audio_samplerate_opts_set(builder, "audio_sample_rate", hb_audio_rates, hb_audio_rates_count); - if (all || strcmp(name, "pref_audio_rate1") == 0) - audio_samplerate_opts_set(builder, "pref_audio_rate1", hb_audio_rates, hb_audio_rates_count); - if (all || strcmp(name, "pref_audio_rate2") == 0) - audio_samplerate_opts_set(builder, "pref_audio_rate2", hb_audio_rates, hb_audio_rates_count); + if (all || strcmp(name, "audio_rate") == 0) + audio_samplerate_opts_set(builder, "audio_rate", hb_audio_rates, hb_audio_rates_count); if (all || strcmp(name, "framerate") == 0) video_rate_opts_set(builder, "framerate", hb_video_rates, hb_video_rates_count); if (all || strcmp(name, "audio_mix") == 0) mix_opts_set(builder, "audio_mix"); - if (all || strcmp(name, "pref_audio_mix1") == 0) - mix_opts_set(builder, "pref_audio_mix1"); - if (all || strcmp(name, "pref_audio_mix2") == 0) - mix_opts_set(builder, "pref_audio_mix2"); - if (all || strcmp(name, "pref_source_audio_lang") == 0) - language_opts_set(builder, "pref_source_audio_lang"); + if (all || strcmp(name, "source_audio_lang") == 0) + language_opts_set(builder, "source_audio_lang"); if (all || strcmp(name, "subtitle_lang") == 0) subtitle_opts_set(builder, "subtitle_lang", user_data); if (all || strcmp(name, "title") == 0) @@ -1376,12 +1389,6 @@ ghb_update_ui_combo_box(GtkBuilder *builder, const gchar *name, gint user_data, generic_opts_set(builder, "video_codec", &vcodec_opts); if (all || strcmp(name, "audio_codec") == 0) generic_opts_set(builder, "audio_codec", &acodec_opts); - if (all || strcmp(name, "pref_audio_codec1") == 0) - generic_opts_set(builder, "pref_audio_codec1", &pref_acodec_opts); - if (all || strcmp(name, "pref_audio_codec2") == 0) - generic_opts_set(builder, "pref_audio_codec2", &pref_acodec_opts); - if (all || strcmp(name, "pref_source_audio_codec") == 0) - generic_opts_set(builder, "pref_source_audio_codec", &source_acodec_opts); if (all || strcmp(name, "x264_direct") == 0) generic_opts_set(builder, "x264_direct", &direct_opts); if (all || strcmp(name, "x264_me") == 0) @@ -1402,16 +1409,10 @@ static void init_ui_combo_boxes(GtkBuilder *builder) { init_combo_box(builder, "audio_bitrate"); - init_combo_box(builder, "pref_audio_bitrate1"); - init_combo_box(builder, "pref_audio_bitrate2"); - init_combo_box(builder, "audio_sample_rate"); - init_combo_box(builder, "pref_audio_rate1"); - init_combo_box(builder, "pref_audio_rate2"); + init_combo_box(builder, "audio_rate"); init_combo_box(builder, "framerate"); init_combo_box(builder, "audio_mix"); - init_combo_box(builder, "pref_audio_mix1"); - init_combo_box(builder, "pref_audio_mix2"); - init_combo_box(builder, "pref_source_audio_lang"); + init_combo_box(builder, "source_audio_lang"); init_combo_box(builder, "subtitle_lang"); init_combo_box(builder, "title"); init_combo_box(builder, "audio_track"); @@ -1420,9 +1421,6 @@ init_ui_combo_boxes(GtkBuilder *builder) init_combo_box(builder, "denoise"); init_combo_box(builder, "video_codec"); init_combo_box(builder, "audio_codec"); - init_combo_box(builder, "pref_audio_codec1"); - init_combo_box(builder, "pref_audio_codec2"); - init_combo_box(builder, "pref_source_audio_codec"); init_combo_box(builder, "x264_direct"); init_combo_box(builder, "x264_me"); init_combo_box(builder, "x264_subme"); @@ -2630,7 +2628,7 @@ ghb_add_job(job_settings_t *js, gint unique_id) audio.out.mixdown = ghb_get_best_mix(titleindex, audio.in.track, audio.out.codec, audio.out.mixdown); audio.out.bitrate = ghb_settings_get_int(asettings, "audio_bitrate") / 1000; - gint srate = ghb_settings_get_int(asettings, "audio_sample_rate"); + gint srate = ghb_settings_get_int(asettings, "audio_rate"); if (srate == 0) // 0 is same as source audio.out.samplerate = taudio->in.samplerate; else diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h index d5a65afe6..1b7e641c5 100644 --- a/gtk/src/hb-backend.h +++ b/gtk/src/hb-backend.h @@ -106,7 +106,7 @@ gboolean ghb_set_passthru_rate_opts(GtkBuilder *builder, gint bitrate); gboolean ghb_set_default_rate_opts(GtkBuilder *builder); void ghb_grey_combo_options(GtkBuilder *builder); void ghb_update_ui_combo_box(GtkBuilder *builder, const gchar *name, gint user_data, gboolean all); -gint ghb_find_audio_track(gint titleindex, const gchar *lang, gint acodec); +gint ghb_find_audio_track(gint titleindex, const gchar *lang, gint index); gint ghb_longest_title(); gchar* ghb_build_x264opts_string(GHashTable *settings); GdkPixbuf* ghb_get_preview_image(gint titleindex, gint index, GHashTable *settings, gboolean borders); @@ -119,5 +119,10 @@ gboolean ghb_validate_vquality(GHashTable *settings); gboolean ghb_validate_audio(signal_user_data_t *ud); gboolean ghb_validate_video(signal_user_data_t *ud); void ghb_hb_cleanup(gboolean partial); +gint ghb_lookup_acodec(const gchar *acodec); +gint ghb_lookup_bitrate(const gchar *bitrate); +gint ghb_lookup_rate(const gchar *rate); +gint ghb_lookup_mix(const gchar *mix); +gdouble ghb_lookup_drc(const gchar *drc); #endif // _HBBACKEND_H_ diff --git a/gtk/src/internal_defaults b/gtk/src/internal_defaults index 0a8d33f59..19ac6fefe 100644 --- a/gtk/src/internal_defaults +++ b/gtk/src/internal_defaults @@ -2,16 +2,11 @@ preset_description= subtitle_lang=none forced_subtitles=enable -pref_source_audio_lang=und -pref_source_audio_codec=ac3 -pref_audio_codec1=ac3 -pref_audio_codec2=none -pref_audio_bitrate1=192 -pref_audio_bitrate2=192 -pref_audio_rate1=source -pref_audio_rate2=source -pref_audio_mix1=dpl2 -pref_audio_mix2=dpl2 +source_audio_lang=und +pref_audio_codec=ac3 +pref_audio_bitrate=192 +pref_audio_rate=source +pref_audio_mix=dpl2 pref_audio_drc=1.0 chapter_markers=enable container=mp4 diff --git a/gtk/src/internal_defaults.h b/gtk/src/internal_defaults.h index 28c53935f..13ffbe144 100644 --- a/gtk/src/internal_defaults.h +++ b/gtk/src/internal_defaults.h @@ -2,16 +2,11 @@ "preset_description=\n" "subtitle_lang=none\n" "forced_subtitles=enable\n" -"pref_source_audio_lang=und\n" -"pref_source_audio_codec=ac3\n" -"pref_audio_codec1=ac3\n" -"pref_audio_codec2=none\n" -"pref_audio_bitrate1=192\n" -"pref_audio_bitrate2=192\n" -"pref_audio_rate1=source\n" -"pref_audio_rate2=source\n" -"pref_audio_mix1=dpl2\n" -"pref_audio_mix2=dpl2\n" +"source_audio_lang=und\n" +"pref_audio_codec=ac3\n" +"pref_audio_bitrate=192\n" +"pref_audio_rate=source\n" +"pref_audio_mix=dpl2\n" "pref_audio_drc=1.0\n" "chapter_markers=enable\n" "container=mp4\n" diff --git a/gtk/src/settings.c b/gtk/src/settings.c index 1e78fcbd6..662561038 100644 --- a/gtk/src/settings.c +++ b/gtk/src/settings.c @@ -21,6 +21,7 @@ #include "hb-backend.h" void dump_settings(GHashTable *settings); +void ghb_pref_audio_init(signal_user_data_t *ud); GObject* debug_get_object(GtkBuilder* b, const gchar *n) @@ -1034,6 +1035,10 @@ preset_update_ui(signal_user_data_t *ud, presets_data_t *data, const gchar *key) // Initialize the ui from presets file. if (data == NULL) return; str = g_key_file_get_string(data->keyFile, data->name, key, NULL); + if (str == NULL) + { + str = g_key_file_get_string(internalKeyFile, "Presets", key, NULL); + } if (str != NULL) { ghb_ui_update(ud, key, str); @@ -1046,7 +1051,7 @@ ghb_set_preset(signal_user_data_t *ud, const gchar *name) { presets_data_t *data; - g_debug("ghb_update_from_preset() %s\n", name); + g_debug("ghb_set_preset() %s\n", name); if (name == NULL) { name = ghb_presets_get_name(0); @@ -1061,6 +1066,7 @@ ghb_set_preset(signal_user_data_t *ud, const gchar *name) preset_to_ui(ud, data); ghb_settings_set_string(ud->settings, "preset", name); } + ghb_pref_audio_init(ud); } void @@ -1071,7 +1077,7 @@ ghb_update_from_preset( { presets_data_t *data; - g_debug("ghb_set_preset() %s\n", name); + g_debug("ghb_update_from_preset() %s %s\n", name, key); if (name == NULL) return; data = presets_list_search(presetsList, name); preset_update_ui(ud, data, key); @@ -2012,3 +2018,117 @@ ghb_sanitize_x264opts(signal_user_data_t *ud, const gchar *options) return result; } +static gint pref_acodec[8]; +static gint pref_bitrate[8]; +static gint pref_rate[8]; +static gint pref_mix[8]; +static gdouble pref_drc[8]; +static gint pref_audio_count = 0; + +void +ghb_pref_audio_init(signal_user_data_t *ud) +{ + const gchar *acodec, *bitrate, *rate, *mix, *drc; + gchar **split_acodec, **split_bitrate, **split_rate; + gchar **split_mix, **split_drc; + + acodec = ghb_settings_get_string(ud->settings, "pref_audio_codec"); + bitrate = ghb_settings_get_string(ud->settings, "pref_audio_bitrate"); + rate = ghb_settings_get_string(ud->settings, "pref_audio_rate"); + mix = ghb_settings_get_string(ud->settings, "pref_audio_mix"); + drc = ghb_settings_get_string(ud->settings, "pref_audio_drc"); + split_acodec = g_strsplit(acodec, ",", 8); + split_bitrate = g_strsplit(bitrate, ",", 8); + split_rate = g_strsplit(rate, ",", 8); + split_mix = g_strsplit(mix, ",", 8); + split_drc = g_strsplit(drc, ",", 8); + if (split_acodec == NULL) + { // This should never happen, but just in case... + split_acodec = g_strsplit("faac", ",", -1); + } + gint ii; + for (ii = 0; split_acodec[ii]; ii++) + { + pref_acodec[ii] = ghb_lookup_acodec(split_acodec[ii]); + } + pref_audio_count = ii; + for (ii = 0; split_bitrate && split_bitrate[ii]; ii++) + { + pref_bitrate[ii] = ghb_lookup_bitrate(split_bitrate[ii]); + } + for (ii = 0; ii < pref_audio_count; ii++) + { + pref_bitrate[ii] = pref_bitrate[0]; + } + for (ii = 0; split_rate && split_rate[ii]; ii++) + { + pref_rate[ii] = ghb_lookup_rate(split_rate[ii]); + } + for (ii = 0; ii < pref_audio_count; ii++) + { + pref_rate[ii] = pref_rate[0]; + } + for (ii = 0; split_mix && split_mix[ii]; ii++) + { + pref_mix[ii] = ghb_lookup_mix(split_mix[ii]); + } + for (ii = 0; ii < pref_audio_count; ii++) + { + pref_mix[ii] = pref_mix[0]; + } + for (ii = 0; split_drc && split_drc[ii]; ii++) + { + pref_drc[ii] = ghb_lookup_drc(split_drc[ii]); + } + for (ii = 0; ii < pref_audio_count; ii++) + { + pref_drc[ii] = pref_drc[0]; + } +} + +gint +ghb_pref_acount() +{ + return pref_audio_count; +} + +gint +ghb_pref_acodec(gint index) +{ + if (index >= pref_audio_count) + return 0; + return pref_acodec[index]; +} + +gint +ghb_pref_bitrate(gint index) +{ + if (index >= pref_audio_count) + return 0; + return pref_bitrate[index]; +} + +gint +ghb_pref_rate(gint index) +{ + if (index >= pref_audio_count) + return 0; + return pref_rate[index]; +} + +gint +ghb_pref_mix(gint index) +{ + if (index >= pref_audio_count) + return 0; + return pref_mix[index]; +} + +gdouble +ghb_pref_drc(gint index) +{ + if (index >= pref_audio_count) + return 0; + return pref_drc[index]; +} + diff --git a/gtk/src/settings.h b/gtk/src/settings.h index 44f7f906c..e136a5003 100644 --- a/gtk/src/settings.h +++ b/gtk/src/settings.h @@ -128,5 +128,11 @@ void ghb_set_preset_default(GHashTable *settings); void ghb_x264_parse_options(signal_user_data_t *ud, const gchar *options); void ghb_x264_opt_update(signal_user_data_t *ud, GtkWidget *widget); gchar* ghb_sanitize_x264opts(signal_user_data_t *ud, const gchar *options); +gint ghb_pref_acount(); +gint ghb_pref_acodec(gint index); +gint ghb_pref_bitrate(gint index); +gint ghb_pref_rate(gint index); +gint ghb_pref_mix(gint index); +gdouble ghb_pref_drc(gint index); #endif // _SETTINGS_H_ diff --git a/gtk/src/standard_presets b/gtk/src/standard_presets index 68e03bd81..7b05a0775 100755 --- a/gtk/src/standard_presets +++ b/gtk/src/standard_presets @@ -21,8 +21,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=160 +pref_audio_codec=faac +pref_audio_bitrate=160 subtitles=disable [Animation] @@ -49,8 +49,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=160 +pref_audio_codec=faac +pref_audio_bitrate=160 subtitles=disable [AppleTV] @@ -77,9 +77,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_codec2=ac3 -pref_audio_bitrate1=160 +pref_audio_codec=faac,ac3 +pref_audio_bitrate=160 subtitles=disable [Bedlam] @@ -106,8 +105,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=ac3 -pref_audio_bitrate1=160 +pref_audio_codec=ac3 +pref_audio_bitrate=160 subtitles=disable [Blind] @@ -133,8 +132,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=128 +pref_audio_codec=faac +pref_audio_bitrate=128 subtitles=disable [Broke] @@ -162,8 +161,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=128 +pref_audio_codec=faac +pref_audio_bitrate=128 subtitles=disable [Classic] @@ -188,8 +187,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=160 +pref_audio_codec=faac +pref_audio_bitrate=160 subtitles=disable [Constant Quality Rate] @@ -215,8 +214,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=ac3 -pref_audio_bitrate1=160 +pref_audio_codec=ac3 +pref_audio_bitrate=160 subtitles=disable [Deux Six Quatre] @@ -243,8 +242,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=ac3 -pref_audio_bitrate1=160 +pref_audio_codec=ac3 +pref_audio_bitrate=160 subtitles=disable [Film] @@ -271,8 +270,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=ac3 -pref_audio_bitrate1=160 +pref_audio_codec=ac3 +pref_audio_bitrate=160 subtitles=disable [iPhone / iPod Touch] @@ -300,8 +299,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=128 +pref_audio_codec=faac +pref_audio_bitrate=128 subtitles=disable [iPod High-Rez] @@ -329,8 +328,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=160 +pref_audio_codec=faac +pref_audio_bitrate=160 subtitles=disable [iPod Low-Rez] @@ -358,8 +357,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=160 +pref_audio_codec=faac +pref_audio_bitrate=160 subtitles=disable [Normal] @@ -386,8 +385,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=160 +pref_audio_codec=faac +pref_audio_bitrate=160 subtitles=disable [PSP] @@ -413,8 +412,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=128 +pref_audio_codec=faac +pref_audio_bitrate=128 subtitles=disable [PS3] @@ -440,8 +439,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=160 +pref_audio_codec=faac +pref_audio_bitrate=160 subtitles=disable [QuickTime] @@ -468,8 +467,8 @@ denoise=none decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=160 +pref_audio_codec=faac +pref_audio_bitrate=160 subtitles=disable [Television] @@ -496,6 +495,6 @@ denoise=weak decomb=disable variable_frame_rate=disable deblock=disable -pref_audio_codec1=faac -pref_audio_bitrate1=160 +pref_audio_codec=faac +pref_audio_bitrate=160 subtitles=disable |