[vlc-devel] [PATCH 02/26] sout:encoder: separate audio/video/spu encoder capabilities

Steve Lhomme robux4 at ycbcr.xyz
Mon Jan 18 08:32:41 UTC 2021


Similar to ac866164aa3be234250801a2e2571b57448cc8df,
89504cd744236e4599228f2b15cc4df1d934e30d and
3b4420ccf93d2a37c6c9eb8f9d9e259d88db184f but for encoders.

Avoid forward declaration in edummy.
---
 modules/codec/aom.c                           |  2 +-
 modules/codec/araw.c                          |  2 +-
 modules/codec/avcodec/avcodec.c               |  6 ++-
 modules/codec/daala.c                         |  2 +-
 modules/codec/dmo/dmo.c                       |  5 +-
 modules/codec/dvbsub.c                        |  2 +-
 modules/codec/edummy.c                        | 51 +++++++++++--------
 modules/codec/fdkaac.c                        |  2 +-
 modules/codec/flac.c                          |  2 +-
 modules/codec/g711.c                          |  2 +-
 modules/codec/jpeg.c                          |  2 +-
 modules/codec/lpcm.c                          |  2 +-
 modules/codec/omxil/omxil.c                   |  2 +-
 modules/codec/opus.c                          |  2 +-
 modules/codec/png.c                           |  2 +-
 modules/codec/qsv.c                           |  2 +-
 modules/codec/rav1e.c                         |  2 +-
 modules/codec/rtpvideo.c                      |  2 +-
 modules/codec/schroedinger.c                  |  2 +-
 modules/codec/shine.c                         |  2 +-
 modules/codec/speex.c                         |  2 +-
 modules/codec/substx3g.c                      |  2 +-
 modules/codec/t140.c                          |  2 +-
 modules/codec/theora.c                        |  2 +-
 modules/codec/twolame.c                       |  2 +-
 modules/codec/vorbis.c                        |  2 +-
 modules/codec/vpx.c                           |  2 +-
 modules/codec/webvtt/webvtt.c                 |  2 +-
 modules/codec/x264.c                          |  6 +--
 modules/codec/x265.c                          |  2 +-
 .../gui/qt/dialogs/sout/profile_selector.cpp  |  4 +-
 modules/misc/stats.c                          | 22 ++++++--
 modules/stream_out/transcode/encoder/audio.c  |  4 +-
 modules/stream_out/transcode/encoder/spu.c    |  2 +-
 modules/stream_out/transcode/encoder/video.c  |  4 +-
 modules/stream_out/transcode/transcode.c      |  6 +--
 src/misc/image.c                              |  2 +-
 src/stream_output/stream_output.c             | 13 ++---
 38 files changed, 103 insertions(+), 74 deletions(-)

diff --git a/modules/codec/aom.c b/modules/codec/aom.c
index 20ec11c75c9..db17d017dca 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -74,7 +74,7 @@ vlc_module_begin ()
 #ifdef ENABLE_SOUT
     add_submodule()
         set_shortname("aom")
-        set_capability("encoder", 101)
+        set_capability("video encoder", 101)
         set_description(N_("AOM video encoder"))
         set_callbacks(OpenEncoder, CloseEncoder)
         add_integer( SOUT_CFG_PREFIX "profile", 0, "Profile", NULL, true )
diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index c8c921414ea..012bc64894d 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -56,7 +56,7 @@ vlc_module_begin ()
     /* audio encoder submodule */
     add_submodule ()
     set_description( N_("Raw audio encoder") )
-    set_capability( "encoder", 150 )
+    set_capability( "audio encoder", 150 )
     set_callback( EncoderOpen )
 #endif
 vlc_module_end ()
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index 2db8797d32a..5c4bf688b99 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -144,8 +144,12 @@ vlc_module_begin ()
     add_shortcut( "ffmpeg" )
     set_section( N_("Encoding") , NULL )
     set_description( N_("FFmpeg audio/video encoder") )
-    set_capability( "encoder", 100 )
+    set_capability( "video encoder", 100 )
     set_callbacks( InitVideoEnc, EndVideoEnc )
