changeset 8340:a17ce1496ca6

cleanup
author michael
date Wed, 04 Dec 2002 11:53:47 +0000
parents ff0bddb59e81
children fd670708f87f
files libmpcodecs/vd_ffmpeg.c libmpcodecs/ve_lavc.c libmpcodecs/vf_lavc.c
diffstat 3 files changed, 3 insertions(+), 144 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Wed Dec 04 10:49:03 2002 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Wed Dec 04 11:53:47 2002 +0000
@@ -33,7 +33,7 @@
 #endif
 
 #if LIBAVCODEC_BUILD < 4641
-#error your version of libavcodec is too old, get a newer one, and dont send a bugreport, THIS IS NO BUG
+#error we dont support libavcodec prior to build 4641, get the latest libavcodec CVS
 #endif
 
 int avcodec_inited=0;
@@ -64,11 +64,7 @@
 static int get_buffer(AVCodecContext *avctx, AVVideoFrame *pic);
 static void release_buffer(AVCodecContext *avctx, AVVideoFrame *pic);
 
-#ifdef FF_BUG_AUTODETECT
 static int lavc_param_workaround_bugs= FF_BUG_AUTODETECT;
-#else
-static int lavc_param_workaround_bugs= 0;
-#endif
 static int lavc_param_error_resilience=2;
 static int lavc_param_error_concealment=3;
 static int lavc_param_gray=0;
