ext/lame/gstlame.c: Disable the bitrate checking when the user has requested

Original commit message from CVS:
* ext/lame/gstlame.c: (gst_lame_setup):
Disable the bitrate checking when the user has requested
Free Format mode, as all bitrates less than the maximum
are valid then.
This commit is contained in:
Jan Schmidt 2007-03-21 12:53:57 +00:00
parent 0e3f19744e
commit c39c53197c

View file

@ -667,11 +667,12 @@ init_error:
/* call this MACRO outside of the NULL state so that we have a higher chance
* of actually having a pipeline and bus to get the message through */
#define CHECK_AND_FIXUP_BITRATE(obj,param,rate) \
#define CHECK_AND_FIXUP_BITRATE(obj,param,rate,free_format) \
G_STMT_START { \
gint ___rate = rate; \
gint maxrate = 320; \
gint multiplier = 64; \
if (!free_format) { \
if (rate <= 64) { \
maxrate = 64; multiplier = 8; \
if ((rate % 8) != 0) ___rate = GST_ROUND_UP_8 (rate); \
@ -695,6 +696,7 @@ G_STMT_START { \
maxrate, multiplier)); \
rate = ___rate; \
} \
} \
} G_STMT_END
static void
@ -1162,7 +1164,7 @@ gst_lame_setup (GstLame * lame)
lame->mode = 3;
CHECK_ERROR (lame_set_num_channels (lame->lgf, lame->num_channels));
CHECK_AND_FIXUP_BITRATE (lame, "bitrate", lame->bitrate);
CHECK_AND_FIXUP_BITRATE (lame, "bitrate", lame->bitrate, lame->free_format);
CHECK_ERROR (lame_set_brate (lame->lgf, lame->bitrate));
CHECK_ERROR (lame_set_compression_ratio (lame->lgf, lame->compression_ratio));
CHECK_ERROR (lame_set_quality (lame->lgf, lame->quality));
@ -1180,10 +1182,12 @@ gst_lame_setup (GstLame * lame)
CHECK_ERROR (lame_set_VBR_q (lame->lgf, lame->vbr_quality));
CHECK_ERROR (lame_set_VBR_mean_bitrate_kbps (lame->lgf,
lame->vbr_mean_bitrate));
CHECK_AND_FIXUP_BITRATE (lame, "vbr-min-bitrate", lame->vbr_min_bitrate);
CHECK_AND_FIXUP_BITRATE (lame, "vbr-min-bitrate", lame->vbr_min_bitrate,
lame->free_format);
CHECK_ERROR (lame_set_VBR_min_bitrate_kbps (lame->lgf,
lame->vbr_min_bitrate));
CHECK_AND_FIXUP_BITRATE (lame, "vbr-max-bitrate", lame->vbr_max_bitrate);
CHECK_AND_FIXUP_BITRATE (lame, "vbr-max-bitrate", lame->vbr_max_bitrate,
lame->free_format);
CHECK_ERROR (lame_set_VBR_max_bitrate_kbps (lame->lgf,
lame->vbr_max_bitrate));
CHECK_ERROR (lame_set_VBR_hard_min (lame->lgf, lame->vbr_hard_min));