+    add_submodule()
+        set_capability( "audio encoder", 100 )
+        add_shortcut( "ffmpeg" )
+        set_callbacks( InitVideoEnc, EndVideoEnc )
 
     /* removed in 2.1.0 */
     add_obsolete_string( "sout-ffmpeg-codec" )
diff --git a/modules/codec/daala.c b/modules/codec/daala.c
index be3826796eb..88f988043db 100644
--- a/modules/codec/daala.c
+++ b/modules/codec/daala.c
@@ -130,7 +130,7 @@ vlc_module_begin ()
 #ifdef ENABLE_SOUT
     add_submodule ()
     set_description( N_("Daala video encoder") )
-    set_capability( "encoder", 150 )
+    set_capability( "video encoder", 150 )
     set_callbacks( OpenEncoder, CloseEncoder )
     add_shortcut( "daala" )
 
diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index 3656b6cf615..5a14e2da282 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -82,8 +82,11 @@ vlc_module_begin ()
     add_submodule ()
     set_description( N_("DirectMedia Object encoder") )
     add_shortcut( "dmo" )
-    set_capability( "encoder", 10 )
+    set_capability( "audio encoder", 10 )
     set_callbacks( EncoderOpen, EncoderClose )
+    add_submodule()
+      set_capability( "video encoder", 100 )
+      set_callbacks( EncoderOpen, EncoderClose )
 
 vlc_module_end ()
 
diff --git a/modules/codec/dvbsub.c b/modules/codec/dvbsub.c
index a989c45416d..921c5593a9a 100644
--- a/modules/codec/dvbsub.c
+++ b/modules/codec/dvbsub.c
@@ -133,7 +133,7 @@ vlc_module_begin ()
 #   define ENC_CFG_PREFIX "sout-dvbsub-"
     add_submodule ()
     set_description( N_("DVB subtitles encoder") )
-    set_capability( "encoder", 100 )
+    set_capability( "spu encoder", 100 )
     set_callbacks( OpenEncoder, CloseEncoder )
 
     add_integer( ENC_CFG_PREFIX "x", -1, ENC_POSX_TEXT, ENC_POSX_LONGTEXT, false )
diff --git a/modules/codec/edummy.c b/modules/codec/edummy.c
index 89ad5f6c2e2..bd78fb3e8a8 100644
--- a/modules/codec/edummy.c
+++ b/modules/codec/edummy.c
@@ -31,36 +31,22 @@
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
 
-static int OpenEncoder( vlc_object_t * );
+static int OpenAudioEncoder( vlc_object_t * );
+static int OpenVideoEncoder( vlc_object_t * );
 
 vlc_module_begin ()
     set_shortname( N_("Dummy") )
     set_description( N_("Dummy encoder") )
-    set_capability( "encoder", 0 )
-    set_callback( OpenEncoder )
+    set_capability( "audio encoder", 0 )
+    set_callbacks( OpenAudioEncoder, NULL )
     add_shortcut( "dummy" )
+    add_submodule ()
+        set_capability( "video encoder", 0 )
+        add_shortcut( "dummy" )
+        set_callbacks( OpenVideoEncoder, NULL )
 vlc_module_end ()
 
 
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict );
-static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_buf );
-
-/*****************************************************************************
- * OpenDecoder: open the dummy encoder.
- *****************************************************************************/
-static int OpenEncoder( vlc_object_t *p_this )
-{
-    encoder_t *p_enc = (encoder_t *)p_this;
-
-    p_enc->pf_encode_video = EncodeVideo;
-    p_enc->pf_encode_audio = EncodeAudio;
-
-    return VLC_SUCCESS;
-}
-
 /****************************************************************************
  * EncodeVideo: the whole thing
  ****************************************************************************/
@@ -78,3 +64,24 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_buf )
     VLC_UNUSED(p_enc); VLC_UNUSED(p_buf);
     return NULL;
 }
