[vlc-devel] [PATCH 10/26] sout:encoder: set callbacks of audio encoders with set_callback_audio_encoder
Steve Lhomme
robux4 at ycbcr.xyz
Mon Jan 18 08:32:49 UTC 2021
---
modules/codec/araw.c | 8 +++-----
modules/codec/avcodec/avcodec.c | 5 ++---
modules/codec/avcodec/avcodec.h | 5 ++---
modules/codec/avcodec/encoder.c | 17 +++--------------
modules/codec/dmo/dmo.c | 26 ++++++--------------------
modules/codec/edummy.c | 9 +++------
modules/codec/fdkaac.c | 16 ++++++----------
modules/codec/flac.c | 13 +++++--------
modules/codec/g711.c | 9 +++------
modules/codec/lpcm.c | 13 +++++--------
modules/codec/opus.c | 14 +++++---------
modules/codec/shine.c | 14 ++++++--------
modules/codec/speex.c | 13 +++++--------
modules/codec/twolame.c | 13 +++++--------
modules/codec/vorbis.c | 13 +++++--------
modules/misc/stats.c | 9 +++------
16 files changed, 67 insertions(+), 130 deletions(-)
diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index 012bc64894d..b962a13a226 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -41,7 +41,7 @@
static int DecoderOpen ( vlc_object_t * );
#ifdef ENABLE_SOUT
-static int EncoderOpen ( vlc_object_t * );
+static int EncoderOpen ( encoder_t * );
#endif
vlc_module_begin ()
@@ -56,8 +56,7 @@ vlc_module_begin ()
/* audio encoder submodule */
add_submodule ()
set_description( N_("Raw audio encoder") )
- set_capability( "audio encoder", 150 )
- set_callback( EncoderOpen )
+ set_callback_audio_encoder( EncoderOpen, NULL, 150 )
#endif
vlc_module_end ()
@@ -796,9 +795,8 @@ static block_t *Encode( encoder_t *enc, block_t *in )
/**
* Probes the PCM audio encoder.
*/
-static int EncoderOpen( vlc_object_t *p_this )
+static int EncoderOpen( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
void (*encode)(void *, const uint8_t *, unsigned) = NULL;
switch( p_enc->fmt_out.i_codec )
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index 295f4fbc3c7..13e2e7af60a 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -144,11 +144,10 @@ vlc_module_begin ()
add_shortcut( "ffmpeg" )
set_section( N_("Encoding") , NULL )
set_description( N_("FFmpeg audio/video encoder") )
- set_callback_video_encoder( InitVideoEnc, EndVideoEnc, 100 )
+ set_callback_video_encoder( InitVideoEnc, EndEncoder, 100 )
add_submodule()
- set_capability( "audio encoder", 100 )
add_shortcut( "ffmpeg" )
- set_callbacks( InitAudioEnc, EndAudioEnc )
+ set_callback_audio_encoder( InitAudioEnc, EndEncoder, 100 )
/* removed in 2.1.0 */
add_obsolete_string( "sout-ffmpeg-codec" )
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index 00e0512f9db..e30d5a20f1d 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -31,7 +31,7 @@ vlc_fourcc_t GetVlcAudioFormat( int i_sample_fmt );
/* Video encoder module */
int InitVideoEnc ( encoder_t * );
-void EndVideoEnc( encoder_t * );
+void EndEncoder( encoder_t * );
/* Video Decoder */
int InitVideoDec( vlc_object_t * );
@@ -42,8 +42,7 @@ int InitAudioDec( vlc_object_t * );
void EndAudioDec( vlc_object_t * );
/* Audio encoder module */
-int InitAudioEnc ( vlc_object_t * );
-void EndAudioEnc( vlc_object_t * );
+int InitAudioEnc ( encoder_t * );
/* Subtitle Decoder */
int InitSubtitleDec( vlc_object_t * );
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 8aad59c9081..9addf873bd6 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -1063,9 +1063,8 @@ int InitVideoEnc( encoder_t *p_enc )
return res;
}
-int InitAudioEnc( vlc_object_t *p_this )
+int InitAudioEnc( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
int res = InitEncoder( p_enc );
if (res == VLC_SUCCESS)
p_enc->pf_encode_audio = EncodeAudio;
@@ -1467,9 +1466,9 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
}
/*****************************************************************************
- * EndVideoEnc: libavcodec encoder destruction
+ * EndEncoder: libavcodec encoder destruction
*****************************************************************************/
-static void EndEncoder( encoder_t *p_enc )
+void EndEncoder( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
@@ -1486,13 +1485,3 @@ static void EndEncoder( encoder_t *p_enc )
free( p_sys );
}
-
-void EndVideoEnc( encoder_t *p_enc )
-{
- EndEncoder( p_enc );
-}
-
-void EndAudioEnc( vlc_object_t *p_this )
-{
- EndEncoder( (encoder_t*)p_this );
-}
diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index 8593e510dcb..45b15f74e9a 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -56,10 +56,9 @@ static int DecoderOpen ( vlc_object_t * );
static void DecoderClose ( vlc_object_t * );
static int DecodeBlock ( decoder_t *, block_t * );
static void *DecoderThread( void * );
-static int EncoderAudioOpen ( vlc_object_t * );
+static int EncoderAudioOpen ( encoder_t * );
static int EncoderVideoOpen ( encoder_t * );
-static void EncoderAudioClose ( vlc_object_t * );
-static void EncoderVideoClose ( encoder_t * );
+static void EncoderClose ( encoder_t * );
static block_t *EncodeBlock( encoder_t *, block_t *, vlc_tick_t );
static int EncOpen ( encoder_t * );
@@ -84,10 +83,9 @@ vlc_module_begin ()
add_submodule ()
set_description( N_("DirectMedia Object encoder") )
add_shortcut( "dmo" )
- set_capability( "audio encoder", 10 )
- set_callbacks( EncoderAudioOpen, EncoderAudioClose )
+ set_callback_audio_encoder( EncoderAudioOpen, EncoderClose, 10 )
add_submodule()
- set_callback_video_encoder( EncoderVideoOpen, EncoderVideoClose, 100 )
+ set_callback_video_encoder( EncoderVideoOpen, EncoderClose, 100 )
vlc_module_end ()
@@ -1083,10 +1081,8 @@ static block_t * EncodeVideoBlock( encoder_t *p_enc, picture_t *p_pic )
/*****************************************************************************
* EncoderOpen: open dmo codec
*****************************************************************************/
-static int EncoderAudioOpen( vlc_object_t *p_this )
+static int EncoderAudioOpen( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t*)p_this;
-
int i_ret = EncOpen( p_enc );
if( i_ret != VLC_SUCCESS ) return i_ret;
@@ -1607,7 +1603,7 @@ static block_t *EncodeBlock( encoder_t *p_enc, block_t *p_block_in, vlc_tick_t i
/*****************************************************************************
* EncoderClose: close codec
*****************************************************************************/
-static void EncoderClose( encoder_t *p_enc )
+void EncoderClose( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
@@ -1621,13 +1617,3 @@ static void EncoderClose( encoder_t *p_enc )
free( p_sys );
}
-
-static void EncoderAudioClose ( vlc_object_t *p_this )
-{
- EncoderClose( (encoder_t*)p_this );
-}
-
-static void EncoderVideoClose ( encoder_t *p_enc )
-{
- EncoderClose( p_enc );
-}
diff --git a/modules/codec/edummy.c b/modules/codec/edummy.c
index 98daa9e3791..9694f01b0d7 100644
--- a/modules/codec/edummy.c
+++ b/modules/codec/edummy.c
@@ -31,14 +31,13 @@
#include <vlc_plugin.h>
#include <vlc_codec.h>
-static int OpenAudioEncoder( vlc_object_t * );
+static int OpenAudioEncoder( encoder_t * );
static int OpenVideoEncoder( encoder_t * );
vlc_module_begin ()
set_shortname( N_("Dummy") )
set_description( N_("Dummy encoder") )
- set_capability( "audio encoder", 0 )
- set_callbacks( OpenAudioEncoder, NULL )
+ set_callback_audio_encoder( OpenAudioEncoder, NULL, 0 )
add_shortcut( "dummy" )
add_submodule ()
set_callback_video_encoder( OpenVideoEncoder, NULL, 0 )
@@ -67,10 +66,8 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_buf )
/*****************************************************************************
* OpenDecoder: open the dummy encoder.
*****************************************************************************/
-static int OpenAudioEncoder( vlc_object_t *p_this )
+static int OpenAudioEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
-
p_enc->pf_encode_audio = EncodeAudio;
return VLC_SUCCESS;
diff --git a/modules/codec/fdkaac.c b/modules/codec/fdkaac.c
index ed8cc74b0f6..2048570fbf0 100644
--- a/modules/codec/fdkaac.c
+++ b/modules/codec/fdkaac.c
@@ -59,8 +59,8 @@
#include <vlc_plugin.h>
#include <vlc_codec.h>
-static int OpenEncoder(vlc_object_t *);
-static void CloseEncoder(vlc_object_t *);
+static int OpenEncoder(encoder_t *);
+static void CloseEncoder(encoder_t *);
#define ENC_CFG_PREFIX "sout-fdkaac-"
@@ -104,8 +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("audio encoder", 150)
- set_callbacks(OpenEncoder, CloseEncoder)
+ set_callback_audio_encoder(OpenEncoder, CloseEncoder, 150)
add_shortcut("fdkaac")
set_category(CAT_INPUT)
set_subcategory(SUBCAT_INPUT_ACODEC)
@@ -168,10 +167,8 @@ static const char *fdkaac_error(AACENC_ERROR erraac)
/*****************************************************************************
* OpenDecoder: open the encoder.
*****************************************************************************/
-static int OpenEncoder(vlc_object_t *p_this)
+static int OpenEncoder(encoder_t *p_enc)
{
- encoder_t *p_enc = (encoder_t *)p_this;
-
config_ChainParse(p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg);
int i_aot;
@@ -319,7 +316,7 @@ static int OpenEncoder(vlc_object_t *p_this)
return VLC_SUCCESS;
error:
- CloseEncoder(p_this);
+ CloseEncoder(p_enc);
return VLC_EGENERIC;
}
@@ -466,9 +463,8 @@ static block_t *EncodeAudio(encoder_t *p_enc, block_t *p_aout_buf)
/*****************************************************************************
* CloseDecoder: decoder destruction
*****************************************************************************/
-static void CloseEncoder(vlc_object_t *p_this)
+static void CloseEncoder(encoder_t *p_enc)
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys = p_enc->p_sys;
aacEncClose(&p_sys->handle);
diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index 7b6df530a8d..8c5d650e072 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -144,8 +144,8 @@ static int OpenDecoder ( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
#ifdef ENABLE_SOUT
-static int OpenEncoder ( vlc_object_t * );
-static void CloseEncoder ( vlc_object_t * );
+static int OpenEncoder ( encoder_t * );
+static void CloseEncoder ( encoder_t * );
#endif
static int DecodeBlock( decoder_t *, block_t * );
@@ -168,8 +168,7 @@ vlc_module_begin ()
add_submodule ()
add_shortcut( "flac" )
set_description( N_("Flac audio encoder") )
- set_capability( "audio encoder", 100 )
- set_callbacks( OpenEncoder, CloseEncoder )
+ set_callback_audio_encoder( OpenEncoder, CloseEncoder, 100 )
#endif
vlc_module_end ()
@@ -795,9 +794,8 @@ static void EncoderMetadataCallback( const FLAC__StreamEncoder *encoder,
/*****************************************************************************
* OpenEncoder: probe the encoder and return score
*****************************************************************************/
-static int OpenEncoder( vlc_object_t *p_this )
+static int OpenEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys;
if( p_enc->fmt_out.i_codec != VLC_CODEC_FLAC &&
@@ -908,9 +906,8 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
/*****************************************************************************
* CloseEncoder: encoder destruction
*****************************************************************************/
-static void CloseEncoder( vlc_object_t *p_this )
+static void CloseEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys = p_enc->p_sys;
FLAC__stream_encoder_delete( p_sys->p_flac );
diff --git a/modules/codec/g711.c b/modules/codec/g711.c
index e6301b1ea2e..46eb07276a0 100644
--- a/modules/codec/g711.c
+++ b/modules/codec/g711.c
@@ -36,7 +36,7 @@ static int DecodeBlock( decoder_t *, block_t * );
static void Flush( decoder_t * );
#ifdef ENABLE_SOUT
-static int EncoderOpen ( vlc_object_t * );
+static int EncoderOpen ( encoder_t * );
static block_t *EncoderEncode( encoder_t *, block_t * );
#endif
@@ -50,8 +50,7 @@ vlc_module_begin ()
#ifdef ENABLE_SOUT
add_submodule ()
set_description( N_("G.711 encoder") )
- set_capability( "audio encoder", 150 )
- set_callback( EncoderOpen )
+ set_callback_audio_encoder( EncoderOpen, NULL, 150 )
#endif
vlc_module_end ()
@@ -1145,10 +1144,8 @@ static const int8_t ulaw_encode[8193] =
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00
};
-static int EncoderOpen( vlc_object_t *p_this )
+static int EncoderOpen( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
-
if( p_enc->fmt_out.i_codec != VLC_CODEC_ALAW
&& p_enc->fmt_out.i_codec != VLC_CODEC_MULAW )
return VLC_EGENERIC;
diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index 4a948102cae..573730b9bf6 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -46,8 +46,8 @@ static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * );
#ifdef ENABLE_SOUT
-static int OpenEncoder ( vlc_object_t * );
-static void CloseEncoder ( vlc_object_t * );
+static int OpenEncoder ( encoder_t * );
+static void CloseEncoder ( encoder_t * );
static block_t *EncodeFrames( encoder_t *, block_t * );
#endif
@@ -67,8 +67,7 @@ vlc_module_begin ()
#ifdef ENABLE_SOUT
add_submodule ()
set_description( N_("Linear PCM audio encoder") )
- set_capability( "audio encoder", 100 )
- set_callbacks( OpenEncoder, CloseEncoder )
+ set_callback_audio_encoder( OpenEncoder, CloseEncoder, 100 )
add_shortcut( "lpcm" )
#endif
@@ -513,9 +512,8 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
/*****************************************************************************
* OpenEncoder: lpcm encoder construction
*****************************************************************************/
-static int OpenEncoder( vlc_object_t *p_this )
+static int OpenEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys;
/* We only support DVD LPCM yet. */
@@ -571,9 +569,8 @@ static int OpenEncoder( vlc_object_t *p_this )
/*****************************************************************************
* CloseEncoder: lpcm encoder destruction
*****************************************************************************/
-static void CloseEncoder ( vlc_object_t *p_this )
+static void CloseEncoder ( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys = p_enc->p_sys;
free( p_sys->p_buffer );
diff --git a/modules/codec/opus.c b/modules/codec/opus.c
index f170aab9720..8ef24e0e156 100644
--- a/modules/codec/opus.c
+++ b/modules/codec/opus.c
@@ -50,8 +50,8 @@
static int OpenDecoder ( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
#ifdef ENABLE_SOUT
-static int OpenEncoder ( vlc_object_t * );
-static void CloseEncoder ( vlc_object_t * );
+static int OpenEncoder ( encoder_t * );
+static void CloseEncoder ( encoder_t * );
#endif
vlc_module_begin ()
@@ -66,9 +66,8 @@ vlc_module_begin ()
#ifdef ENABLE_SOUT
add_submodule ()
set_description( N_("Opus audio encoder") )
- set_capability( "audio encoder", 150 )
set_shortname( N_("Opus") )
- set_callbacks( OpenEncoder, CloseEncoder )
+ set_callback_audio_encoder( OpenEncoder, CloseEncoder, 150 )
#endif
vlc_module_end ()
@@ -648,10 +647,8 @@ static block_t *Encode(encoder_t *enc, block_t *buf)
return result;
}
-static int OpenEncoder(vlc_object_t *p_this)
+static int OpenEncoder(encoder_t *enc)
{
- encoder_t *enc = (encoder_t *)p_this;
-
if (enc->fmt_out.i_codec != VLC_CODEC_OPUS)
return VLC_EGENERIC;
@@ -754,9 +751,8 @@ error:
return status;
}
-static void CloseEncoder(vlc_object_t *p_this)
+static void CloseEncoder(encoder_t *enc)
{
- encoder_t *enc = (encoder_t *)p_this;
encoder_sys_t *sys = enc->p_sys;
opus_multistream_encoder_destroy(sys->enc);
diff --git a/modules/codec/shine.c b/modules/codec/shine.c
index 153488705a9..180d4d951b3 100644
--- a/modules/codec/shine.c
+++ b/modules/codec/shine.c
@@ -55,8 +55,8 @@ typedef struct
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static int OpenEncoder ( vlc_object_t * );
-static void CloseEncoder ( vlc_object_t * );
+static int OpenEncoder ( encoder_t * );
+static void CloseEncoder ( encoder_t * );
static block_t *EncodeFrame ( encoder_t *, block_t * );
@@ -64,15 +64,13 @@ vlc_module_begin();
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_ACODEC );
set_description( N_("MP3 fixed point audio encoder") );
- set_capability( "audio encoder", 50 );
- set_callbacks( OpenEncoder, CloseEncoder );
+ set_callback_audio_encoder( OpenEncoder, CloseEncoder, 50 );
vlc_module_end();
static atomic_bool busy = ATOMIC_VAR_INIT(false);
-static int OpenEncoder( vlc_object_t *p_this )
+static int OpenEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t*)p_this;
encoder_sys_t *p_sys;
/* shine is an 'MP3' encoder */
@@ -273,9 +271,9 @@ static block_t *EncodeFrame( encoder_t *p_enc, block_t *p_block )
return p_chain;
}
-static void CloseEncoder( vlc_object_t *p_this )
+static void CloseEncoder( encoder_t *p_enc )
{
- encoder_sys_t *p_sys = ((encoder_t*)p_this)->p_sys;
+ encoder_sys_t *p_sys = p_enc->p_sys;
/* TODO: we should send the last PCM block padded with 0
* But we don't know if other blocks will come before it's too late */
diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index 9fa0e5a2740..c05adac7ecc 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -49,8 +49,8 @@ static int OpenPacketizer( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
#ifdef ENABLE_SOUT
-static int OpenEncoder ( vlc_object_t * );
-static void CloseEncoder ( vlc_object_t * );
+static int OpenEncoder ( encoder_t * );
+static void CloseEncoder ( encoder_t * );
#endif
#define ENC_CFG_PREFIX "sout-speex-"
@@ -107,8 +107,7 @@ vlc_module_begin ()
#ifdef ENABLE_SOUT
add_submodule ()
set_description( N_("Speex audio encoder") )
- set_capability( "audio encoder", 100 )
- set_callbacks( OpenEncoder, CloseEncoder )
+ set_callback_audio_encoder( OpenEncoder, CloseEncoder, 100 )
add_integer( ENC_CFG_PREFIX "mode", 0, ENC_MODE_TEXT,
ENC_MODE_LONGTEXT, false )
@@ -956,9 +955,8 @@ static block_t *Encode ( encoder_t *, block_t * );
/*****************************************************************************
* OpenEncoder: probe the encoder and return score
*****************************************************************************/
-static int OpenEncoder( vlc_object_t *p_this )
+static int OpenEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys;
const SpeexMode *p_speex_mode = &speex_nb_mode;
int i_tmp, i;
@@ -1180,9 +1178,8 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
/*****************************************************************************
* CloseEncoder: encoder destruction
*****************************************************************************/
-static void CloseEncoder( vlc_object_t *p_this )
+static void CloseEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys = p_enc->p_sys;
speex_encoder_destroy( p_sys->p_state );
diff --git a/modules/codec/twolame.c b/modules/codec/twolame.c
index 28bb0492ffb..dcd60da7ad4 100644
--- a/modules/codec/twolame.c
+++ b/modules/codec/twolame.c
@@ -41,8 +41,8 @@
/****************************************************************************
* Local prototypes
****************************************************************************/
-static int OpenEncoder ( vlc_object_t * );
-static void CloseEncoder ( vlc_object_t * );
+static int OpenEncoder ( encoder_t * );
+static void CloseEncoder ( encoder_t * );
static block_t *Encode ( encoder_t *, block_t * );
/*****************************************************************************
@@ -72,8 +72,7 @@ static const char *const ppsz_stereo_descriptions[] =
vlc_module_begin ()
set_shortname( "Twolame")
set_description( N_("Libtwolame audio encoder") )
- set_capability( "audio encoder", 120 )
- set_callbacks( OpenEncoder, CloseEncoder )
+ set_callback_audio_encoder( OpenEncoder, CloseEncoder, 120 )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACODEC )
@@ -123,9 +122,8 @@ static const uint16_t mpa_bitrate_tab[2][15] =
static const uint16_t mpa_freq_tab[6] =
{ 44100, 48000, 32000, 22050, 24000, 16000 };
-static int OpenEncoder( vlc_object_t *p_this )
+static int OpenEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys;
int i_frequency;
@@ -350,9 +348,8 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
/*****************************************************************************
* CloseEncoder: twolame encoder destruction
*****************************************************************************/
-static void CloseEncoder( vlc_object_t *p_this )
+static void CloseEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys = p_enc->p_sys;
twolame_close( &p_sys->p_twolame );
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 914346dc16a..725e958f877 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -161,8 +161,8 @@ static void ParseVorbisComments( decoder_t * );
static void ConfigureChannelOrder(uint8_t *, int, uint32_t );
#ifdef HAVE_VORBIS_ENCODER
-static int OpenEncoder ( vlc_object_t * );
-static void CloseEncoder ( vlc_object_t * );
+static int OpenEncoder ( encoder_t * );
+static void CloseEncoder ( encoder_t * );
static block_t *Encode ( encoder_t *, block_t * );
#endif
@@ -204,8 +204,7 @@ vlc_module_begin ()
# define ENC_CFG_PREFIX "sout-vorbis-"
add_submodule ()
set_description( N_("Vorbis audio encoder") )
- set_capability( "audio encoder", 130 )
- set_callbacks( OpenEncoder, CloseEncoder )
+ set_callback_audio_encoder( OpenEncoder, CloseEncoder, 130 )
add_integer( ENC_CFG_PREFIX "quality", 0, ENC_QUALITY_TEXT,
ENC_QUALITY_LONGTEXT, false )
@@ -752,9 +751,8 @@ typedef struct
/*****************************************************************************
* OpenEncoder: probe the encoder and return score
*****************************************************************************/
-static int OpenEncoder( vlc_object_t *p_this )
+static int OpenEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys;
int i_quality, i_min_bitrate, i_max_bitrate;
ogg_packet header[3];
@@ -959,9 +957,8 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
/*****************************************************************************
* CloseEncoder: vorbis encoder destruction
*****************************************************************************/
-static void CloseEncoder( vlc_object_t *p_this )
+static void CloseEncoder( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys = p_enc->p_sys;
vorbis_block_clear( &p_sys->vb );
diff --git a/modules/misc/stats.c b/modules/misc/stats.c
index 7b33946bc8f..a4be15c0c03 100644
--- a/modules/misc/stats.c
+++ b/modules/misc/stats.c
@@ -119,11 +119,9 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_abuff )
return NULL;
}
-static int OpenAudioEncoder ( vlc_object_t *p_this )
+static int OpenAudioEncoder ( encoder_t *p_enc )
{
- encoder_t *p_enc = (encoder_t *)p_this;
-
- msg_Dbg( p_this, "opening stats encoder" );
+ msg_Dbg( p_enc, "opening stats encoder" );
p_enc->pf_encode_audio = EncodeAudio;
@@ -224,9 +222,8 @@ vlc_module_begin ()
set_callback_video_encoder( OpenVideoEncoder, NULL, 0 )
add_shortcut( "stats" )
add_submodule ()
- set_capability( "audio encoder", 0 )
add_shortcut( "stats" )
- set_callback( OpenAudioEncoder )
+ set_callback_audio_encoder( OpenAudioEncoder, NULL, 0 )
add_submodule ()
#endif
set_section( N_( "Stats decoder" ), NULL )
--
2.29.2
More information about the vlc-devel
mailing list