[vlc-commits] decoder: use "audio decoder" capability for audio decoders
Rémi Denis-Courmont
git at videolan.org
Mon Jun 19 19:59:24 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jun 19 20:40:18 2017 +0300| [89504cd744236e4599228f2b15cc4df1d934e30d] | committer: Rémi Denis-Courmont
decoder: use "audio decoder" capability for audio decoders
This avoids probing video or SPU decoders for audio format and vice-
versa.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89504cd744236e4599228f2b15cc4df1d934e30d
---
modules/codec/a52.c | 2 +-
modules/codec/adpcm.c | 2 +-
modules/codec/aes3.c | 2 +-
modules/codec/araw.c | 2 +-
modules/codec/avcodec/audio.c | 3 ---
modules/codec/avcodec/avcodec.c | 2 +-
modules/codec/dca.c | 2 +-
modules/codec/ddummy.c | 8 ++++++++
modules/codec/dmo/dmo.c | 5 +++++
modules/codec/faad.c | 2 +-
modules/codec/flac.c | 2 +-
modules/codec/fluidsynth.c | 2 +-
modules/codec/g711.c | 2 +-
modules/codec/lpcm.c | 2 +-
modules/codec/mad.c | 2 +-
modules/codec/mft.c | 5 +++++
modules/codec/mpg123.c | 2 +-
modules/codec/omxil/mediacodec.c | 8 ++++++++
modules/codec/omxil/omxil.c | 14 +++++++++-----
modules/codec/opus.c | 2 +-
modules/codec/spdif.c | 2 +-
modules/codec/speex.c | 2 +-
modules/codec/uleaddvaudio.c | 2 +-
modules/codec/vorbis.c | 4 ++--
modules/codec/wmafixed/wma.c | 2 +-
modules/misc/stats.c | 6 ++++++
modules/stream_out/transcode/audio.c | 2 +-
src/input/decoder.c | 2 +-
28 files changed, 63 insertions(+), 30 deletions(-)
diff --git a/modules/codec/a52.c b/modules/codec/a52.c
index f9f48cfb31..0f59b581ef 100644
--- a/modules/codec/a52.c
+++ b/modules/codec/a52.c
@@ -81,7 +81,7 @@ vlc_module_begin ()
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
add_bool( "a52-dynrng", true, DYNRNG_TEXT, DYNRNG_LONGTEXT, false )
- set_capability( "decoder", 60 )
+ set_capability( "audio decoder", 60 )
set_callbacks( Open, Close )
vlc_module_end ()
diff --git a/modules/codec/adpcm.c b/modules/codec/adpcm.c
index f61bd54911..89eacbda0b 100644
--- a/modules/codec/adpcm.c
+++ b/modules/codec/adpcm.c
@@ -46,7 +46,7 @@ static void Flush( decoder_t * );
vlc_module_begin ()
set_description( N_("ADPCM audio decoder") )
- set_capability( "decoder", 50 )
+ set_capability( "audio decoder", 50 )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
set_callbacks( OpenDecoder, CloseDecoder )
diff --git a/modules/codec/aes3.c b/modules/codec/aes3.c
index daee35e9ee..c68f455a0c 100644
--- a/modules/codec/aes3.c
+++ b/modules/codec/aes3.c
@@ -45,7 +45,7 @@ vlc_module_begin ()
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
set_description( N_("AES3/SMPTE 302M audio decoder") )
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
set_callbacks( OpenDecoder, Close )
add_submodule ()
diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index 6430e2672b..9db6973b3b 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -49,7 +49,7 @@ static int EncoderOpen ( vlc_object_t * );
vlc_module_begin ()
/* audio decoder module */
set_description( N_("Raw/Log Audio decoder") )
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
set_callbacks( DecoderOpen, DecoderClose )
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index e3b29bf589..e15d103a8a 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -214,9 +214,6 @@ void EndAudioDec( vlc_object_t *obj )
int InitAudioDec( vlc_object_t *obj )
{
decoder_t *p_dec = (decoder_t *)obj;
- if( p_dec->fmt_in.i_cat != AUDIO_ES )
- return VLC_EGENERIC;
-
const AVCodec *codec;
AVCodecContext *avctx = ffmpeg_AllocContext( p_dec, &codec );
if( avctx == NULL )
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index f2c1a21d4e..2dcdc43bfa 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -83,7 +83,7 @@ vlc_module_begin ()
add_submodule()
add_shortcut("ffmpeg")
- set_capability("decoder", 70)
+ set_capability("audio decoder", 70)
set_callbacks(InitAudioDec, EndAudioDec)
add_submodule()
diff --git a/modules/codec/dca.c b/modules/codec/dca.c
index d5256d5749..db8c0bfcdc 100644
--- a/modules/codec/dca.c
+++ b/modules/codec/dca.c
@@ -72,7 +72,7 @@ vlc_module_begin ()
set_shortname( "DCA" )
set_description( N_("DTS Coherent Acoustics audio decoder") )
add_bool( "dts-dynrng", true, DYNRNG_TEXT, DYNRNG_LONGTEXT, false )
- set_capability( "decoder", 60 )
+ set_capability( "audio decoder", 60 )
set_callbacks( Open, Close )
vlc_module_end ()
diff --git a/modules/codec/ddummy.c b/modules/codec/ddummy.c
index 28f18c84c0..895d1a27f9 100644
--- a/modules/codec/ddummy.c
+++ b/modules/codec/ddummy.c
@@ -51,6 +51,10 @@ vlc_module_begin ()
set_subcategory( SUBCAT_INPUT_SCODEC )
add_bool( "dummy-save-es", false, SAVE_TEXT, SAVE_LONGTEXT, true )
add_shortcut( "dummy" )
+ add_submodule()
+ add_shortcut( "dummy" )
+ set_capability( "audio decoder", 0 )
+ set_callbacks( OpenDecoder, CloseDecoder )
add_submodule ()
set_section( N_( "Dump decoder" ), NULL )
@@ -58,6 +62,10 @@ vlc_module_begin ()
set_capability( "decoder", -1 )
set_callbacks( OpenDecoderDump, CloseDecoder )
add_shortcut( "dump" )
+ add_submodule()
+ add_shortcut( "dump")
+ set_capability( "audio decoder", 0 )
+ set_callbacks( OpenDecoderDump, CloseDecoder )
vlc_module_end ()
diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index ef40f3859f..7acbeef240 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -95,6 +95,11 @@ vlc_module_begin ()
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_VCODEC )
+ add_submodule()
+ add_shortcut("dmo")
+ set_capability( "audio decoder", 1 )
+ set_callbacks(DecoderOpen, DecoderClose)
+
# define ENC_CFG_PREFIX "sout-dmo-"
add_submodule ()
set_description( N_("DirectMedia Object encoder") )
diff --git a/modules/codec/faad.c b/modules/codec/faad.c
index 809983fd52..ec9e2abb6b 100644
--- a/modules/codec/faad.c
+++ b/modules/codec/faad.c
@@ -52,7 +52,7 @@ static void Close( vlc_object_t * );
vlc_module_begin ()
set_description( N_("AAC audio decoder (using libfaad2)") )
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
set_callbacks( Open, Close )
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 7d2913a40d..7a831cca7f 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -162,7 +162,7 @@ vlc_module_begin ()
add_shortcut( "flac" )
set_description( N_("Flac audio decoder") )
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
set_callbacks( OpenDecoder, CloseDecoder )
#ifdef ENABLE_SOUT
diff --git a/modules/codec/fluidsynth.c b/modules/codec/fluidsynth.c
index 93c803a4b7..54b3f1d0f4 100644
--- a/modules/codec/fluidsynth.c
+++ b/modules/codec/fluidsynth.c
@@ -68,7 +68,7 @@ static void Close (vlc_object_t *);
vlc_module_begin ()
set_description (N_("FluidSynth MIDI synthesizer"))
- set_capability ("decoder", 100)
+ set_capability ("audio decoder", 100)
set_shortname (N_("FluidSynth"))
set_category (CAT_INPUT)
set_subcategory (SUBCAT_INPUT_ACODEC)
diff --git a/modules/codec/g711.c b/modules/codec/g711.c
index 95483e8026..e938efb637 100644
--- a/modules/codec/g711.c
+++ b/modules/codec/g711.c
@@ -44,7 +44,7 @@ static block_t *EncoderEncode( encoder_t *, block_t * );
vlc_module_begin ()
set_description( N_("G.711 decoder") )
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
set_callbacks( DecoderOpen, DecoderClose )
diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index b7210f980b..eba8ba0f92 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -58,7 +58,7 @@ vlc_module_begin ()
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
set_description( N_("Linear PCM audio decoder") )
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
set_callbacks( OpenDecoder, CloseCommon )
add_submodule ()
diff --git a/modules/codec/mad.c b/modules/codec/mad.c
index 635b2eadcd..e6f50956c9 100644
--- a/modules/codec/mad.c
+++ b/modules/codec/mad.c
@@ -76,7 +76,7 @@ vlc_module_begin ()
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
set_description( N_("MPEG audio layer I/II/III decoder") )
- set_capability( "decoder", 99 )
+ set_capability( "audio decoder", 99 )
set_callbacks( Open, Close )
vlc_module_end ()
diff --git a/modules/codec/mft.c b/modules/codec/mft.c
index 84cbb65829..a974745d5e 100644
--- a/modules/codec/mft.c
+++ b/modules/codec/mft.c
@@ -65,6 +65,11 @@ vlc_module_begin()
set_callbacks(Open, Close)
set_category(CAT_INPUT)
set_subcategory(SUBCAT_INPUT_VCODEC)
+
+ add_submodule()
+ add_shortcut("mft")
+ set_capability("audio decoder", 1)
+ set_callbacks(Open, Close)
vlc_module_end()
typedef struct
diff --git a/modules/codec/mpg123.c b/modules/codec/mpg123.c
index dcddafa0a1..52b5921b7a 100644
--- a/modules/codec/mpg123.c
+++ b/modules/codec/mpg123.c
@@ -65,7 +65,7 @@ vlc_module_begin ()
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
set_description( N_("MPEG audio decoder using mpg123") )
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
set_shortname( "mpg123" )
set_callbacks( OpenDecoder, CloseDecoder )
vlc_module_end ()
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 5ce756344c..ac8123ceb4 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -190,10 +190,18 @@ vlc_module_begin ()
set_callbacks(OpenDecoderNdk, CloseDecoder)
add_shortcut("mediacodec_ndk")
add_submodule ()
+ set_capability("audio decoder", 0)
+ set_callbacks(OpenDecoderNdk, CloseDecoder)
+ add_shortcut("mediacodec_ndk")
+ add_submodule ()
set_description("Video decoder using Android MediaCodec via JNI")
set_capability("decoder", 0)
set_callbacks(OpenDecoderJni, CloseDecoder)
add_shortcut("mediacodec_jni")
+ add_submodule ()
+ set_capability("audio decoder", 0)
+ set_callbacks(OpenDecoderJni, CloseDecoder)
+ add_shortcut("mediacodec_jni")
vlc_module_end ()
static void CSDFree(decoder_t *p_dec)
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 2ae9bb1874..130170bfa3 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -157,6 +157,15 @@ vlc_module_begin ()
set_capability( "decoder", 80 )
#endif
set_callbacks( OpenDecoder, CloseGeneric )
+#ifndef __ANDROID__
+ add_submodule()
+# if defined(USE_IOMX)
+ set_capability("audio decoder", 0)
+# else
+ set_capability("audio decoder", 80)
+# endif
+ set_callbacks(OpenDecoder, CloseGeneric)
+#endif
add_submodule ()
set_section( N_("Encoding") , NULL )
@@ -1008,11 +1017,6 @@ static int OpenDecoder( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t*)p_this;
int status;
-#ifdef __ANDROID__
- if( p_dec->fmt_in.i_cat == AUDIO_ES )
- return VLC_EGENERIC;
-#endif
-
if( 0 || !GetOmxRole(p_dec->fmt_in.i_codec, p_dec->fmt_in.i_cat, false) )
return VLC_EGENERIC;
diff --git a/modules/codec/opus.c b/modules/codec/opus.c
index ca136cb36a..a5953bc231 100644
--- a/modules/codec/opus.c
+++ b/modules/codec/opus.c
@@ -60,7 +60,7 @@ vlc_module_begin ()
set_subcategory( SUBCAT_INPUT_ACODEC )
set_description( N_("Opus audio decoder") )
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
set_shortname( N_("Opus") )
set_callbacks( OpenDecoder, CloseDecoder )
diff --git a/modules/codec/spdif.c b/modules/codec/spdif.c
index 7edba69f38..db25526781 100644
--- a/modules/codec/spdif.c
+++ b/modules/codec/spdif.c
@@ -34,7 +34,7 @@ vlc_module_begin()
set_category(CAT_INPUT)
set_subcategory(SUBCAT_INPUT_ACODEC)
set_description(N_("S/PDIF pass-through decoder"))
- set_capability("decoder", 120)
+ set_capability("audio decoder", 120)
set_callbacks(OpenDecoder, NULL)
vlc_module_end()
diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index 6cec5696d4..9ada14c7a1 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -96,7 +96,7 @@ vlc_module_begin ()
set_subcategory( SUBCAT_INPUT_ACODEC )
set_description( N_("Speex audio decoder") )
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
set_shortname( N_("Speex") )
set_callbacks( OpenDecoder, CloseDecoder )
diff --git a/modules/codec/uleaddvaudio.c b/modules/codec/uleaddvaudio.c
index cc1dcb9c2a..b6bff684e9 100644
--- a/modules/codec/uleaddvaudio.c
+++ b/modules/codec/uleaddvaudio.c
@@ -39,7 +39,7 @@ static void Close(vlc_object_t *);
vlc_module_begin()
set_description(N_("Ulead DV audio decoder"))
- set_capability("decoder", 50)
+ set_capability("audio decoder", 50)
set_category(CAT_INPUT)
set_subcategory(SUBCAT_INPUT_ACODEC)
set_callbacks(Open, Close)
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 6f6ed8ba54..4623e38a1e 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -188,9 +188,9 @@ vlc_module_begin ()
set_shortname( "Vorbis" )
set_description( N_("Vorbis audio decoder") )
#ifdef MODULE_NAME_IS_tremor
- set_capability( "decoder", 90 )
+ set_capability( "audio decoder", 90 )
#else
- set_capability( "decoder", 100 )
+ set_capability( "audio decoder", 100 )
#endif
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
diff --git a/modules/codec/wmafixed/wma.c b/modules/codec/wmafixed/wma.c
index a7abfb27cb..d62c64c866 100644
--- a/modules/codec/wmafixed/wma.c
+++ b/modules/codec/wmafixed/wma.c
@@ -81,7 +81,7 @@ vlc_module_begin();
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_ACODEC );
set_description( _("WMA v1/v2 fixed point audio decoder") );
- set_capability( "decoder", 80 );
+ set_capability( "audio decoder", 80 );
add_shortcut( "wmafixed" )
set_callbacks( OpenDecoder, CloseDecoder );
vlc_module_end();
diff --git a/modules/misc/stats.c b/modules/misc/stats.c
index 85bd1d2594..f8c8781bac 100644
--- a/modules/misc/stats.c
+++ b/modules/misc/stats.c
@@ -223,6 +223,12 @@ vlc_module_begin ()
set_capability( "decoder", 0 )
add_shortcut( "stats" )
set_callbacks( OpenDecoder, NULL )
+ add_submodule()
+ set_section( N_( "Stats decoder" ), NULL )
+ set_description( N_("Stats decoder function") )
+ set_capability( "audio decoder", 0 )
+ add_shortcut( "stats" )
+ set_callbacks( OpenDecoder, NULL )
add_submodule ()
set_section( N_( "Stats demux" ), NULL )
set_description( N_("Stats demux function") )
diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index f2f75d7aa2..67ab7ed500 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -175,7 +175,7 @@ int transcode_audio_new( sout_stream_t *p_stream,
id->p_decoder->pf_aout_format_update = audio_update_format;
/* id->p_decoder->p_cfg = p_sys->p_audio_cfg; */
id->p_decoder->p_module =
- module_need( id->p_decoder, "decoder", "$codec", false );
+ module_need( id->p_decoder, "audio decoder", "$codec", false );
if( !id->p_decoder->p_module )
{
msg_Err( p_stream, "cannot find audio decoder" );
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 7614b8b762..db9ff0531f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -173,7 +173,7 @@ static int LoadDecoder( decoder_t *p_dec, bool b_packetizer,
{
const char caps[ES_CATEGORY_COUNT][16] = {
[VIDEO_ES] = "decoder",
- [AUDIO_ES] = "decoder",
+ [AUDIO_ES] = "audio decoder",
[SPU_ES] = "decoder",
};
p_dec->p_module = module_need( p_dec, caps[p_dec->fmt_in.i_cat],
More information about the vlc-commits
mailing list