comparison vorbis_enc.c @ 3833:d4c01d85fb46 libavcodec

Original Commit: r27 | ods15 | 2006-09-22 14:19:51 +0300 (Fri, 22 Sep 2006) | 2 lines better frame_size, depending on blocksize
author ods15
date Mon, 02 Oct 2006 05:56:05 +0000
parents 3d159e4cde5a
children e99820d52041
comparison
equal deleted inserted replaced
3832:3d159e4cde5a 3833:d4c01d85fb46
532 //if (avccontext->flags & CODEC_FLAG_QSCALE) avccontext->global_quality / (float)FF_QP2LAMBDA); else avccontext->bit_rate; 532 //if (avccontext->flags & CODEC_FLAG_QSCALE) avccontext->global_quality / (float)FF_QP2LAMBDA); else avccontext->bit_rate;
533 //if(avccontext->cutoff > 0) cfreq = avccontext->cutoff / 1000.0; 533 //if(avccontext->cutoff > 0) cfreq = avccontext->cutoff / 1000.0;
534 534
535 avccontext->extradata_size = put_main_header(venc, (uint8_t**)&avccontext->extradata); 535 avccontext->extradata_size = put_main_header(venc, (uint8_t**)&avccontext->extradata);
536 536
537 avccontext->frame_size = VORBIS_FRAME_SIZE; 537 avccontext->frame_size = 1 << venc->blocksize[0];
538 538
539 avccontext->coded_frame = avcodec_alloc_frame(); 539 avccontext->coded_frame = avcodec_alloc_frame();
540 avccontext->coded_frame->key_frame = 1; 540 avccontext->coded_frame->key_frame = 1;
541 541
542 return 0; 542 return 0;
546 static int vorbis_encode_frame(AVCodecContext * avccontext, unsigned char * packets, int buf_size, void *data) 546 static int vorbis_encode_frame(AVCodecContext * avccontext, unsigned char * packets, int buf_size, void *data)
547 { 547 {
548 #if 0 548 #if 0
549 venc_context_t * venc = avccontext->priv_data; 549 venc_context_t * venc = avccontext->priv_data;
550 signed short * audio = data; 550 signed short * audio = data;
551 int samples = data ? VORBIS_FRAME_SIZE : 0; 551 int samples = data ? avccontext->frame_size : 0;
552 552
553 avccontext->coded_frame->pts = av_rescale_q(op2->granulepos, (AVRational){1, avccontext->sample_rate}, avccontext->time_base); 553 avccontext->coded_frame->pts = av_rescale_q(op2->granulepos, (AVRational){1, avccontext->sample_rate}, avccontext->time_base);
554 memcpy(packets, compressed_frame, l); 554 memcpy(packets, compressed_frame, l);
555 #endif 555 #endif
556 return data ? 50 : 0; 556 return data ? 50 : 0;