[vlc-commits] vdpau/sharpen: use the input video context to check if sharpen is supported

Steve Lhomme git at videolan.org
Mon Dec 2 13:43:18 CET 2019


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

vdpau/sharpen: use the input video context to check if sharpen is supported

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

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

diff --git a/modules/hw/vdpau/sharpen.c b/modules/hw/vdpau/sharpen.c
index 5e93fc7568..f001c04718 100644
--- a/modules/hw/vdpau/sharpen.c
+++ b/modules/hw/vdpau/sharpen.c
@@ -90,21 +90,26 @@ static int Open(vlc_object_t *obj)
     if (!video_format_IsSimilar(&filter->fmt_in.video, &filter->fmt_out.video))
         return VLC_EGENERIC;
 
+    vlc_decoder_device *dec_dev = vlc_video_context_HoldDevice(filter->vctx_in);
+    assert(dec_dev != NULL);
+
+    vdpau_decoder_device_t *vdpau_decoder = GetVDPAUOpaqueDevice(dec_dev);
+    if (vdpau_decoder == NULL)
+    {
+        vlc_decoder_device_Release(dec_dev);
+        return VLC_EBADVAR;
+    }
+
     /* Check for sharpen support */
-    vdp_t *vdp;
-    VdpDevice device;
     VdpStatus err;
     VdpBool ok;
 
-    err = vdp_get_x11(NULL, -1, &vdp, &device);
-    if (err != VDP_STATUS_OK)
-        return VLC_EGENERIC; /* Weird. The decoder should be active... */
-
-    err = vdp_video_mixer_query_feature_support(vdp, device,
+    err = vdp_video_mixer_query_feature_support(vdpau_decoder->vdp,
+                                                vdpau_decoder->device,
                                        VDP_VIDEO_MIXER_FEATURE_SHARPNESS, &ok);
+    vlc_decoder_device_Release(dec_dev);
     if (err != VDP_STATUS_OK)
         ok = VDP_FALSE;
-    vdp_release_x11(vdp);
 
     if (ok != VDP_TRUE)
     {



More information about the vlc-commits mailing list