+
+/*****************************************************************************
+ * OpenDecoder: open the dummy encoder.
+ *****************************************************************************/
+static int OpenAudioEncoder( vlc_object_t *p_this )
+{
+    encoder_t *p_enc = (encoder_t *)p_this;
+
+    p_enc->pf_encode_audio = EncodeAudio;
+
+    return VLC_SUCCESS;
+}
+static int OpenVideoEncoder( vlc_object_t *p_this )
+{
+    encoder_t *p_enc = (encoder_t *)p_this;
+
+    p_enc->pf_encode_video = EncodeVideo;
+
+    return VLC_SUCCESS;
+}
+
diff --git a/modules/codec/fdkaac.c b/modules/codec/fdkaac.c
index 3ac7b756a33..ed8cc74b0f6 100644
--- a/modules/codec/fdkaac.c
+++ b/modules/codec/fdkaac.c
@@ -104,7 +104,7 @@ static const char *const ppsz_aot_descriptions[] =
 vlc_module_begin ()
     set_shortname(N_("FDKAAC"))
     set_description(N_("FDK-AAC Audio encoder"))
-    set_capability("encoder", 150)
+    set_capability("audio encoder", 150)
     set_callbacks(OpenEncoder, CloseEncoder)
     add_shortcut("fdkaac")
     set_category(CAT_INPUT)
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 850ea002c9b..7b6df530a8d 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -168,7 +168,7 @@ vlc_module_begin ()
     add_submodule ()
     add_shortcut( "flac" )
     set_description( N_("Flac audio encoder") )
-    set_capability( "encoder", 100 )
+    set_capability( "audio encoder", 100 )
     set_callbacks( OpenEncoder, CloseEncoder )
 #endif
 
diff --git a/modules/codec/g711.c b/modules/codec/g711.c
index 1e55b1d54af..e6301b1ea2e 100644
--- a/modules/codec/g711.c
+++ b/modules/codec/g711.c
@@ -50,7 +50,7 @@ vlc_module_begin ()
 #ifdef ENABLE_SOUT
     add_submodule ()
     set_description( N_("G.711 encoder") )
-    set_capability( "encoder", 150 )
+    set_capability( "audio encoder", 150 )
     set_callback( EncoderOpen )
 #endif
 vlc_module_end ()
diff --git a/modules/codec/jpeg.c b/modules/codec/jpeg.c
index 486502b2113..e16a3b649ea 100644
--- a/modules/codec/jpeg.c
+++ b/modules/codec/jpeg.c
@@ -119,7 +119,7 @@ vlc_module_begin()
     add_shortcut("jpeg")
     set_section(N_("Encoding"), NULL)
     set_description(N_("JPEG image encoder"))
-    set_capability("encoder", 1000)
+    set_capability("video encoder", 1000)
     set_callbacks(OpenEncoder, CloseEncoder)
     add_integer_with_range(ENC_CFG_PREFIX "quality", 95, 0, 100,
                            ENC_QUALITY_TEXT, ENC_QUALITY_LONGTEXT, true)
diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index f698c5195e8..4a948102cae 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -67,7 +67,7 @@ vlc_module_begin ()
 #ifdef ENABLE_SOUT
     add_submodule ()
     set_description( N_("Linear PCM audio encoder") )
-    set_capability( "encoder", 100 )
+    set_capability( "audio encoder", 100 )
     set_callbacks( OpenEncoder, CloseEncoder )
     add_shortcut( "lpcm" )
 #endif
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 5f3a5370b3c..9c0a8fefed1 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -101,7 +101,7 @@ vlc_module_begin ()
     add_submodule ()
     set_section( N_("Encoding") , NULL )
     set_description( N_("Video encoder (using OpenMAX IL)") )
-    set_capability( "encoder", 0 )
+    set_capability( "video encoder", 0 )
     set_callbacks( OpenEncoder, CloseGeneric )
 vlc_module_end ()
 
diff --git a/modules/codec/opus.c b/modules/codec/opus.c
index c6aaf407cb3..f170aab9720 100644
--- a/modules/codec/opus.c
+++ b/modules/codec/opus.c
@@ -66,7 +66,7 @@ vlc_module_begin ()
 #ifdef ENABLE_SOUT
     add_submodule ()
     set_description( N_("Opus audio encoder") )
