summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2008-07-30 23:42:55 +0000
committerjstebbins <[email protected]>2008-07-30 23:42:55 +0000
commitb22fd6b62c3f13000d36f8badc297b872f5b7a45 (patch)
treed7bd791547b1f8fda493a43d69a6d4fc3dffd87b /gtk
parentbec5dee00e2b3f3c1cd0c9797e281eabeb19a4d7 (diff)
LinGui: change extension from mp4 to m4v if there is an ac3 output track
disable ac3 passthru option if http optimized is selected git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1598 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c34
-rw-r--r--gtk/src/ghb.ui2
-rw-r--r--gtk/src/hb-backend.c102
-rw-r--r--gtk/src/hb-backend.h2
4 files changed, 125 insertions, 15 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index b5646d3c6..78b393b6e 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -824,6 +824,16 @@ container_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
check_depencency(ud, widget);
update_acodec_combo(ud);
clear_presets_selection(ud);
+ if (ghb_ac3_in_audio_list (ud->audio_settings))
+ {
+ const gchar *container;
+
+ container = ghb_settings_get_string(ud->settings, "container");
+ if (strcmp(container, "mp4") == 0)
+ {
+ ghb_ui_update(ud, "container", "m4v");
+ }
+ }
}
static gchar*
@@ -1168,6 +1178,16 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_widget_to_setting(asettings, widget);
audio_list_refresh_selected(ud);
}
+ if (ghb_ac3_in_audio_list (ud->audio_settings))
+ {
+ const gchar *container;
+
+ container = ghb_settings_get_string(ud->settings, "container");
+ if (strcmp(container, "mp4") == 0)
+ {
+ ghb_ui_update(ud, "container", "m4v");
+ }
+ }
}
static void audio_list_refresh_selected(signal_user_data_t *ud);
@@ -1221,6 +1241,15 @@ setting_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
}
void
+http_opt_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
+{
+ ghb_widget_to_setting(ud->settings, widget);
+ check_depencency(ud, widget);
+ clear_presets_selection(ud);
+ ghb_grey_combo_options (ud->builder);
+}
+
+void
vcodec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
gint vqmin, vqmax;
@@ -2362,6 +2391,11 @@ validate_settings(signal_user_data_t *ud)
{
return FALSE;
}
+ // Validate container settings
+ if (!ghb_validate_container(ud))
+ {
+ return FALSE;
+ }
audio_list_refresh(ud);
return TRUE;
}
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index cafbd0829..fc540c50c 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -825,7 +825,7 @@
<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">HTTP Optimized MP4</property>
<property name="draw_indicator">True</property>
- <signal handler="setting_widget_changed_cb" name="toggled"/>
+ <signal handler="http_opt_changed_cb" name="toggled"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index b2958b07a..4707660a9 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -39,7 +39,6 @@ typedef struct
gint ivalue;
gdouble dvalue;
const gchar *svalue;
- gboolean sensitive;
} options_map_t;
typedef struct
@@ -630,6 +629,7 @@ ghb_grey_combo_options(GtkBuilder *builder)
{
GtkWidget *widget;
gint container, track, titleindex, acodec;
+ gboolean httpopt;
hb_audio_config_t *audio = NULL;
widget = GHB_WIDGET (builder, "title");
@@ -637,6 +637,10 @@ ghb_grey_combo_options(GtkBuilder *builder)
widget = GHB_WIDGET (builder, "audio_track");
track = ghb_widget_int(widget);
audio = get_hb_audio(titleindex, track);
+ widget = GHB_WIDGET (builder, "container");
+ container = ghb_widget_int(widget);
+ widget = GHB_WIDGET (builder, "http_optimize_mp4");
+ 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);
@@ -647,16 +651,28 @@ ghb_grey_combo_options(GtkBuilder *builder)
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);
- if (audio && audio->in.codec != HB_ACODEC_AC3)
+
+ gboolean allow_ac3 = TRUE;
+ allow_ac3 =
+ !(container == HB_MUX_MP4 && httpopt) &&
+ (container != HB_MUX_OGM);
+
+ if (allow_ac3)
{
- grey_combo_box_item(builder, "audio_codec", HB_ACODEC_AC3, TRUE);
+ 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, FALSE);
+ 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)
+ {
+ grey_combo_box_item(builder, "audio_codec", HB_ACODEC_AC3, TRUE);
}
- grey_combo_box_item(builder, "pref_audio_codec1", HB_ACODEC_AC3, FALSE);
- grey_combo_box_item(builder, "pref_audio_codec2", HB_ACODEC_AC3, FALSE);
grey_combo_box_item(builder, "video_codec", HB_VCODEC_THEORA, FALSE);
widget = GHB_WIDGET (builder, "audio_codec");
@@ -665,8 +681,6 @@ ghb_grey_combo_options(GtkBuilder *builder)
{
grey_combo_box_item(builder, "audio_mix", 0, TRUE);
}
- widget = GHB_WIDGET (builder, "container");
- container = ghb_widget_int(widget);
if (container == HB_MUX_MP4)
{
grey_combo_box_item(builder, "audio_codec", HB_ACODEC_LAME, TRUE);
@@ -692,9 +706,6 @@ ghb_grey_combo_options(GtkBuilder *builder)
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_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);
}
gboolean allow_mono = TRUE;
@@ -1603,6 +1614,26 @@ ghb_get_chapters(gint titleindex)
}
gboolean
+ghb_ac3_in_audio_list(GSList *audio_list)
+{
+ GSList *link;
+
+ link = audio_list;
+ while (link != NULL)
+ {
+ GHashTable *asettings;
+ gint acodec;
+
+ asettings = (GHashTable*)link->data;
+ acodec = ghb_settings_get_int(asettings, "audio_codec");
+ if (acodec == HB_ACODEC_AC3)
+ return TRUE;
+ link = link->next;
+ }
+ return FALSE;
+}
+
+gboolean
ghb_set_passthru_rate_opts(GtkBuilder *builder, gint bitrate)
{
gboolean changed = FALSE;
@@ -2084,7 +2115,7 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
}
static void
-set_job_picture_settings(hb_job_t *job, GHashTable *settings)
+set_preview_job_settings(hb_job_t *job, GHashTable *settings)
{
job->crop[0] = ghb_settings_get_int(settings, "crop_top");
job->crop[1] = ghb_settings_get_int(settings, "crop_bottom");
@@ -2111,7 +2142,8 @@ set_job_picture_settings(hb_job_t *job, GHashTable *settings)
job->width = ghb_settings_get_int(settings, "scale_width");
job->height = ghb_settings_get_int(settings, "scale_height");
gint deint = ghb_settings_get_int(settings, "deinterlace");
- job->deinterlace = (deint == 0) ? 0 : 1;
+ gboolean decomb = ghb_settings_get_bool(settings, "decomb");
+ job->deinterlace = (!decomb && deint == 0) ? 0 : 1;
}
gint
@@ -2214,6 +2246,48 @@ ghb_validate_video(signal_user_data_t *ud)
}
gboolean
+ghb_validate_container(signal_user_data_t *ud)
+{
+ gint container;
+ gchar *message;
+
+ container = ghb_settings_get_bool(ud->settings, "container");
+ if (container == HB_MUX_MP4)
+ {
+ gboolean httpopt;
+ httpopt = ghb_settings_get_bool(ud->settings, "http_optimize_mp4");
+ if (httpopt && ghb_ac3_in_audio_list(ud->audio_settings))
+ {
+ message = g_strdup_printf(
+ "AC3 audio in HTTP optimized MP4 is not supported.\n\n"
+ "You should choose a different audio codec.\n"
+ "If you continue, FAAC will be chosen for you.");
+ if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Cancel", "Continue"))
+ {
+ g_free(message);
+ return FALSE;
+ }
+ g_free(message);
+ GSList *link = ud->audio_settings;
+ while (link != NULL)
+ {
+ GHashTable *asettings;
+ asettings = (GHashTable*)link->data;
+ gint acodec = ghb_settings_get_int(asettings, "audio_codec");
+ if (acodec == HB_ACODEC_AC3)
+ {
+ setting_value_t *value;
+ value = get_acodec_value(HB_ACODEC_FAAC);
+ ghb_settings_set(asettings, "audio_codec", value);
+ }
+ link = link->next;
+ }
+ }
+ }
+ return TRUE;
+}
+
+gboolean
ghb_validate_audio(signal_user_data_t *ud)
{
hb_list_t * list;
@@ -2946,7 +3020,7 @@ ghb_get_preview_image(gint titleindex, gint index, GHashTable *settings, gboolea
title = hb_list_item( list, titleindex );
if (title == NULL) return NULL;
if (title->job == NULL) return NULL;
- set_job_picture_settings(title->job, settings);
+ set_preview_job_settings(title->job, settings);
// hb_get_preview can't handle sizes that are larger than the original title
// dimensions
diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h
index d03589191..486c7b29d 100644
--- a/gtk/src/hb-backend.h
+++ b/gtk/src/hb-backend.h
@@ -92,6 +92,7 @@ gboolean ghb_get_title_info(ghb_title_info_t *tinfo, gint titleindex);
void ghb_set_scale(signal_user_data_t *ud, gint mode);
gchar ** ghb_get_chapters(gint titleindex);
gint ghb_get_best_mix(gint titleindex, gint track, gint acodec, gint mix);
+gboolean ghb_ac3_in_audio_list(GSList *audio_list);
gboolean ghb_audio_is_passthru(gint acodec);
gint ghb_get_default_acodec();
gboolean ghb_get_audio_info(ghb_audio_info_t *ainfo, gint titleindex, gint audioindex);
@@ -107,6 +108,7 @@ gint ghb_calculate_target_bitrate(GHashTable *settings, gint titleindex);
gchar* ghb_dvd_volname(const gchar *device);
gint ghb_guess_bitrate(GHashTable *settings);
+gboolean ghb_validate_container(signal_user_data_t *ud);
gboolean ghb_validate_vquality(GHashTable *settings);
gboolean ghb_validate_audio(signal_user_data_t *ud);
gboolean ghb_validate_video(signal_user_data_t *ud);