mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
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:
parent
0e3f19744e
commit
c39c53197c
1 changed files with 30 additions and 26 deletions
|
@ -667,33 +667,35 @@ 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 (rate <= 64) { \
|
||||
maxrate = 64; multiplier = 8; \
|
||||
if ((rate % 8) != 0) ___rate = GST_ROUND_UP_8 (rate); \
|
||||
} else if (rate <= 128) { \
|
||||
maxrate = 128; multiplier = 16; \
|
||||
if ((rate % 16) != 0) ___rate = GST_ROUND_UP_16 (rate); \
|
||||
} else if (rate <= 256) { \
|
||||
maxrate = 256; multiplier = 32; \
|
||||
if ((rate % 32) != 0) ___rate = GST_ROUND_UP_32 (rate); \
|
||||
} else if (rate <= 320) { \
|
||||
maxrate = 320; multiplier = 64; \
|
||||
if ((rate % 64) != 0) ___rate = GST_ROUND_UP_64 (rate); \
|
||||
} \
|
||||
if (___rate != rate) { \
|
||||
GST_ELEMENT_WARNING (obj, LIBRARY, SETTINGS, \
|
||||
(_("The requested bitrate %d kbit/s for property '%s' " \
|
||||
"is not allowed. " \
|
||||
"The bitrate was changed to %d kbit/s."), rate, \
|
||||
param, ___rate), \
|
||||
("A bitrate below %d should be a multiple of %d.", \
|
||||
maxrate, multiplier)); \
|
||||
rate = ___rate; \
|
||||
if (!free_format) { \
|
||||
if (rate <= 64) { \
|
||||
maxrate = 64; multiplier = 8; \
|
||||
if ((rate % 8) != 0) ___rate = GST_ROUND_UP_8 (rate); \
|
||||
} else if (rate <= 128) { \
|
||||
maxrate = 128; multiplier = 16; \
|
||||
if ((rate % 16) != 0) ___rate = GST_ROUND_UP_16 (rate); \
|
||||
} else if (rate <= 256) { \
|
||||
maxrate = 256; multiplier = 32; \
|
||||
if ((rate % 32) != 0) ___rate = GST_ROUND_UP_32 (rate); \
|
||||
} else if (rate <= 320) { \
|
||||
maxrate = 320; multiplier = 64; \
|
||||
if ((rate % 64) != 0) ___rate = GST_ROUND_UP_64 (rate); \
|
||||
} \
|
||||
if (___rate != rate) { \
|
||||
GST_ELEMENT_WARNING (obj, LIBRARY, SETTINGS, \
|
||||
(_("The requested bitrate %d kbit/s for property '%s' " \
|
||||
"is not allowed. " \
|
||||
"The bitrate was changed to %d kbit/s."), rate, \
|
||||
param, ___rate), \
|
||||
("A bitrate below %d should be a multiple of %d.", \
|
||||
maxrate, multiplier)); \
|
||||
rate = ___rate; \
|
||||
} \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue