[vlc-devel] [PATCH] core: add "hw-dev" bool option
Thomas Guillem
thomas at gllm.fr
Tue Jan 21 11:30:13 CET 2020
As requested by jb who prefers a smaller option name.
I revert/forced the orginal commit in the meantime.
On Tue, Jan 21, 2020, at 11:28, Thomas Guillem wrote:
> Enabled by default, this option be used to disable hardware decoders (with
> "--no-hw-dec"). This option can be set on input/media items and will be
> forwarded to the decoder via the input_thread_t.
>
> To disable hardware decoders, the core decoder have to disable decoder devices.
> ---
> src/input/decoder.c | 4 ++++
> src/libvlc-module.c | 6 ++++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 17a36df3c9b..dfa1ceb4097 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -614,6 +614,10 @@ static vlc_decoder_device *
> ModuleThread_GetDecoderDevice( decoder_t *p_dec )
> {
> struct decoder_owner *p_owner = dec_get_owner( p_dec );
>
> + /* Requesting a decoder device will automatically enable hw
> decoding */
> + if( !var_InheritBool( p_dec, "hw-dec" ) )
> + return NULL;
> +
> enum vlc_vout_order vout_order;
> vlc_decoder_device *dec_device = NULL;
> int created_vout = CreateVoutIfNeeded(p_owner, NULL, &vout_order,
> &dec_device);
> diff --git a/src/libvlc-module.c b/src/libvlc-module.c
> index 1e733662cf6..c6dd9a29b17 100644
> --- a/src/libvlc-module.c
> +++ b/src/libvlc-module.c
> @@ -968,6 +968,11 @@ static const char *const ppsz_prefres[] = {
> "before trying the other ones. Only advanced users should " \
> "alter this option as it can break playback of all your streams." )
>
> +#define HW_DEC_TEXT N_("Enable hardware decoders")
> +#define HW_DEC_LONGTEXT N_( \
> + "VLC will fallback automatically to software decoders in case of "
> \
> + "hardware decoder failure." )
> +
> #define ENCODER_TEXT N_("Preferred encoders list")
> #define ENCODER_LONGTEXT N_( \
> "This allows you to select a list of encoders that VLC will use in
> " \
> @@ -2044,6 +2049,7 @@ vlc_module_begin ()
> add_category_hint(N_("Decoders"), CODEC_CAT_LONGTEXT)
> add_string( "codec", NULL, CODEC_TEXT,
> CODEC_LONGTEXT, true )
> + add_bool( "hw-dec", true, HW_DEC_TEXT, HW_DEC_LONGTEXT, true )
> add_string( "encoder", NULL, ENCODER_TEXT,
> ENCODER_LONGTEXT, true )
> add_module("dec-dev", "decoder device", "any", DEC_DEV_TEXT,
> DEC_DEV_LONGTEXT)
> --
> 2.20.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list