<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}
p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div>On Mon, Jan 20, 2020, at 14:45, Rémi Denis-Courmont wrote:<br></div><blockquote id="qt" type="cite"><div>Hi,<br></div><div><br></div><div>Conceptually okay but on the implementation level, why do you need to cache the value?<br></div></blockquote><div><br></div><div>Because I know that some decoders call decoder_UpdateVideoFormat() a lot, for each frames, that is the case for avcodec.<br></div><div>I had an other look, it seems that the decoder device is only requested when needed, so we could get ride of this cache value.<br></div><div><br></div><blockquote id="qt" type="cite"><div><br></div><div class="qt-gmail_quote"><div>Le 20 janvier 2020 12:34:59 GMT+02:00, Thomas Guillem <thomas@gllm.fr> a écrit :<br></div><blockquote class="qt-gmail_quote" style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;"><pre class="qt-k9mail"><div>Enabled by default, this option be used to disable hardware decoders (with<br></div><div>"--no-decoder-hw"). This option can be set on input/media items and will be<br></div><div>forwarded to the decoder via the input_thread_t.<br></div><div><br></div><div>To disable hardware decoders, the core decoder have to disable decoder devices.<hr> src/input/decoder.c | 8 +++++++-<br></div><div> src/libvlc-module.c | 6 ++++++<br></div><div> 2 files changed, 13 insertions(+), 1 deletion(-)<br></div><div><br></div><div>diff --git a/src/input/decoder.c b/src/input/decoder.c<br></div><div>index 17a36df3c9b..03d92c429c2 100644<br></div><div>--- a/src/input/decoder.c<br></div><div>+++ b/src/input/decoder.c<br></div><div>@@ -129,6 +129,7 @@ struct decoder_owner<br></div><div>     vout_thread_t   *p_vout;<br></div><div>     enum vlc_vout_order vout_order;<br></div><div>     bool            vout_thread_started;<br></div><div>+    bool            use_hw;<br></div><div> <br></div><div>     /* -- Theses variables need locking on read *and* write -- */<br></div><div>     /* Preroll */<br></div><div>@@ -615,8 +616,12 @@ static vlc_decoder_device * ModuleThread_GetDecoderDevice( decoder_t *p_dec )<br></div><div>     struct decoder_owner *p_owner = dec_get_owner( p_dec );<br></div><div> <br></div><div>     enum vlc_vout_order vout_order;<br></div><div>+<br></div><div>+    /* Requesting a decoder device will automatically enable hw decoding */<br></div><div>     vlc_decoder_device *dec_device = NULL;<br></div><div>-    int created_vout = CreateVoutIfNeeded(p_owner, NULL, &vout_order, &dec_device);<br></div><div>+    vlc_decoder_device **dec_device_ptr = p_owner->use_hw ? &dec_device : NULL;<br></div><div>+<br></div><div>+    int created_vout = CreateVoutIfNeeded(p_owner, NULL, &vout_order, dec_device_ptr);<br></div><div>     if (created_vout == -1)<br></div><div>     {<br></div><div>         if ( dec_device )<br></div><div>@@ -1848,6 +1853,7 @@ static struct decoder_owner * CreateDecoder( vlc_object_t *p_parent,<br></div><div>     p_owner->p_aout = NULL;<br></div><div>     p_owner->p_vout = NULL;<br></div><div>     p_owner->vout_thread_started = false;<br></div><div>+    p_owner->use_hw = var_InheritBool( p_parent, "decoder-hw" );<br></div><div>     p_owner->i_spu_channel = VOUT_SPU_CHANNEL_INVALID;<br></div><div>     p_owner->i_spu_order = 0;<br></div><div>     p_owner->p_sout = p_sout;<br></div><div>diff --git a/src/libvlc-module.c b/src/libvlc-module.c<br></div><div>index 1e733662cf6..9839a8274a9 100644<br></div><div>--- a/src/libvlc-module.c<br></div><div>+++ b/src/libvlc-module.c<br></div><div>@@ -968,6 +968,11 @@ static const char *const ppsz_prefres[] = {<br></div><div>     "before trying the other ones. Only advanced users should " \<br></div><div>     "alter this option as it can break playback of all your streams." )<br></div><div> <br></div><div>+#define DECODER_HW_TEXT N_("Enable hardware decoders")<br></div><div>+#define DECODER_HW_LONGTEXT N_( \<br></div><div>+    "This will enable hardware decoders. VLC will fallback automatically to " \<br></div><div>+    "software decoders in case of hardware decoder failure." )<br></div><div>+<br></div><div> #define ENCODER_TEXT N_("Preferred encoders list")<br></div><div> #define ENCODER_LONGTEXT N_( \<br></div><div>     "This allows you to select a list of encoders that VLC will use in " \<br></div><div>@@ -2044,6 +2049,7 @@ vlc_module_begin ()<br></div><div>     add_category_hint(N_("Decoders"), CODEC_CAT_LONGTEXT)<br></div><div>     add_string( "codec", NULL, CODEC_TEXT,<br></div><div>                 CODEC_LONGTEXT, true )<br></div><div>+    add_bool( "decoder-hw", true, DECODER_HW_TEXT, DECODER_HW_LONGTEXT, true )<br></div><div>     add_string( "encoder",  NULL, ENCODER_TEXT,<br></div><div>                 ENCODER_LONGTEXT, true )<br></div><div>     add_module("dec-dev", "decoder device", "any", DEC_DEV_TEXT, DEC_DEV_LONGTEXT)<br></div></pre></blockquote></div><div><br></div><div>-- <br></div><div>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. <br></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>