summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorRodeo <[email protected]>2015-05-16 21:08:27 +0000
committerRodeo <[email protected]>2015-05-16 21:08:27 +0000
commit2879be588a4e89338ceb13409ecc0005977ab781 (patch)
tree22ffa494c5a9463e77c54bb68f43595de40327e8 /libhb
parentbec7d3d5986a4845fd5c7cccf88de40e4b6e2c74 (diff)
libhb: return the global bitrate limits for a given mixdown when the samplerate is not known.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7199 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libhb/common.c b/libhb/common.c
index 8a7b72522..d6d0d61a9 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -989,6 +989,20 @@ fail:
void hb_audio_bitrate_get_limits(uint32_t codec, int samplerate, int mixdown,
int *low, int *high)
{
+ /*
+ * samplerate == 0 means "auto" (same as source) and the UIs know the source
+ * samplerate -- except where there isn't a source (audio defaults panel);
+ * but we have enough info to return the global bitrate limits for this
+ * mixdown, since the first/last samplerate are known to us and non-zero.
+ */
+ if (samplerate == 0)
+ {
+ int dummy;
+ hb_audio_bitrate_get_limits(codec, hb_audio_rates_first_item->rate, mixdown, low, &dummy);
+ hb_audio_bitrate_get_limits(codec, hb_audio_rates_last_item->rate, mixdown, &dummy, high);
+ return;
+ }
+
/* samplerate, sr_shift */
int sr_shift;
samplerate = hb_audio_samplerate_get_best(codec, samplerate, &sr_shift);