-    set_capability( "encoder", 150 )
+    set_capability( "audio encoder", 150 )
     set_shortname( N_("Opus") )
     set_callbacks( OpenEncoder, CloseEncoder )
 #endif
diff --git a/modules/codec/png.c b/modules/codec/png.c
index 40f021e4253..ef855c2bcec 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -95,7 +95,7 @@ vlc_module_begin ()
     add_shortcut("png")
     set_section(N_("Encoding"), NULL)
     set_description(N_("PNG video encoder"))
-    set_capability("encoder", 1000)
+    set_capability("video encoder", 1000)
     set_callback(OpenEncoder)
 vlc_module_end ()
 
diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index e996b2ae218..ef0745e11ed 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -198,7 +198,7 @@ vlc_module_begin ()
     set_subcategory(SUBCAT_INPUT_VCODEC)
     set_description(N_("Intel QuickSync Video encoder for MPEG4-Part10/MPEG2 (aka H.264/H.262)"))
     set_shortname("qsv")
-    set_capability("encoder", 0)
+    set_capability("video encoder", 0)
     set_callbacks(Open, Close)
 
     add_bool(SOUT_CFG_PREFIX "software", false, SW_IMPL_TEXT, SW_IMPL_LONGTEXT, true)
diff --git a/modules/codec/rav1e.c b/modules/codec/rav1e.c
index d3373a987f4..d2819f70417 100644
--- a/modules/codec/rav1e.c
+++ b/modules/codec/rav1e.c
@@ -293,7 +293,7 @@ static const char *bitdepth_values_name_list[] = {N_("8 bpp"), N_("10 bpp")};
 vlc_module_begin()
     set_shortname("rav1e")
     set_description(N_("rav1e video encoder"))
-    set_capability("encoder", 105)
+    set_capability("video encoder", 105)
     set_callbacks(OpenEncoder, CloseEncoder)
     set_category(CAT_INPUT)
     set_subcategory(SUBCAT_INPUT_VCODEC)
diff --git a/modules/codec/rtpvideo.c b/modules/codec/rtpvideo.c
index c495f4e1144..e1c27b1d3ce 100644
--- a/modules/codec/rtpvideo.c
+++ b/modules/codec/rtpvideo.c
@@ -42,7 +42,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict );
  *****************************************************************************/
 vlc_module_begin ()
     set_description( N_("Raw video encoder for RTP") )
-    set_capability( "encoder", 50 )
+    set_capability( "video encoder", 50 )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_VCODEC )
     set_callback( OpenEncoder )
diff --git a/modules/codec/schroedinger.c b/modules/codec/schroedinger.c
index 20c708948b8..606583fad3c 100644
--- a/modules/codec/schroedinger.c
+++ b/modules/codec/schroedinger.c
@@ -370,7 +370,7 @@ vlc_module_begin ()
     add_submodule()
     set_section( N_("Encoding") , NULL )
     set_description( N_("Dirac video encoder using libschroedinger") )
-    set_capability( "encoder", 110 )
+    set_capability( "video encoder", 110 )
     set_callbacks( OpenEncoder, CloseEncoder )
     add_shortcut( "schroedinger", "schro" )
 
diff --git a/modules/codec/shine.c b/modules/codec/shine.c
index 45e8ca41146..153488705a9 100644
--- a/modules/codec/shine.c
+++ b/modules/codec/shine.c
@@ -64,7 +64,7 @@ vlc_module_begin();
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_ACODEC );
     set_description( N_("MP3 fixed point audio encoder") );
-    set_capability( "encoder", 50 );
+    set_capability( "audio encoder", 50 );
     set_callbacks( OpenEncoder, CloseEncoder );
 vlc_module_end();
 
diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index 38eb459dc66..9fa0e5a2740 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -107,7 +107,7 @@ vlc_module_begin ()
 #ifdef ENABLE_SOUT
     add_submodule ()
     set_description( N_("Speex audio encoder") )
