summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-06-06 18:20:53 +0000
committerjstebbins <[email protected]>2010-06-06 18:20:53 +0000
commit21edb5248c8d25d334e3225e2f52ff9e8d9782dd (patch)
tree9ce215924f9535633f03685ce05852b499fe2c20 /gtk/src
parent19025e1f3fed54961b4fa4516a55ffa3c4f7bca7 (diff)
LinGui: Improvements to audio panel
When codec is "Choose for me", show the codec chosen in the list, but leave the combo box showing "Choose for me". This way, if the user saves the settings in a new preset, the audio codec saved remaines 'auto' instead of reverting to the codec that was chosen. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3361 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/audiohandler.c46
-rw-r--r--gtk/src/hb-backend.c2
-rw-r--r--gtk/src/main.c5
-rw-r--r--gtk/src/widgetdeps.c10
4 files changed, 41 insertions, 22 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index 5895a83c0..da1044ef1 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -23,7 +23,7 @@
void
ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
{
- gint titleindex, audioindex, acodec, mix;
+ gint titleindex, track, acodec, mix;
ghb_audio_info_t ainfo;
GtkWidget *widget;
GValue *gval;
@@ -33,7 +33,7 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
widget = GHB_WIDGET(ud->builder, "AudioTrack");
gval = ghb_widget_value(widget);
- audioindex = ghb_lookup_combo_int("AudioTrack", gval);
+ track = ghb_lookup_combo_int("AudioTrack", gval);
ghb_value_free(gval);
widget = GHB_WIDGET(ud->builder, "AudioEncoder");
@@ -48,7 +48,7 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
if (ghb_audio_is_passthru (acodec))
{
ghb_set_default_bitrate_opts (ud->builder, 0, -1);
- if (ghb_get_audio_info (&ainfo, titleindex, audioindex))
+ if (ghb_get_audio_info (&ainfo, titleindex, track))
{
gint br = ainfo.bitrate / 1000;
// Set the values for bitrate and samplerate to the input rates
@@ -58,12 +58,21 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
{
ghb_set_passthru_bitrate_opts (ud->builder, br);
ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(0));
+ acodec &= ainfo.codec;
}
else
{
- acodec = ghb_select_audio_codec(ud, audioindex);
+ if (acodec != HB_ACODEC_MASK)
+ {
+ acodec = ghb_select_audio_codec(ud, track);
+ ghb_ui_update(ud, "AudioEncoder", ghb_int64_value(acodec));
+ }
+ else
+ {
+ acodec = ghb_select_audio_codec(ud, track);
+ }
br = ghb_find_closest_audio_bitrate(acodec, br);
- mix = ghb_get_best_mix( titleindex, audioindex, acodec, 0);
+ mix = ghb_get_best_mix( titleindex, track, acodec, 0);
ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix));
}
ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(br));
@@ -101,6 +110,9 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
{
ghb_set_default_bitrate_opts (ud->builder, 0, -1);
}
+ ghb_settings_take_value(ud->settings, "AudioEncoderActual",
+ ghb_lookup_acodec_value(acodec));
+ ghb_check_dependency(ud, NULL, "AudioEncoderActual");
}
static void
@@ -171,7 +183,6 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud)
rate = ghb_settings_combo_double(audio, "AudioSamplerate");
mix = ghb_settings_combo_int(audio, "AudioMixdown");
drc = ghb_settings_get_value(audio, "AudioTrackDRCSlider");
- //acodec_code = ghb_lookup_combo_int("AudioEncoder", acodec);
// If there are multiple audios using the same codec, then
// select sequential tracks for each. The hash keeps track
// of the tracks used for each codec.
@@ -187,7 +198,8 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud)
// HB_ACODEC_* are bit fields. Treat acodec as mask
if (!(ainfo.codec & acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)))
{
- acodec = fallback_acodec;
+ if (acodec != HB_ACODEC_MASK)
+ acodec = fallback_acodec;
// If there's more audio to process, or we've already
// placed one in the list, then we can skip this one
if ((ii + 1 < count) || (list_count != 0))
@@ -204,10 +216,6 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud)
mix = HB_AMIXDOWN_DOLBYPLII;
}
}
- else
- {
- acodec &= ainfo.codec;
- }
}
if (titleindex >= 0 && track < 0)
acodec = 0;
@@ -286,7 +294,7 @@ ghb_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 *s_drc, *s_track, *s_codec, *s_br, *s_sr, *s_mix;
+ gchar *actual_codec, *s_drc, *s_track, *s_codec, *s_br, *s_sr, *s_mix;
gint itrack, icodec;
gdouble drc;
// Get the row number
@@ -311,6 +319,7 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud)
s_track = ghb_settings_get_string(asettings, "AudioTrack");
s_codec = ghb_settings_get_string(asettings, "AudioEncoder");
+ actual_codec = ghb_settings_get_string(asettings, "AudioEncoderActual");
s_br = ghb_settings_get_string(asettings, "AudioBitrate");
s_sr = ghb_settings_get_string(asettings, "AudioSamplerate");
s_mix = ghb_settings_get_string(asettings, "AudioMixdown");
@@ -338,10 +347,12 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud)
9, s_sr,
10, s_mix,
11, drc,
+ 12, actual_codec,
-1);
g_free(s_drc);
g_free(s_track);
g_free(s_codec);
+ g_free(actual_codec);
g_free(s_br);
g_free(s_sr);
g_free(s_mix);
@@ -514,7 +525,7 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings)
GtkListStore *store;
GtkTreeSelection *selection;
const gchar *track, *codec, *br, *sr, *mix;
- gchar *s_drc, *s_track, *s_codec, *s_br, *s_sr, *s_mix;
+ gchar *s_drc, *s_track, *s_codec, *s_br, *s_sr, *s_mix, *actual_codec;
gint icodec, itrack;
gdouble drc;
@@ -533,6 +544,7 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings)
s_track = ghb_settings_get_string(settings, "AudioTrack");
s_codec = ghb_settings_get_string(settings, "AudioEncoder");
+ actual_codec = ghb_settings_get_string(settings, "AudioEncoderActual");
s_br = ghb_settings_get_string(settings, "AudioBitrate");
s_sr = ghb_settings_get_string(settings, "AudioSamplerate");
s_mix = ghb_settings_get_string(settings, "AudioMixdown");
@@ -563,11 +575,13 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings)
9, s_sr,
10, s_mix,
11, drc,
+ 12, actual_codec,
-1);
gtk_tree_selection_select_iter(selection, &iter);
g_free(s_drc);
g_free(s_track);
g_free(s_codec);
+ g_free(actual_codec);
g_free(s_br);
g_free(s_sr);
g_free(s_mix);
@@ -583,7 +597,7 @@ audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t
g_debug("audio_list_selection_changed_cb ()");
if (gtk_tree_selection_get_selected(selection, &store, &iter))
{
- const gchar *track, *codec, *bitrate, *sample_rate, *mix;
+ const gchar *actual_codec, *track, *codec, *bitrate, *sample_rate, *mix;
gdouble drc;
gtk_tree_model_get(store, &iter,
@@ -593,9 +607,12 @@ audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t
9, &sample_rate,
10, &mix,
11, &drc,
+ 12, &actual_codec,
-1);
ghb_ui_update(ud, "AudioTrack", ghb_string_value(track));
ghb_ui_update(ud, "AudioEncoder", ghb_string_value(codec));
+ ghb_settings_set_string(ud->settings, "AudioEncoderActual", actual_codec);
+ ghb_check_dependency(ud, NULL, "AudioEncoderActual");
ghb_ui_update(ud, "AudioBitrate", ghb_string_value(bitrate));
ghb_ui_update(ud, "AudioSamplerate", ghb_string_value(sample_rate));
ghb_ui_update(ud, "AudioMixdown", ghb_string_value(mix));
@@ -746,6 +763,7 @@ ghb_set_audio(signal_user_data_t *ud, GValue *settings)
ghb_ui_update(ud, "AudioMixdown", mix);
}
ghb_ui_update(ud, "AudioTrackDRCSlider", drc);
+ ghb_adjust_audio_rate_combos(ud);
}
}
}
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 5f28ffea2..8f1ac95fb 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -2454,7 +2454,7 @@ small_opts_set(GtkBuilder *builder, const gchar *name, combo_opts_t *opts)
gint ii;
gchar *str;
- g_debug("generic_opts_set ()\n");
+ g_debug("small_opts_set ()\n");
if (name == NULL || opts == NULL) return;
store = get_combo_box_store(builder, name);
gtk_list_store_clear(store);
diff --git a/gtk/src/main.c b/gtk/src/main.c
index e043623e0..2a8e4524b 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -330,12 +330,13 @@ bind_audio_tree_model (signal_user_data_t *ud)
selection = gtk_tree_view_get_selection (treeview);
// 12 columns in model. 6 are visible, the other 6 are for storing
// values that I need
- treestore = gtk_list_store_new(12, G_TYPE_STRING, G_TYPE_STRING,
+ treestore = gtk_list_store_new(13, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_DOUBLE);
+ G_TYPE_STRING, G_TYPE_DOUBLE,
+ G_TYPE_STRING);
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
cell = gtk_cell_renderer_text_new();
diff --git a/gtk/src/widgetdeps.c b/gtk/src/widgetdeps.c
index 71a544719..eeb400708 100644
--- a/gtk/src/widgetdeps.c
+++ b/gtk/src/widgetdeps.c
@@ -57,11 +57,11 @@ static dependency_t dep_map[] =
{"VideoEncoder", "x264_tab", "x264", FALSE, FALSE},
{"VideoEncoder", "x264_tab_label", "x264", FALSE, FALSE},
{"VideoEncoder", "Mp4iPodCompatible", "x264", FALSE, FALSE},
- {"AudioEncoder", "AudioBitrate", "ac3|dts|auto", TRUE, FALSE},
- {"AudioEncoder", "AudioSamplerate", "ac3|dts|auto", TRUE, FALSE},
- {"AudioEncoder", "AudioMixdown", "ac3|dts|auto", TRUE, FALSE},
- {"AudioEncoder", "AudioTrackDRCSlider", "ac3|dts|auto", TRUE, FALSE},
- {"AudioEncoder", "drc_label", "ac3|dts|auto", TRUE, FALSE},
+ {"AudioEncoderActual", "AudioBitrate", "ac3|dts", TRUE, FALSE},
+ {"AudioEncoderActual", "AudioSamplerate", "ac3|dts", TRUE, FALSE},
+ {"AudioEncoderActual", "AudioMixdown", "ac3|dts", TRUE, FALSE},
+ {"AudioEncoderActual", "AudioTrackDRCSlider", "ac3|dts", TRUE, FALSE},
+ {"AudioEncoderActual", "drc_label", "ac3|dts", TRUE, FALSE},
{"x264_bframes", "x264_weighted_bframes", "0", TRUE, FALSE},
{"x264_bframes", "x264_bpyramid", "<2", TRUE, FALSE},
{"x264_bframes", "x264_direct", "0", TRUE, FALSE},