[vlc-devel] [PATCH 1/4] core: dec-dev: add a way to force a module name

Rémi Denis-Courmont remi at remlab.net
Thu Jan 16 19:08:31 CET 2020


Le torstaina 16. tammikuuta 2020, 18.41.34 EET Thomas Guillem a écrit :
> ---
>  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");

No no. Either it stays there or the caller provides the value, lest nobody 
understands how the preferences work and how they're supposed to.

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list