[vlc-devel] [PATCH 3/3] core: remove the avcodec-hw variable

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 25 15:45:46 CEST 2019


Now the modules only load if they are given a compatible decoder device.
This decoder device is loaded with the --dec-dev option.

---
v3: don't fully remove the option, mark it obsolete and don't use it

There's no add_obsolete_module() so use add_obsolete_string() instead.
---
 lib/media_player.c              | 11 ++++-------
 modules/codec/avcodec/avcodec.c |  2 +-
 modules/codec/avcodec/avcodec.h |  3 ---
 modules/codec/avcodec/va.c      |  4 +---
 4 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/lib/media_player.c b/lib/media_player.c
index 70b470b3b02..965cab2100a 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -604,7 +604,6 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     var_Create( mp, "vout-cb-select-plane", VLC_VAR_ADDRESS );
 
     var_Create (mp, "dec-dev", VLC_VAR_STRING);
-    var_Create (mp, "avcodec-hw", VLC_VAR_STRING);
     var_Create (mp, "drawable-xid", VLC_VAR_INTEGER);
 #if defined (_WIN32) || defined (__OS2__)
     var_Create (mp, "drawable-hwnd", VLC_VAR_INTEGER);
@@ -1008,7 +1007,7 @@ void libvlc_video_set_callbacks( libvlc_media_player_t *mp,
     var_SetAddress( mp, "vmem-unlock", unlock_cb );
     var_SetAddress( mp, "vmem-display", display_cb );
     var_SetAddress( mp, "vmem-data", opaque );
-    var_SetString( mp, "avcodec-hw", "none" );
+    var_SetString( mp, "dec-dev", "none" );
     var_SetString( mp, "vout", "vmem" );
     var_SetString( mp, "window", "dummy" );
 }
@@ -1087,13 +1086,11 @@ bool libvlc_video_direct3d_set_callbacks(libvlc_media_player_t *mp,
     if ( engine == libvlc_video_direct3d_engine_d3d11 )
     {
         var_SetString ( mp, "vout", "direct3d11" );
-        var_SetString ( mp, "avcodec-hw", "d3d11va");
         var_SetString ( mp, "dec-dev", "d3d11-device" );
     }
     else if ( engine == libvlc_video_direct3d_engine_d3d9 )
     {
         var_SetString ( mp, "vout", "direct3d9" );
-        var_SetString ( mp, "avcodec-hw", "dxva2");
         var_SetString ( mp, "dec-dev", "d3d9-device" );
     }
     else
@@ -1118,7 +1115,7 @@ void libvlc_media_player_set_nsobject( libvlc_media_player_t *p_mi,
 {
     assert (p_mi != NULL);
 #ifdef __APPLE__
-    var_SetString (p_mi, "avcodec-hw", "");
+    var_SetString (p_mi, "dec-dev", "");
     var_SetString (p_mi, "vout", "");
     var_SetString (p_mi, "window", "");
     var_SetAddress (p_mi, "drawable-nsobject", drawable);
@@ -1153,7 +1150,7 @@ void libvlc_media_player_set_xwindow( libvlc_media_player_t *p_mi,
 {
     assert (p_mi != NULL);
 
-    var_SetString (p_mi, "avcodec-hw", "");
+    var_SetString (p_mi, "dec-dev", "");
     var_SetString (p_mi, "vout", "");
     var_SetString (p_mi, "window", drawable ? "embed-xid,any" : "");
     var_SetInteger (p_mi, "drawable-xid", drawable);
@@ -1175,7 +1172,7 @@ void libvlc_media_player_set_hwnd( libvlc_media_player_t *p_mi,
 {
     assert (p_mi != NULL);
 #if defined (_WIN32) || defined (__OS2__)
-    var_SetString (p_mi, "avcodec-hw", "");
+    var_SetString (p_mi, "dec-dev", "");
     var_SetString (p_mi, "vout", "");
     var_SetString (p_mi, "window",
                    (drawable != NULL) ? "embed-hwnd,any" : "");
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index ab76fd8e5ed..ad2201cb1fb 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -131,7 +131,7 @@ vlc_module_begin ()
     add_obsolete_string( "ffmpeg-codec" ) /* removed since 2.1.0 */
     add_string( "avcodec-codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true )
     add_obsolete_bool( "ffmpeg-hw" ) /* removed since 2.1.0 */
-    add_module("avcodec-hw", "hw decoder", "any", HW_TEXT, HW_LONGTEXT)
+    add_obsolete_string( "avcodec-hw" ) /* removed since 4.0.0 */
 #if defined(FF_THREAD_FRAME)
     add_obsolete_integer( "ffmpeg-threads" ) /* removed since 2.1.0 */
     add_integer( "avcodec-threads", 0, THREADS_TEXT, THREADS_LONGTEXT, true );
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index 5e526a3b1cd..1df39c613ab 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -109,9 +109,6 @@ int ffmpeg_OpenCodec( decoder_t *p_dec, AVCodecContext *, const AVCodec * );
     "usually has a detrimental effect on quality. However it provides a big " \
     "speedup for high definition streams." )
 
-#define HW_TEXT N_("Hardware decoding")
-#define HW_LONGTEXT N_("This allows hardware decoding when available.")
-
 #define THREADS_TEXT N_( "Threads" )
 #define THREADS_LONGTEXT N_( "Number of threads used for decoding, 0 meaning auto" )
 
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index 277a8b1ba47..c4768f24bd0 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -119,9 +119,8 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj,
     if (unlikely(va == NULL))
         return NULL;
 
-    char *modlist = var_InheritString(obj, "avcodec-hw");
 
-    if (vlc_module_load(va, "hw decoder", modlist, true,
+    if (vlc_module_load(va, "hw decoder", NULL, true,
                         vlc_va_Start, va, avctx, src_desc, fmt_in, device,
                         fmt_out, vtcx_out) == NULL)
     {
@@ -129,7 +128,6 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj,
         va = NULL;
     }
 
-    free(modlist);
     return va;
 }
 
-- 
2.17.1



More information about the vlc-devel mailing list