summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorRodeo <[email protected]>2012-09-03 12:37:16 +0000
committerRodeo <[email protected]>2012-09-03 12:37:16 +0000
commit8d9969febdcec59fee453888ed0bb6a64adf7679 (patch)
treedbe81e961c2ed4c0f3e38d44c5afa86cc475693a /gtk
parent56bf9b80b9b55ecaec9855addda41898261d26b1 (diff)
Audio improvements.
New supported samplerates: 8, 11.025, 12, 16 kHz. Now 8, 11.025, 12, 16, 22.05, 24, 42, 44.1, 48 Khz are supported. Unsupported samplerates are sanitized to the closest samplerate for all encoders. Samplerates < 32 kHz are now forbidden for AC3 encoding (sanitized to 32 kHz). Most AC3 decoders don't support such samplerates. New upmixing: 3.0 (Front Left, Right & Center) can now be upmixed to 5.1 to preserve the center channel. New mixdowns: 6.1 (Front Left, Right & Center, Surround Left, Right & Center, LFE) 7.1 (Front Left, Right & Center, Surround Left & Right, Rear Left & Right, LFE) -> available to Vorbis & FLAC encoders for compatible input channel layouts 7.1 (Front Left, Right & Center, Front Left & Right of Center, Surround Left & Right, LFE) -> available to AAC encoders (ca_aac, ca_haac, faac) for compatible input channel layouts Mono (Left Only): Stereo to Mono by discarding the Right channel Mono (Right Only): Stereo to Mono by discarding the Left channel -> available to all encoders for non-Dolby Stereo input The "6-channel discrete" mixdown becomes "5.1 Channels". New bitrates: 960 - 1536 Kbps. This lets users work around poor audio quality in crappy encoders by throwing more bits at them. Bitrate limits have been re-worked and re-tested for all encoders. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4930 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/audiohandler.c6
-rw-r--r--gtk/src/audiohandler.h1
-rw-r--r--gtk/src/hb-backend.c89
-rw-r--r--gtk/src/presets.c39
4 files changed, 65 insertions, 70 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index f2940bb81..95b9ba166 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -56,7 +56,8 @@ check_list_full(signal_user_data_t *ud)
gint
ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec, gint fallback, gint copy_mask)
{
- guint32 in_codec = aconfig ? aconfig->in.codec : 0;
+ guint32 in_codec = aconfig != NULL ? aconfig->in.codec : 0;
+
if (acodec == HB_ACODEC_AUTO_PASS)
{
return hb_autopassthru_get_encoder(in_codec, copy_mask, fallback, mux);
@@ -119,7 +120,7 @@ int ghb_get_copy_mask(GValue *settings)
return mask;
}
-static int ghb_select_fallback( GValue *settings, int mux, int acodec )
+int ghb_select_fallback( GValue *settings, int mux, int acodec )
{
gint mask;
gint fallback = 0;
@@ -839,6 +840,7 @@ global_audio_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_check_dependency(ud, widget, NULL);
ghb_widget_to_setting(ud->settings, widget);
ghb_adjust_audio_rate_combos(ud);
+ ghb_grey_combo_options (ud);
ghb_audio_list_refresh_selected(ud);
ghb_live_reset(ud);
}
diff --git a/gtk/src/audiohandler.h b/gtk/src/audiohandler.h
index 0a3f98c3f..7bd300cc5 100644
--- a/gtk/src/audiohandler.h
+++ b/gtk/src/audiohandler.h
@@ -34,6 +34,7 @@ void ghb_set_audio(signal_user_data_t *ud, GValue *settings);
const gchar* ghb_get_user_audio_lang(GValue *settings, gint titleindex, gint track);
void ghb_audio_list_refresh_selected(signal_user_data_t *ud);
gint ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec, gint fallback_acodec, gint copy_mask);
+int ghb_select_fallback( GValue *settings, int mux, int acodec );
int ghb_get_copy_mask(GValue *settings);
void ghb_audio_list_refresh(signal_user_data_t *ud);
char * ghb_format_quality( const char *prefix, int codec, double quality );
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index f5746e9f9..f2638bf73 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -1590,6 +1590,21 @@ grey_combo_box_item(GtkBuilder *builder, const gchar *name, gint value, gboolean
}
}
+static void
+grey_mix_opts(signal_user_data_t *ud, gint acodec, gint64 layout)
+{
+ gint ii;
+
+ g_debug("grey_mix_opts()\n");
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ grey_combo_box_item(ud->builder, "AudioMixdown",
+ hb_audio_mixdowns[ii].amixdown,
+ !hb_mixdown_is_supported(hb_audio_mixdowns[ii].amixdown,
+ acodec, layout));
+ }
+}
+
void
ghb_grey_combo_options(signal_user_data_t *ud)
{
@@ -1670,32 +1685,12 @@ ghb_grey_combo_options(signal_user_data_t *ud)
gval = ghb_widget_value(widget);
acodec = ghb_lookup_combo_int("AudioEncoder", gval);
ghb_value_free(gval);
- grey_combo_box_item(ud->builder, "AudioMixdown", 0, TRUE);
-
- gboolean allow_mono = TRUE;
- gboolean allow_stereo = TRUE;
- gboolean allow_dolby = TRUE;
- gboolean allow_dpl2 = TRUE;
- gboolean allow_6ch = TRUE;
- allow_6ch = acodec & ~HB_ACODEC_LAME;
- if (aconfig)
- {
- fallback = ghb_settings_combo_int(ud->settings, "AudioEncoderFallback");
- gint copy_mask = ghb_get_copy_mask(ud->settings);
- acodec = ghb_select_audio_codec(mux, aconfig, acodec, fallback, copy_mask);
- gint best = hb_get_best_mixdown(acodec, aconfig->in.channel_layout, HB_INVALID_AMIXDOWN);
-
- allow_stereo = best >= HB_AMIXDOWN_STEREO;
- allow_dolby = best >= HB_AMIXDOWN_DOLBY;
- allow_dpl2 = best >= HB_AMIXDOWN_DOLBYPLII;
- allow_6ch = best >= HB_AMIXDOWN_6CH;
- allow_mono = best >= HB_AMIXDOWN_MONO;
- }
- grey_combo_box_item(ud->builder, "AudioMixdown", HB_AMIXDOWN_MONO, !allow_mono);
- grey_combo_box_item(ud->builder, "AudioMixdown", HB_AMIXDOWN_STEREO, !allow_stereo);
- grey_combo_box_item(ud->builder, "AudioMixdown", HB_AMIXDOWN_DOLBY, !allow_dolby);
- grey_combo_box_item(ud->builder, "AudioMixdown", HB_AMIXDOWN_DOLBYPLII, !allow_dpl2);
- grey_combo_box_item(ud->builder, "AudioMixdown", HB_AMIXDOWN_6CH, !allow_6ch);
+
+ gint64 layout = aconfig != NULL ? aconfig->in.channel_layout : ~0;
+ fallback = ghb_select_fallback(ud->settings, mux, acodec);
+ gint copy_mask = ghb_get_copy_mask(ud->settings);
+ acodec = ghb_select_audio_codec(mux, aconfig, acodec, fallback, copy_mask);
+ grey_mix_opts(ud, acodec, layout);
}
gint
@@ -4472,40 +4467,20 @@ ghb_validate_audio(GValue *settings)
}
gint mix = ghb_settings_combo_int (asettings, "AudioMixdown");
- gboolean allow_mono = TRUE;
- gboolean allow_stereo = TRUE;
- gboolean allow_dolby = TRUE;
- gboolean allow_dpl2 = TRUE;
- gboolean allow_6ch = TRUE;
- allow_mono = TRUE;
-
- gint best = hb_get_best_mixdown(codec, aconfig->in.channel_layout, HB_INVALID_AMIXDOWN);
-
- allow_stereo = best >= HB_AMIXDOWN_STEREO;
- allow_dolby = best >= HB_AMIXDOWN_DOLBY;
- allow_dpl2 = best >= HB_AMIXDOWN_DOLBYPLII;
- allow_6ch = best >= HB_AMIXDOWN_6CH;
+ gint jj;
gchar *mix_unsup = NULL;
- if (mix == HB_AMIXDOWN_MONO && !allow_mono)
+ if (!hb_mixdown_is_supported(mix, codec, aconfig->in.channel_layout))
{
- mix_unsup = "mono";
- }
- if (mix == HB_AMIXDOWN_STEREO && !allow_stereo)
- {
- mix_unsup = "stereo";
- }
- if (mix == HB_AMIXDOWN_DOLBY && !allow_dolby)
- {
- mix_unsup = "Dolby";
- }
- if (mix == HB_AMIXDOWN_DOLBYPLII && !allow_dpl2)
- {
- mix_unsup = "Dolby Pro Logic II";
- }
- if (mix == HB_AMIXDOWN_6CH && !allow_6ch)
- {
- mix_unsup = "6 Channel";
+ for (jj = 0; jj < hb_audio_mixdowns_count; jj++)
+ {
+ if (mix == hb_audio_mixdowns[jj].amixdown)
+ {
+ {
+ mix_unsup = hb_audio_mixdowns[jj].human_readable_name;
+ }
+ }
+ }
}
if (mix_unsup)
{
diff --git a/gtk/src/presets.c b/gtk/src/presets.c
index 809ede24e..eeacbde04 100644
--- a/gtk/src/presets.c
+++ b/gtk/src/presets.c
@@ -2067,17 +2067,16 @@ value_map_t samplerate_xlat[] =
{NULL, NULL}
};
-value_map_t mix_xlat[] =
-{
- {"Mono", "mono"},
- {"Stereo", "stereo"},
- {"Dolby Surround", "dpl1"},
- {"Dolby Pro Logic II", "dpl2"},
- {"6-channel discrete", "6ch"},
- {"None", "none"},
- {"AC3 Passthru", "none"}, // Backwards compatibility with mac ui
- {"DTS Passthru", "none"}, // Backwards compatibility with mac ui
- {"DTS-HD Passthru", "none"}, // Backwards compatibility with mac ui
+// mix translation table filed in with hb_audio_mixdowns table contents
+value_map_t *mix_xlat;
+
+// Backwards compatibility mappings for audio mix
+value_map_t mix_xlat_compat[] =
+{
+ {"6-channel discrete", "5point1"},
+ {"AC3 Passthru", "none"},
+ {"DTS Passthru", "none"},
+ {"DTS-HD Passthru", "none"},
{NULL, NULL}
};
@@ -3130,6 +3129,24 @@ update_standard_presets(signal_user_data_t *ud)
void
ghb_presets_load(signal_user_data_t *ud)
{
+ int ii, jj;
+
+ // Create audio mixdown translation table
+ mix_xlat = malloc(sizeof(value_map_t) *
+ (hb_audio_mixdowns_count +
+ sizeof(mix_xlat_compat) / sizeof(value_map_t)));
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ mix_xlat[ii].mac_val = hb_audio_mixdowns[ii].human_readable_name;
+ mix_xlat[ii].lin_val = hb_audio_mixdowns[ii].short_name;
+ }
+ for (jj = 0; mix_xlat_compat[jj].mac_val != NULL; jj++, ii++)
+ {
+ mix_xlat[ii] = mix_xlat_compat[jj];
+ }
+ mix_xlat[ii].mac_val = NULL;
+ mix_xlat[ii].lin_val = NULL;
+
presetsPlist = load_plist("presets");
if (presetsPlist == NULL)
{