[vlc-devel] [PATCH 01/11] decoder: use an object to create the decoder device
Steve Lhomme
robux4 at ycbcr.xyz
Mon Nov 4 13:05:20 CET 2019
Allowing the window to be NULL, which is OK for D3D11/D3D9/NVDEC.
---
include/vlc_codec.h | 6 ++++--
src/input/decoder_helpers.c | 7 ++++---
src/video_output/video_output.c | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 6649ef94cc2..c0394522aae 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -604,8 +604,10 @@ typedef int (*vlc_decoder_device_Open)(vlc_decoder_device *device,
* This function will be hidden in the future. It is now used by opengl vout
* module as a transition.
*/
-VLC_USED vlc_decoder_device *
-vlc_decoder_device_Create(vout_window_t *window);
+vlc_decoder_device *
+vlc_decoder_device_Create(vlc_object_t *, vout_window_t *window) VLC_USED;
+#define vlc_decoder_device_Create(a, b) \
+ vlc_decoder_device_Create(VLC_OBJECT(a), (b))
/**
* Hold a decoder device
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 3d8a06985db..a34d32f8185 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -181,14 +181,15 @@ static int decoder_device_Open(void *func, bool forced, va_list ap)
return open(device, window);
}
+#undef vlc_decoder_device_Create
vlc_decoder_device *
-vlc_decoder_device_Create(vout_window_t *window)
+vlc_decoder_device_Create(vlc_object_t *o, vout_window_t *window)
{
struct vlc_decoder_device_priv *priv =
- vlc_object_create(window, sizeof (*priv));
+ vlc_object_create(o, sizeof (*priv));
if (!priv)
return NULL;
- char *name = var_InheritString(window, "dec-dev");
+ char *name = var_InheritString(o, "dec-dev");
module_t *module = vlc_module_load(&priv->device, "decoder device", name,
true, decoder_device_Open, &priv->device,
window);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 8aa527120c0..66ab3e22b3e 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1990,7 +1990,7 @@ static int vout_EnableWindow(vout_thread_t *vout, const video_format_t *original
if (pp_dec_device)
{
if (sys->dec_device == NULL)
- sys->dec_device = vlc_decoder_device_Create(sys->display_cfg.window);
+ sys->dec_device = vlc_decoder_device_Create(vout, sys->display_cfg.window);
*pp_dec_device = sys->dec_device ? vlc_decoder_device_Hold( sys->dec_device ) : NULL;
}
vlc_mutex_unlock(&sys->window_lock);
--
2.17.1
More information about the vlc-devel
mailing list