[MPlayer-cvslog] r37316 - trunk/libmpcodecs/vd_ffmpeg.c

reimar subversion at mplayerhq.hu
Sat Nov 1 13:10:00 CET 2014


Author: reimar
Date: Sat Nov  1 13:10:00 2014
New Revision: 37316

Log:
vd_ffmpeg: Initialize hwaccel_context earlier to avoid FFmpeg warnings.

Modified:
   trunk/libmpcodecs/vd_ffmpeg.c

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Wed Oct 29 03:37:46 2014	(r37315)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sat Nov  1 13:10:00 2014	(r37316)
@@ -292,6 +292,14 @@ static void set_format_params(struct AVC
         return;
     ctx->use_hwaccel = fmt == AV_PIX_FMT_VDPAU;
     imgfmt = pixfmt2imgfmt2(fmt, avctx->codec_id);
+    if (!ctx->use_hwaccel) {
+        av_freep(&avctx->hwaccel_context);
+    } else {
+        AVVDPAUContext *vdpc = avctx->hwaccel_context;
+        if (!vdpc)
+            avctx->hwaccel_context = vdpc = av_alloc_vdpaucontext();
+        vdpc->render2 = vdpau_render_wrapper;
+    }
     if (IMGFMT_IS_HWACCEL(imgfmt)) {
         ctx->do_dr1    = 1;
         ctx->nonref_dr = 0;
@@ -741,12 +749,7 @@ static int get_buffer(AVCodecContext *av
 #if CONFIG_VDPAU
     if (ctx->use_hwaccel) {
         struct vdpau_render_state *render = mpi->priv;
-        AVVDPAUContext *vdpc;
         avctx->draw_horiz_band= NULL;
-        if (!avctx->hwaccel_context)
-            avctx->hwaccel_context = av_alloc_vdpaucontext();
-        vdpc = avctx->hwaccel_context;
-        vdpc->render2 = vdpau_render_wrapper;
         mpi->planes[3] = render->surface;
     }
 #endif


More information about the MPlayer-cvslog mailing list