[vlc-devel] [PATCH 2/3] d3d11_deinterlace: always fill the output picture->context
Steve Lhomme
robux4 at videolabs.io
Thu Jul 20 11:04:27 CEST 2017
It is necessary for snapshots which create a picture from scratch and then copy
"pixels" using the planes or the context callback.
Fixes #18533
---
modules/video_output/win32/d3d11_deinterlace.c | 41 ++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/modules/video_output/win32/d3d11_deinterlace.c b/modules/video_output/win32/d3d11_deinterlace.c
index 6be55c600f..2557213cb3 100644
--- a/modules/video_output/win32/d3d11_deinterlace.c
+++ b/modules/video_output/win32/d3d11_deinterlace.c
@@ -230,6 +230,46 @@ static const struct filter_mode_t *GetFilterMode(const char *mode)
return NULL;
}
+static void d3d11_pic_context_destroy(struct picture_context_t *opaque)
+{
+ struct va_pic_context *pic_ctx = (struct va_pic_context*)opaque;
+ ReleasePictureSys(&pic_ctx->picsys);
+ free(pic_ctx);
+}
+
+static struct picture_context_t *d3d11_pic_context_copy(struct picture_context_t *ctx)
+{
+ struct va_pic_context *src_ctx = (struct va_pic_context*)ctx;
+ struct va_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx));
+ if (unlikely(pic_ctx==NULL))
+ return NULL;
+ pic_ctx->s.destroy = d3d11_pic_context_destroy;
+ pic_ctx->s.copy = d3d11_pic_context_copy;
+ pic_ctx->picsys = src_ctx->picsys;
+ AcquirePictureSys(&pic_ctx->picsys);
+ return &pic_ctx->s;
+}
+
+static picture_t *NewOutputPicture( filter_t *p_filter )
+{
+ picture_t *pic = filter_NewPicture( p_filter );
+ if ( !pic->context )
+ {
+ /* the picture might be duplicated for snapshots so it needs a context */
+ assert( pic->p_sys != NULL ); /* this opaque picture is wrong */
+ struct va_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx));
+ if (likely(pic_ctx!=NULL))
+ {
+ pic_ctx->s.destroy = d3d11_pic_context_destroy;
+ pic_ctx->s.copy = d3d11_pic_context_copy;
+ pic_ctx->picsys = *pic->p_sys;
+ AcquirePictureSys( &pic_ctx->picsys );
+ pic->context = &pic_ctx->s;
+ }
+ }
+ return pic;
+}
+
static int Open(vlc_object_t *obj)
{
filter_t *filter = (filter_t *)obj;
@@ -426,6 +466,7 @@ static int Open(vlc_object_t *obj)
sys->context.pf_render_ordered = RenderPic;
else
sys->context.pf_render_single_pic = RenderSinglePic;
+ sys->context.pf_new_output_picture = NewOutputPicture;
video_format_t out_fmt;
GetDeinterlacingOutput( &sys->context, &out_fmt, &filter->fmt_in.video );
--
2.12.1
More information about the vlc-devel
mailing list