-    set_capability( "encoder", 100 )
+    set_capability( "audio encoder", 100 )
     set_callbacks( OpenEncoder, CloseEncoder )
 
     add_integer( ENC_CFG_PREFIX "mode", 0, ENC_MODE_TEXT,
diff --git a/modules/codec/substx3g.c b/modules/codec/substx3g.c
index 8315f1e194b..bc74c6fcd39 100644
--- a/modules/codec/substx3g.c
+++ b/modules/codec/substx3g.c
@@ -53,7 +53,7 @@ vlc_module_begin ()
     add_submodule ()
         set_description( N_("tx3g subtitles encoder") )
         set_shortname( N_("tx3g subtitles encoder") )
-        set_capability( "encoder", 101 )
+        set_capability( "spu encoder", 101 )
         set_callback( OpenEncoder )
 #endif
 vlc_module_end ()
diff --git a/modules/codec/t140.c b/modules/codec/t140.c
index eab8b96cde0..3e0bbc2447b 100644
--- a/modules/codec/t140.c
+++ b/modules/codec/t140.c
@@ -33,7 +33,7 @@ static void Close( vlc_object_t * );
 
 vlc_module_begin ()
     set_description( N_("T.140 text encoder") )
-    set_capability( "encoder", 100 )
+    set_capability( "spu encoder", 100 )
     set_callback( Open )
 vlc_module_end ()
 
diff --git a/modules/codec/theora.c b/modules/codec/theora.c
index b038502fd2a..05b4b640504 100644
--- a/modules/codec/theora.c
+++ b/modules/codec/theora.c
@@ -128,7 +128,7 @@ vlc_module_begin ()
 #ifdef ENABLE_SOUT
     add_submodule ()
     set_description( N_("Theora video encoder") )
-    set_capability( "encoder", 150 )
+    set_capability( "video encoder", 150 )
     set_callbacks( OpenEncoder, CloseEncoder )
     add_shortcut( "theora" )
 
diff --git a/modules/codec/twolame.c b/modules/codec/twolame.c
index 4208ab100e3..28bb0492ffb 100644
--- a/modules/codec/twolame.c
+++ b/modules/codec/twolame.c
@@ -72,7 +72,7 @@ static const char *const ppsz_stereo_descriptions[] =
 vlc_module_begin ()
     set_shortname( "Twolame")
     set_description( N_("Libtwolame audio encoder") )
-    set_capability( "encoder", 120 )
+    set_capability( "audio encoder", 120 )
     set_callbacks( OpenEncoder, CloseEncoder )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_ACODEC )
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 39133e5ff24..914346dc16a 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -204,7 +204,7 @@ vlc_module_begin ()
 #   define ENC_CFG_PREFIX "sout-vorbis-"
     add_submodule ()
     set_description( N_("Vorbis audio encoder") )
