[MPlayer-cvslog] r34747 - trunk/libmpcodecs/vf_screenshot.c

al subversion at mplayerhq.hu
Sun Feb 19 23:09:30 CET 2012


Author: al
Date: Sun Feb 19 23:09:30 2012
New Revision: 34747

Log:
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.

Modified:
   trunk/libmpcodecs/vf_screenshot.c

Modified: trunk/libmpcodecs/vf_screenshot.c
==============================================================================
--- trunk/libmpcodecs/vf_screenshot.c	Sun Feb 19 21:33:32 2012	(r34746)
+++ trunk/libmpcodecs/vf_screenshot.c	Sun Feb 19 23:09:30 2012	(r34747)
@@ -69,7 +69,6 @@ static int config(struct vf_instance *vf
     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 @@ static int vf_open(vf_instance_t *vf, ch
     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");


More information about the MPlayer-cvslog mailing list