d3d9: set the video context in the picture context
authorSteve Lhomme <robux4@ycbcr.xyz>
Wed, 13 Nov 2019 15:32:08 +0000 (16:32 +0100)
committerSteve Lhomme <robux4@ycbcr.xyz>
Mon, 2 Dec 2019 12:42:13 +0000 (13:42 +0100)
modules/codec/avcodec/dxva2.c
modules/hw/d3d9/dxa9.c
modules/hw/d3d9/dxva2_deinterlace.c
modules/video_chroma/d3d9_fmt.c

index a3c708e..3ef809c 100644 (file)
@@ -175,19 +175,20 @@ static picture_context_t *dxva2_pic_context_copy(picture_context_t *ctx)
     if (unlikely(pic_ctx==NULL))
         return NULL;
     *pic_ctx = *src_ctx;
+    vlc_video_context_Hold(pic_ctx->ctx.s.vctx);
     va_surface_AddRef(pic_ctx->va_surface);
     AcquireD3D9PictureSys(&pic_ctx->ctx.picsys);
     return &pic_ctx->ctx.s;
 }
 
-static struct dxva2_pic_context *CreatePicContext(IDirect3DSurface9 *surface)
+static struct dxva2_pic_context *CreatePicContext(IDirect3DSurface9 *surface, vlc_video_context *vctx)
 {
     struct dxva2_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx));
     if (unlikely(pic_ctx==NULL))
         return NULL;
     pic_ctx->ctx.s = (picture_context_t) {
         dxva2_pic_context_destroy, dxva2_pic_context_copy,
-        NULL /*TODO*/
+        vlc_video_context_Hold(vctx),
     };
     pic_ctx->ctx.picsys.surface = surface;
     AcquireD3D9PictureSys(&pic_ctx->ctx.picsys);
@@ -197,7 +198,7 @@ static struct dxva2_pic_context *CreatePicContext(IDirect3DSurface9 *surface)
 static picture_context_t* NewSurfacePicContext(vlc_va_t *va, vlc_va_surface_t *va_surface)
 {
     vlc_va_sys_t *sys = va->sys;
-    struct dxva2_pic_context *pic_ctx = CreatePicContext(sys->hw_surface[va_surface_GetIndex(va_surface)]);
+    struct dxva2_pic_context *pic_ctx = CreatePicContext(sys->hw_surface[va_surface_GetIndex(va_surface)], sys->vctx);
     if (unlikely(pic_ctx==NULL))
         return NULL;
     pic_ctx->va_surface = va_surface;
index 4b11ba7..64021a9 100644 (file)
@@ -272,7 +272,7 @@ static void YV12_D3D9(filter_t *p_filter, picture_t *src, picture_t *dst)
         {
             pic_ctx->s = (picture_context_t) {
                 d3d9_pic_context_destroy, d3d9_pic_context_copy,
-                NULL /*TODO*/
+                vlc_video_context_Hold(p_filter->vctx_out),
             };
             pic_ctx->picsys = *p_sys;
             AcquireD3D9PictureSys(&pic_ctx->picsys);
index 48b59a2..164a4bd 100644 (file)
@@ -326,7 +326,7 @@ picture_t *AllocPicture( filter_t *p_filter )
         {
             pic_ctx->s = (picture_context_t) {
                 d3d9_pic_context_destroy, d3d9_pic_context_copy,
-                NULL /*TODO*/
+                vlc_video_context_Hold(p_filter->vctx_in),
             };
             pic_ctx->picsys = *pic_sys;
             AcquireD3D9PictureSys( &pic_ctx->picsys );
index 6cead89..945ca49 100644 (file)
@@ -303,6 +303,7 @@ picture_context_t *d3d9_pic_context_copy(picture_context_t *ctx)
     if (unlikely(pic_ctx==NULL))
         return NULL;
     *pic_ctx = *D3D9_PICCONTEXT_FROM_PICCTX(ctx);
+    vlc_video_context_Hold(pic_ctx->s.vctx);
     AcquireD3D9PictureSys(&pic_ctx->picsys);
     return &pic_ctx->s;
 }