# HG changeset patch # User al # Date 1329689370 0 # Node ID c7db9db9105cc00589f99fc24c5056affb08873b # Parent 4b4f769fe68722c4ba15ba35cba3c7c0081b5704 vf screenshot: Fix breakage after lavc API changes The avcodec_open2() function wants a valid avctx->pix_fmt to be set in the AVCodecContext prior to its invocation. Thanks to Ivan for working this out for vo png already. diff -r 4b4f769fe687 -r c7db9db9105c libmpcodecs/vf_screenshot.c --- a/libmpcodecs/vf_screenshot.c Sun Feb 19 20:33:32 2012 +0000 +++ b/libmpcodecs/vf_screenshot.c Sun Feb 19 22:09:30 2012 +0000 @@ -69,7 +69,6 @@ vf->priv->outbuffer = realloc(vf->priv->outbuffer, vf->priv->outbuffer_size); vf->priv->avctx->width = d_width; vf->priv->avctx->height = d_height; - vf->priv->avctx->pix_fmt = PIX_FMT_RGB24; vf->priv->avctx->compression_level = 0; vf->priv->dw = d_width; vf->priv->dh = d_height; @@ -301,6 +300,7 @@ vf->priv->outbuffer=0; vf->priv->ctx=0; vf->priv->avctx = avcodec_alloc_context3(NULL); + vf->priv->avctx->pix_fmt = PIX_FMT_RGB24; avcodec_register_all(); if (avcodec_open2(vf->priv->avctx, avcodec_find_encoder(CODEC_ID_PNG), NULL)) { mp_msg(MSGT_VFILTER, MSGL_FATAL, "Could not open libavcodec PNG encoder\n");