summaryrefslogtreecommitdiffstats
path: root/gtk/src
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-06-08 01:37:06 +0000
committerjstebbins <[email protected]>2010-06-08 01:37:06 +0000
commit1771d1652c81af218fd366cab8be991f19c27e49 (patch)
tree6e8d80ee6696bab40903704a68e304087ad9b346 /gtk/src
parent6874e350d53bb2e362da011d7f9c0a3befcd7e6b (diff)
LinGui: fix some problems i introduced with the recent audio tab changes
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3370 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r--gtk/src/audiohandler.c12
-rw-r--r--gtk/src/hb-backend.c236
2 files changed, 193 insertions, 55 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index 35f982ba4..e11d4e061 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -226,14 +226,18 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud)
{
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);
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 517f105c1..5ec7ced42 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -841,20 +841,36 @@ static gint
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;
}
@@ -862,20 +878,73 @@ static const gchar*
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;
}
@@ -925,21 +994,37 @@ static gint
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;
}
@@ -947,21 +1032,37 @@ static const gchar*
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;
}
@@ -996,21 +1097,37 @@ static gint
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;
}
@@ -1018,21 +1135,37 @@ static const gchar*
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;
}
@@ -2612,7 +2745,7 @@ ghb_lookup_combo_string(const gchar *name, const GValue *gval)
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)
@@ -4586,6 +4719,7 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
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 =