@@ -76,19 +72,11 @@
 static int lavc_param_idct_algo=0;
 
 struct config lavc_decode_opts_conf[]={
-#if LIBAVCODEC_BUILD >= 4611
 	{"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, -1, 99, NULL},
 	{"er", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4614
 	{"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4629
 	{"idct", &lavc_param_idct_algo, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4631
 	{"ec", &lavc_param_error_concealment, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
-#endif
 	{"vstats", &lavc_param_vstats, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
@@ -147,33 +135,22 @@
     if(vd_use_slices && lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)
 	ctx->do_slices=1;
  
-#if LIBAVCODEC_BUILD > 4615
     if(lavc_codec->capabilities&CODEC_CAP_DR1)
 	ctx->do_dr1=1;
     //XXX:FIXME:HACK:UGLY 422P with direct rendering is buggy cuz of that chroma stride trick ...
     if(sh->format == mmioFOURCC('H','F','Y','U'))
         ctx->do_dr1=0;
-#endif
     ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64;
 
-#if LIBAVCODEC_BUILD >= 4641
     ctx->pic = avcodec_alloc_picture();
-#endif
-#if LIBAVCODEC_BUILD >= 4624
     ctx->avctx = avcodec_alloc_context();
-#else
-    ctx->avctx = malloc(sizeof(AVCodecContext));
-    memset(ctx->avctx, 0, sizeof(AVCodecContext));
-#endif
     avctx = ctx->avctx;
 
-#if LIBAVCODEC_BUILD > 4615
     if(ctx->do_dr1){
         avctx->flags|= CODEC_FLAG_EMU_EDGE; 
         avctx->get_buffer= get_buffer;
         avctx->release_buffer= release_buffer;
     }
-#endif
 
 #ifdef CODEC_FLAG_NOT_TRUNCATED
     avctx->flags|= CODEC_FLAG_NOT_TRUNCATED;
@@ -181,25 +158,14 @@
     
     avctx->width = sh->disp_w;
     avctx->height= sh->disp_h;
-#if LIBAVCODEC_BUILD >= 4611
     avctx->workaround_bugs= lavc_param_workaround_bugs;
     avctx->error_resilience= lavc_param_error_resilience;
-#endif
-#if LIBAVCODEC_BUILD >= 4614
     if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY;
-#endif
-#if LIBAVCODEC_BUILD >= 4628
     avctx->fourcc= sh->format;
-#endif
-#if LIBAVCODEC_BUILD >= 4629
     avctx->idct_algo= lavc_param_idct_algo;
-#endif
-#if LIBAVCODEC_BUILD >= 4631
     avctx->error_concealment= lavc_param_error_concealment;
-#endif
     
     mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height);
-#if LIBAVCODEC_BUILD >= 4605
     /* AVRn stores huffman table in AVI header */
     /* Pegasus MJPEG stores it also in AVI header, but it uses the common
        MJPG fourcc :( */
@@ -224,7 +190,6 @@
 	}
 #endif
     }
-#endif
     if(   sh->format == mmioFOURCC('R', 'V', '1', '0')
        || sh->format == mmioFOURCC('R', 'V', '1', '3')){
         avctx->extradata_size= 8;
@@ -257,10 +222,8 @@
 	memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
     }
     
-#if LIBAVCODEC_BUILD >= 4639
     if(sh->bih)
 	avctx->bits_per_sample= sh->bih->biBitCount;
-#endif    
 
     /* open it */
     if (avcodec_open(avctx, lavc_codec) < 0) {
@@ -280,16 +243,12 @@
     if (avcodec_close(avctx) < 0)
     	    mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec);
 
-#if LIBAVCODEC_BUILD >= 4605
     if (avctx->extradata_size)
 	free(avctx->extradata);
     avctx->extradata=NULL;
-#endif
-#if LIBAVCODEC_BUILD >= 4630
     if(avctx->slice_offset!=NULL) 
         free(avctx->slice_offset);
     avctx->slice_offset=NULL;
-#endif
 
     if (avctx)
 	free(avctx);
@@ -306,18 +265,14 @@
     int stride[3];
     int start=0, i;
     int skip_stride= (s->width+15)>>4;
-#if LIBAVCODEC_BUILD >= 4641
     UINT8 *skip= &s->coded_picture->mbskip_table[(y>>4)*skip_stride];
     int threshold= s->coded_picture->age;
-#endif
 
     stride[0]=linesize;
-#if LIBAVCODEC_BUILD >= 4641
     if(s->coded_picture->linesize[1]){
         stride[1]= s->coded_picture->linesize[1];
         stride[2]= s->coded_picture->linesize[2];
     }else
-#endif
         stride[1]=stride[2]=stride[0]/2;
 #if 0
     if(s->pict_type!=B_TYPE){
@@ -348,24 +303,18 @@
 	avctx->height != sh->disp_h ||
 	!ctx->vo_inited)
     {
-#if LIBAVCODEC_BUILD >= 4640
 	mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "aspect_ratio: %d\n", avctx->aspect_ratio);
 	sh->aspect = 
         ctx->last_aspect = avctx->aspect_ratio;
-#endif
 	sh->disp_w = avctx->width;
 	sh->disp_h = avctx->height;
 	ctx->vo_inited=1;
 	switch(avctx->pix_fmt){
-#if LIBAVCODEC_BUILD >= 4615
 	case PIX_FMT_YUV410P: ctx->best_csp=IMGFMT_YVU9;break; //svq1
-#endif
 	case PIX_FMT_YUV420P: ctx->best_csp=IMGFMT_YV12;break; //mpegs
 	case PIX_FMT_YUV422P: ctx->best_csp=IMGFMT_422P;break; //mjpeg / huffyuv
 	case PIX_FMT_YUV444P: ctx->best_csp=IMGFMT_444P;break; //???
-#if LIBAVCODEC_BUILD >= 4631
 	case PIX_FMT_YUV411P: ctx->best_csp=IMGFMT_411P;break; //dv ntsc
-#endif
 	case PIX_FMT_YUV422:  ctx->best_csp=IMGFMT_YUY2;break; //huffyuv perhaps in the future
 	case PIX_FMT_BGR24 :  ctx->best_csp=IMGFMT_BGR24;break; //huffyuv
 	case PIX_FMT_BGRA32:  ctx->best_csp=IMGFMT_BGR32;break; //huffyuv
@@ -380,7 +329,6 @@
     return 0;
 }
 
-#if LIBAVCODEC_BUILD >= 4641
 static int get_buffer(AVCodecContext *avctx, AVVideoFrame *pic){
     sh_video_t * sh = avctx->opaque;
     vd_ffmpeg_ctx *ctx = sh->context;
@@ -409,13 +357,11 @@
         flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE
                 | (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0);
 
-#if LIBAVCODEC_BUILD > 4616
     if(avctx->has_b_frames){
         type= MP_IMGTYPE_IPB;
     }else{
         type= MP_IMGTYPE_IP;
     }
-#endif
     mp_msg(MSGT_DECVIDEO,MSGL_DBG2, type== MP_IMGTYPE_IPB ? "using IPB\n" : "using IP\n");
 
     mpi= mpcodecs_get_image(sh,type, flags,
@@ -489,7 +435,6 @@
     }
 //printf("R%X %X\n", pic->linesize[0], pic->data[0]);
 }
-#endif
 
 // copypaste from demux_real.c - it should match to get it working!
 //FIXME put into some header
@@ -524,11 +469,8 @@
 	}
     }
 
-#if LIBAVCODEC_BUILD > 4603
     avctx->hurry_up=(flags&3)?((flags&2)?2:1):0;
-#endif
 
-#if LIBAVCODEC_BUILD >= 4630
 //    if(sh->ds->demuxer->type == DEMUXER_TYPE_REAL){
     if(   sh->format == mmioFOURCC('R', 'V', '1', '0')
        || sh->format == mmioFOURCC('R', 'V', '1', '3'))
@@ -547,7 +489,6 @@
 	len=hdr->len;
         data+= sizeof(dp_hdr_t);
     }
-#endif
 
     ret = avcodec_decode_video(avctx, pic,
 	     &got_picture, data, len);
@@ -607,11 +548,9 @@
 
     if(init_vo(sh)<0) return NULL;
 
-#if LIBAVCODEC_BUILD > 4615
     if(dr1 && pic->opaque){
         mpi= (mp_image_t*)pic->opaque;
     }
-#endif
         
     if(!mpi && ctx->convert){
 	// do yuv422p -> yuy2 conversion:
@@ -648,11 +587,9 @@
     }
     
 /* to comfirm with newer lavc style */
-#if LIBAVCODEC_BUILD >= 4641
     mpi->qscale =pic->qscale_table;
     mpi->qstride=pic->qstride;
     mpi->pict_type=pic->pict_type;
-#endif
     
     return mpi;
 }