-    set_capability( "encoder", 130 )
+    set_capability( "audio encoder", 130 )
     set_callbacks( OpenEncoder, CloseEncoder )
 
     add_integer( ENC_CFG_PREFIX "quality", 0, ENC_QUALITY_TEXT,
diff --git a/modules/codec/vpx.c b/modules/codec/vpx.c
index cb29f4428db..eced20c1758 100644
--- a/modules/codec/vpx.c
+++ b/modules/codec/vpx.c
@@ -72,7 +72,7 @@ vlc_module_begin ()
 #ifdef ENABLE_SOUT
     add_submodule()
     set_shortname("vpx")
-    set_capability("encoder", 60)
+    set_capability("video encoder", 60)
     set_description(N_("WebM video encoder"))
     set_callbacks(OpenEncoder, CloseEncoder)
 #   define ENC_CFG_PREFIX "sout-vpx-"
diff --git a/modules/codec/webvtt/webvtt.c b/modules/codec/webvtt/webvtt.c
index 9583d7b4ee6..8da5f6d4e02 100644
--- a/modules/codec/webvtt/webvtt.c
+++ b/modules/codec/webvtt/webvtt.c
@@ -61,7 +61,7 @@ vlc_module_begin ()
 #ifdef ENABLE_SOUT
     add_submodule()
         set_description( "WEBVTT text encoder" )
-        set_capability( "encoder", 101 )
+        set_capability( "spu encoder", 101 )
         set_subcategory( SUBCAT_INPUT_SCODEC )
         set_callback( webvtt_OpenEncoder )
 #endif
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 70049f50b8b..c18ecb31354 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -440,15 +440,15 @@ static const char *const framepacking_list_text[] =
 vlc_module_begin ()
 #ifdef MODULE_NAME_IS_x26410b
     set_description( N_("H.264/MPEG-4 Part 10/AVC encoder (x264 10-bit)"))
-    set_capability( "encoder", 0 )
+    set_capability( "video encoder", 0 )
 #endif
 #ifdef MODULE_NAME_IS_x262
     set_description( N_("H.262/MPEG-2 encoder (x262)"))
-    set_capability( "encoder", 0 )
+    set_capability( "video encoder", 0 )
 #endif
 #ifdef MODULE_NAME_IS_x264
     set_description( N_("H.264/MPEG-4 Part 10/AVC encoder (x264)"))
-    set_capability( "encoder", 200 )
+    set_capability( "video encoder", 200 )
 #endif
     set_callbacks( Open, Close )
     set_category( CAT_INPUT )
diff --git a/modules/codec/x265.c b/modules/codec/x265.c
index 0fb8c0be8bb..7a39797fb80 100644
--- a/modules/codec/x265.c
+++ b/modules/codec/x265.c
@@ -44,7 +44,7 @@ static void Close(vlc_object_t *);
 
 vlc_module_begin ()
     set_description(N_("H.265/HEVC encoder (x265)"))
-    set_capability("encoder", 200)
+    set_capability("video encoder", 200)
     set_callbacks(Open, Close)
     set_category(CAT_INPUT)
     set_subcategory(SUBCAT_INPUT_VCODEC)
diff --git a/modules/gui/qt/dialogs/sout/profile_selector.cpp b/modules/gui/qt/dialogs/sout/profile_selector.cpp
index 6e3d553876f..6df30210c49 100644
--- a/modules/gui/qt/dialogs/sout/profile_selector.cpp
+++ b/modules/gui/qt/dialogs/sout/profile_selector.cpp
@@ -477,8 +477,8 @@ void VLCProfileEditor::loadCapabilities()
 
          if( module_provides( p_module, "sout mux" ) )
              caps["muxers"].insert( module_get_object( p_module ) );
-//        else if ( module_provides( p_module, "encoder" ) )
-//            caps["encoders"].insert( module_get_object( p_module ) );
+//        else if ( module_provides( p_module, "video encoder" ) )
+//            caps["video encoders"].insert( module_get_object( p_module ) );
     }
     module_list_free (p_all);
 }
diff --git a/modules/misc/stats.c b/modules/misc/stats.c
index c5377e3fbd9..fb47b89b560 100644
--- a/modules/misc/stats.c
+++ b/modules/misc/stats.c
@@ -119,17 +119,27 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_abuff )
     return NULL;
 }
 
-static int OpenEncoder ( vlc_object_t *p_this )
+static int OpenAudioEncoder ( vlc_object_t *p_this )
 {
     encoder_t *p_enc = (encoder_t *)p_this;
 
     msg_Dbg( p_this, "opening stats encoder" );
 
-    p_enc->pf_encode_video = EncodeVideo;
     p_enc->pf_encode_audio = EncodeAudio;
 
     return VLC_SUCCESS;
 }
+
+static int OpenVideoEncoder ( vlc_object_t *p_this )
+{
+    encoder_t *p_enc = (encoder_t *)p_this;
+
+    msg_Dbg( p_this, "opening stats encoder" );
+
+    p_enc->pf_encode_video = EncodeVideo;
+
+    return VLC_SUCCESS;
+}
 #endif
 
 /*** Demuxer ***/
@@ -213,9 +223,13 @@ vlc_module_begin ()
     set_shortname( N_("Stats"))
 #ifdef ENABLE_SOUT
     set_description( N_("Stats encoder function") )
