Index: libmpcodecs/ve_lavc.c =================================================================== --- libmpcodecs/ve_lavc.c (revision 23306) +++ libmpcodecs/ve_lavc.c (working copy) @@ -36,6 +36,16 @@ #include "libavcodec/avcodec.h" #endif +#ifdef USE_LIBAVFORMAT +#ifdef USE_LIBAVFORMAT_SO +#include +#else +#include "libavformat/avformat.h" +#endif +extern const struct AVCodecTag *mp_bmp_taglists[]; +#endif + + extern int avcodec_inited; /* video options */ @@ -955,9 +965,24 @@ return 0; } - if (!strcasecmp(lavc_param_vcodec, "mpeg1") || !strcasecmp(lavc_param_vcodec, "mpeg1video")) + if (!avcodec_inited){ + avcodec_init(); + avcodec_register_all(); + avcodec_inited=1; + } + + vf->priv->codec = (AVCodec *)avcodec_find_encoder_by_name(lavc_param_vcodec); + if (!vf->priv->codec) { + mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_MissingLAVCcodec, lavc_param_vcodec); + return 0; + } + +#ifdef USE_LIBAVFORMAT + mux_v->bih->biCompression = av_codec_get_tag(mp_bmp_taglists, vf->priv->codec->id); +#else + if (!strcasecmp(lavc_param_vcodec, "mpeg1video")) mux_v->bih->biCompression = mmioFOURCC('m', 'p', 'g', '1'); - else if (!strcasecmp(lavc_param_vcodec, "mpeg2") || !strcasecmp(lavc_param_vcodec, "mpeg2video")) + else if (!strcasecmp(lavc_param_vcodec, "mpeg2video")) mux_v->bih->biCompression = mmioFOURCC('m', 'p', 'g', '2'); else if (!strcasecmp(lavc_param_vcodec, "h263") || !strcasecmp(lavc_param_vcodec, "h263p")) mux_v->bih->biCompression = mmioFOURCC('h', '2', '6', '3'); @@ -996,19 +1021,8 @@ else mux_v->bih->biCompression = mmioFOURCC(lavc_param_vcodec[0], lavc_param_vcodec[1], lavc_param_vcodec[2], lavc_param_vcodec[3]); /* FIXME!!! */ +#endif /* ifdef USE_LIBAVFORMAT */ - if (!avcodec_inited){ - avcodec_init(); - avcodec_register_all(); - avcodec_inited=1; - } - - vf->priv->codec = (AVCodec *)avcodec_find_encoder_by_name(lavc_param_vcodec); - if (!vf->priv->codec) { - mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_MissingLAVCcodec, lavc_param_vcodec); - return 0; - } - vf->priv->pic = avcodec_alloc_frame(); vf->priv->context = avcodec_alloc_context();