[vlc-devel] [PATCH 35/39] vdpau: create a dummy video context

Steve Lhomme robux4 at ycbcr.xyz
Wed Oct 2 16:30:08 CEST 2019


---
 modules/hw/vdpau/avcodec.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 534dce12909..5d2130d3341 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -47,6 +47,7 @@ struct vlc_va_sys_t
     void *hwaccel_context;
     uint32_t width;
     uint32_t height;
+    vlc_video_context *vctx;
     vlc_vdp_video_field_t *pool[];
 };
 
@@ -125,6 +126,7 @@ static void Close(vlc_va_t *va)
     for (unsigned i = 0; sys->pool[i] != NULL; i++)
         vlc_vdp_video_destroy(sys->pool[i]);
     vdp_release_x11(sys->vdp);
+    vlc_video_context_Release(sys->vctx);
     if (sys->hwaccel_context)
         av_free(sys->hwaccel_context);
     free(sys);
@@ -213,6 +215,10 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
         goto error;
     }
 
+    sys->vctx = vlc_video_context_Create( dec_device, VLC_VIDEO_CONTEXT_VDPAU, 0, NULL );
+    if (sys->vctx == NULL)
+        goto error;
+
     if (i < refs)
         msg_Warn(va, "video RAM low (allocated %u of %u buffers)",
                  i, refs);
@@ -221,6 +227,7 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
     if (vdp_get_information_string(sys->vdp, &infos) == VDP_STATUS_OK)
         msg_Info(va, "Using %s", infos);
 
+    *vtcx_out = sys->vctx;
     va->ops = &ops;
     return VLC_SUCCESS;
 
-- 
2.17.1



More information about the vlc-devel mailing list