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
This commit is contained in:
Mark Hills 2002-12-21 15:54:21 +00:00 committed by Michael Niedermayer
parent a960b45f5a
commit c55427f8c8
1 changed files with 11 additions and 3 deletions

View File

@ -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
}