# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#ifdef HAVE_UNISTD_H
/*****************************************************************************
* Module descriptor
*****************************************************************************/
-vlc_module_begin();
- set_category( CAT_AUDIO );
- set_subcategory( SUBCAT_AUDIO_MISC );
- set_description( _("Audio filter for DTS->S/PDIF encapsulation") );
- set_capability( "audio filter", 10 );
- set_callbacks( Create, Close );
-vlc_module_end();
+vlc_module_begin ()
+ set_category( CAT_AUDIO )
+ set_subcategory( SUBCAT_AUDIO_MISC )
+ set_description( N_("Audio filter for DTS->S/PDIF encapsulation") )
+ set_capability( "audio filter", 10 )
+ set_callbacks( Create, Close )
+vlc_module_end ()
/*****************************************************************************
* Create:
}
/* Allocate the memory needed to store the module's structure */
- p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) );
- if( p_filter->p_sys == NULL )
- {
- msg_Err( p_filter, "out of memory" );
+ p_filter->p_sys = calloc( 1, sizeof(struct aout_filter_sys_t) );
+ if( !p_filter->p_sys )
return VLC_ENOMEM;
- }
- memset( p_filter->p_sys, 0, sizeof(struct aout_filter_sys_t) );
- p_filter->p_sys->p_buf = 0;
p_filter->pf_do_work = DoWork;
p_filter->b_in_place = 1;
if( p_in_buf->i_nb_bytes != p_filter->p_sys->i_frame_size )
{
/* Frame size changed, reset everything */
- msg_Warn( p_aout, "Frame size changed from %d to %d, resetting everything.",
- p_filter->p_sys->i_frame_size, p_in_buf->i_nb_bytes );
+ msg_Warn( p_aout, "Frame size changed from %u to %u, "
+ "resetting everything.",
+ p_filter->p_sys->i_frame_size,
+ (unsigned)p_in_buf->i_nb_bytes );
p_filter->p_sys->i_frame_size = p_in_buf->i_nb_bytes;
p_filter->p_sys->p_buf = realloc( p_filter->p_sys->p_buf,
/* We are dealing with a big endian bitstream and a little endian output
* or a little endian bitstream and a big endian output.
* Byteswap the stream */
-#ifdef HAVE_SWAB
swab( p_in, p_out + 8, i_length );
-#else
- uint16_t i;
- uint8_t * p_tmp, tmp;
- p_tmp = p_out + 8;
- for( i = i_length / 2 ; i-- ; )
- {
- tmp = p_in[0]; /* in-place filter */
- p_tmp[0] = p_in[1];
- p_tmp[1] = tmp;
- p_tmp += 2; p_in += 2;
- }
-#endif
+
/* If i_length is odd, we have to adjust swapping a bit.. */
if( i_length & 1 )
{