Mercurial > mplayer.hg
changeset 19073:8b52dad54b1d
Remove #if LIBAVCODEC_BUILD >= XXX and #if LIBAVFORMAT_BUILD >= XXX jungle.
It served no apparent purpose anymore.
author | diego |
---|---|
date | Thu, 13 Jul 2006 23:02:03 +0000 |
parents | e6f5f7c26166 |
children | d385666efa27 |
files | libmpcodecs/vd_ffmpeg.c libmpcodecs/ve_lavc.c libmpcodecs/vf_lavc.c libmpdemux/demux_lavf.c libmpdemux/muxer_lavf.c |
diffstat | 5 files changed, 8 insertions(+), 325 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c Thu Jul 13 22:56:02 2006 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Thu Jul 13 23:02:03 2006 +0000 @@ -27,28 +27,6 @@ #include "libavcodec/avcodec.h" #endif -#if LIBAVCODEC_BUILD < 4641 -#error we do not support libavcodec prior to build 4641, get the latest libavcodec CVS -#endif - -#if LIBAVCODEC_BUILD < 4645 -#warning your version of libavcodec is old, u might want to get a newer one -#endif - -#if LIBAVCODEC_BUILD < 4645 -#define AVFrame AVVideoFrame -#define coded_frame coded_picture -#endif - -#if LIBAVCODEC_BUILD < 4654 -#define PIX_FMT_RGB24 PIX_FMT_BGR24 -#define PIX_FMT_RGBA32 PIX_FMT_BGRA32 -#endif - -#if LIBAVCODEC_BUILD < 4672 -#undef HAVE_XVMC -#endif - #ifdef HAVE_XVMC #include "xvmc_render.h" #endif @@ -105,11 +83,9 @@ static int lavc_param_fast=0; static int lavc_param_lowres=0; static char *lavc_param_lowres_str=NULL; -#if LIBAVCODEC_BUILD >= 4758 static char *lavc_param_skip_loop_filter_str = NULL; static char *lavc_param_skip_idct_str = NULL; static char *lavc_param_skip_frame_str = NULL; -#endif static int lavc_param_threads=1; static int lavc_param_bitexact=0; @@ -128,17 +104,14 @@ {"fast", &lavc_param_fast, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG2_FAST, NULL}, #endif {"lowres", &lavc_param_lowres_str, CONF_TYPE_STRING, 0, 0, 0, NULL}, -#if LIBAVCODEC_BUILD >= 4758 {"skiploopfilter", &lavc_param_skip_loop_filter_str, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"skipidct", &lavc_param_skip_idct_str, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"skipframe", &lavc_param_skip_frame_str, CONF_TYPE_STRING, 0, 0, 0, NULL}, -#endif {"threads", &lavc_param_threads, CONF_TYPE_INT, CONF_RANGE, 1, 8, NULL}, {"bitexact", &lavc_param_bitexact, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_BITEXACT, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; -#if LIBAVCODEC_BUILD >= 4758 static enum AVDiscard str2AVDiscard(char *str) { if (!str) return AVDISCARD_DEFAULT; @@ -157,7 +130,6 @@ mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Unknown discard value %s\n", str); return AVDISCARD_DEFAULT; } -#endif // to set/get/query special features/parameters static int control(sh_video_t *sh,int cmd,void* arg,...){ @@ -200,9 +172,7 @@ AVCodecContext *avctx; vd_ffmpeg_ctx *ctx; AVCodec *lavc_codec; -#if LIBAVCODEC_BUILD >= 4722 int lowres_w=0; -#endif int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP)); if(!avcodec_inited){ @@ -230,19 +200,10 @@ ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64; ctx->ip_count= ctx->b_count= 0; -#if LIBAVCODEC_BUILD >= 4645 ctx->pic = avcodec_alloc_frame(); -#else - ctx->pic = avcodec_alloc_picture(); -#endif ctx->avctx = avcodec_alloc_context(); avctx = ctx->avctx; -#if LIBAVCODEC_BUILD >= 4691 && LIBAVCODEC_BUILD <= 4692 - if(lavc_codec->capabilities&CODEC_CAP_CR) - avctx->cr_available = 1; -#endif - #ifdef HAVE_XVMC #ifdef CODEC_CAP_HWACCEL @@ -265,9 +226,7 @@ avctx->flags|= CODEC_FLAG_EMU_EDGE; avctx->get_buffer= get_buffer; avctx->release_buffer= release_buffer; -#if LIBAVCODEC_BUILD >= 4693 avctx->reget_buffer= get_buffer; -#endif } #ifdef CODEC_FLAG_NOT_TRUNCATED @@ -284,24 +243,15 @@ avctx->flags2|= lavc_param_fast; #endif avctx->codec_tag= sh->format; -#if LIBAVCODEC_BUILD >= 4679 avctx->stream_codec_tag= sh->video.fccHandler; -#endif avctx->idct_algo= lavc_param_idct_algo; avctx->error_concealment= lavc_param_error_concealment; -#if LIBAVCODEC_BUILD >= 4642 avctx->debug= lavc_param_debug; if (lavc_param_debug) av_log_set_level(AV_LOG_DEBUG); -#endif -#if LIBAVCODEC_BUILD >= 4698 avctx->debug_mv= lavc_param_vismv; -#endif -#if LIBAVCODEC_BUILD >= 4717 avctx->skip_top = lavc_param_skip_top; avctx->skip_bottom= lavc_param_skip_bottom; -#endif -#if LIBAVCODEC_BUILD >= 4722 if(lavc_param_lowres_str != NULL) { sscanf(lavc_param_lowres_str, "%d,%d", &lavc_param_lowres, &lowres_w); @@ -309,12 +259,9 @@ lavc_param_lowres = 0; avctx->lowres = lavc_param_lowres; } -#endif -#if LIBAVCODEC_BUILD >= 4758 avctx->skip_loop_filter = str2AVDiscard(lavc_param_skip_loop_filter_str); avctx->skip_idct = str2AVDiscard(lavc_param_skip_idct_str); avctx->skip_frame = str2AVDiscard(lavc_param_skip_frame_str); -#endif mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); switch (sh->format) { case mmioFOURCC('A','V','R','n'): @@ -383,7 +330,6 @@ break; } /* Pass palette to codec */ -#if LIBAVCODEC_BUILD >= 4689 if (sh->bih && (sh->bih->biBitCount <= 8)) { avctx->palctrl = calloc(1,sizeof(AVPaletteControl)); avctx->palctrl->palette_changed = 1; @@ -396,15 +342,12 @@ memcpy(avctx->palctrl->palette, sh->bih+1, min(sh->bih->biClrUsed * 4, AVPALETTE_SIZE)); } -#endif - + if(sh->bih) avctx->bits_per_sample= sh->bih->biBitCount; -#if LIBAVCODEC_BUILD >= 4716 if(lavc_param_threads > 1) avcodec_thread_init(avctx, lavc_param_threads); -#endif /* open it */ if (avcodec_open(avctx, lavc_codec) < 0) { mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); @@ -435,9 +378,7 @@ mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); av_freep(&avctx->extradata); -#if LIBAVCODEC_BUILD >= 4689 av_freep(&avctx->palctrl); -#endif av_freep(&avctx->slice_offset); av_freep(&avctx); @@ -447,11 +388,7 @@ } static void draw_slice(struct AVCodecContext *s, -#if LIBAVCODEC_BUILD >= 4670 AVFrame *src, int offset[4], -#else - uint8_t **src, int linesize, -#endif int y, int type, int height){ sh_video_t * sh = s->opaque; int start=0, i; @@ -459,18 +396,7 @@ int skip_stride= ((width<<lavc_param_lowres)+15)>>4; uint8_t *skip= &s->coded_frame->mbskip_table[(y>>4)*skip_stride]; int threshold= s->coded_frame->age; -#if LIBAVCODEC_BUILD >= 4670 uint8_t *source[3]= {src->data[0] + offset[0], src->data[1] + offset[1], src->data[2] + offset[2]}; -#else - int stride[3]; - - stride[0]=linesize; - if(s->coded_frame->linesize[1]){ - stride[1]= s->coded_frame->linesize[1]; - stride[2]= s->coded_frame->linesize[2]; - }else - stride[1]=stride[2]=stride[0]/2; -#endif #if 0 if(s->pict_type!=B_TYPE){ for(i=0; i*16<width+16; i++){ @@ -489,11 +415,7 @@ }else #endif if (y < sh->disp_h) { -#if LIBAVCODEC_BUILD >= 4670 mpcodecs_draw_slice (sh, source, src->linesize, sh->disp_w, (y+height)<=sh->disp_h?height:sh->disp_h-y, 0, y); -#else - mpcodecs_draw_slice (sh,src, stride, sh->disp_w, (y+height)<=sh->disp_h?height:sh->disp_h-y, 0, y); -#endif } } @@ -501,11 +423,7 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt){ vd_ffmpeg_ctx *ctx = sh->context; AVCodecContext *avctx = ctx->avctx; -#if LIBAVCODEC_BUILD >= 4687 float aspect= av_q2d(avctx->sample_aspect_ratio) * avctx->width / avctx->height; -#else - float aspect= avctx->aspect_ratio; -#endif int width, height; width = avctx->width; @@ -582,7 +500,6 @@ if(avctx->pix_fmt == PIX_FMT_YUV410P) align=63; //yes seriously, its really needed (16x16 chroma blocks in SVQ1 -> 64x64) -#if LIBAVCODEC_BUILD >= 4691 if (pic->buffer_hints) { mp_msg(MSGT_DECVIDEO,MSGL_DBG2, "Buffer hints: %u\n", pic->buffer_hints); type = MP_IMGTYPE_TEMP; @@ -600,7 +517,6 @@ MP_IMGFLAG_DRAW_CALLBACK:0; mp_msg(MSGT_DECVIDEO,MSGL_DBG2, type == MP_IMGTYPE_STATIC ? "using STATIC\n" : "using TEMP\n"); } else { -#endif if(!pic->reference){ ctx->b_count++; flags|=(!avctx->hurry_up && ctx->do_slices) ? @@ -610,19 +526,15 @@ flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE | (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0); } -#if LIBAVCODEC_BUILD >= 4691 } -#endif if(init_vo(sh,avctx->pix_fmt) < 0){ avctx->release_buffer= avcodec_default_release_buffer; avctx->get_buffer= avcodec_default_get_buffer; return avctx->get_buffer(avctx, pic); } - -#if LIBAVCODEC_BUILD >= 4691 + if (!pic->buffer_hints) { -#endif if(ctx->b_count>1 || ctx->ip_count>2){ mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_DRIFailure); @@ -637,9 +549,7 @@ type= MP_IMGTYPE_IP; } mp_msg(MSGT_DECVIDEO,MSGL_DBG2, type== MP_IMGTYPE_IPB ? "using IPB\n" : "using IP\n"); -#if LIBAVCODEC_BUILD >= 4691 } -#endif mpi= mpcodecs_get_image(sh,type, flags, (width+align)&(~align), (height+align)&(~align)); @@ -652,11 +562,9 @@ } else avctx->draw_horiz_band= NULL; -#if LIBAVCODEC_BUILD >= 4689 // Palette support: libavcodec copies palette to *data[1] if (mpi->bpp == 8) mpi->planes[1] = av_malloc(AVPALETTE_SIZE); -#endif pic->data[0]= mpi->planes[0]; pic->data[1]= mpi->planes[1]; @@ -709,9 +617,7 @@ ctx->ip_age[1]++; ctx->b_age=1; } -#if LIBAVCODEC_BUILD >= 4644 pic->type= FF_BUFFER_TYPE_USER; -#endif return 0; } @@ -734,12 +640,10 @@ if ( mpi && (mpi->bpp == 8)) av_freep(&mpi->planes[1]); -#if LIBAVCODEC_BUILD >= 4644 if(pic->type!=FF_BUFFER_TYPE_USER){ avcodec_default_release_buffer(avctx, pic); return; } -#endif for(i=0; i<4; i++){ pic->data[i]= NULL; @@ -770,16 +674,8 @@ if(len<=0) return NULL; // skipped frame -#if LIBAVCODEC_BUILD < 4707 - -#ifdef HAVE_XVMC - if( !avctx->xvmc_acceleration ) -#endif - -#else //ffmpeg interlace (mpeg2) bug have been fixed. no need of -noslices if (!dr1) -#endif avctx->draw_horiz_band=NULL; avctx->opaque=sh; if(ctx->vo_inited && !(flags&3) && !dr1){ @@ -825,7 +721,6 @@ if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n"); //printf("repeat: %d\n", pic->repeat_pict); //-- vstats generation -#if LIBAVCODEC_BUILD >= 4643 while(lavc_param_vstats){ // always one time loop static FILE *fvstats=NULL; char filename[20]; @@ -896,7 +791,6 @@ break; } -#endif //-- if(!got_picture) return NULL; // skipped image @@ -937,16 +831,12 @@ mpi->qscale =pic->qscale_table; mpi->qstride=pic->qstride; mpi->pict_type=pic->pict_type; -#if LIBAVCODEC_BUILD >= 4664 mpi->qscale_type= pic->qscale_type; -#endif -#if LIBAVCODEC_BUILD >= 4697 mpi->fields = MP_IMGFIELD_ORDERED; if(pic->interlaced_frame) mpi->fields |= MP_IMGFIELD_INTERLACED; if(pic->top_field_first ) mpi->fields |= MP_IMGFIELD_TOP_FIRST; if(pic->repeat_pict == 1) mpi->fields |= MP_IMGFIELD_REPEAT_FIRST; -#endif - + return mpi; }
--- a/libmpcodecs/ve_lavc.c Thu Jul 13 22:56:02 2006 +0000 +++ b/libmpcodecs/ve_lavc.c Thu Jul 13 23:02:03 2006 +0000 @@ -36,19 +36,6 @@ #include "libavcodec/avcodec.h" #endif -#if LIBAVCODEC_BUILD < 4641 -#error we do not support libavcodec prior to build 4641, get the latest libavcodec CVS -#endif - -#if LIBAVCODEC_BUILD < 4659 -#warning your version of libavcodec is old, u might want to get a newer one -#endif - -#if LIBAVCODEC_BUILD < 4645 -#define AVFrame AVVideoFrame -#define coded_frame coded_picture -#endif - extern int avcodec_inited; /* video options */ @@ -132,10 +119,8 @@ static int lavc_param_pre_me= 1; static int lavc_param_me_subpel_quality= 8; static int lavc_param_me_range= 0; -#if LIBAVCODEC_BUILD >= 4663 static int lavc_param_ibias= FF_DEFAULT_QUANT_BIAS; static int lavc_param_pbias= FF_DEFAULT_QUANT_BIAS; -#endif static int lavc_param_coder= 0; static int lavc_param_context= 0; static char *lavc_param_intra_matrix = NULL; @@ -233,12 +218,8 @@ {"idct", &lavc_param_idct, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL}, {"pred", &lavc_param_prediction_method, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL}, {"format", &lavc_param_format, CONF_TYPE_IMGFMT, 0, 0, 0, NULL}, -#if LIBAVCODEC_BUILD >= 4642 {"debug", &lavc_param_debug, CONF_TYPE_INT, CONF_RANGE, 0, 100000000, NULL}, -#endif -#if LIBAVCODEC_BUILD >= 4643 {"psnr", &lavc_param_psnr, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR, NULL}, -#endif {"precmp", &lavc_param_me_pre_cmp, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL}, {"cmp", &lavc_param_me_cmp, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL}, {"subcmp", &lavc_param_me_sub_cmp, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL}, @@ -250,9 +231,7 @@ {"predia", &lavc_param_pre_dia_size, CONF_TYPE_INT, CONF_RANGE, -2000, 2000, NULL}, {"dia", &lavc_param_dia_size, CONF_TYPE_INT, CONF_RANGE, -2000, 2000, NULL}, {"qpel", &lavc_param_qpel, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL, NULL}, -#if LIBAVCODEC_BUILD >= 4648 {"trell", &lavc_param_trell, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT, NULL}, -#endif {"last_pred", &lavc_param_last_pred, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL}, {"preme", &lavc_param_pre_me, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL}, {"subq", &lavc_param_me_subpel_quality, CONF_TYPE_INT, CONF_RANGE, 0, 8, NULL}, @@ -270,24 +249,14 @@ #ifdef CODEC_FLAG_LOOP_FILTER {"loop", &lavc_param_loop, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_LOOP_FILTER, NULL}, #endif -#if LIBAVCODEC_BUILD >= 4663 {"ibias", &lavc_param_ibias, CONF_TYPE_INT, CONF_RANGE, -512, 512, NULL}, {"pbias", &lavc_param_pbias, CONF_TYPE_INT, CONF_RANGE, -512, 512, NULL}, -#endif -#if LIBAVCODEC_BUILD >= 4669 {"coder", &lavc_param_coder, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL}, {"context", &lavc_param_context, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL}, -#endif -#if LIBAVCODEC_BUILD >= 4675 {"intra_matrix", &lavc_param_intra_matrix, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"inter_matrix", &lavc_param_inter_matrix, CONF_TYPE_STRING, 0, 0, 0, NULL}, -#endif -#if LIBAVCODEC_BUILD >= 4681 {"cbp", &lavc_param_cbp, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CBP_RD, NULL}, -#endif -#if LIBAVCODEC_BUILD >= 4683 {"mv0", &lavc_param_mv0, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0, NULL}, -#endif {"nr", &lavc_param_noise_reduction, CONF_TYPE_INT, CONF_RANGE, 0, 1000000, NULL}, #ifdef CODEC_FLAG_QP_RD {"qprd", &lavc_param_qp_rd, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QP_RD, NULL}, @@ -304,12 +273,8 @@ #ifdef CODEC_FLAG_CLOSED_GOP {"cgop", &lavc_param_closed_gop, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CLOSED_GOP, NULL}, #endif -#if LIBAVCODEC_BUILD >= 4711 {"dc", &lavc_param_dc_precision, CONF_TYPE_INT, CONF_RANGE, 8, 11, NULL}, -#endif -#if LIBAVCODEC_BUILD >= 4741 {"border_mask", &lavc_param_border_masking, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 1.0, NULL}, -#endif {"inter_threshold", &lavc_param_inter_threshold, CONF_TYPE_INT, CONF_RANGE, -1000000, 1000000, NULL}, {"sc_threshold", &lavc_param_sc_threshold, CONF_TYPE_INT, CONF_RANGE, -1000000000, 1000000000, NULL}, {"top", &lavc_param_top, CONF_TYPE_INT, CONF_RANGE, -1, 1, NULL}, @@ -341,10 +306,6 @@ #define mux_v (vf->priv->mux) #define lavc_venc_context (vf->priv->context) -#if LIBAVCODEC_BUILD < 4684 -#define FF_QP2LAMBDA 1 -#endif - static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts); static int config(struct vf_instance_s* vf, @@ -373,26 +334,13 @@ //mux_v->wf->nAvgBytesPerSec= lavc_venc_context->bit_rate/8; lavc_venc_context->bit_rate_tolerance= lavc_param_vrate_tolerance*1000; -#if LIBAVCODEC_BUILD >= 4754 lavc_venc_context->time_base= (AVRational){mux_v->h.dwScale, mux_v->h.dwRate}; -#else -#if LIBAVCODEC_BUILD >= 4662 - lavc_venc_context->frame_rate = mux_v->h.dwRate; - lavc_venc_context->frame_rate_base = mux_v->h.dwScale; -#else - lavc_venc_context->frame_rate = mux_v->h.dwRate*FRAME_RATE_BASE/mux_v->h.dwScale; -#endif -#endif lavc_venc_context->qmin= lavc_param_vqmin; lavc_venc_context->qmax= lavc_param_vqmax; -#if LIBAVCODEC_BUILD >= 4646 lavc_venc_context->mb_qmin= lavc_param_mb_qmin; lavc_venc_context->mb_qmax= lavc_param_mb_qmax; -#endif -#if LIBAVCODEC_BUILD >= 4684 lavc_venc_context->lmin= (int)(FF_QP2LAMBDA * lavc_param_lmin + 0.5); lavc_venc_context->lmax= (int)(FF_QP2LAMBDA * lavc_param_lmax + 0.5); -#endif lavc_venc_context->max_qdiff= lavc_param_vqdiff; lavc_venc_context->qcompress= lavc_param_vqcompress; lavc_venc_context->qblur= lavc_param_vqblur; @@ -425,49 +373,22 @@ lavc_param_rc_initial_buffer_occupancy; lavc_venc_context->rc_buffer_aggressivity= lavc_param_rc_buffer_aggressivity; lavc_venc_context->rc_initial_cplx= lavc_param_rc_initial_cplx; -#if LIBAVCODEC_BUILD >= 4642 lavc_venc_context->debug= lavc_param_debug; -#endif -#if LIBAVCODEC_BUILD >= 4649 lavc_venc_context->last_predictor_count= lavc_param_last_pred; -#endif -#if LIBAVCODEC_BUILD >= 4650 lavc_venc_context->pre_me= lavc_param_pre_me; -#endif -#if LIBAVCODEC_BUILD >= 4651 lavc_venc_context->me_pre_cmp= lavc_param_me_pre_cmp; lavc_venc_context->pre_dia_size= lavc_param_pre_dia_size; -#endif -#if LIBAVCODEC_BUILD >= 4652 lavc_venc_context->me_subpel_quality= lavc_param_me_subpel_quality; -#endif -#if LIBAVCODEC_BUILD >= 4659 lavc_venc_context->me_range= lavc_param_me_range; -#endif -#if LIBAVCODEC_BUILD >= 4663 lavc_venc_context->intra_quant_bias= lavc_param_ibias; lavc_venc_context->inter_quant_bias= lavc_param_pbias; -#endif -#if LIBAVCODEC_BUILD >= 4669 lavc_venc_context->coder_type= lavc_param_coder; lavc_venc_context->context_model= lavc_param_context; -#endif -#if LIBAVCODEC_BUILD >= 4680 lavc_venc_context->scenechange_threshold= lavc_param_sc_threshold; -#endif -#if LIBAVCODEC_BUILD >= 4690 lavc_venc_context->noise_reduction= lavc_param_noise_reduction; -#endif -#if LIBAVCODEC_BUILD >= 4700 lavc_venc_context->quantizer_noise_shaping= lavc_param_qns; -#endif -#if LIBAVCODEC_BUILD >= 4693 lavc_venc_context->inter_threshold= lavc_param_inter_threshold; -#endif -#if LIBAVCODEC_BUILD >= 4716 lavc_venc_context->nsse_weight= lavc_param_nssew; -#endif -#if LIBAVCODEC_BUILD >= 4675 if (lavc_param_intra_matrix) { char *tmp; @@ -508,7 +429,6 @@ else mp_msg(MSGT_MENCODER, MSGL_V, "Using user specified inter matrix\n"); } -#endif p= lavc_param_rc_override_string; for(i=0; p; i++){ @@ -545,9 +465,7 @@ lavc_venc_context->spatial_cplx_masking= lavc_param_spatial_cplx_masking; lavc_venc_context->p_masking= lavc_param_p_masking; lavc_venc_context->dark_masking= lavc_param_dark_masking; -#if LIBAVCODEC_BUILD >= 4741 lavc_venc_context->border_masking = lavc_param_border_masking; -#endif if (lavc_param_aspect != NULL) { @@ -563,14 +481,10 @@ } if (e && ratio > 0.1 && ratio < 10.0) { -#if LIBAVCODEC_BUILD >= 4687 lavc_venc_context->sample_aspect_ratio= av_d2q(ratio * height / width, 255); mp_dbg(MSGT_MENCODER, MSGL_DBG2, "sample_aspect_ratio: %d/%d\n", lavc_venc_context->sample_aspect_ratio.num, lavc_venc_context->sample_aspect_ratio.den); -#else - lavc_venc_context->aspect_ratio= ratio; -#endif mux_v->aspect = ratio; mp_dbg(MSGT_MENCODER, MSGL_DBG2, "aspect_ratio: %f\n", ratio); } else { @@ -579,11 +493,7 @@ } } else if (lavc_param_autoaspect) { -#if LIBAVCODEC_BUILD >= 4687 lavc_venc_context->sample_aspect_ratio = av_d2q((float)d_width/d_height*height / width, 255); -#else - lavc_venc_context->aspect_ratio = -#endif mux_v->aspect = (float)d_width/d_height; } @@ -597,14 +507,9 @@ if (lavc_param_mb_decision) { mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_MPCODECS_HighQualityEncodingSelected); -#if LIBAVCODEC_BUILD < 4673 - lavc_venc_context->flags = CODEC_FLAG_HQ; -#else lavc_venc_context->mb_decision= lavc_param_mb_decision; -#endif } -#if LIBAVCODEC_BUILD >= 4647 lavc_venc_context->me_cmp= lavc_param_me_cmp; lavc_venc_context->me_sub_cmp= lavc_param_me_sub_cmp; lavc_venc_context->mb_cmp= lavc_param_mb_cmp; @@ -613,10 +518,7 @@ #endif lavc_venc_context->dia_size= lavc_param_dia_size; lavc_venc_context->flags|= lavc_param_qpel; -#endif -#if LIBAVCODEC_BUILD >= 4648 lavc_venc_context->flags|= lavc_param_trell; -#endif lavc_venc_context->flags|= lavc_param_bit_exact; lavc_venc_context->flags|= lavc_param_aic; lavc_venc_context->flags|= lavc_param_aiv; @@ -638,12 +540,8 @@ if(lavc_param_normalize_aqp) lavc_venc_context->flags|= CODEC_FLAG_NORMALIZE_AQP; if(lavc_param_interlaced_dct) lavc_venc_context->flags|= CODEC_FLAG_INTERLACED_DCT; -#if LIBAVCODEC_BUILD >= 4643 lavc_venc_context->flags|= lavc_param_psnr; -#endif -#if LIBAVCODEC_BUILD >= 4711 lavc_venc_context->intra_dc_precision = lavc_param_dc_precision - 8; -#endif lavc_venc_context->prediction_method= lavc_param_prediction_method; lavc_venc_context->brd_scale = lavc_param_brd_scale; lavc_venc_context->bidir_refine = lavc_param_bidir_refine; @@ -751,16 +649,12 @@ { mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_MPCODECS_UsingConstantQscale, lavc_param_vqscale); lavc_venc_context->flags |= CODEC_FLAG_QSCALE; -#if LIBAVCODEC_BUILD >= 4668 lavc_venc_context->global_quality= -#endif vf->priv->pic->quality = (int)(FF_QP2LAMBDA * lavc_param_vqscale + 0.5); } - -#if LIBAVCODEC_BUILD >= 4716 + if(lavc_param_threads > 1) avcodec_thread_init(lavc_venc_context, lavc_param_threads); -#endif if (avcodec_open(lavc_venc_context, vf->priv->codec) != 0) { mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantOpenCodec); @@ -846,7 +740,6 @@ pic->linesize[1]=mpi->stride[1]; pic->linesize[2]=mpi->stride[2]; -#if LIBAVCODEC_BUILD >= 4697 if(lavc_param_interlaced_dct){ if((mpi->fields & MP_IMGFIELD_ORDERED) && (mpi->fields & MP_IMGFIELD_INTERLACED)) pic->top_field_first= !!(mpi->fields & MP_IMGFIELD_TOP_FIRST); @@ -856,7 +749,6 @@ if(lavc_param_top!=-1) pic->top_field_first= lavc_param_top; } -#endif return (encode_frame(vf, pic, pts) >= 0); } @@ -906,7 +798,6 @@ free(lavc_venc_context->coded_frame->opaque); lavc_venc_context->coded_frame->opaque= NULL; -#if LIBAVCODEC_BUILD >= 4643 /* store psnr / pict size / type / qscale */ if(lavc_param_psnr){ static FILE *fvstats=NULL; @@ -958,7 +849,6 @@ pict_type_char[lavc_venc_context->coded_frame->pict_type] ); } -#endif /* store stats if there are any */ if(lavc_venc_context->stats_out && stats_file) fprintf(stats_file, "%s", lavc_venc_context->stats_out); @@ -966,8 +856,7 @@ } static void uninit(struct vf_instance_s* vf){ - -#if LIBAVCODEC_BUILD >= 4643 + if(lavc_param_psnr){ double f= lavc_venc_context->width*lavc_venc_context->height*255.0*255.0; f*= lavc_venc_context->coded_frame->coded_picture_number; @@ -979,12 +868,9 @@ psnr((lavc_venc_context->error[0]+lavc_venc_context->error[1]+lavc_venc_context->error[2])/(f*1.5)) ); } -#endif -#if LIBAVCODEC_BUILD >= 4675 av_freep(&lavc_venc_context->intra_matrix); av_freep(&lavc_venc_context->inter_matrix); -#endif avcodec_close(lavc_venc_context); @@ -1110,11 +996,7 @@ return 0; } -#if LIBAVCODEC_BUILD >= 4645 vf->priv->pic = avcodec_alloc_frame(); -#else - vf->priv->pic = avcodec_alloc_picture(); -#endif vf->priv->context = avcodec_alloc_context(); return 1;
--- a/libmpcodecs/vf_lavc.c Thu Jul 13 22:56:02 2006 +0000 +++ b/libmpcodecs/vf_lavc.c Thu Jul 13 23:02:03 2006 +0000 @@ -19,23 +19,6 @@ #include "libavcodec/avcodec.h" #endif -#if LIBAVCODEC_BUILD < 4641 -#error we do not support libavcodec prior to build 4641, get the latest libavcodec CVS -#endif - -#if LIBAVCODEC_BUILD < 4645 -#warning your version of libavcodec is old, u might want to get a newer one -#endif - -#if LIBAVCODEC_BUILD < 4645 -#define AVFrame AVVideoFrame -#define coded_frame coded_picture -#endif - -#if LIBAVCODEC_BUILD < 4684 -#define FF_QP2LAMBDA 1 -#endif - extern int avcodec_inited; struct vf_priv_s { @@ -59,39 +42,17 @@ lavc_venc_context.width = width; lavc_venc_context.height = height; -#if LIBAVCODEC_BUILD >= 4754 if(!lavc_venc_context.time_base.num || !lavc_venc_context.time_base.den){ -#else - if(!lavc_venc_context.frame_rate){ -#endif // guess FPS: switch(height){ case 240: case 480: -#if LIBAVCODEC_BUILD >= 4754 lavc_venc_context.time_base= (AVRational){1001,30000}; -#else -#if LIBAVCODEC_BUILD >= 4662 - lavc_venc_context.frame_rate = 30000; - lavc_venc_context.frame_rate_base= 1001; -#else - lavc_venc_context.frame_rate=29.97*FRAME_RATE_BASE; // NTSC -#endif -#endif break; case 576: case 288: default: -#if LIBAVCODEC_BUILD >= 4754 lavc_venc_context.time_base= (AVRational){1,25}; -#else -#if LIBAVCODEC_BUILD >= 4662 - lavc_venc_context.frame_rate = 25; - lavc_venc_context.frame_rate_base= 1; -#else - lavc_venc_context.frame_rate=25*FRAME_RATE_BASE; // PAL -#endif -#endif break; // lavc_venc_context.frame_rate=vo_fps*FRAME_RATE_BASE; // same as src } @@ -181,11 +142,7 @@ } vf->priv->context=avcodec_alloc_context(); -#if LIBAVCODEC_BUILD >= 4645 vf->priv->pic = avcodec_alloc_frame(); -#else - vf->priv->pic = avcodec_alloc_picture(); -#endif // TODO: parse args -> if(args) sscanf(args, "%d:%f", &p_quality, &p_fps); @@ -193,25 +150,14 @@ if(p_quality<32){ // fixed qscale lavc_venc_context.flags = CODEC_FLAG_QSCALE; -#if LIBAVCODEC_BUILD >= 4668 lavc_venc_context.global_quality = -#endif vf->priv->pic->quality = (int)(FF_QP2LAMBDA * ((p_quality<1) ? 1 : p_quality) + 0.5); } else { // fixed bitrate (in kbits) lavc_venc_context.bit_rate = 1000*p_quality; } -#if LIBAVCODEC_BUILD >= 4754 lavc_venc_context.time_base.num = 1000*1001; lavc_venc_context.time_base.den = (p_fps<1.0) ? 1000*1001*25 : (p_fps * lavc_venc_context.time_base.num); -#else -#if LIBAVCODEC_BUILD >= 4662 - lavc_venc_context.frame_rate_base = 1000*1001; - lavc_venc_context.frame_rate = (p_fps<1.0) ? 0 : (p_fps * lavc_venc_context.frame_rate_base); -#else - lavc_venc_context.frame_rate = (p_fps<1.0) ? 0 : (p_fps * FRAME_RATE_BASE); -#endif -#endif lavc_venc_context.gop_size = 0; // I-only lavc_venc_context.pix_fmt= PIX_FMT_YUV420P;
--- a/libmpdemux/demux_lavf.c Thu Jul 13 22:56:02 2006 +0000 +++ b/libmpdemux/demux_lavf.c Thu Jul 13 23:02:03 2006 +0000 @@ -178,12 +178,8 @@ for(i=0; i<avfc->nb_streams; i++){ AVStream *st= avfc->streams[i]; -#if LIBAVFORMAT_BUILD >= 4629 AVCodecContext *codec= st->codec; -#else - AVCodecContext *codec= &st->codec; -#endif - + switch(codec->codec_type){ case CODEC_TYPE_AUDIO:{ WAVEFORMATEX *wf= calloc(sizeof(WAVEFORMATEX) + codec->extradata_size, 1); @@ -276,13 +272,8 @@ sh_video->video.dwRate= st->time_base.den; sh_video->video.dwScale= st->time_base.num; } else { -#if LIBAVFORMAT_BUILD >= 4624 sh_video->video.dwRate= codec->time_base.den; sh_video->video.dwScale= codec->time_base.num; -#else - sh_video->video.dwRate= codec->frame_rate; - sh_video->video.dwScale= codec->frame_rate_base; -#endif } sh_video->fps=av_q2d(st->r_frame_rate); sh_video->frametime=1/av_q2d(st->r_frame_rate); @@ -380,13 +371,8 @@ } if(pkt.pts != AV_NOPTS_VALUE){ -#if LIBAVFORMAT_BUILD >= 4624 dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base); priv->last_pts= dp->pts * AV_TIME_BASE; -#else - priv->last_pts= pkt.pts; - dp->pts=pkt.pts / (float)AV_TIME_BASE; -#endif } dp->pos=demux->filepos; dp->flags= !!(pkt.flags&PKT_FLAG_KEY); @@ -398,12 +384,8 @@ static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags){ lavf_priv_t *priv = demuxer->priv; mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_seek_lavf(%p, %f, %f, %d)\n", demuxer, rel_seek_secs, audio_delay, flags); - -#if LIBAVFORMAT_BUILD < 4619 - av_seek_frame(priv->avfc, -1, priv->last_pts + rel_seek_secs*AV_TIME_BASE); -#else + av_seek_frame(priv->avfc, -1, priv->last_pts + rel_seek_secs*AV_TIME_BASE, rel_seek_secs < 0 ? AVSEEK_FLAG_BACKWARD : 0); -#endif } static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
--- a/libmpdemux/muxer_lavf.c Thu Jul 13 22:56:02 2006 +0000 +++ b/libmpdemux/muxer_lavf.c Thu Jul 13 23:02:03 2006 +0000 @@ -158,11 +158,7 @@ } spriv->avstream->stream_copy = 1; -#if LIBAVFORMAT_BUILD >= 4629 ctx = spriv->avstream->codec; -#else - ctx = &(spriv->avstream->codec); -#endif ctx->codec_id = muxer->avih.dwStreams; switch(type) { @@ -187,12 +183,8 @@ muxer_stream_priv_t *spriv = (muxer_stream_priv_t *) stream->priv; AVCodecContext *ctx; -#if LIBAVFORMAT_BUILD >= 4629 ctx = spriv->avstream->codec; -#else - ctx = &(spriv->avstream->codec); -#endif - + if(stream->wf && stream->wf->nAvgBytesPerSec) ctx->bit_rate = stream->wf->nAvgBytesPerSec * 8; ctx->rc_buffer_size= stream->vbv_size; @@ -236,13 +228,8 @@ ctx->width = stream->bih->biWidth; ctx->height = stream->bih->biHeight; ctx->bit_rate = 800000; -#if (LIBAVFORMAT_BUILD >= 4624) ctx->time_base.den = stream->h.dwRate; ctx->time_base.num = stream->h.dwScale; -#else - ctx->frame_rate = stream->h.dwRate; - ctx->frame_rate_base = stream->h.dwScale; -#endif if(stream->bih+1 && (stream->bih->biSize > sizeof(BITMAPINFOHEADER))) { ctx->extradata = av_malloc(stream->bih->biSize - sizeof(BITMAPINFOHEADER)); @@ -279,11 +266,7 @@ //pkt.pts = AV_NOPTS_VALUE; -#if LIBAVFORMAT_BUILD >= 4624 pkt.pts = (stream->timer / av_q2d(priv->oc->streams[pkt.stream_index]->time_base) + 0.5); -#else - pkt.pts = AV_TIME_BASE * stream->timer; -#endif //fprintf(stderr, "%Ld %Ld id:%d tb:%f %f\n", pkt.dts, pkt.pts, pkt.stream_index, av_q2d(priv->oc->streams[pkt.stream_index]->time_base), stream->timer); if(av_interleaved_write_frame(priv->oc, &pkt) != 0) //av_write_frame(priv->oc, &pkt)