summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-01-24 19:26:05 +0000
committerjstebbins <[email protected]>2009-01-24 19:26:05 +0000
commit5c379b6636abf8626e0bf2c323a5d77fd42f7fe5 (patch)
tree4e95f28b91d2b09c4de89f97fe7d050e444f7d26 /gtk
parente98a23579ed5e4ca68d9c82af3ac50dfd833e86e (diff)
LinGui: fix how an audio is chosen after a source is scanned or the preset
selection changes. It wasn't honoring the preferred language or matching the codec when passthru is selected. Also checking in the ui changes needed for dts pasthru. The option is disabled until we get libhb support. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2094 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/audiohandler.c9
-rw-r--r--gtk/src/callbacks.c1
-rw-r--r--gtk/src/hb-backend.c71
-rw-r--r--gtk/src/hb-backend.h3
-rw-r--r--gtk/src/makedeps.c8
-rw-r--r--gtk/src/resource_data.h8
-rw-r--r--gtk/src/resources.plist8
-rw-r--r--gtk/src/widget_reverse_deps8
8 files changed, 78 insertions, 38 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index 3c369566b..7967870de 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -127,7 +127,8 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud)
else
index = *(gint*)iptr;
- track = ghb_find_audio_track(titleindex, source_lang, index);
+ track = ghb_find_audio_track(titleindex, source_lang,
+ acodec_code, index);
// Check to see if:
// 1. pref codec is ac3
// 2. source codec is not ac3
@@ -135,7 +136,7 @@ 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 (!ghb_audio_is_passthru(ainfo.codec))
+ if (ainfo.codec != acodec_code)
{
acodec_code = ghb_get_default_acodec();
// If there's more audio to process, or we've already
@@ -511,15 +512,11 @@ audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t
ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_double_value(drc));
widget = GHB_WIDGET (ud->builder, "audio_remove");
gtk_widget_set_sensitive(widget, TRUE);
- //widget = GHB_WIDGET (ud->builder, "audio_update");
- //gtk_widget_set_sensitive(widget, TRUE);
}
else
{
widget = GHB_WIDGET (ud->builder, "audio_remove");
gtk_widget_set_sensitive(widget, FALSE);
- //widget = GHB_WIDGET (ud->builder, "audio_update");
- //gtk_widget_set_sensitive(widget, FALSE);
}
}
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index ab4cc6fb6..3e10696c1 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1708,6 +1708,7 @@ ghb_backend_events(signal_user_data_t *ud)
else if (status.queue.state & GHB_STATE_SCANDONE)
{
ghb_clear_queue_state(GHB_STATE_SCANDONE);
+ usleep(2000000);
submit_job(ud->current_job);
}
else if (status.queue.state & GHB_STATE_PAUSED)
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 78651d3bb..501fe7781 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -135,6 +135,7 @@ static options_map_t d_acodec_opts[] =
{"MP3 (lame)", "lame", HB_ACODEC_LAME, "lame"},
{"Vorbis", "vorbis", HB_ACODEC_VORBIS, "vorbis"},
{"AC3 (pass-thru)", "ac3", HB_ACODEC_AC3, "ac3"},
+// {"DTS (pass-thru)", "dts", HB_ACODEC_DCA, "dts"},
};
combo_opts_t acodec_opts =
{
@@ -990,15 +991,21 @@ ghb_grey_combo_options(GtkBuilder *builder)
if (allow_ac3)
{
grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_AC3, FALSE);
+ grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA, FALSE);
}
else
{
grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_AC3, TRUE);
+ grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA, TRUE);
}
if (audio && audio->in.codec != HB_ACODEC_AC3)
{
grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_AC3, TRUE);
}
+ if (audio && audio->in.codec != HB_ACODEC_DCA)
+ {
+ grey_combo_box_item(builder, "AudioEncoder", HB_ACODEC_DCA, TRUE);
+ }
grey_combo_box_item(builder, "VideoEncoder", HB_VCODEC_THEORA, FALSE);
widget = GHB_WIDGET (builder, "AudioEncoder");
@@ -1598,7 +1605,11 @@ ghb_longest_title()
}
gint
-ghb_find_audio_track(gint titleindex, const gchar *lang, gint index)
+ghb_find_audio_track(
+ gint titleindex,
+ const gchar *lang,
+ gint acodec,
+ gint index)
{
hb_list_t * list;
hb_title_t * title;
@@ -1609,16 +1620,35 @@ ghb_find_audio_track(gint titleindex, const gchar *lang, gint index)
gint match = 0;
g_debug("find_audio_track ()\n");
- if (h_scan != NULL)
+ if (h_scan == NULL) return -1;
+ list = hb_get_titles( h_scan );
+ title = (hb_title_t*)hb_list_item( list, titleindex );
+ if (title != NULL)
{
- list = hb_get_titles( h_scan );
- title = (hb_title_t*)hb_list_item( list, titleindex );
- if (title != NULL)
+ count = hb_list_count( title->list_audio );
+ }
+ if (count > 10) count = 10;
+ if (acodec == HB_ACODEC_AC3 || acodec == HB_ACODEC_DCA)
+ {
+ for (ii = 0; ii < count; ii++)
{
- count = hb_list_count( title->list_audio );
+ audio = (hb_audio_config_t*)hb_list_audio_config_item(
+ title->list_audio, ii );
+ if ((audio->in.codec == acodec) &&
+ ((strcmp(lang, audio->lang.iso639_2) == 0) ||
+ (strcmp(lang, "und") == 0)))
+ {
+ if (index == match)
+ {
+ track = ii;
+ break;
+ }
+ match++;
+ }
}
}
- if (count > 10) count = 10;
+ if (track > -1) return track;
+ match = 0;
for (ii = 0; ii < count; ii++)
{
audio = (hb_audio_config_t*)hb_list_audio_config_item( title->list_audio, ii );
@@ -1633,7 +1663,7 @@ ghb_find_audio_track(gint titleindex, const gchar *lang, gint index)
match++;
}
}
- if (match) return track;
+ if (track > -1) return track;
if (index < count)
track = index;
return track;
@@ -2288,8 +2318,7 @@ gboolean
ghb_audio_is_passthru(gint acodec)
{
g_debug("ghb_audio_is_passthru () \n");
- g_debug("acodec %d\n", acodec);
- return (acodec == HB_ACODEC_AC3);
+ return (acodec == HB_ACODEC_AC3) || (acodec == HB_ACODEC_DCA);
}
gint
@@ -2740,13 +2769,16 @@ ghb_validate_audio(signal_user_data_t *ud)
gint codec = ghb_settings_combo_int(asettings, "AudioEncoder");
taudio = (hb_audio_config_t *) hb_list_audio_config_item(
title->list_audio, track );
- if ((taudio->in.codec != HB_ACODEC_AC3) && (codec == HB_ACODEC_AC3))
+ if ((taudio->in.codec != HB_ACODEC_AC3 && codec == HB_ACODEC_AC3) ||
+ (taudio->in.codec != HB_ACODEC_DCA && codec == HB_ACODEC_DCA))
{
// Not supported. AC3 is passthrough only, so input must be AC3
+ char *str;
+ str = (codec == HB_ACODEC_AC3) ? "AC-3" : "DTS";
message = g_strdup_printf(
- "The source does not support AC3 Pass-Thru.\n\n"
+ "The source does not support %s Pass-Thru.\n\n"
"You should choose a different audio codec.\n"
- "If you continue, one will be chosen for you.");
+ "If you continue, one will be chosen for you.", str);
if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
{
g_free(message);
@@ -2810,6 +2842,11 @@ ghb_validate_audio(signal_user_data_t *ud)
a_unsup = "AC-3";
codec = HB_ACODEC_VORBIS;
}
+ if (codec == HB_ACODEC_DCA)
+ {
+ a_unsup = "DTS";
+ codec = HB_ACODEC_VORBIS;
+ }
}
if (a_unsup)
{
@@ -3226,7 +3263,10 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
audio.out.codec = ghb_settings_combo_int(asettings, "AudioEncoder");
taudio = (hb_audio_config_t *) hb_list_audio_config_item(
title->list_audio, audio.in.track );
- if ((taudio->in.codec != HB_ACODEC_AC3) && (audio.out.codec == HB_ACODEC_AC3))
+ if ((taudio->in.codec != HB_ACODEC_AC3 &&
+ audio.out.codec == HB_ACODEC_AC3) ||
+ (taudio->in.codec != HB_ACODEC_DCA &&
+ audio.out.codec == HB_ACODEC_DCA))
{
// Not supported. AC3 is passthrough only, so input must be AC3
if (job->mux == HB_MUX_AVI)
@@ -3255,7 +3295,8 @@ printf("switching to faac\n");
}
if ((job->mux == HB_MUX_OGM) &&
((audio.out.codec == HB_ACODEC_FAAC) ||
- (audio.out.codec == HB_ACODEC_AC3)))
+ (audio.out.codec == HB_ACODEC_AC3) ||
+ (audio.out.codec == HB_ACODEC_DCA)))
{
// ogm/faac|ac3 combination is not supported.
audio.out.codec = HB_ACODEC_VORBIS;
diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h
index 057bea693..508ea5ce1 100644
--- a/gtk/src/hb-backend.h
+++ b/gtk/src/hb-backend.h
@@ -130,7 +130,8 @@ void ghb_set_default_bitrate_opts(GtkBuilder *builder, gint last_rate);
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 index);
+gint ghb_find_audio_track(
+ gint titleindex, const gchar *lang, gint acodec, gint index);
gint ghb_longest_title(void);
gchar* ghb_build_x264opts_string(GValue *settings);
GdkPixbuf* ghb_get_preview_image(
diff --git a/gtk/src/makedeps.c b/gtk/src/makedeps.c
index dc6d66714..d3711645e 100644
--- a/gtk/src/makedeps.c
+++ b/gtk/src/makedeps.c
@@ -52,10 +52,10 @@ static dependency_t dep_map[] =
{"VideoEncoder", "x264_tab_label", "x264", FALSE},
{"VideoEncoder", "Mp4iPodCompatible", "x264", FALSE},
{"VideoEncoder", "directqp", "x264|ffmpeg", FALSE},
- {"AudioEncoder", "AudioBitrate", "ac3", TRUE},
- {"AudioEncoder", "AudioSamplerate", "ac3", TRUE},
- {"AudioEncoder", "AudioMixdown", "ac3", TRUE},
- {"AudioEncoder", "AudioTrackDRCSlider", "ac3", TRUE},
+ {"AudioEncoder", "AudioBitrate", "ac3|dts", TRUE},
+ {"AudioEncoder", "AudioSamplerate", "ac3|dts", TRUE},
+ {"AudioEncoder", "AudioMixdown", "ac3|dts", TRUE},
+ {"AudioEncoder", "AudioTrackDRCSlider", "ac3|dts", TRUE},
{"x264_bframes", "x264_weighted_bframes", "0", TRUE},
{"x264_bframes", "x264_bpyramid", "<2", TRUE},
{"x264_bframes", "x264_direct", "0", TRUE},
diff --git a/gtk/src/resource_data.h b/gtk/src/resource_data.h
index fdbf9ff7f..53334463b 100644
--- a/gtk/src/resource_data.h
+++ b/gtk/src/resource_data.h
@@ -12692,7 +12692,7 @@
" <array>\n"
" <array>\n"
" <string>AudioEncoder</string>\n"
-" <string>ac3</string>\n"
+" <string>ac3|dts</string>\n"
" <true />\n"
" </array>\n"
" </array>\n"
@@ -12700,7 +12700,7 @@
" <array>\n"
" <array>\n"
" <string>AudioEncoder</string>\n"
-" <string>ac3</string>\n"
+" <string>ac3|dts</string>\n"
" <true />\n"
" </array>\n"
" </array>\n"
@@ -12708,7 +12708,7 @@
" <array>\n"
" <array>\n"
" <string>AudioEncoder</string>\n"
-" <string>ac3</string>\n"
+" <string>ac3|dts</string>\n"
" <true />\n"
" </array>\n"
" </array>\n"
@@ -12716,7 +12716,7 @@
" <array>\n"
" <array>\n"
" <string>AudioEncoder</string>\n"
-" <string>ac3</string>\n"
+" <string>ac3|dts</string>\n"
" <true />\n"
" </array>\n"
" </array>\n"
diff --git a/gtk/src/resources.plist b/gtk/src/resources.plist
index b0c415ae7..5f1166612 100644
--- a/gtk/src/resources.plist
+++ b/gtk/src/resources.plist
@@ -7191,7 +7191,7 @@ R2RrUAAABBgBAQACAAAAQAAAABAAAAAQ////AP///wD///8A////AP///wD///8A////AP///wD///8A
<array>
<array>
<string>AudioEncoder</string>
- <string>ac3</string>
+ <string>ac3|dts</string>
<true />
</array>
</array>
@@ -7199,7 +7199,7 @@ R2RrUAAABBgBAQACAAAAQAAAABAAAAAQ////AP///wD///8A////AP///wD///8A////AP///wD///8A
<array>
<array>
<string>AudioEncoder</string>
- <string>ac3</string>
+ <string>ac3|dts</string>
<true />
</array>
</array>
@@ -7207,7 +7207,7 @@ R2RrUAAABBgBAQACAAAAQAAAABAAAAAQ////AP///wD///8A////AP///wD///8A////AP///wD///8A
<array>
<array>
<string>AudioEncoder</string>
- <string>ac3</string>
+ <string>ac3|dts</string>
<true />
</array>
</array>
@@ -7215,7 +7215,7 @@ R2RrUAAABBgBAQACAAAAQAAAABAAAAAQ////AP///wD///8A////AP///wD///8A////AP///wD///8A
<array>
<array>
<string>AudioEncoder</string>
- <string>ac3</string>
+ <string>ac3|dts</string>
<true />
</array>
</array>
diff --git a/gtk/src/widget_reverse_deps b/gtk/src/widget_reverse_deps
index f4abad270..0c767d5d0 100644
--- a/gtk/src/widget_reverse_deps
+++ b/gtk/src/widget_reverse_deps
@@ -6,7 +6,7 @@
<array>
<array>
<string>AudioEncoder</string>
- <string>ac3</string>
+ <string>ac3|dts</string>
<true />
</array>
</array>
@@ -14,7 +14,7 @@
<array>
<array>
<string>AudioEncoder</string>
- <string>ac3</string>
+ <string>ac3|dts</string>
<true />
</array>
</array>
@@ -22,7 +22,7 @@
<array>
<array>
<string>AudioEncoder</string>
- <string>ac3</string>
+ <string>ac3|dts</string>
<true />
</array>
</array>
@@ -30,7 +30,7 @@
<array>
<array>
<string>AudioEncoder</string>
- <string>ac3</string>
+ <string>ac3|dts</string>
<true />
</array>
</array>