summaryrefslogtreecommitdiff
path: root/libavcodec/oggvorbis.c
diff options
context:
space:
mode:
authorMark Hills <mark@pogo.org.uk>2002-12-21 15:54:21 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-12-21 15:54:21 +0000
commitc55427f8c8348af12b77b9601479769d701d8c99 (patch)
tree6c1b73d886c2b494140e958892ba98bdd5b84b80 /libavcodec/oggvorbis.c
parenta960b45f5aba73219ec079876577c0c8719a5d4f (diff)
fixes crash patch by (Mark Hills <mark at pogo dot org dot uk>)
Originally committed as revision 1355 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/oggvorbis.c')
-rw-r--r--libavcodec/oggvorbis.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libavcodec/oggvorbis.c b/libavcodec/oggvorbis.c
index e327e2fd3e..6e661926c6 100644
--- a/libavcodec/oggvorbis.c
+++ b/libavcodec/oggvorbis.c
@@ -24,12 +24,20 @@ typedef struct OggVorbisContext {
int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) {
- if(avccontext->coded_frame->quality) /* VBR requested */
- return vorbis_encode_init_vbr(vi, avccontext->channels,
- avccontext->sample_rate, (float)avccontext->coded_frame->quality / 1000) ;
+
+#ifdef OGGVORBIS_VBR_BY_ESTIMATE
+ /* variable bitrate by estimate */
+
+ return (vorbis_encode_setup_managed(vi, avccontext->channels,
+ avccontext->sample_rate, -1, avccontext->bit_rate, -1) ||
+ vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_AVG, NULL) ||
+ vorbis_encode_setup_init(vi)) ;
+#else
+ /* constant bitrate */
return vorbis_encode_init(vi, avccontext->channels,
avccontext->sample_rate, -1, avccontext->bit_rate, -1) ;
+#endif
}