Originally committed as revision 1355 to svn://svn.ffmpeg.org/ffmpeg/trunk
Mark Hills authored on 2002/12/22 00:54:21... | ... |
@@ -24,12 +24,20 @@ typedef struct OggVorbisContext { |
24 | 24 |
|
25 | 25 |
|
26 | 26 |
int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) { |
27 |
- if(avccontext->coded_frame->quality) /* VBR requested */ |
|
28 |
- return vorbis_encode_init_vbr(vi, avccontext->channels, |
|
29 |
- avccontext->sample_rate, (float)avccontext->coded_frame->quality / 1000) ; |
|
27 |
+ |
|
28 |
+#ifdef OGGVORBIS_VBR_BY_ESTIMATE |
|
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 | 38 |
return vorbis_encode_init(vi, avccontext->channels, |
32 | 39 |
avccontext->sample_rate, -1, avccontext->bit_rate, -1) ; |
40 |
+#endif |
|
33 | 41 |
} |
34 | 42 |
|
35 | 43 |
|