Mercurial > libavcodec.hg
comparison oggvorbis.c @ 2850:c553a407b1b6 libavcodec
fixed quality / vbr encoding patch by (Justin Ruggles, jruggle, earthlink net)
author | michael |
---|---|
date | Fri, 02 Sep 2005 11:08:49 +0000 |
parents | 040b965f2cd0 |
children | 411601677547 |
comparison
equal
deleted
inserted
replaced
2849:c4311f623fd5 | 2850:c553a407b1b6 |
---|---|
28 } OggVorbisContext ; | 28 } OggVorbisContext ; |
29 | 29 |
30 | 30 |
31 static int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) { | 31 static int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) { |
32 | 32 |
33 if(avccontext->flags & CODEC_FLAG_QSCALE) { | |
34 return vorbis_encode_init_vbr(vi, avccontext->channels, | |
35 avccontext->sample_rate, | |
36 avccontext->global_quality / (float)FF_QP2LAMBDA); | |
37 } | |
33 #ifdef OGGVORBIS_VBR_BY_ESTIMATE | 38 #ifdef OGGVORBIS_VBR_BY_ESTIMATE |
34 /* variable bitrate by estimate */ | 39 /* variable bitrate by estimate */ |
35 | 40 |
36 return (vorbis_encode_setup_managed(vi, avccontext->channels, | 41 return (vorbis_encode_setup_managed(vi, avccontext->channels, |
37 avccontext->sample_rate, -1, avccontext->bit_rate, -1) || | 42 avccontext->sample_rate, -1, avccontext->bit_rate, -1) || |
85 vorbis_dsp_clear(&context->vd); | 90 vorbis_dsp_clear(&context->vd); |
86 vorbis_info_clear(&context->vi);*/ | 91 vorbis_info_clear(&context->vi);*/ |
87 vorbis_comment_clear(&context->vc); | 92 vorbis_comment_clear(&context->vc); |
88 | 93 |
89 avccontext->frame_size = OGGVORBIS_FRAME_SIZE ; | 94 avccontext->frame_size = OGGVORBIS_FRAME_SIZE ; |
95 avccontext->time_base.den = avccontext->sample_rate; | |
96 avccontext->time_base.num = 1; | |
90 | 97 |
91 avccontext->coded_frame= avcodec_alloc_frame(); | 98 avccontext->coded_frame= avcodec_alloc_frame(); |
92 avccontext->coded_frame->key_frame= 1; | 99 avccontext->coded_frame->key_frame= 1; |
93 | 100 |
94 return 0 ; | 101 return 0 ; |