changeset 34659:c7db9db9105c

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.
author al
date Sun, 19 Feb 2012 22:09:30 +0000
parents 4b4f769fe687
children ae0f39283934
files libmpcodecs/vf_screenshot.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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");