changeset 36353:46bc86e725af

Add hack/workaround for FFmpeg offering pixfmts not valid for the selected codec. Fixes crashes with -vc ffmpeg12vdpau.
author reimar
date Mon, 16 Sep 2013 18:35:46 +0000
parents d637c5e698f0
children c728ba2a3f70
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Mon Sep 16 01:46:25 2013 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Mon Sep 16 18:35:46 2013 +0000
@@ -1081,6 +1081,10 @@
     int i;
 
     for(i=0;fmt[i]!=PIX_FMT_NONE;i++){
+        // it is incorrect of FFmpeg to even offer these, filter them out
+        if(!(avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) &&
+           (fmt[i] == AV_PIX_FMT_VDPAU_MPEG1 || fmt[i] == AV_PIX_FMT_VDPAU_MPEG2))
+            continue;
         imgfmt = pixfmt2imgfmt2(fmt[i], avctx->codec_id);
         if(!IMGFMT_IS_HWACCEL(imgfmt)) continue;
         mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i);