[vlc-commits] Remove ugly function casts in combined audio decoder/packetizer modules
Rémi Denis-Courmont
git at videolan.org
Thu Aug 25 19:08:26 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 25 18:53:38 2011 +0300| [63227deb43329b80385f87bed3a250756470a0a1] | committer: Rémi Denis-Courmont
Remove ugly function casts in combined audio decoder/packetizer modules
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=63227deb43329b80385f87bed3a250756470a0a1
---
modules/codec/a52.c | 10 ++++------
modules/codec/dts.c | 10 ++++------
modules/codec/lpcm.c | 10 ++++------
modules/codec/mpeg_audio.c | 10 ++++------
modules/codec/speex.c | 13 +++++--------
modules/codec/vorbis.c | 10 ++++------
6 files changed, 25 insertions(+), 38 deletions(-)
diff --git a/modules/codec/a52.c b/modules/codec/a52.c
index d2768a4..6bcfae9 100644
--- a/modules/codec/a52.c
+++ b/modules/codec/a52.c
@@ -98,7 +98,7 @@ enum {
/****************************************************************************
* Local prototypes
****************************************************************************/
-static void *DecodeBlock ( decoder_t *, block_t ** );
+static block_t *DecodeBlock ( decoder_t *, block_t ** );
static uint8_t *GetOutBuffer ( decoder_t *, block_t ** );
static aout_buffer_t *GetAoutBuffer( decoder_t * );
@@ -150,11 +150,9 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
/* Set callback */
if( b_packetizer )
- p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
+ p_dec->pf_packetize = DecodeBlock;
else
- p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
+ p_dec->pf_decode_audio = DecodeBlock;
return VLC_SUCCESS;
}
@@ -176,7 +174,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
****************************************************************************
* This function is called just after the thread is launched.
****************************************************************************/
-static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
+static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[VLC_A52_HEADER_SIZE];
diff --git a/modules/codec/dts.c b/modules/codec/dts.c
index 812c49f..c0e7448 100644
--- a/modules/codec/dts.c
+++ b/modules/codec/dts.c
@@ -105,7 +105,7 @@ enum {
* Local prototypes
****************************************************************************/
static int OpenCommon( vlc_object_t *, bool b_packetizer );
-static void *DecodeBlock( decoder_t *, block_t ** );
+static block_t *DecodeBlock( decoder_t *, block_t ** );
static inline int SyncCode( const uint8_t * );
static int SyncInfo( const uint8_t *, bool *, unsigned int *, unsigned int *,
@@ -165,10 +165,8 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
/* Set callback */
- p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
- p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
+ p_dec->pf_decode_audio = DecodeBlock;
+ p_dec->pf_packetize = DecodeBlock;
return VLC_SUCCESS;
}
@@ -176,7 +174,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
/****************************************************************************
* DecodeBlock: the whole thing
****************************************************************************/
-static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
+static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[DTS_HEADER_SIZE];
diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index cfba3fd..5d91ee1 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -162,7 +162,7 @@ typedef struct
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static void *DecodeFrame ( decoder_t *, block_t ** );
+static block_t *DecodeFrame ( decoder_t *, block_t ** );
/* */
static int VobHeader( unsigned *pi_rate,
@@ -266,10 +266,8 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
}
/* Set callback */
- p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
- DecodeFrame;
- p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
- DecodeFrame;
+ p_dec->pf_decode_audio = DecodeFrame;
+ p_dec->pf_packetize = DecodeFrame;
return VLC_SUCCESS;
}
@@ -287,7 +285,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
****************************************************************************
* Beware, this function must be fed with complete frames (PES packet).
*****************************************************************************/
-static void *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
+static block_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block;
diff --git a/modules/codec/mpeg_audio.c b/modules/codec/mpeg_audio.c
index 73373c3..26d7278 100644
--- a/modules/codec/mpeg_audio.c
+++ b/modules/codec/mpeg_audio.c
@@ -95,7 +95,7 @@ enum {
static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
-static void *DecodeBlock ( decoder_t *, block_t ** );
+static block_t *DecodeBlock ( decoder_t *, block_t ** );
static uint8_t *GetOutBuffer ( decoder_t *, block_t ** );
static aout_buffer_t *GetAoutBuffer( decoder_t * );
@@ -160,10 +160,8 @@ static int Open( vlc_object_t *p_this )
p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
/* Set callback */
- p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
- p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
+ p_dec->pf_decode_audio = DecodeBlock;
+ p_dec->pf_packetize = DecodeBlock;
/* Start with the minimum size for a free bitrate frame */
p_sys->i_free_frame_size = MPGA_HEADER_SIZE;
@@ -196,7 +194,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
****************************************************************************
* This function is called just after the thread is launched.
****************************************************************************/
-static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
+static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[MAD_BUFFER_GUARD];
diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index 5c3372d..5f3284a 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -185,7 +185,7 @@ static const int pi_channels_maps[6] =
* Local prototypes
****************************************************************************/
-static void *DecodeBlock ( decoder_t *, block_t ** );
+static block_t *DecodeBlock ( decoder_t *, block_t ** );
static aout_buffer_t *DecodeRtpSpeexPacket( decoder_t *, block_t **);
static int ProcessHeaders( decoder_t * );
static int ProcessInitialHeader ( decoder_t *, ogg_packet * );
@@ -233,16 +233,13 @@ static int OpenDecoder( vlc_object_t *p_this )
{
msg_Dbg( p_dec, "Using RTP version of Speex decoder @ rate %d.",
p_dec->fmt_in.audio.i_rate );
- p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
- DecodeRtpSpeexPacket;
+ p_dec->pf_decode_audio = DecodeRtpSpeexPacket;
}
else
{
- p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
+ p_dec->pf_decode_audio = DecodeBlock;
}
- p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
+ p_dec->pf_packetize = DecodeBlock;
p_sys->p_state = NULL;
p_sys->p_header = NULL;
@@ -271,7 +268,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
****************************************************************************
* This function must be fed with ogg packets.
****************************************************************************/
-static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
+static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
ogg_packet oggpacket;
diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 85640c0..6b42f98 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -141,7 +141,7 @@ static const uint32_t pi_3channels_in[] =
static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * );
static void CloseDecoder ( vlc_object_t * );
-static void *DecodeBlock ( decoder_t *, block_t ** );
+static block_t *DecodeBlock ( decoder_t *, block_t ** );
static int ProcessHeaders( decoder_t * );
static void *ProcessPacket ( decoder_t *, ogg_packet *, block_t ** );
@@ -261,10 +261,8 @@ static int OpenDecoder( vlc_object_t *p_this )
#endif
/* Set callbacks */
- p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
- p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
- DecodeBlock;
+ p_dec->pf_decode_audio = DecodeBlock;
+ p_dec->pf_packetize = DecodeBlock;
return VLC_SUCCESS;
}
@@ -289,7 +287,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
****************************************************************************
* This function must be fed with ogg packets.
****************************************************************************/
-static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
+static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
ogg_packet oggpacket;
More information about the vlc-commits
mailing list