/* 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
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));
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));