summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/audiohandler.c92
-rw-r--r--gtk/src/hb-backend.c157
-rw-r--r--gtk/src/hb-backend.h6
-rw-r--r--gtk/src/internal_defaults.xml2
-rw-r--r--gtk/src/queuehandler.c15
5 files changed, 100 insertions, 172 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index c5586b926..8a1879a9c 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -54,7 +54,7 @@ static void audio_deps(signal_user_data_t *ud, GValue *asettings, GtkWidget *wid
if (widget != NULL)
ghb_check_dependency(ud, widget, NULL);
- gint track = -1, encoder = 0;
+ gint track = -1, codec = 0;
hb_audio_config_t *aconfig = NULL;
int title_id;
gint titleindex;
@@ -66,16 +66,16 @@ static void audio_deps(signal_user_data_t *ud, GValue *asettings, GtkWidget *wid
if (asettings != NULL)
{
track = ghb_settings_get_int(asettings, "AudioTrack");
- encoder = ghb_settings_combo_int(asettings, "AudioEncoder");
+ codec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
aconfig = ghb_get_audio_info(title, track);
}
- gboolean is_passthru = (encoder & HB_ACODEC_PASS_FLAG);
+ gboolean is_passthru = (codec & HB_ACODEC_PASS_FLAG);
gboolean enable_drc = TRUE;
if (aconfig != NULL)
{
enable_drc = hb_audio_can_apply_drc(aconfig->in.codec,
- aconfig->in.codec_param, encoder) &&
+ aconfig->in.codec_param, codec) &&
!is_passthru;
}
@@ -86,8 +86,7 @@ static void audio_deps(signal_user_data_t *ud, GValue *asettings, GtkWidget *wid
widget = GHB_WIDGET(ud->builder, "AudioTrackDRCValue");
gtk_widget_set_sensitive(widget, enable_drc);
- enable_quality_widget(ud, encoder);
-
+ enable_quality_widget(ud, codec);
widget = GHB_WIDGET(ud->builder, "AudioBitrate");
gtk_widget_set_sensitive(widget, !is_passthru);
@@ -197,7 +196,8 @@ int ghb_select_fallback(GValue *settings, int acodec)
mux_id = ghb_settings_get_const_string(settings, "FileFormat");
mux = ghb_lookup_container_by_name(mux_id);
- fallback = ghb_settings_combo_int(settings, "AudioEncoderFallback");
+ fallback = ghb_settings_audio_encoder_codec(settings,
+ "AudioEncoderFallback");
return hb_autopassthru_get_encoder(acodec, 0, fallback, mux->format);
}
}
@@ -222,7 +222,7 @@ audio_sanitize_settings(GValue *settings, GValue *asettings)
title_id = ghb_settings_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
track = ghb_settings_get_int(asettings, "AudioTrack");
- acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
+ acodec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
mix = ghb_settings_combo_int(asettings, "AudioMixdown");
bitrate = ghb_settings_combo_int(asettings, "AudioBitrate");
sr = ghb_settings_combo_int(asettings, "AudioSamplerate");
@@ -272,8 +272,8 @@ audio_sanitize_settings(GValue *settings, GValue *asettings)
ghb_settings_set_string(asettings, "AudioBitrate",
ghb_lookup_combo_string("AudioBitrate", ghb_int_value(bitrate)));
- ghb_settings_take_value(asettings, "AudioEncoder",
- ghb_lookup_audio_encoder_value(select_acodec));
+ ghb_settings_set_string(asettings, "AudioEncoder",
+ hb_audio_encoder_get_short_name(select_acodec));
}
void
@@ -302,10 +302,7 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
track = ghb_lookup_combo_int("AudioTrack", gval);
ghb_value_free(gval);
- widget = GHB_WIDGET(ud->builder, "AudioEncoder");
- gval = ghb_widget_value(widget);
- acodec = ghb_lookup_combo_int("AudioEncoder", gval);
- ghb_value_free(gval);
+ acodec = ghb_settings_audio_encoder_codec(ud->settings, "AudioEncoder");
widget = GHB_WIDGET(ud->builder, "AudioMixdown");
gval = ghb_widget_value(widget);
@@ -371,13 +368,13 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud)
}
ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(bitrate));
- ghb_settings_take_value(ud->settings, "AudioEncoder",
- ghb_lookup_audio_encoder_value(select_acodec));
+ ghb_settings_set_string(ud->settings, "AudioEncoder",
+ hb_audio_encoder_get_short_name(select_acodec));
GValue *asettings = audio_get_selected_settings(ud, NULL);
if (asettings)
{
- ghb_settings_take_value(asettings, "AudioEncoder",
- ghb_lookup_audio_encoder_value(select_acodec));
+ ghb_settings_set_string(asettings, "AudioEncoder",
+ hb_audio_encoder_get_short_name(select_acodec));
}
ghb_audio_list_refresh_selected(ud);
}
@@ -475,7 +472,7 @@ audio_add_track(
ghb_settings_set_int(asettings, "AudioTrack", track);
ghb_settings_set_string(asettings, "AudioEncoder",
- ghb_lookup_combo_string("AudioEncoder", ghb_int_value(encoder)));
+ hb_audio_encoder_get_short_name(encoder));
ghb_settings_set_boolean(asettings,
"AudioTrackQualityEnable", enable_quality);
@@ -531,7 +528,7 @@ audio_select_and_add_track(
audio = ghb_array_get_nth(pref_audio, pref_index);
- acodec = ghb_settings_combo_int(audio, "AudioEncoder");
+ acodec = ghb_settings_audio_encoder_codec(audio, "AudioEncoder");
fallback = ghb_select_fallback(settings, acodec);
bitrate = ghb_settings_combo_int(audio, "AudioBitrate");
@@ -598,7 +595,7 @@ static void set_pref_audio_with_lang(
gboolean enable_quality;
audio = ghb_array_get_nth(pref_audio, ii);
- acodec = ghb_settings_combo_int(audio, "AudioEncoder");
+ acodec = ghb_settings_audio_encoder_codec(audio, "AudioEncoder");
fallback = ghb_select_fallback(settings, acodec);
copy_mask = ghb_get_copy_mask(settings);
bitrate = ghb_settings_combo_int(audio, "AudioBitrate");
@@ -761,13 +758,14 @@ audio_refresh_list_row_ui(
info_src_2 = NULL;
info_dst_2 = NULL;
- const gchar *s_track, *s_codec, *s_mix;
+ const gchar *s_track, *s_mix;
gchar *s_drc, *s_gain, *s_br_quality, *s_sr, *s_track_name;
gdouble drc, gain;
hb_audio_config_t *aconfig;
- int titleindex, track, sr, codec;
+ int titleindex, track, sr;
int title_id;
const hb_title_t *title;
+ const hb_encoder_t *encoder;
title_id = ghb_settings_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
@@ -780,14 +778,13 @@ audio_refresh_list_row_ui(
s_track = ghb_settings_combo_option(settings, "AudioTrack");
- codec = ghb_settings_combo_int(settings, "AudioEncoder");
- s_codec = ghb_settings_combo_option(settings, "AudioEncoder");
+ encoder = ghb_settings_audio_encoder(settings, "AudioEncoder");
double quality = ghb_settings_get_double(settings, "AudioTrackQuality");
if (ghb_settings_get_boolean(settings, "AudioTrackQualityEnable") &&
quality != HB_INVALID_AUDIO_QUALITY)
{
- s_br_quality = ghb_format_quality("Quality: ", codec, quality);
+ s_br_quality = ghb_format_quality("Quality: ", encoder->codec, quality);
}
else
{
@@ -824,13 +821,13 @@ audio_refresh_list_row_ui(
(double)aconfig->in.bitrate / 1000);
}
- if (ghb_audio_is_passthru(codec))
+ if (ghb_audio_is_passthru(encoder->codec))
{
info_dst = g_strdup_printf("Passthrough");
}
else
{
- info_dst = g_strdup_printf("%s (%s) (%s)", s_codec, s_mix, s_sr);
+ info_dst = g_strdup_printf("%s (%s) (%s)", encoder->name, s_mix, s_sr);
if (s_track_name && s_track_name[0])
{
info_dst_2 = g_strdup_printf(
@@ -969,21 +966,21 @@ G_MODULE_EXPORT void
audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
static gint prev_acodec = 0;
- gint acodec_code;
+ gint acodec;
GValue *asettings;
ghb_widget_to_setting(ud->settings, widget);
- acodec_code = ghb_settings_combo_int(ud->settings, "AudioEncoder");
+ acodec = ghb_settings_audio_encoder_codec(ud->settings, "AudioEncoder");
if (block_updates)
{
- prev_acodec = acodec_code;
+ prev_acodec = acodec;
return;
}
asettings = audio_get_selected_settings(ud, NULL);
- if (ghb_audio_is_passthru (prev_acodec) &&
- !ghb_audio_is_passthru (acodec_code))
+ if (ghb_audio_is_passthru(prev_acodec) &&
+ !ghb_audio_is_passthru(acodec))
{
// Transition from passthru to not, put some audio settings back to
// pref settings
@@ -1022,13 +1019,13 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
sr = aconfig ? aconfig->in.samplerate : 48000;
}
- mix_code = ghb_get_best_mix( aconfig, acodec_code, mix_code);
- br = hb_audio_bitrate_get_best(acodec_code, br, sr, mix_code);
+ mix_code = ghb_get_best_mix( aconfig, acodec, mix_code);
+ br = hb_audio_bitrate_get_best(acodec, br, sr, mix_code);
ghb_ui_update(ud, "AudioBitrate", ghb_int64_value(br));
ghb_ui_update(ud, "AudioMixdown", ghb_int64_value(mix_code));
}
- prev_acodec = acodec_code;
+ prev_acodec = acodec;
if (asettings != NULL)
{
ghb_widget_to_setting(asettings, widget);
@@ -1039,8 +1036,8 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
float low, high, gran, defval;
int dir;
- hb_audio_quality_get_limits(acodec_code, &low, &high, &gran, &dir);
- defval = hb_audio_quality_get_default(acodec_code);
+ hb_audio_quality_get_limits(acodec, &low, &high, &gran, &dir);
+ defval = hb_audio_quality_get_default(acodec);
GtkScaleButton *sb;
GtkAdjustment *adj;
sb = GTK_SCALE_BUTTON(GHB_WIDGET(ud->builder, "AudioTrackQuality"));
@@ -1179,7 +1176,7 @@ quality_widget_changed_cb(GtkWidget *widget, gdouble quality, signal_user_data_t
ghb_check_dependency(ud, widget, NULL);
float low, high, gran;
int dir;
- int codec = ghb_settings_combo_int(ud->settings, "AudioEncoder");
+ int codec = ghb_settings_audio_encoder_codec(ud->settings, "AudioEncoder");
hb_audio_quality_get_limits(codec, &low, &high, &gran, &dir);
if (dir)
{
@@ -2119,22 +2116,23 @@ void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget)
GValue *adict = ghb_array_get_nth(alist, index);
- int encoder = ghb_settings_combo_int(adict, "AudioEncoder");
- int fallback = ghb_settings_combo_int(ud->settings, "AudioEncoderFallback");
+ int codec = ghb_settings_audio_encoder_codec(adict, "AudioEncoder");
+ int fallback = ghb_settings_audio_encoder_codec(ud->settings,
+ "AudioEncoderFallback");
// Allow quality settings if the current encoder supports quality
// or if the encoder is auto-passthru and the fallback encoder
// supports quality.
gboolean sensitive =
- hb_audio_quality_get_default(encoder) != HB_INVALID_AUDIO_QUALITY ||
- (encoder == HB_ACODEC_AUTO_PASS &&
+ hb_audio_quality_get_default(codec) != HB_INVALID_AUDIO_QUALITY ||
+ (codec == HB_ACODEC_AUTO_PASS &&
hb_audio_quality_get_default(fallback) != HB_INVALID_AUDIO_QUALITY);
audio_def_settings_quality_set_sensitive(GTK_WIDGET(row), sensitive);
int enc;
if (sensitive)
{
- enc = encoder;
- if (hb_audio_quality_get_default(encoder) == HB_INVALID_AUDIO_QUALITY)
+ enc = codec;
+ if (hb_audio_quality_get_default(codec) == HB_INVALID_AUDIO_QUALITY)
{
enc = fallback;
}
@@ -2142,7 +2140,7 @@ void audio_def_set_limits(signal_user_data_t *ud, GtkWidget *widget)
"AudioTrackQuality"), enc);
}
- enc = encoder;
+ enc = codec;
if (enc & HB_ACODEC_PASS_FLAG)
{
enc = ghb_select_fallback(ud->settings, enc);
@@ -2219,7 +2217,7 @@ audio_def_quality_changed_cb(GtkWidget *widget, gdouble quality, signal_user_dat
GValue *alist = ghb_settings_get_value(ud->settings, "AudioList");
GValue *adict = ghb_array_get_nth(alist, index);
- int codec = ghb_settings_combo_int(adict, "AudioEncoder");
+ int codec = ghb_settings_audio_encoder_codec(adict, "AudioEncoder");
float low, high, gran;
int dir;
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 63c52b699..5b4c94eca 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -1087,50 +1087,6 @@ lookup_audio_bitrate_option(const GValue *grate)
}
static const hb_encoder_t *
-lookup_audio_encoder_by_int(int ienc)
-{
- const hb_encoder_t *enc;
- for (enc = hb_audio_encoder_get_next(NULL); enc != NULL;
- enc = hb_audio_encoder_get_next(enc))
- {
- if (enc->codec == ienc)
- {
- return enc;
- }
- }
- return NULL;
-}
-
-static const hb_encoder_t *
-lookup_audio_encoder(const GValue *genc)
-{
- const hb_encoder_t *enc;
-
- if (G_VALUE_TYPE(genc) == G_TYPE_STRING)
- {
- gchar *str = ghb_value_string(genc);
- for (enc = hb_audio_encoder_get_next(NULL); enc != NULL;
- enc = hb_audio_encoder_get_next(enc))
- {
- if (strcmp(enc->name, str) == 0 ||
- strcmp(enc->short_name, str) == 0)
- {
- g_free(str);
- return enc;
- }
- }
- g_free(str);
- }
- else if (G_VALUE_TYPE(genc) == G_TYPE_INT ||
- G_VALUE_TYPE(genc) == G_TYPE_INT64 ||
- G_VALUE_TYPE(genc) == G_TYPE_DOUBLE)
- {
- return lookup_audio_encoder_by_int(ghb_value_int(genc));
- }
- return NULL;
-}
-
-static const hb_encoder_t *
lookup_video_encoder_by_int(int ienc)
{
const hb_encoder_t *enc;
@@ -1175,15 +1131,6 @@ lookup_video_encoder(const GValue *genc)
}
static gint
-lookup_audio_encoder_int(const GValue *genc)
-{
- const hb_encoder_t *enc = lookup_audio_encoder(genc);
- if (enc != NULL)
- return enc->codec;
- return 0;
-}
-
-static gint
lookup_video_encoder_int(const GValue *genc)
{
const hb_encoder_t *enc = lookup_video_encoder(genc);
@@ -1193,15 +1140,6 @@ lookup_video_encoder_int(const GValue *genc)
}
static const gchar*
-lookup_audio_encoder_option(const GValue *genc)
-{
- const hb_encoder_t *enc = lookup_audio_encoder(genc);
- if (enc != NULL)
- return enc->name;
- return "None";
-}
-
-static const gchar*
lookup_video_encoder_option(const GValue *genc)
{
const hb_encoder_t *enc = lookup_video_encoder(genc);
@@ -1211,15 +1149,6 @@ lookup_video_encoder_option(const GValue *genc)
}
static const gchar*
-lookup_audio_encoder_string(const GValue *genc)
-{
- const hb_encoder_t *enc = lookup_audio_encoder(genc);
- if (enc != NULL)
- return enc->short_name;
- return "none";
-}
-
-static const gchar*
lookup_video_encoder_string(const GValue *genc)
{
const hb_encoder_t *enc = lookup_video_encoder(genc);
@@ -1300,15 +1229,6 @@ lookup_audio_lang_option(const GValue *glang)
return "Any";
}
-GValue*
-ghb_lookup_audio_encoder_value(gint ienc)
-{
- const hb_encoder_t *enc = lookup_audio_encoder_by_int(ienc);
- if (enc != NULL)
- return ghb_string_value_new(enc->short_name);
- return ghb_string_value_new("none");
-}
-
static GValue*
lookup_mixdown_value(gint imix)
{
@@ -1537,10 +1457,7 @@ ghb_grey_combo_options(signal_user_data_t *ud)
grey_builder_combo_box_item(ud->builder, "AudioEncoder", HB_ACODEC_DCA_HD_PASS, TRUE);
}
- widget = GHB_WIDGET (ud->builder, "AudioEncoder");
- gval = ghb_widget_value(widget);
- acodec = ghb_lookup_combo_int("AudioEncoder", gval);
- ghb_value_free(gval);
+ acodec = ghb_settings_audio_encoder_codec(ud->settings, "AudioEncoder");
gint64 layout = aconfig != NULL ? aconfig->in.channel_layout : ~0;
fallback = ghb_select_fallback(ud->settings, acodec);
@@ -1817,17 +1734,41 @@ ghb_audio_encoder_opts_set_with_mask(
const hb_encoder_t*
ghb_lookup_audio_encoder(const char *name)
{
- const hb_encoder_t *enc;
- for (enc = hb_audio_encoder_get_next(NULL); enc != NULL;
+ // First find an enabled encoder
+ int codec = hb_audio_encoder_get_from_name(name);
+
+ // Now find the matching encoder info
+ const hb_encoder_t *enc, *first;
+ for (first = enc = hb_audio_encoder_get_next(NULL); enc != NULL;
enc = hb_audio_encoder_get_next(enc))
{
- if (!strncmp(name, enc->short_name, 80) ||
- !strncmp(name, enc->name, 80))
+ if (codec == enc->codec)
{
return enc;
}
}
- return NULL;
+ // Return a default encoder if nothing matches
+ return first;
+}
+
+int
+ghb_lookup_audio_encoder_codec(const char *name)
+{
+ return ghb_lookup_audio_encoder(name)->codec;
+}
+
+int
+ghb_settings_audio_encoder_codec(const GValue *settings, const char *name)
+{
+ const char *encoder_id = ghb_settings_get_const_string(settings, name);
+ return ghb_lookup_audio_encoder_codec(encoder_id);
+}
+
+const hb_encoder_t*
+ghb_settings_audio_encoder(const GValue *settings, const char *name)
+{
+ const char *encoder_id = ghb_settings_get_const_string(settings, name);
+ return ghb_lookup_audio_encoder(encoder_id);
}
static void
@@ -2697,10 +2638,6 @@ ghb_lookup_combo_int(const gchar *name, const GValue *gval)
return lookup_audio_lang_int(gval);
else if (strcmp(name, "VideoEncoder") == 0)
return lookup_video_encoder_int(gval);
- else if (strcmp(name, "AudioEncoder") == 0)
- return lookup_audio_encoder_int(gval);
- else if (strcmp(name, "AudioEncoderFallback") == 0)
- return lookup_audio_encoder_int(gval);
else
{
return lookup_generic_int(find_combo_table(name), gval);
@@ -2726,10 +2663,6 @@ ghb_lookup_combo_double(const gchar *name, const GValue *gval)
return lookup_audio_lang_int(gval);
else if (strcmp(name, "VideoEncoder") == 0)
return lookup_video_encoder_int(gval);
- else if (strcmp(name, "AudioEncoder") == 0)
- return lookup_audio_encoder_int(gval);
- else if (strcmp(name, "AudioEncoderFallback") == 0)
- return lookup_audio_encoder_int(gval);
else
{
return lookup_generic_double(find_combo_table(name), gval);
@@ -2755,10 +2688,6 @@ ghb_lookup_combo_option(const gchar *name, const GValue *gval)
return lookup_audio_lang_option(gval);
else if (strcmp(name, "VideoEncoder") == 0)
return lookup_video_encoder_option(gval);
- else if (strcmp(name, "AudioEncoder") == 0)
- return lookup_audio_encoder_option(gval);
- else if (strcmp(name, "AudioEncoderFallback") == 0)
- return lookup_audio_encoder_option(gval);
else
{
return lookup_generic_option(find_combo_table(name), gval);
@@ -2784,10 +2713,6 @@ ghb_lookup_combo_string(const gchar *name, const GValue *gval)
return lookup_audio_lang_option(gval);
else if (strcmp(name, "VideoEncoder") == 0)
return lookup_video_encoder_string(gval);
- else if (strcmp(name, "AudioEncoder") == 0)
- return lookup_audio_encoder_string(gval);
- else if (strcmp(name, "AudioEncoderFallback") == 0)
- return lookup_audio_encoder_string(gval);
else
{
return lookup_generic_string(find_combo_table(name), gval);
@@ -3162,7 +3087,7 @@ ghb_ac3_in_audio_list(const GValue *audio_list)
gint acodec;
asettings = ghb_array_get_nth(audio_list, ii);
- acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
+ acodec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
if (acodec & HB_ACODEC_AC3)
return TRUE;
}
@@ -4352,7 +4277,6 @@ ghb_validate_audio(GValue *settings)
gint title_id, titleindex;
const hb_title_t * title;
gchar *message;
- GValue *value;
title_id = ghb_settings_get_int(settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
@@ -4378,10 +4302,11 @@ ghb_validate_audio(GValue *settings)
{
GValue *asettings;
hb_audio_config_t *aconfig;
+ int track, codec;
asettings = ghb_array_get_nth(audio_list, ii);
- gint track = ghb_settings_combo_int(asettings, "AudioTrack");
- gint codec = ghb_settings_combo_int(asettings, "AudioEncoder");
+ track = ghb_settings_combo_int(asettings, "AudioTrack");
+ codec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
if (codec == HB_ACODEC_AUTO_PASS)
continue;
@@ -4415,8 +4340,8 @@ ghb_validate_audio(GValue *settings)
{
codec = HB_ACODEC_FAAC;
}
- value = ghb_lookup_audio_encoder_value(codec);
- ghb_settings_take_value(asettings, "AudioEncoder", value);
+ const char *name = hb_audio_encoder_get_short_name(codec);
+ ghb_settings_set_string(asettings, "AudioEncoder", name);
}
gchar *a_unsup = NULL;
gchar *mux_s = NULL;
@@ -4442,8 +4367,8 @@ ghb_validate_audio(GValue *settings)
return FALSE;
}
g_free(message);
- value = ghb_lookup_audio_encoder_value(codec);
- ghb_settings_take_value(asettings, "AudioEncoder", value);
+ const char *name = hb_audio_encoder_get_short_name(codec);
+ ghb_settings_set_string(asettings, "AudioEncoder", name);
}
gint mix = ghb_settings_combo_int (asettings, "AudioMixdown");
@@ -4468,7 +4393,7 @@ ghb_validate_audio(GValue *settings)
}
g_free(message);
mix = ghb_get_best_mix(aconfig, codec, mix);
- value = lookup_mixdown_value(mix);
+ GValue *value = lookup_mixdown_value(mix);
ghb_settings_take_value(asettings, "AudioMixdown", value);
}
}
@@ -4876,9 +4801,9 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, int titleindex)
aconfig = (hb_audio_config_t *) hb_list_audio_config_item(
title->list_audio, audio.in.track );
- acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
+ acodec = ghb_settings_audio_encoder_codec(asettings, "AudioEncoder");
- fallback = ghb_settings_combo_int(js, "AudioEncoderFallback");
+ fallback = ghb_settings_audio_encoder_codec(js, "AudioEncoderFallback");
gint copy_mask = ghb_get_copy_mask(js);
audio.out.codec = ghb_select_audio_codec(job->mux, aconfig, acodec, fallback, copy_mask);
diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h
index 26dce0eda..de5708701 100644
--- a/gtk/src/hb-backend.h
+++ b/gtk/src/hb-backend.h
@@ -154,7 +154,6 @@ const gchar* ghb_lookup_combo_option(const gchar *name, const GValue *gval);
const gchar* ghb_lookup_combo_string(const gchar *name, const GValue *gval);
gchar* ghb_get_tmp_dir();
gint ghb_find_closest_audio_samplerate(gint rate);
-GValue* ghb_lookup_audio_encoder_value(gint val);
void ghb_init_lang_list_box(GtkListBox *list_box);
@@ -174,5 +173,10 @@ gchar* ghb_create_title_label(const hb_title_t *title);
// libhb lookup helpers
const hb_title_t* ghb_lookup_title(int title_id, int *index);
const hb_container_t* ghb_lookup_container_by_name(const gchar *name);
+const hb_encoder_t* ghb_lookup_audio_encoder(const char *name);
+int ghb_lookup_audio_encoder_codec(const char *name);
+int ghb_settings_audio_encoder_codec(const GValue *settings, const char *name);
+const hb_encoder_t* ghb_settings_audio_encoder(
+ const GValue *settings, const char *name);
#endif // _HBBACKEND_H_
diff --git a/gtk/src/internal_defaults.xml b/gtk/src/internal_defaults.xml
index 2959e4945..665a20adc 100644
--- a/gtk/src/internal_defaults.xml
+++ b/gtk/src/internal_defaults.xml
@@ -15,6 +15,8 @@
<dict>
<key>AudioTrackName</key>
<string></string>
+ <key>AudioEncoder</key>
+ <string>copy:ac3</string>
<key>angle_count</key>
<integer>1</integer>
<key>angle</key>
diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c
index 2979d09aa..3dd07af69 100644
--- a/gtk/src/queuehandler.c
+++ b/gtk/src/queuehandler.c
@@ -530,20 +530,19 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
for (ii = 0; ii < count; ii++)
{
gchar *quality = NULL, *samplerate, *track;
- const gchar *acodec_opt, *mix;
- int acodec;
+ const gchar *mix;
GValue *asettings;
gdouble sr;
+ const hb_encoder_t *encoder;
asettings = ghb_array_get_nth(audio_list, ii);
- acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
- acodec_opt = ghb_settings_combo_option(asettings, "AudioEncoder");
+ encoder = ghb_settings_audio_encoder(asettings, "AudioEncoder");
double q = ghb_settings_get_double(asettings, "AudioTrackQuality");
if (ghb_settings_get_boolean(asettings, "AudioTrackQualityEnable") &&
q != HB_INVALID_AUDIO_QUALITY)
{
- quality = ghb_format_quality("Quality: ", acodec, q);
+ quality = ghb_format_quality("Quality: ", encoder->codec, q);
}
else
{
@@ -566,15 +565,15 @@ add_to_queue_list(signal_user_data_t *ud, GValue *settings, GtkTreeIter *piter)
if (count > 1)
XPRINT("\t");
- if (acodec & HB_ACODEC_PASS_FLAG)
+ if (encoder->codec & HB_ACODEC_PASS_FLAG)
{
- XPRINT("<small>%s, Encoder: %s</small>\n", track, acodec_opt);
+ XPRINT("<small>%s, Encoder: %s</small>\n", track, encoder->name);
}
else
{
XPRINT(
"<small>%s, Encoder: %s, Mixdown: %s, SampleRate: %s, %s</small>\n",
- track, acodec_opt, mix, samplerate, quality);
+ track, encoder->name, mix, samplerate, quality);
}
g_free(track);
g_free(quality);