-    set_capability( "encoder", 0 )
+    set_capability( "video encoder", 0 )
     add_shortcut( "stats" )
-    set_callback( OpenEncoder )
+    set_callback( OpenVideoEncoder )
+    add_submodule ()
+        set_capability( "audio encoder", 0 )
+        add_shortcut( "stats" )
+        set_callback( OpenAudioEncoder )
     add_submodule ()
 #endif
         set_section( N_( "Stats decoder" ), NULL )
diff --git a/modules/stream_out/transcode/encoder/audio.c b/modules/stream_out/transcode/encoder/audio.c
index 2aa0c78859b..ea59256e145 100644
--- a/modules/stream_out/transcode/encoder/audio.c
+++ b/modules/stream_out/transcode/encoder/audio.c
@@ -62,7 +62,7 @@ int transcode_encoder_audio_open( transcode_encoder_t *p_enc,
     p_enc->p_encoder->p_cfg = p_cfg->p_config_chain;
     p_enc->p_encoder->fmt_out.i_codec = p_cfg->i_codec;
 
-    p_enc->p_encoder->p_module = module_need( p_enc->p_encoder, "encoder",
+    p_enc->p_encoder->p_module = module_need( p_enc->p_encoder, "audio encoder",
                                               p_cfg->psz_name, true );
 
     if( p_enc->p_encoder->p_module )
@@ -169,7 +169,7 @@ int transcode_encoder_audio_test( encoder_t *p_encoder,
         p_afmt_out->i_physical_channels = AOUT_CHANS_STEREO;
     }
 
-    module_t *p_module = module_need( p_encoder, "encoder", p_cfg->psz_name, true );
+    module_t *p_module = module_need( p_encoder, "audio encoder", p_cfg->psz_name, true );
     if( !p_module )
     {
         msg_Err( p_encoder, "cannot find audio encoder (module:%s fourcc:%4.4s). "
diff --git a/modules/stream_out/transcode/encoder/spu.c b/modules/stream_out/transcode/encoder/spu.c
index 45f4bdf57e2..5724e19cf78 100644
--- a/modules/stream_out/transcode/encoder/spu.c
+++ b/modules/stream_out/transcode/encoder/spu.c
@@ -41,7 +41,7 @@ int transcode_encoder_spu_open( transcode_encoder_t *p_enc,
     p_enc->p_encoder->p_cfg = p_cfg->p_config_chain;
     p_enc->p_encoder->fmt_out.i_codec = p_cfg->i_codec;
 
-    p_enc->p_encoder->p_module = module_need( p_enc->p_encoder, "encoder",
+    p_enc->p_encoder->p_module = module_need( p_enc->p_encoder, "spu encoder",
                                               p_cfg->psz_name, true );
 
     return ( p_enc->p_encoder->p_module ) ? VLC_SUCCESS: VLC_EGENERIC;
diff --git a/modules/stream_out/transcode/encoder/video.c b/modules/stream_out/transcode/encoder/video.c
index cfa4b095049..d34a0c1bdbc 100644
--- a/modules/stream_out/transcode/encoder/video.c
+++ b/modules/stream_out/transcode/encoder/video.c
@@ -325,7 +325,7 @@ int transcode_encoder_video_test( encoder_t *p_encoder,
     p_vfmt_out->i_width  = p_vfmt_in->i_width & ~1;
     p_vfmt_out->i_height = p_vfmt_in->i_height & ~1;
 
-    module_t *p_module = module_need( p_encoder, "encoder", p_cfg->psz_name, true );
+    module_t *p_module = module_need( p_encoder, "video encoder", p_cfg->psz_name, true );
     if( !p_module )
     {
         msg_Err( p_encoder, "cannot find video encoder (module:%s fourcc:%4.4s). "
@@ -456,7 +456,7 @@ int transcode_encoder_video_open( transcode_encoder_t *p_enc,
     p_enc->p_encoder->p_cfg = p_cfg->p_config_chain;
 
     p_enc->p_encoder->p_module =
-        module_need( p_enc->p_encoder, "encoder", p_cfg->psz_name, true );
+        module_need( p_enc->p_encoder, "video encoder", p_cfg->psz_name, true );
     if( !p_enc->p_encoder->p_module )
         return VLC_EGENERIC;
 
diff --git a/modules/stream_out/transcode/transcode.c b/modules/stream_out/transcode/transcode.c
index ceca2df1e59..148b51e5195 100644
--- a/modules/stream_out/transcode/transcode.c
+++ b/modules/stream_out/transcode/transcode.c
@@ -150,7 +150,7 @@ vlc_module_begin ()
     set_category( CAT_SOUT )
     set_subcategory( SUBCAT_SOUT_STREAM )
     set_section( N_("Video"), NULL )
-    add_module(SOUT_CFG_PREFIX "venc", "encoder", NULL,
+    add_module(SOUT_CFG_PREFIX "venc", "video encoder", NULL,
                VENC_TEXT, VENC_LONGTEXT)
     add_string( SOUT_CFG_PREFIX "vcodec", NULL, VCODEC_TEXT,
                 VCODEC_LONGTEXT, false )
@@ -179,7 +179,7 @@ vlc_module_begin ()
                     VFILTER_TEXT, VFILTER_LONGTEXT)
 
     set_section( N_("Audio"), NULL )
-    add_module(SOUT_CFG_PREFIX "aenc", "encoder", NULL,
+    add_module(SOUT_CFG_PREFIX "aenc", "audio encoder", NULL,
                AENC_TEXT, AENC_LONGTEXT)
     add_string( SOUT_CFG_PREFIX "acodec", NULL, ACODEC_TEXT,
                 ACODEC_LONGTEXT, false )
@@ -198,7 +198,7 @@ vlc_module_begin ()
                     AFILTER_TEXT, AFILTER_LONGTEXT)
 
     set_section( N_("Overlays/Subtitles"), NULL )
-    add_module(SOUT_CFG_PREFIX "senc", "encoder", NULL,
+    add_module(SOUT_CFG_PREFIX "senc", "spu encoder", NULL,
                SENC_TEXT, SENC_LONGTEXT)
     add_string( SOUT_CFG_PREFIX "scodec", NULL, SCODEC_TEXT,
                 SCODEC_LONGTEXT, false )
diff --git a/src/misc/image.c b/src/misc/image.c
index e0353299467..92c75eaa8db 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -742,7 +742,7 @@ static encoder_t *CreateEncoder( vlc_object_t *p_this, const video_format_t *fmt
     p_enc->fmt_out.video.i_height = p_enc->fmt_in.video.i_height;
 
     /* Find a suitable decoder module */
-    p_enc->p_module = module_need( p_enc, "encoder", NULL, false );
+    p_enc->p_module = module_need( p_enc, "video encoder", NULL, false );
     if( !p_enc->p_module )
     {
         msg_Err( p_enc, "no suitable encoder module for fourcc `%4.4s'.\n"
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 6d77adc7085..22bda26e987 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -998,14 +998,15 @@ rtp:
     return psz_chain;
 }
 
+static const char encoder_caps[ES_CATEGORY_COUNT][16] = {
+    [VIDEO_ES] = "video encoder",
+    [AUDIO_ES] = "audio encoder",
+    [SPU_ES]   = "spu encoder",
+};
+
 #undef sout_EncoderCreate
 encoder_t *sout_EncoderCreate( vlc_object_t *p_this, size_t owner_size, enum es_format_category_e i_cat )
 {
     assert( owner_size >= sizeof(encoder_t) );
-    const char caps[ES_CATEGORY_COUNT][16] = {
-        [VIDEO_ES] = "encoder",
-        [AUDIO_ES] = "encoder",
-        [SPU_ES]   = "encoder",
-    };
-    return vlc_custom_create( p_this, owner_size, caps[i_cat] );
+    return vlc_custom_create( p_this, owner_size, encoder_caps[i_cat] );
 }
-- 
2.29.2



More information about the vlc-devel mailing list