[vlc-devel] [PATCH 4/5] demux: declare file extensions in descriptor

RĂ©mi Denis-Courmont remi at remlab.net
Thu Sep 24 16:40:20 CEST 2020


For each *existing* mapping of a file extension to a demux in
src/input/demux.c, this adds a corresponding declaration in the module
descriptor.
---
 include/vlc_demux.h               | 3 +++
 modules/codec/avcodec/avcodec.c   | 1 +
 modules/demux/aiff.c              | 1 +
 modules/demux/asf/asf.c           | 3 +++
 modules/demux/au.c                | 1 +
 modules/demux/avformat/avformat.c | 2 ++
 modules/demux/avi/avi.c           | 1 +
 modules/demux/flac.c              | 1 +
 modules/demux/mkv/mkv.cpp         | 3 +++
 modules/demux/mp4/mp4.c           | 5 +++++
 modules/demux/mpeg/h26x.c         | 1 +
 modules/demux/nsv.c               | 1 +
 modules/demux/ogg.c               | 7 +++++++
 modules/demux/playlist/playlist.c | 1 +
 modules/demux/pva.c               | 1 +
 modules/demux/rawdv.c             | 1 +
 modules/demux/smf.c               | 3 +++
 modules/demux/voc.c               | 1 +
 18 files changed, 37 insertions(+)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index eca3d0c6dd..8a9cc57bf9 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -50,6 +50,9 @@
 #define INPUT_UPDATE_META       0x0040
 #define INPUT_UPDATE_TITLE_LIST 0x0100
 
+/* Demux module descriptor helpers */
+#define add_file_extension(ext) add_shortcut("ext-" ext)
+
 /* demux_meta_t is returned by "meta reader" module to the demuxer */
 typedef struct demux_meta_t
 {
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index dc2d3d3550..75bb9337d7 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -31,6 +31,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
+#include <vlc_demux.h>
 #include <vlc_avcodec.h>
 #include <vlc_cpu.h>
 
diff --git a/modules/demux/aiff.c b/modules/demux/aiff.c
index 77fb9dfa2c..87e9db16b0 100644
--- a/modules/demux/aiff.c
+++ b/modules/demux/aiff.c
@@ -49,6 +49,7 @@ vlc_module_begin ()
     set_capability( "demux", 10 )
     set_callback( Open )
     add_shortcut( "aiff" )
+    add_file_extension("aiff")
 vlc_module_end ()
 
 /*****************************************************************************
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index 441d9ec7e4..4828a77804 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -62,6 +62,9 @@ vlc_module_begin ()
     set_capability( "demux", 200 )
     set_callbacks( Open, Close )
     add_shortcut( "asf", "wmv" )
+    add_file_extension("asf")
+    add_file_extension("wma")
+    add_file_extension("wmv")
 vlc_module_end ()
 
 
diff --git a/modules/demux/au.c b/modules/demux/au.c
index e2b4618976..a271dea127 100644
--- a/modules/demux/au.c
+++ b/modules/demux/au.c
@@ -50,6 +50,7 @@ vlc_module_begin ()
     set_capability( "demux", 10 )
     set_callback( Open )
     add_shortcut( "au" )
+    add_file_extension("au")
 vlc_module_end ()
 
 /*****************************************************************************
diff --git a/modules/demux/avformat/avformat.c b/modules/demux/avformat/avformat.c
index ac34a377c5..a33ffcfbe2 100644
--- a/modules/demux/avformat/avformat.c
+++ b/modules/demux/avformat/avformat.c
@@ -28,6 +28,7 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
+#include <vlc_demux.h>
 
 #include "avformat.h"
 #include "../../codec/avcodec/avcommon.h"
@@ -35,6 +36,7 @@
 vlc_module_begin ()
 #endif /* MERGE_FFMPEG */
     add_shortcut( "ffmpeg", "avformat" )
+    add_file_extension("rm")
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_DEMUX )
     set_description( N_("Avformat demuxer" ) )
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 34bd228681..7bae686ca1 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -73,6 +73,7 @@ vlc_module_begin ()
     set_capability( "demux", 212 )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_DEMUX )
+    add_file_extension("avi")
 
     add_bool( "avi-interleaved", false,
               INTERLEAVE_TEXT, INTERLEAVE_TEXT, true )
diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index ab029554c8..defb7d39bc 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -54,6 +54,7 @@ vlc_module_begin ()
     set_subcategory( SUBCAT_INPUT_DEMUX )
     set_callbacks( Open, Close )
     add_shortcut( "flac" )
