[vlc-commits] vdpau: check the input video context of filters matches the VDPAU chromas

Steve Lhomme git at videolan.org
Mon Dec 2 15:23:12 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov  8 09:10:20 2019 +0100| [ff775d07b9ba476572b7711d6b533d4ce5af83af] | committer: Steve Lhomme

vdpau: check the input video context of filters matches the VDPAU chromas

And set the output video context.

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

 modules/hw/vdpau/adjust.c      | 3 +++
 modules/hw/vdpau/deinterlace.c | 5 +++++
 modules/hw/vdpau/sharpen.c     | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/modules/hw/vdpau/adjust.c b/modules/hw/vdpau/adjust.c
index 5db0379c28..abba194695 100644
--- a/modules/hw/vdpau/adjust.c
+++ b/modules/hw/vdpau/adjust.c
@@ -129,6 +129,9 @@ static int Open(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
 
+    if ( filter->vctx_in == NULL ||
+         vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_VDPAU )
+        return VLC_EGENERIC;
     if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_420
      && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_422
      && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_444)
diff --git a/modules/hw/vdpau/deinterlace.c b/modules/hw/vdpau/deinterlace.c
index 619c75346c..0302c640e5 100644
--- a/modules/hw/vdpau/deinterlace.c
+++ b/modules/hw/vdpau/deinterlace.c
@@ -100,6 +100,9 @@ static int Open(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
 
+    if ( filter->vctx_in == NULL ||
+         vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_VDPAU )
+        return VLC_EGENERIC;
     if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_420
      && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_422
      && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_444)
@@ -119,6 +122,7 @@ static int Open(vlc_object_t *obj)
     filter->pf_video_filter = Deinterlace;
     filter->p_sys = sys;
     filter->fmt_out.video.i_frame_rate *= 2;
+    filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
     return VLC_SUCCESS;
 }
 
@@ -127,6 +131,7 @@ static void Close(vlc_object_t *obj)
     filter_t *filter = (filter_t *)obj;
     filter_sys_t *sys = filter->p_sys;
 
+    vlc_video_context_Release(filter->vctx_out);
     free(sys);
 }
 
diff --git a/modules/hw/vdpau/sharpen.c b/modules/hw/vdpau/sharpen.c
index f001c04718..4aee7e3c40 100644
--- a/modules/hw/vdpau/sharpen.c
+++ b/modules/hw/vdpau/sharpen.c
@@ -83,6 +83,9 @@ static int Open(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
 
+    if ( filter->vctx_in == NULL ||
+         vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_VDPAU )
+        return VLC_EGENERIC;
     if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_420
      && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_422
      && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_444)



More information about the vlc-commits mailing list