comparison oggvorbis.c @ 934:159333d9297e libavcodec

fixes crash patch by (Mark Hills <mark at pogo dot org dot uk>)
author michaelni
date Sat, 21 Dec 2002 15:54:21 +0000
parents 7fccaa0d699d
children b32afefe7d33
comparison
equal deleted inserted replaced
933:8254eac24488 934:159333d9297e
22 vorbis_comment vc ; 22 vorbis_comment vc ;
23 } OggVorbisContext ; 23 } OggVorbisContext ;
24 24
25 25
26 int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) { 26 int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) {
27 if(avccontext->coded_frame->quality) /* VBR requested */ 27
28 return vorbis_encode_init_vbr(vi, avccontext->channels, 28 #ifdef OGGVORBIS_VBR_BY_ESTIMATE
29 avccontext->sample_rate, (float)avccontext->coded_frame->quality / 1000) ; 29 /* variable bitrate by estimate */
30
31 return (vorbis_encode_setup_managed(vi, avccontext->channels,
32 avccontext->sample_rate, -1, avccontext->bit_rate, -1) ||
33 vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_AVG, NULL) ||
34 vorbis_encode_setup_init(vi)) ;
35 #else
36 /* constant bitrate */
30 37
31 return vorbis_encode_init(vi, avccontext->channels, 38 return vorbis_encode_init(vi, avccontext->channels,
32 avccontext->sample_rate, -1, avccontext->bit_rate, -1) ; 39 avccontext->sample_rate, -1, avccontext->bit_rate, -1) ;
40 #endif
33 } 41 }
34 42
35 43
36 static int oggvorbis_encode_init(AVCodecContext *avccontext) { 44 static int oggvorbis_encode_init(AVCodecContext *avccontext) {
37 OggVorbisContext *context = avccontext->priv_data ; 45 OggVorbisContext *context = avccontext->priv_data ;