[FFmpeg-cvslog] libvorbis: fix use of minrate/maxrate AVOptions

Justin Ruggles git at videolan.org
Thu Oct 25 17:10:48 CEST 2012


ffmpeg | branch: release/0.10 | Justin Ruggles <justin.ruggles at gmail.com> | Tue Feb 28 18:52:30 2012 -0500| [5920d00d741796a7e1a53241c7814d529cb68455] | committer: Anton Khirnov

libvorbis: fix use of minrate/maxrate AVOptions

- enable the options for audio encoding
- properly check for user-set maxrate
- use correct calling order in vorbis_encode_setup_managed()
(cherry picked from commit 182d4f1f3855460ee8634ea052f33332cf9d174e)

Conflicts:
	libavcodec/libvorbis.c

Fixes a part of Bug 277

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5920d00d741796a7e1a53241c7814d529cb68455
---

 libavcodec/libvorbis.c |    6 +++---
 libavcodec/options.c   |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c
index 25e6006..c790ff0 100644
--- a/libavcodec/libvorbis.c
+++ b/libavcodec/libvorbis.c
@@ -74,12 +74,12 @@ static av_cold int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avcco
             return -1;
     } else {
         int minrate = avccontext->rc_min_rate > 0 ? avccontext->rc_min_rate : -1;
-        int maxrate = avccontext->rc_min_rate > 0 ? avccontext->rc_max_rate : -1;
+        int maxrate = avccontext->rc_max_rate > 0 ? avccontext->rc_max_rate : -1;
 
         /* constant bitrate */
         if (vorbis_encode_setup_managed(vi, avccontext->channels,
-                                        avccontext->sample_rate, minrate,
-                                        avccontext->bit_rate, maxrate))
+                                        avccontext->sample_rate, maxrate,
+                                        avccontext->bit_rate, minrate))
             return -1;
 
         /* variable bitrate by estimate, disable slow rate management */
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 26f3ab3..bd0083c 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -226,8 +226,8 @@ static const AVOption options[]={
 {"rc_qmod_freq", "experimental quantizer modulation", OFFSET(rc_qmod_freq), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"rc_override_count", NULL, OFFSET(rc_override_count), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
 {"rc_eq", "set rate control equation", OFFSET(rc_eq), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, V|E},
-{"maxrate", "set max video bitrate tolerance (in bits/s)", OFFSET(rc_max_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
-{"minrate", "set min video bitrate tolerance (in bits/s)", OFFSET(rc_min_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"maxrate", "set max bitrate tolerance (in bits/s)", OFFSET(rc_max_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+{"minrate", "set min bitrate tolerance (in bits/s)", OFFSET(rc_min_rate), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
 {"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, A|V|E},
 {"rc_buf_aggressivity", "currently useless", OFFSET(rc_buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, V|E},
 {"i_qfactor", "qp factor between P and I frames", OFFSET(i_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = -0.8 }, -FLT_MAX, FLT_MAX, V|E},



More information about the ffmpeg-cvslog mailing list