changeset 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 c4311f623fd5
children 411601677547
files oggvorbis.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/oggvorbis.c	Fri Sep 02 08:30:26 2005 +0000
+++ b/oggvorbis.c	Fri Sep 02 11:08:49 2005 +0000
@@ -30,6 +30,11 @@
 
 static int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) {
 
+    if(avccontext->flags & CODEC_FLAG_QSCALE) {
+        return vorbis_encode_init_vbr(vi, avccontext->channels,
+                avccontext->sample_rate,
+                avccontext->global_quality / (float)FF_QP2LAMBDA);
+    }
 #ifdef OGGVORBIS_VBR_BY_ESTIMATE
     /* variable bitrate by estimate */
 
@@ -87,6 +92,8 @@
     vorbis_comment_clear(&context->vc);
        
     avccontext->frame_size = OGGVORBIS_FRAME_SIZE ;
+    avccontext->time_base.den = avccontext->sample_rate;
+    avccontext->time_base.num = 1;
  
     avccontext->coded_frame= avcodec_alloc_frame();
     avccontext->coded_frame->key_frame= 1;