[vlc-commits] avcodec: vdpau: use the decoder device to get the vdp_t*

Steve Lhomme git at videolan.org
Fri Oct 18 09:47:12 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jun 19 11:41:59 2019 +0200| [7a3700608b36d7fde971857f595e361a66f8b043] | committer: Steve Lhomme

avcodec: vdpau: use the decoder device to get the vdp_t*

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a3700608b36d7fde971857f595e361a66f8b043
---

 modules/hw/vdpau/avcodec.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 3c8317ca12..23c8b14bbd 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -35,6 +35,7 @@
 #include <vlc_plugin.h>
 #include <vlc_fourcc.h>
 #include <vlc_picture.h>
+#include <vlc_codec.h>
 #include <vlc_xlib.h>
 #include "vlc_vdpau.h"
 #include "../../codec/avcodec/va.h"
@@ -136,7 +137,8 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, const AVPixFmtDescriptor *d
                 enum PixelFormat pix_fmt,
                 const es_format_t *fmt, void *p_sys, vlc_decoder_device *dec_device)
 {
-    if (pix_fmt != AV_PIX_FMT_VDPAU)
+    if (pix_fmt != AV_PIX_FMT_VDPAU|| dec_device == NULL ||
+        dec_device->type != VLC_DECODER_DEVICE_VDPAU)
         return VLC_EGENERIC;
 
     (void) fmt;
@@ -177,13 +179,8 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, const AVPixFmtDescriptor *d
     sys->width = width;
     sys->height = height;
     sys->hwaccel_context = NULL;
-
-    err = vdp_get_x11(NULL, -1, &sys->vdp, &sys->device);
-    if (err != VDP_STATUS_OK)
-    {
-        free(sys);
-        return VLC_EGENERIC;
-    }
+    sys->vdp = dec_device->opaque;
+    vdp_hold_x11(sys->vdp, &sys->device);
 
     unsigned flags = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH;
 



More information about the vlc-commits mailing list