[vlc-commits] core: add "hw-dec" bool option

Thomas Guillem git at videolan.org
Wed Jan 22 13:19:54 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jan 20 11:31:14 2020 +0100| [18a87a21dbe33551c6c451fccffd485b4776c162] | committer: Thomas Guillem

core: add "hw-dec" bool option

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=18a87a21dbe33551c6c451fccffd485b4776c162
---

 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 17a36df3c9..dfa1ceb409 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 1e733662cf..c6dd9a29b1 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)



More information about the vlc-commits mailing list