Commit 63227deb authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove ugly function casts in combined audio decoder/packetizer modules

parent 0dfcbe01
...@@ -98,7 +98,7 @@ enum { ...@@ -98,7 +98,7 @@ enum {
/**************************************************************************** /****************************************************************************
* Local prototypes * 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 uint8_t *GetOutBuffer ( decoder_t *, block_t ** );
static aout_buffer_t *GetAoutBuffer( decoder_t * ); static aout_buffer_t *GetAoutBuffer( decoder_t * );
...@@ -150,11 +150,9 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer ) ...@@ -150,11 +150,9 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
/* Set callback */ /* Set callback */
if( b_packetizer ) if( b_packetizer )
p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **)) p_dec->pf_packetize = DecodeBlock;
DecodeBlock;
else else
p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **)) p_dec->pf_decode_audio = DecodeBlock;
DecodeBlock;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -176,7 +174,7 @@ static int OpenPacketizer( vlc_object_t *p_this ) ...@@ -176,7 +174,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
**************************************************************************** ****************************************************************************
* This function is called just after the thread is launched. * 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; decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[VLC_A52_HEADER_SIZE]; uint8_t p_header[VLC_A52_HEADER_SIZE];
......
...@@ -105,7 +105,7 @@ enum { ...@@ -105,7 +105,7 @@ enum {
* Local prototypes * Local prototypes
****************************************************************************/ ****************************************************************************/
static int OpenCommon( vlc_object_t *, bool b_packetizer ); 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 inline int SyncCode( const uint8_t * );
static int SyncInfo( const uint8_t *, bool *, unsigned int *, unsigned int *, 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 ) ...@@ -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 */ p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
/* Set callback */ /* Set callback */
p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **)) p_dec->pf_decode_audio = DecodeBlock;
DecodeBlock; p_dec->pf_packetize = DecodeBlock;
p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
DecodeBlock;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -176,7 +174,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer ) ...@@ -176,7 +174,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
/**************************************************************************** /****************************************************************************
* DecodeBlock: the whole thing * 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; decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[DTS_HEADER_SIZE]; uint8_t p_header[DTS_HEADER_SIZE];
......
...@@ -162,7 +162,7 @@ typedef struct ...@@ -162,7 +162,7 @@ typedef struct
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static void *DecodeFrame ( decoder_t *, block_t ** ); static block_t *DecodeFrame ( decoder_t *, block_t ** );
/* */ /* */
static int VobHeader( unsigned *pi_rate, static int VobHeader( unsigned *pi_rate,
...@@ -266,10 +266,8 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer ) ...@@ -266,10 +266,8 @@ static int OpenCommon( vlc_object_t *p_this, bool b_packetizer )
} }
/* Set callback */ /* Set callback */
p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **)) p_dec->pf_decode_audio = DecodeFrame;
DecodeFrame; p_dec->pf_packetize = DecodeFrame;
p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
DecodeFrame;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -287,7 +285,7 @@ static int OpenPacketizer( vlc_object_t *p_this ) ...@@ -287,7 +285,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
**************************************************************************** ****************************************************************************
* Beware, this function must be fed with complete frames (PES packet). * 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; decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block; block_t *p_block;
......
...@@ -95,7 +95,7 @@ enum { ...@@ -95,7 +95,7 @@ enum {
static int OpenDecoder ( vlc_object_t * ); static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * ); static int OpenPacketizer( vlc_object_t * );
static void CloseDecoder ( 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 uint8_t *GetOutBuffer ( decoder_t *, block_t ** );
static aout_buffer_t *GetAoutBuffer( decoder_t * ); static aout_buffer_t *GetAoutBuffer( decoder_t * );
...@@ -160,10 +160,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -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 */ p_dec->fmt_out.audio.i_rate = 0; /* So end_date gets initialized */
/* Set callback */ /* Set callback */
p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **)) p_dec->pf_decode_audio = DecodeBlock;
DecodeBlock; p_dec->pf_packetize = DecodeBlock;
p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
DecodeBlock;
/* Start with the minimum size for a free bitrate frame */ /* Start with the minimum size for a free bitrate frame */
p_sys->i_free_frame_size = MPGA_HEADER_SIZE; p_sys->i_free_frame_size = MPGA_HEADER_SIZE;
...@@ -196,7 +194,7 @@ static int OpenPacketizer( vlc_object_t *p_this ) ...@@ -196,7 +194,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
**************************************************************************** ****************************************************************************
* This function is called just after the thread is launched. * 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; decoder_sys_t *p_sys = p_dec->p_sys;
uint8_t p_header[MAD_BUFFER_GUARD]; uint8_t p_header[MAD_BUFFER_GUARD];
......
...@@ -185,7 +185,7 @@ static const int pi_channels_maps[6] = ...@@ -185,7 +185,7 @@ static const int pi_channels_maps[6] =
* Local prototypes * 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 aout_buffer_t *DecodeRtpSpeexPacket( decoder_t *, block_t **);
static int ProcessHeaders( decoder_t * ); static int ProcessHeaders( decoder_t * );
static int ProcessInitialHeader ( decoder_t *, ogg_packet * ); static int ProcessInitialHeader ( decoder_t *, ogg_packet * );
...@@ -233,16 +233,13 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -233,16 +233,13 @@ static int OpenDecoder( vlc_object_t *p_this )
{ {
msg_Dbg( p_dec, "Using RTP version of Speex decoder @ rate %d.", msg_Dbg( p_dec, "Using RTP version of Speex decoder @ rate %d.",
p_dec->fmt_in.audio.i_rate ); p_dec->fmt_in.audio.i_rate );
p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **)) p_dec->pf_decode_audio = DecodeRtpSpeexPacket;
DecodeRtpSpeexPacket;
} }
else else
{ {
p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **)) p_dec->pf_decode_audio = DecodeBlock;
DecodeBlock;
} }
p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **)) p_dec->pf_packetize = DecodeBlock;
DecodeBlock;
p_sys->p_state = NULL; p_sys->p_state = NULL;
p_sys->p_header = NULL; p_sys->p_header = NULL;
...@@ -271,7 +268,7 @@ static int OpenPacketizer( vlc_object_t *p_this ) ...@@ -271,7 +268,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
**************************************************************************** ****************************************************************************
* This function must be fed with ogg packets. * 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; decoder_sys_t *p_sys = p_dec->p_sys;
ogg_packet oggpacket; ogg_packet oggpacket;
......
...@@ -141,7 +141,7 @@ static const uint32_t pi_3channels_in[] = ...@@ -141,7 +141,7 @@ static const uint32_t pi_3channels_in[] =
static int OpenDecoder ( vlc_object_t * ); static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * ); static int OpenPacketizer( vlc_object_t * );
static void CloseDecoder ( 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 int ProcessHeaders( decoder_t * );
static void *ProcessPacket ( decoder_t *, ogg_packet *, block_t ** ); static void *ProcessPacket ( decoder_t *, ogg_packet *, block_t ** );
...@@ -261,10 +261,8 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -261,10 +261,8 @@ static int OpenDecoder( vlc_object_t *p_this )
#endif #endif
/* Set callbacks */ /* Set callbacks */
p_dec->pf_decode_audio = (aout_buffer_t *(*)(decoder_t *, block_t **)) p_dec->pf_decode_audio = DecodeBlock;
DecodeBlock; p_dec->pf_packetize = DecodeBlock;
p_dec->pf_packetize = (block_t *(*)(decoder_t *, block_t **))
DecodeBlock;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -289,7 +287,7 @@ static int OpenPacketizer( vlc_object_t *p_this ) ...@@ -289,7 +287,7 @@ static int OpenPacketizer( vlc_object_t *p_this )
**************************************************************************** ****************************************************************************
* This function must be fed with ogg packets. * 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; decoder_sys_t *p_sys = p_dec->p_sys;
ogg_packet oggpacket; ogg_packet oggpacket;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment