summaryrefslogtreecommitdiffstats
path: root/gtk/src/hb-backend.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-10-06 22:59:17 +0000
committerjstebbins <[email protected]>2010-10-06 22:59:17 +0000
commit0e2bd81fff72c226f073d27ae8b22530e932c20e (patch)
tree9af58accd12d89922c1f9dd1939d9366737635eb /gtk/src/hb-backend.c
parent7622dc8c73084d98e22ca6a7c44fec91962c492d (diff)
LinGui: centralize min/max audio bitrate limit calculation to one place
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3575 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r--gtk/src/hb-backend.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index ea99e0c57..20ced8f69 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -1610,6 +1610,31 @@ ghb_grey_combo_options(GtkBuilder *builder)
grey_combo_box_item(builder, "AudioMixdown", HB_AMIXDOWN_6CH, !allow_6ch);
}
+void
+ghb_get_audio_bitrate_limits(gint acodec, gint channels, gint *low, gint *high)
+{
+ if (acodec & HB_ACODEC_FAAC)
+ {
+ *low = 32 * channels;
+ if (channels >= 6)
+ *high = 768;
+ else if (channels >= 2)
+ *high = 320;
+ else
+ *high = 160;
+ }
+ else if (acodec & HB_ACODEC_AC3)
+ {
+ *low = 32 * channels;
+ *high = 640;
+ }
+ else
+ {
+ *low = hb_audio_bitrates[0].rate;
+ *high = hb_audio_bitrates[hb_audio_bitrates_count-1].rate;
+ }
+}
+
gint
ghb_find_closest_audio_bitrate(gint codec, gint rate)
{