X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Faudio_output%2Fesd.c;h=b56b99cb9890facf6927a0e228a3700306096683;hb=2de5a8f49b5fd8ffed2919d665ccf744bb66a1aa;hp=02745c77be4fcb91fcbd2d77a38ece5fe5353d48;hpb=85b29bdc288a1573d43bd524908be5748a9b3640;p=vlc diff --git a/modules/audio_output/esd.c b/modules/audio_output/esd.c index 02745c77be..b56b99cb98 100644 --- a/modules/audio_output/esd.c +++ b/modules/audio_output/esd.c @@ -1,7 +1,7 @@ /***************************************************************************** * esd.c : EsounD module ***************************************************************************** - * Copyright (C) 2000, 2001 VideoLAN (Centrale Réseaux) and its contributors + * Copyright (C) 2000, 2001 the VideoLAN team * $Id$ * * Authors: Samuel Hocevar @@ -18,21 +18,22 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ #include /* ENOMEM */ -#include /* open(), O_WRONLY */ -#include /* strerror() */ #include /* write(), close() */ -#include /* calloc(), malloc(), free() */ -#include -#include -#include "aout_internal.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include #include @@ -66,10 +67,10 @@ static void Play ( aout_instance_t * ); * Module descriptor *****************************************************************************/ vlc_module_begin(); - set_description( _("EsounD audio output") ); + set_description( N_("EsounD audio output") ); set_shortname( "EsounD" ); set_capability( "audio output", 50 ); - add_string( "esdserver", "", NULL, N_("Esound server"), NULL, VLC_FALSE ); + add_string( "esdserver", "", NULL, N_("Esound server"), NULL, false ); set_category( CAT_AUDIO ); set_subcategory( SUBCAT_AUDIO_AOUT ); set_callbacks( Open, Close ); @@ -90,10 +91,7 @@ static int Open( vlc_object_t *p_this ) /* Allocate structure */ p_sys = malloc( sizeof( aout_sys_t ) ); if( p_sys == NULL ) - { - msg_Err( p_aout, "out of memory" ); return VLC_ENOMEM; - } p_aout->output.p_sys = p_sys; @@ -148,6 +146,7 @@ static int Open( vlc_object_t *p_this ) { msg_Err( p_aout, "cannot open esound socket (format 0x%08x at %d Hz)", p_sys->esd_format, p_aout->output.output.i_rate ); + free( psz_server ); free( p_sys ); return VLC_EGENERIC; } @@ -169,7 +168,7 @@ static int Open( vlc_object_t *p_this ) { p_sys->latency = 0; } - + /* ESD latency is calculated for 44100 Hz. We don't have any way to get the * number of buffered samples, so I assume ESD_BUF_SIZE/2 */ p_sys->latency += @@ -182,6 +181,7 @@ static int Open( vlc_object_t *p_this ) / p_aout->output.output.i_bytes_per_frame / p_aout->output.output.i_rate; + free( psz_server ); close( i_newfd ); return VLC_SUCCESS; } @@ -199,16 +199,16 @@ static void Play( aout_instance_t *p_aout ) if ( p_buffer != NULL ) { - int pos; - char *data = p_buffer->p_buffer; + unsigned int pos; + unsigned char *data = p_buffer->p_buffer; - for( pos = 0; pos + ESD_BUF_SIZE <= p_buffer->i_nb_bytes; + for( pos = 0; pos + ESD_BUF_SIZE <= p_buffer->i_nb_bytes; pos += ESD_BUF_SIZE ) { i_tmp = write( p_sys->i_fd, data + pos, ESD_BUF_SIZE ); if( i_tmp < 0 ) { - msg_Err( p_aout, "write failed (%s)", strerror(errno) ); + msg_Err( p_aout, "write failed (%m)" ); } } aout_BufferFree( p_buffer ); @@ -233,7 +233,7 @@ static void Close( vlc_object_t *p_this ) ***************************************************************************** * This function writes a buffer of i_length bytes in the socket *****************************************************************************/ -static void Play( aout_thread_t *p_aout, byte_t *buffer, int i_size ) +static void Play( aout_thread_t *p_aout, uint8_t *buffer, int i_size ) { int i_amount;