+    add_file_extension("flac")
 vlc_module_end ()
 
 /*****************************************************************************
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 4685968f2b..82f464a74a 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -81,6 +81,9 @@ vlc_module_begin ()
             N_("Find all cluster positions by jumping cluster-to-cluster before playback"), true );
 
     add_shortcut( "mka", "mkv" )
+    add_file_extension("mka")
+    add_file_extension("mks")
+    add_file_extension("mkv")
 vlc_module_end ()
 
 namespace mkv {
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 161e09e50a..875d8c4d38 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -65,6 +65,11 @@ vlc_module_begin ()
     set_shortname( N_("MP4") )
     set_capability( "demux", 240 )
     set_callbacks( Open, Close )
+    add_file_extension("m4a")
+    add_file_extension("m4v")
+    add_file_extension("moov")
+    add_file_extension("mov")
+    add_file_extension("mp4")
 
     add_category_hint("Hacks", NULL)
     add_bool( CFG_PREFIX"m4a-audioonly", false, MP4_M4A_TEXT, MP4_M4A_LONGTEXT, true )
diff --git a/modules/demux/mpeg/h26x.c b/modules/demux/mpeg/h26x.c
index b9af7ccc88..a4ba6fecad 100644
--- a/modules/demux/mpeg/h26x.c
+++ b/modules/demux/mpeg/h26x.c
@@ -56,6 +56,7 @@ vlc_module_begin ()
     add_float( "h264-fps", 0.0, FPS_TEXT, FPS_LONGTEXT, true )
     set_callbacks( OpenH264, Close )
     add_shortcut( "h264" )
+    add_file_extension("h264")
 
     add_submodule()
         set_shortname( "HEVC")
diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index 62cd52d63e..f540b103b2 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -53,6 +53,7 @@ vlc_module_begin ()
     set_subcategory( SUBCAT_INPUT_DEMUX )
     set_callbacks( Open, Close )
     add_shortcut( "nsv" )
+    add_file_extension("nsv")
 vlc_module_end ()
 
 /*****************************************************************************
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index c81f5bb1b3..479aea9402 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -64,6 +64,13 @@ vlc_module_begin ()
     set_capability( "demux", 50 )
     set_callbacks( Open, Close )
     add_shortcut( "ogg" )
+    add_file_extension("oga")
+    add_file_extension("ogg")
+    add_file_extension("ogm")
+    add_file_extension("ogv")
+    add_file_extension("ogx")
+    add_file_extension("opus")
+    add_file_extension("spx")
 vlc_module_end ()
 
 
diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index b5222c0465..5ae914ba8b 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -68,6 +68,7 @@ vlc_module_begin ()
         add_shortcut( "m3u", "m3u8" )
         set_capability( "stream_filter", 310 )
         set_callback( Import_M3U )
+        add_file_extension("m3u")
     add_submodule ()
         set_description( N_("RAM playlist import") )
         set_capability( "stream_filter", 310 )
diff --git a/modules/demux/pva.c b/modules/demux/pva.c
index 72a7a9482a..252de09298 100644
--- a/modules/demux/pva.c
+++ b/modules/demux/pva.c
@@ -47,6 +47,7 @@ vlc_module_begin ()
     set_subcategory( SUBCAT_INPUT_DEMUX )
     set_callbacks( Open, Close )
     add_shortcut( "pva" )
+    add_file_extension("pva")
 vlc_module_end ()
 
 /*****************************************************************************
diff --git a/modules/demux/rawdv.c b/modules/demux/rawdv.c
index d16ad697ed..84a45cc446 100644
--- a/modules/demux/rawdv.c
+++ b/modules/demux/rawdv.c
@@ -54,6 +54,7 @@ vlc_module_begin ()
     add_bool( "rawdv-hurry-up", false, HURRYUP_TEXT, HURRYUP_LONGTEXT, false )
     set_callbacks( Open, Close )
     add_shortcut( "rawdv" )
+    add_file_extension("dv")
 vlc_module_end ()
 
 
diff --git a/modules/demux/smf.c b/modules/demux/smf.c
index 454a802623..f2dae11439 100644
--- a/modules/demux/smf.c
+++ b/modules/demux/smf.c
@@ -735,4 +735,7 @@ vlc_module_begin ()
     set_subcategory (SUBCAT_INPUT_DEMUX)
     set_capability ("demux", 20)
     set_callbacks (Open, Close)
+    add_file_extension("kar")
+    add_file_extension("mid")
+    add_file_extension("rmi")
 vlc_module_end ()
diff --git a/modules/demux/voc.c b/modules/demux/voc.c
index 329d88bbe0..106303c3c2 100644
--- a/modules/demux/voc.c
+++ b/modules/demux/voc.c
@@ -45,6 +45,7 @@ vlc_module_begin ()
     set_subcategory( SUBCAT_INPUT_DEMUX )
     set_capability( "demux", 10 )
     set_callback( Open )
+    add_file_extension("voc")
 vlc_module_end ()
 
 /*****************************************************************************
-- 
2.28.0



More information about the vlc-devel mailing list