[vlc-devel] [PATCH] decoder device: remove VLC_DECODER_DEVICE_NONE

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 25 08:35:18 CEST 2019


A decoder device should always be associated with a "device" or adapter. If
there is none it can be NULL, there's no need for a dummy one.

Setting values on a module that failed to load and won't be used is misleading.
---
 include/vlc_codec.h         |  1 -
 src/input/decoder_helpers.c | 19 ++-----------------
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 36d48a6204d..6649ef94cc2 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -534,7 +534,6 @@ static inline float decoder_GetDisplayRate( decoder_t *dec )
 /** Decoder device type */
 enum vlc_decoder_device_type
 {
-    VLC_DECODER_DEVICE_NONE,
     VLC_DECODER_DEVICE_VAAPI,
     VLC_DECODER_DEVICE_VDPAU,
     VLC_DECODER_DEVICE_DXVA2,
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index ed13fc98785..f3784e6dfbb 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -114,26 +114,11 @@ struct vlc_decoder_device_priv
 
 static int decoder_device_Open(void *func, bool forced, va_list ap)
 {
+    VLC_UNUSED(forced);
     vlc_decoder_device_Open open = func;
     vlc_decoder_device *device = va_arg(ap, vlc_decoder_device *);
     vout_window_t *window = va_arg(ap, vout_window_t *);
-    int ret = open(device, window);
-    if (ret != VLC_SUCCESS)
-    {
-        struct vlc_decoder_device_priv *priv =
-            container_of(device, struct vlc_decoder_device_priv, device);
-
-        vlc_objres_clear(VLC_OBJECT(&priv->device));
-        device->sys = NULL;
-        device->type = VLC_DECODER_DEVICE_NONE;
-        device->opaque = NULL;
-    }
-    else
-    {
-        assert(device->type != VLC_DECODER_DEVICE_NONE);
-    }
-    (void) forced;
-    return ret;
+    return open(device, window);
 }
 
 vlc_decoder_device *
-- 
2.17.1



More information about the vlc-devel mailing list