[vlc-devel] [PATCH 1/4] core: dec-dev: add a way to force a module name
Thomas Guillem
thomas at gllm.fr
Thu Jan 16 17:41:34 CET 2020
---
include/vlc_codec.h | 3 ++-
modules/stream_out/mosaic_bridge.c | 2 +-
modules/stream_out/sdi/SDIStream.cpp | 2 +-
modules/stream_out/transcode/video.c | 4 ++--
src/input/decoder_helpers.c | 9 ++++++---
src/video_output/video_output.c | 2 +-
6 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index ae647eab2e1..28b0703afa2 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -628,7 +628,8 @@ typedef int (*vlc_decoder_device_Open)(vlc_decoder_device *device,
* module as a transition.
*/
VLC_API vlc_decoder_device *
-vlc_decoder_device_Create(vlc_object_t *, vout_window_t *window) VLC_USED;
+vlc_decoder_device_Create(vlc_object_t *, const char *name,
+ vout_window_t *window) VLC_USED;
/**
* Hold a decoder device
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 63846634e3e..fe57c41d63d 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -256,7 +256,7 @@ static vlc_decoder_device * MosaicHoldDecoderDevice( struct decoder_owner *p_own
{
if ( p_owner->dec_dev == NULL )
{
- p_owner->dec_dev = vlc_decoder_device_Create(&p_owner->dec.obj, NULL);
+ p_owner->dec_dev = vlc_decoder_device_Create(&p_owner->dec.obj, NULL, NULL);
}
return p_owner->dec_dev ? vlc_decoder_device_Hold(p_owner->dec_dev) : NULL;
}
diff --git a/modules/stream_out/sdi/SDIStream.cpp b/modules/stream_out/sdi/SDIStream.cpp
index 6bf0b249a1d..94ecc430d4d 100644
--- a/modules/stream_out/sdi/SDIStream.cpp
+++ b/modules/stream_out/sdi/SDIStream.cpp
@@ -490,7 +490,7 @@ vlc_decoder_device * VideoDecodedStream::VideoDecCallback_get_device(decoder_t *
p_owner = container_of(p_dec, struct decoder_owner, dec);
if (p_owner->dec_dev == NULL)
{
- p_owner->dec_dev = vlc_decoder_device_Create(&p_dec->obj, NULL);
+ p_owner->dec_dev = vlc_decoder_device_Create(&p_dec->obj, NULL, NULL);
}
return p_owner->dec_dev ? vlc_decoder_device_Hold(p_owner->dec_dev) : NULL;
}
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 8453fb70f04..2851990b4d5 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -69,7 +69,7 @@ struct encoder_owner
static vlc_decoder_device *TranscodeHoldDecoderDevice(vlc_object_t *o, sout_stream_id_sys_t *id)
{
if (id->dec_dev == NULL)
- id->dec_dev = vlc_decoder_device_Create( o, NULL );
+ id->dec_dev = vlc_decoder_device_Create( o, NULL, NULL );
return id->dec_dev ? vlc_decoder_device_Hold(id->dec_dev) : NULL;
}
@@ -82,7 +82,7 @@ static vlc_decoder_device *video_get_encoder_device( encoder_t *enc )
{
struct encoder_owner *p_owner = enc_get_owner( enc );
if (p_owner->id->dec_dev == NULL)
- p_owner->id->dec_dev = vlc_decoder_device_Create( &enc->obj, NULL );
+ p_owner->id->dec_dev = vlc_decoder_device_Create( &enc->obj, NULL, NULL );
return p_owner->id->dec_dev ? vlc_decoder_device_Hold(p_owner->id->dec_dev) : NULL;
}
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index e59cdcb3a10..e7926901a85 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -182,17 +182,20 @@ static int decoder_device_Open(void *func, bool forced, va_list ap)
}
vlc_decoder_device *
-vlc_decoder_device_Create(vlc_object_t *o, vout_window_t *window)
+vlc_decoder_device_Create(vlc_object_t *o, const char *name,
+ vout_window_t *window)
{
struct vlc_decoder_device_priv *priv =
vlc_object_create(o, sizeof (*priv));
if (!priv)
return NULL;
- char *name = var_InheritString(o, "dec-dev");
+ char *varname = NULL;
+ if (!name)
+ name = varname = var_InheritString(o, "dec-dev");
module_t *module = vlc_module_load(&priv->device, "decoder device", name,
true, decoder_device_Open, &priv->device,
window);
- free(name);
+ free(varname);
if (module == NULL)
{
vlc_objres_clear(VLC_OBJECT(&priv->device));
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 659ede546ba..d493b6a545c 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -2033,7 +2033,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(&vout->obj, sys->display_cfg.window);
+ sys->dec_device = vlc_decoder_device_Create(&vout->obj, NULL, 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.20.1
More information about the vlc-devel
mailing list