{
GValue *settings = ghb_dict_value_new();
ghb_settings_set_int(settings, "AudioTrack", track);
- ghb_settings_set_int(settings, "AudioEncoder", acodec);
+ ghb_settings_set_string(settings, "AudioEncoder",
+ ghb_lookup_combo_string("AudioEncoder", ghb_int_value(acodec)));
ghb_settings_set_value(settings, "AudioEncoderActual",
ghb_settings_get_value(ud->settings, "AudioEncoderActual"));
// This gets set autimatically if the codec is passthru
- ghb_settings_set_int(settings, "AudioBitrate", bitrate);
- ghb_settings_set_double(settings, "AudioSamplerate", rate);
+ ghb_settings_set_string(settings, "AudioBitrate",
+ ghb_lookup_combo_string("AudioBitrate", ghb_int_value(bitrate)));
+ ghb_settings_set_string(settings, "AudioSamplerate",
+ ghb_lookup_combo_string("AudioSamplerate", ghb_int_value(rate)));
mix = ghb_get_best_mix( titleindex, track, acodec, mix);
- ghb_settings_set_int(settings, "AudioMixdown", mix);
+ ghb_settings_set_string(settings, "AudioMixdown",
+ ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
ghb_settings_set_value(settings, "AudioTrackDRCSlider", drc);
ghb_add_audio(ud, settings);
ghb_adjust_audio_rate_combos(ud);
lookup_mix_int(const GValue *mix)
{
gint ii;
- gchar *str;
gint result = 0;
- str = ghb_value_string(mix);
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ if (G_VALUE_TYPE(mix) == G_TYPE_STRING)
{
- if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
+ gchar * str = ghb_value_string(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
{
- result = hb_audio_mixdowns[ii].amixdown;
- break;
+ if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
+ {
+ result = hb_audio_mixdowns[ii].amixdown;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(mix) == G_TYPE_INT ||
+ G_VALUE_TYPE(mix) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(mix) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (hb_audio_mixdowns[ii].amixdown == val)
+ {
+ result = hb_audio_mixdowns[ii].amixdown;
+ break;
+ }
}
}
- g_free(str);
return result;
}
lookup_mix_option(const GValue *mix)
{
gint ii;
- gchar *str;
gchar *result = "None";
- str = ghb_value_string(mix);
- for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ if (G_VALUE_TYPE(mix) == G_TYPE_STRING)
{
- if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
+ gchar *str = ghb_value_string(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
{
- result = hb_audio_mixdowns[ii].human_readable_name;
- break;
+ if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
+ {
+ result = hb_audio_mixdowns[ii].human_readable_name;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(mix) == G_TYPE_INT ||
+ G_VALUE_TYPE(mix) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(mix) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (hb_audio_mixdowns[ii].amixdown == val)
+ {
+ result = hb_audio_mixdowns[ii].human_readable_name;
+ break;
+ }
+ }
+ }
+ return result;
+}
+
+static const gchar*
+lookup_mix_string(const GValue *mix)
+{
+ gint ii;
+ gchar *result = "None";
+
+
+ if (G_VALUE_TYPE(mix) == G_TYPE_STRING)
+ {
+ gchar *str = ghb_value_string(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (strcmp(hb_audio_mixdowns[ii].short_name, str) == 0)
+ {
+ result = hb_audio_mixdowns[ii].short_name;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(mix) == G_TYPE_INT ||
+ G_VALUE_TYPE(mix) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(mix) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(mix);
+ for (ii = 0; ii < hb_audio_mixdowns_count; ii++)
+ {
+ if (hb_audio_mixdowns[ii].amixdown == val)
+ {
+ result = hb_audio_mixdowns[ii].short_name;
+ break;
+ }
}
}
- g_free(str);
return result;
}
lookup_audio_rate_int(const GValue *rate)
{
gint ii;
- gchar *str;
gint result = 0;
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- str = ghb_value_string(rate);
- for (ii = 0; ii < hb_audio_rates_count; ii++)
+ if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
{
- if (strcmp(hb_audio_rates[ii].string, str) == 0)
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ gchar * str = ghb_value_string(rate);
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
{
- result = hb_audio_rates[ii].rate;
- break;
+ if (strcmp(hb_audio_rates[ii].string, str) == 0)
+ {
+ result = hb_audio_rates[ii].rate;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
+ G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
+ {
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
+ {
+ gint val = ghb_value_int(rate);
+ if (val == hb_audio_rates[ii].rate)
+ {
+ result = hb_audio_rates[ii].rate;
+ break;
+ }
}
}
- g_free(str);
return result;
}
lookup_audio_rate_option(const GValue *rate)
{
gint ii;
- gchar *str;
const gchar *result = "Same as source";
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- str = ghb_value_string(rate);
- for (ii = 0; ii < hb_audio_rates_count; ii++)
+ if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
{
- if (strcmp(hb_audio_rates[ii].string, str) == 0)
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ gchar *str = ghb_value_string(rate);
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
{
- result = hb_audio_rates[ii].string;
- break;
+ if (strcmp(hb_audio_rates[ii].string, str) == 0)
+ {
+ result = hb_audio_rates[ii].string;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
+ G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
+ {
+ for (ii = 0; ii < hb_audio_rates_count; ii++)
+ {
+ gint val = ghb_value_int(rate);
+ if (val == hb_audio_rates[ii].rate)
+ {
+ result = hb_audio_rates[ii].string;
+ break;
+ }
}
}
- g_free(str);
return result;
}
lookup_audio_bitrate_int(const GValue *rate)
{
gint ii;
- gchar *str;
gint result = 0;
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- str = ghb_value_string(rate);
- for (ii = 0; ii < hb_audio_bitrates_count; ii++)
+ if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
{
- if (strcmp(hb_audio_bitrates[ii].string, str) == 0)
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ gchar *str = ghb_value_string(rate);
+ for (ii = 0; ii < hb_audio_bitrates_count; ii++)
{
- result = hb_audio_bitrates[ii].rate;
- break;
+ if (strcmp(hb_audio_bitrates[ii].string, str) == 0)
+ {
+ result = hb_audio_bitrates[ii].rate;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
+ G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(rate);
+ for (ii = 0; ii < hb_audio_bitrates_count; ii++)
+ {
+ if (hb_audio_bitrates[ii].rate == val)
+ {
+ result = hb_audio_bitrates[ii].rate;
+ break;
+ }
}
}
- g_free(str);
return result;
}
lookup_audio_bitrate_option(const GValue *rate)
{
gint ii;
- gchar *str;
const gchar *result = "Same as source";
- // Coincidentally, the string "source" will return 0
- // which is our flag to use "same as source"
- str = ghb_value_string(rate);
- for (ii = 0; ii < hb_audio_bitrates_count; ii++)
+ if (G_VALUE_TYPE(rate) == G_TYPE_STRING)
{
- if (strcmp(hb_audio_bitrates[ii].string, str) == 0)
+ // Coincidentally, the string "source" will return 0
+ // which is our flag to use "same as source"
+ gchar *str = ghb_value_string(rate);
+ for (ii = 0; ii < hb_audio_bitrates_count; ii++)
{
- result = hb_audio_bitrates[ii].string;
- break;
+ if (strcmp(hb_audio_bitrates[ii].string, str) == 0)
+ {
+ result = hb_audio_bitrates[ii].string;
+ break;
+ }
+ }
+ g_free(str);
+ }
+ else if (G_VALUE_TYPE(rate) == G_TYPE_INT ||
+ G_VALUE_TYPE(rate) == G_TYPE_INT64 ||
+ G_VALUE_TYPE(rate) == G_TYPE_DOUBLE)
+ {
+ gint val = ghb_value_int(rate);
+ for (ii = 0; ii < hb_audio_bitrates_count; ii++)
+ {
+ if (hb_audio_bitrates[ii].rate == val)
+ {
+ result = hb_audio_bitrates[ii].string;
+ break;
+ }
}
}
- g_free(str);
return result;
}
else if (strcmp(name, "VideoFramerate") == 0)
return lookup_video_rate_option(gval);
else if (strcmp(name, "AudioMixdown") == 0)
- return lookup_mix_option(gval);
+ return lookup_mix_string(gval);
else if (strcmp(name, "SrtLanguage") == 0)
return lookup_audio_lang_option(gval);
else if (strcmp(name, "PreferredLanguage") == 0)
channels = 2;
// Make sure the mixdown is valid and pick a new one if not.
+printf("mix %x\n", audio.out.mixdown);
audio.out.mixdown = ghb_get_best_mix(titleindex,
audio.in.track, audio.out.codec, audio.out.mixdown);
audio.out.bitrate =