--- a/libmpcodecs/ve_lavc.c	Wed Dec 04 10:49:03 2002 +0000
+++ b/libmpcodecs/ve_lavc.c	Wed Dec 04 11:53:47 2002 +0000
@@ -33,7 +33,7 @@
 #endif
 
 #if LIBAVCODEC_BUILD < 4641
-#error your version of libavcodec is too old, get a newer one, and dont send a bugreport, THIS IS NO BUG
+#error we dont support libavcodec prior to build 4641, get the latest libavcodec CVS
 #endif
 
 #if LIBAVCODEC_BUILD < 4624
@@ -83,9 +83,7 @@
 static int lavc_param_mpeg_quant=0;
 static int lavc_param_fdct=0;
 static int lavc_param_idct=0;
-#if LIBAVCODEC_BUILD >= 4623
 static char* lavc_param_aspect = NULL;
-#endif
 static float lavc_param_lumi_masking= 0.0;
 static float lavc_param_dark_masking= 0.0;
 static float lavc_param_temporal_cplx_masking= 0.0;
@@ -115,26 +113,17 @@
 	{"vb_qfactor", &lavc_param_vb_qfactor, CONF_TYPE_FLOAT, CONF_RANGE, -31.0, 31.0, NULL},
 	{"vmax_b_frames", &lavc_param_vmax_b_frames, CONF_TYPE_INT, CONF_RANGE, 0, FF_MAX_B_FRAMES, NULL},
 	{"vpass", &lavc_param_vpass, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
-#if LIBAVCODEC_BUILD < 4620
 	{"vrc_strategy", &lavc_param_vrc_strategy, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
-#endif
 	{"vb_strategy", &lavc_param_vb_strategy, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL},
-#ifdef CODEC_FLAG_PART
 	{"vb_qoffset", &lavc_param_vb_qoffset, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 31.0, NULL},
 	{"vlelim", &lavc_param_luma_elim_threshold, CONF_TYPE_INT, CONF_RANGE, -99, 99, NULL},
 	{"vcelim", &lavc_param_chroma_elim_threshold, CONF_TYPE_INT, CONF_RANGE, -99, 99, NULL},
 	{"vpsize", &lavc_param_packet_size, CONF_TYPE_INT, CONF_RANGE, 0, 100000000, NULL},
 	{"vstrict", &lavc_param_strict, CONF_TYPE_INT, CONF_RANGE, -99, 99, NULL},
 	{"vdpart", &lavc_param_data_partitioning, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL},
-#endif
 	{"keyint", &lavc_param_keyint, CONF_TYPE_INT, 0, 0, 0, NULL},
-#if LIBAVCODEC_BUILD >= 4614
 	{"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4619
 	{"mpeg_quant", &lavc_param_mpeg_quant, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4620
 	{"vi_qfactor", &lavc_param_vi_qfactor, CONF_TYPE_FLOAT, CONF_RANGE, -31.0, 31.0, NULL},
 	{"vi_qoffset", &lavc_param_vi_qoffset, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 31.0, NULL},
 	{"vqsquish", &lavc_param_rc_qsquish, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 99.0, NULL},
@@ -147,33 +136,18 @@
 	{"vrc_buf_size", &lavc_param_rc_min_rate, CONF_TYPE_INT, CONF_RANGE, 4, 24000000, NULL},
 	{"vrc_buf_aggressivity", &lavc_param_rc_buffer_aggressivity, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 99.0, NULL},
 	{"vrc_init_cplx", &lavc_param_rc_initial_cplx, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 9999999.0, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4621
         {"vfdct", &lavc_param_fdct, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4623
 	{"aspect", &lavc_param_aspect, CONF_TYPE_STRING, 0, 0, 0, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4625
 	{"lumi_mask", &lavc_param_lumi_masking, CONF_TYPE_FLOAT, CONF_RANGE, -1.0, 1.0, NULL},
 	{"tcplx_mask", &lavc_param_temporal_cplx_masking, CONF_TYPE_FLOAT, CONF_RANGE, -1.0, 1.0, NULL},
 	{"scplx_mask", &lavc_param_spatial_cplx_masking, CONF_TYPE_FLOAT, CONF_RANGE, -1.0, 1.0, NULL},
 	{"p_mask", &lavc_param_p_masking, CONF_TYPE_FLOAT, CONF_RANGE, -1.0, 1.0, NULL},
 	{"naq", &lavc_param_normalize_aqp, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4626
 	{"dark_mask", &lavc_param_dark_masking, CONF_TYPE_FLOAT, CONF_RANGE, -1.0, 1.0, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4627
 	{"ildct", &lavc_param_interlaced_dct, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4629
         {"idct", &lavc_param_idct, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL},
-#endif
-#if LIBAVCODEC_BUILD >= 4639
         {"pred", &lavc_param_prediction_method, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL},
         {"format", &lavc_param_format, CONF_TYPE_STRING, 0, 0, 0, NULL},
-#endif
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 #endif
@@ -223,15 +197,12 @@
     lavc_venc_context->b_quant_factor= lavc_param_vb_qfactor;
     lavc_venc_context->rc_strategy= lavc_param_vrc_strategy;
     lavc_venc_context->b_frame_strategy= lavc_param_vb_strategy;
-#ifdef CODEC_FLAG_PART
     lavc_venc_context->b_quant_offset= lavc_param_vb_qoffset;
     lavc_venc_context->luma_elim_threshold= lavc_param_luma_elim_threshold;
     lavc_venc_context->chroma_elim_threshold= lavc_param_chroma_elim_threshold;
     lavc_venc_context->rtp_payload_size= lavc_param_packet_size;
     if(lavc_param_packet_size )lavc_venc_context->rtp_mode=1;
     lavc_venc_context->strict_std_compliance= lavc_param_strict;
-#endif
-#if LIBAVCODEC_BUILD >= 4620
     lavc_venc_context->i_quant_factor= lavc_param_vi_qfactor;
     lavc_venc_context->i_quant_offset= lavc_param_vi_qoffset;
     lavc_venc_context->rc_qsquish= lavc_param_rc_qsquish;
@@ -268,30 +239,18 @@
         if(p) p++;
     }
     lavc_venc_context->rc_override_count=i;
-#endif
 
-#if LIBAVCODEC_BUILD >= 4619
     lavc_venc_context->mpeg_quant=lavc_param_mpeg_quant;
-#endif
 
-#if LIBAVCODEC_BUILD >= 4621
     lavc_venc_context->dct_algo= lavc_param_fdct;
-#endif
-#if LIBAVCODEC_BUILD >= 4629
     lavc_venc_context->idct_algo= lavc_param_idct;
-#endif
 
-#if LIBAVCODEC_BUILD >= 4625
     lavc_venc_context->lumi_masking= lavc_param_lumi_masking;
     lavc_venc_context->temporal_cplx_masking= lavc_param_temporal_cplx_masking;
     lavc_venc_context->spatial_cplx_masking= lavc_param_spatial_cplx_masking;
     lavc_venc_context->p_masking= lavc_param_p_masking;
-#endif
-#if LIBAVCODEC_BUILD >= 4626
     lavc_venc_context->dark_masking= lavc_param_dark_masking;
-#endif
 
-#if LIBAVCODEC_BUILD >= 4640
     if (lavc_param_aspect != NULL)
     {
 	int par_width, par_height, e;
@@ -313,7 +272,6 @@
 	    return 0;
 	}
     }
-#endif
 
     /* keyframe interval */
     if (lavc_param_keyint >= 0) /* != -1 */
@@ -336,20 +294,11 @@
     }
 
     lavc_venc_context->flags|= lavc_param_v4mv ? CODEC_FLAG_4MV : 0;
-#ifdef CODEC_FLAG_PART
     lavc_venc_context->flags|= lavc_param_data_partitioning;
-#endif
-#if LIBAVCODEC_BUILD >= 4614
     if(lavc_param_gray) lavc_venc_context->flags|= CODEC_FLAG_GRAY;
-#endif
 
-#if LIBAVCODEC_BUILD >= 4625
     if(lavc_param_normalize_aqp) lavc_venc_context->flags|= CODEC_FLAG_NORMALIZE_AQP;
-#endif
-#if LIBAVCODEC_BUILD >= 4627
     if(lavc_param_interlaced_dct) lavc_venc_context->flags|= CODEC_FLAG_INTERLACED_DCT;
-#endif
-#if LIBAVCODEC_BUILD >= 4639
     lavc_venc_context->prediction_method= lavc_param_prediction_method;
     if(!strcasecmp(lavc_param_format, "YV12"))
         lavc_venc_context->pix_fmt= PIX_FMT_YUV420P;
@@ -359,22 +308,18 @@
         mp_msg(MSGT_MENCODER,MSGL_ERR,"%s is not a supported format\n", lavc_param_format);
         return 0;
     }
-#endif
     /* lavc internal 2pass bitrate control */
     switch(lavc_param_vpass){
     case 1: 
 	lavc_venc_context->flags|= CODEC_FLAG_PASS1; 
-#if LIBAVCODEC_BUILD >= 4620
 	stats_file= fopen(passtmpfile, "w");
 	if(stats_file==NULL){
 	    mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile);
             return 0;
 	}
-#endif
 	break;
     case 2:
 	lavc_venc_context->flags|= CODEC_FLAG_PASS2; 
-#if LIBAVCODEC_BUILD >= 4620
 	stats_file= fopen(passtmpfile, "r");
 	if(stats_file==NULL){
 	    mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile);
@@ -391,16 +336,10 @@
 	    mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: reading from filename=%s\n", passtmpfile);
             return 0;
 	}        
-#endif
 	break;
     }
 
-#ifdef ME_ZERO
-    // workaround Juanjo's stupid incompatible change:
-    motion_estimation_method = lavc_param_vme;
-#else
     lavc_venc_context->me_method = ME_ZERO+lavc_param_vme;
-#endif
 
     /* fixed qscale :p */
     if (lavc_param_vqscale)
@@ -420,19 +359,15 @@
 	return 0;
     }
     
-#if LIBAVCODEC_BUILD >= 4620
     /* free second pass buffer, its not needed anymore */
     if(lavc_venc_context->stats_in) free(lavc_venc_context->stats_in);
     lavc_venc_context->stats_in= NULL;
-#endif
-#if LIBAVCODEC_BUILD >= 4639
     if(lavc_venc_context->bits_per_sample)
         mux_v->bih->biBitCount= lavc_venc_context->bits_per_sample;
     if(lavc_venc_context->extradata_size){
         memcpy(mux_v->bih + 1, lavc_venc_context->extradata, lavc_venc_context->extradata_size);
         mux_v->bih->biSize= sizeof(BITMAPINFOHEADER) + lavc_venc_context->extradata_size;
     }
-#endif
     
     return 1;
 }
@@ -474,24 +409,20 @@
 
     mencoder_write_chunk(mux_v,out_size,lavc_venc_context->coded_picture->key_frame?0x10:0);
     
-#if LIBAVCODEC_BUILD >= 4620
     /* store stats if there are any */
     if(lavc_venc_context->stats_out && stats_file) 
         fprintf(stats_file, "%s", lavc_venc_context->stats_out);
-#endif
     return 1;
 }
 
 static void uninit(struct vf_instance_s* vf){
     avcodec_close(lavc_venc_context);
 
-#if LIBAVCODEC_BUILD >= 4620
     if(stats_file) fclose(stats_file);
     
     /* free rc_override */
     if(lavc_venc_context->rc_override) free(lavc_venc_context->rc_override);
     lavc_venc_context->rc_override= NULL;
-#endif
 
     if(vf->priv->context) free(vf->priv->context);
     vf->priv->context= NULL;
@@ -576,12 +507,7 @@
     }
 
     vf->priv->pic = avcodec_alloc_picture();
-#if LIBAVCODEC_BUILD >= 4624
     vf->priv->context = avcodec_alloc_context();
-#else
-    vf->priv->context = malloc(sizeof(AVCodecContext));
-    memset(vf->priv->context, 0, sizeof(AVCodecContext));
-#endif
 
     return 1;
 }
--- a/libmpcodecs/vf_lavc.c	Wed Dec 04 10:49:03 2002 +0000
+++ b/libmpcodecs/vf_lavc.c	Wed Dec 04 11:53:47 2002 +0000
@@ -22,7 +22,7 @@
 #endif
 
 #if LIBAVCODEC_BUILD < 4641
-#error your version of libavcodec is too old, get a newer one, and dont send a bugreport, THIS IS NO BUG
+#error we dont support libavcodec prior to build 4641, get the latest libavcodec CVS
 #endif
 
 extern int avcodec_inited;
@@ -156,11 +156,7 @@
     if(p_quality<32){
 	// fixed qscale
 	lavc_venc_context.flags = CODEC_FLAG_QSCALE;
-#if LIBAVCODEC_BUILD >= 4641
 	vf->priv->pic->quality = (p_quality<1) ? 1 : p_quality;
-#else
-	lavc_venc_context.quality = (p_quality<1) ? 1 : p_quality;
-#endif
     } else {
 	// fixed bitrate (in kbits)
 	lavc_venc_context.bit_rate = 1000*p_quality;