[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[121] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2010-01-23 17:56:47
|
Revision: 121 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=121&view=rev Author: nickols_k Date: 2010-01-23 17:56:40 +0000 (Sat, 23 Jan 2010) Log Message: ----------- sign correctness and minor cleanups Modified Paths: -------------- mplayerxp/dec_ahead.c mplayerxp/libao2/ao_alsa9.c mplayerxp/libao2/ao_arts.c mplayerxp/libao2/ao_esd.c mplayerxp/libao2/ao_jack.c mplayerxp/libao2/ao_nas.c mplayerxp/libao2/ao_null.c mplayerxp/libao2/ao_openal.c mplayerxp/libao2/ao_oss.c mplayerxp/libao2/ao_sdl.c mplayerxp/libao2/ao_wav.c mplayerxp/libao2/audio_out.c mplayerxp/libao2/audio_out.h mplayerxp/libao2/audio_out_internal.h mplayerxp/libmpcodecs/ad.h mplayerxp/libmpcodecs/ad_a52.c mplayerxp/libmpcodecs/ad_acm.c mplayerxp/libmpcodecs/ad_dca.c mplayerxp/libmpcodecs/ad_dmo.c mplayerxp/libmpcodecs/ad_dshow.c mplayerxp/libmpcodecs/ad_dvdpcm.c mplayerxp/libmpcodecs/ad_faad.c mplayerxp/libmpcodecs/ad_ffmp3.c mplayerxp/libmpcodecs/ad_hwac3.c mplayerxp/libmpcodecs/ad_internal.h mplayerxp/libmpcodecs/ad_libdv.c mplayerxp/libmpcodecs/ad_mp3.c mplayerxp/libmpcodecs/ad_null.c mplayerxp/libmpcodecs/ad_pcm.c mplayerxp/libmpcodecs/ad_qtaudio.c mplayerxp/libmpcodecs/ad_real.c mplayerxp/libmpcodecs/ad_twin.c mplayerxp/libmpcodecs/ad_vorbis.c mplayerxp/libmpcodecs/dec_audio.c mplayerxp/libmpcodecs/dec_audio.h mplayerxp/libmpcodecs/vd_ffmpeg.c mplayerxp/libmpdemux/demux_avi.c mplayerxp/libmpdemux/demux_mov.c mplayerxp/libmpdemux/demux_mpg.c mplayerxp/libvo/font_load.c mplayerxp/mplayer.c mplayerxp/osdep/timer-lx.c mplayerxp/sig_hand.c Modified: mplayerxp/dec_ahead.c =================================================================== --- mplayerxp/dec_ahead.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/dec_ahead.c 2010-01-23 17:56:40 UTC (rev 121) @@ -110,9 +110,9 @@ extern int init_audio_buffer(int size, int min_reserv, int indices, sh_audio_t *sh_audio); extern void uninit_audio_buffer(void); -extern int read_audio_buffer(sh_audio_t *audio, unsigned char *buffer, int minlen, int maxlen ); +extern int read_audio_buffer(sh_audio_t *audio, unsigned char *buffer, unsigned minlen, unsigned maxlen ); extern float get_delay_audio_buffer(void); -extern int decode_audio_buffer(int len); +extern int decode_audio_buffer(unsigned len); extern void reset_audio_buffer(void); extern int get_len_audio_buffer(void); extern int get_free_audio_buffer(void); @@ -203,7 +203,7 @@ UNLOCK_VDEC_LOCKED(); UNLOCK_VDEC_ACTIVE(); if(xp_is_bad_pts) mpeg_timer=HUGE; - dec_ahead_in_lseek=NoSeek; + dec_ahead_in_lseek=NoSeek; MSG_T("\nDEC_AHEAD: reset counters to (%u %u) due lseek\n",dec_ahead_locked_frame,abs_dec_ahead_locked_frame); pinfo[xp_id].current_module = "dec_ahead 3"; } @@ -233,14 +233,14 @@ xp_eof=0; continue; } - break; + break; } /* in_size==0: it's or broken stream or demuxer's bug */ if(in_size==0 && !pthread_end_of_work) { dec_ahead_in_lseek=NoSeek; continue; } - if(xp_is_bad_pts) + if(xp_is_bad_pts) { if(mpeg_timer==HUGE)mpeg_timer=v_pts; else if( mpeg_timer-duration<v_pts ) { @@ -348,11 +348,11 @@ if(dec_ahead_in_lseek!=NoSeek) continue; LOCK_VDECODING(); if(dec_ahead_in_lseek!=NoSeek) { - UNLOCK_VDECODING(); - continue; - } + UNLOCK_VDECODING(); + continue; + } #if 0 -/* +/* We can't seriously examine question of too slow machines by motivation reasons */ @@ -636,11 +636,11 @@ { int retval; retval = pthread_attr_setdetachstate(&our_attr,PTHREAD_CREATE_DETACHED); - if(retval) + if(retval) { if(verbose) printf("running thread: attr_setdetachstate fault!!!\n"); return retval; - } + } pthread_attr_setscope(&our_attr,PTHREAD_SCOPE_SYSTEM); if( has_xp_audio && enable_xp >= XP_VAPlay ) { @@ -648,7 +648,7 @@ if(retval) { if(verbose) printf("running audio thread: attr_setdetachstate fault!!!\n"); return retval; - } + } pthread_attr_setscope(&audio_attr,PTHREAD_SCOPE_SYSTEM); } @@ -749,26 +749,27 @@ volatile float dec_ahead_audio_delay; int xp_thread_decode_audio() { - int free_buf, len=0, vbuf_size, pref_buf; + int free_buf, vbuf_size, pref_buf; + unsigned len=0; if(dec_ahead_in_lseek) { xp_audio_eof = 0; reset_audio_buffer(); decode_audio_buffer(MAX_OUTBURST); return 1; - } + } free_buf = get_free_audio_buffer(); - + if( free_buf == -1 ) { /* End of file */ xp_audio_eof = 1; return 0; } - if( free_buf < sh_audio->audio_out_minsize ) /* full */ + if( free_buf < (int)sh_audio->audio_out_minsize ) /* full */ return 0; len = get_len_audio_buffer(); - + if( len < MAX_OUTBURST ) /* Buffer underrun */ return decode_audio_buffer(MAX_OUTBURST); Modified: mplayerxp/libao2/ao_alsa9.c =================================================================== --- mplayerxp/libao2/ao_alsa9.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_alsa9.c 2010-01-23 17:56:40 UTC (rev 121) @@ -2,11 +2,11 @@ ao_alsa9 - ALSA-0.9.x output plugin for MPlayer (C) Alex Beregszaszi <al...@na...> - + modified for real alsa-0.9.0-support by Joy Winter <jo...@pi...> additional AC3 passthrough support by Andy Lo A Foe <an...@al...> 08/22/2002 iec958-init rewritten and merged with common init, joy - + Any bugreports regarding to this driver are welcome. */ @@ -51,8 +51,8 @@ /* 16 sets buffersize to 16 * chunksize is as default 1024 * which seems to be good avarge for most situations * so buffersize is 16384 frames by default */ -static int alsa_fragcount = 16; -static int chunk_size = 1024; //is alsa_fragsize / 4 +static unsigned alsa_fragcount = 16; +static unsigned chunk_size = 1024; //is alsa_fragsize / 4 #define MIN_CHUNK_SIZE 1024 @@ -276,7 +276,7 @@ } } #endif - + } //end witch return(CONTROL_UNKNOWN); } @@ -353,17 +353,18 @@ open & setup audio device return: 1=success 0=fail */ -static int __FASTCALL__ init(int flags) +static int __FASTCALL__ init(unsigned flags) { int err; int cards = -1; - int period_val; + unsigned period_val; snd_pcm_info_t *alsa_info; char *str_block_mode; char *alsa_dev=NULL; char *alsa_port=NULL; char alsa_device[ALSA_DEVICE_SIZE]; + UNUSED(flags); alsa_handler = NULL; alsa_device[0]='\0'; @@ -504,7 +505,7 @@ MSG_ERR("alsa-init: error set block-mode %s\n", snd_strerror(err)); } else MSG_V("alsa-init: pcm opend in %s\n", str_block_mode); - + snd_pcm_hw_params_malloc(&alsa_hwparams); snd_pcm_sw_params_malloc(&alsa_swparams); @@ -558,7 +559,7 @@ //set period_count snd_pcm_hw_params_get_periods_max(alsa_hwparams,&period_val, 0); if (period_val < alsa_fragcount) { - alsa_fragcount = period_val; + alsa_fragcount = period_val; } MSG_V("alsa-init: current val=%i, fragcount=%i\n", period_val, alsa_fragcount); @@ -574,9 +575,10 @@ return 1; } // end init -static int __FASTCALL__ configure(int rate_hz, int channels, int format) +static int __FASTCALL__ configure(unsigned rate_hz, unsigned channels, unsigned format) { - int err,i; + int err; + unsigned i; snd_pcm_uframes_t dummy; MSG_V("alsa-conf: requested format: %d Hz, %d channels, %s\n", rate_hz, @@ -623,13 +625,13 @@ bytes_per_sample = ao_data.bps / ao_data.samplerate; if ((err = snd_pcm_hw_params_set_format(alsa_handler, alsa_hwparams, - alsa_format)) < 0) + alsa_format)) < 0) { MSG_ERR("alsa-conf: unable to set format(%s): %s\n", snd_pcm_format_name(alsa_format), snd_strerror(err)); MSG_HINT("Please try one of: "); - for(i=0;i<SND_PCM_FORMAT_LAST;i++) + for(i=0;i<SND_PCM_FORMAT_LAST;i++) if (!(snd_pcm_hw_params_test_format(alsa_handler, alsa_hwparams, i))) MSG_HINT("%s ",snd_pcm_format_name(i)); MSG_HINT("\n"); @@ -805,9 +807,10 @@ thanxs for marius <ma...@ro...> for giving us the light ;) */ -static int __FASTCALL__ play(void* data, int len, int flags) +static unsigned __FASTCALL__ play(void* data, unsigned len, unsigned flags) { - int num_frames; + unsigned num_frames; + UNUSED(flags); snd_pcm_sframes_t res = 0; len = len / ao_data.outburst * ao_data.outburst; num_frames = len / bytes_per_sample; @@ -844,20 +847,21 @@ } } while (res == 0); - return res < 0 ? res : res * bytes_per_sample; + return res * bytes_per_sample; } /* how many byes are free in the buffer */ -static int get_space(void) +static unsigned get_space(void) { snd_pcm_status_t *status; - int ret; + unsigned ret; + int err; snd_pcm_status_alloca(&status); - if ((ret = snd_pcm_status(alsa_handler, status)) < 0) + if ((err = snd_pcm_status(alsa_handler, status)) < 0) { - MSG_ERR("ao_alsa: cannot get PCM status: %s\n", snd_strerror(ret)); + MSG_ERR("ao_alsa: cannot get PCM status: %s\n", snd_strerror(err)); return 0; } Modified: mplayerxp/libao2/ao_arts.c =================================================================== --- mplayerxp/libao2/ao_arts.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_arts.c 2010-01-23 17:56:40 UTC (rev 121) @@ -48,13 +48,15 @@ static int control(int cmd, long arg) { + UNUSED(cmd); + UNUSED(arg); return CONTROL_UNKNOWN; } -static int init(int flags) +static int init(unsigned flags) { int err; - int frag_spec; + UNUSED(flags); if( (err=arts_init()) ) { MSG_ERR("[aRts] init failed: %s\n", arts_error_text(err)); @@ -65,9 +67,9 @@ return 1; } -static int __FASTCALL__ configure(int rate,int channels,int format) +static int __FASTCALL__ configure(unsigned rate,unsigned channels,unsigned format) { - int frag_spec,samplesize; + unsigned frag_spec,samplesize; /* * arts supports 8bit unsigned and 16bit signed sample formats * (16bit apparently in little endian format, even in the case @@ -137,9 +139,10 @@ arts_free(); } -static int play(void* data,int len,int flags) +static unsigned play(void* data,unsigned len,unsigned flags) { - return arts_write(stream, data, len); + UNUSED(flags); + return arts_write(stream, data, len); } static void audio_pause(void) @@ -154,7 +157,7 @@ { } -static int get_space(void) +static unsigned get_space(void) { return arts_stream_get(stream, ARTS_P_BUFFER_SPACE); } Modified: mplayerxp/libao2/ao_esd.c =================================================================== --- mplayerxp/libao2/ao_esd.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_esd.c 2010-01-23 17:56:40 UTC (rev 121) @@ -156,9 +156,10 @@ * open & setup audio device * return: 1=success 0=fail */ -static int init(int flags) +static int init(unsigned flags) { char *server = ao_subdevice; /* NULL for localhost */ + UNUSED(flags); if (esd_fd < 0) { esd_fd = esd_open_sound(server); if (esd_fd < 0) { @@ -166,9 +167,10 @@ return 0; } } + return 1; } -static int configure(int rate_hz, int channels, int format) +static int configure(unsigned rate_hz,unsigned channels,unsigned format) { char *server = ao_subdevice; /* NULL for localhost */ esd_format_t esd_fmt; @@ -310,17 +312,15 @@ * it should round it down to outburst*n * return: number of bytes played */ -static int play(void* data, int len, int flags) +static unsigned play(void* data, unsigned len, unsigned flags) { - int offs; - int nwritten; + unsigned offs; + unsigned nwritten; int nsamples; int n; - + UNUSED(flags); /* round down buffersize to a multiple of ESD_BUF_SIZE bytes */ len = len / ESD_BUF_SIZE * ESD_BUF_SIZE; - if (len <= 0) - return 0; #define SINGLE_WRITE 0 #if SINGLE_WRITE @@ -333,8 +333,9 @@ */ n = write(esd_play_fd, (char*)data + offs, ESD_BUF_SIZE); if ( n < 0 ) { - if ( errno != EAGAIN ) + if ( errno != EAGAIN ) { dprintf("esd play: write failed: %s\n", strerror(errno)); + } break; } else if ( n != ESD_BUF_SIZE ) { nwritten += n; @@ -404,12 +405,12 @@ /* * return: how many bytes can be played without blocking */ -static int get_space(void) +static unsigned get_space(void) { struct timeval tmout; fd_set wfds; float current_delay; - int space; + unsigned space; /* * Don't buffer too much data in the esd daemon. Modified: mplayerxp/libao2/ao_jack.c =================================================================== --- mplayerxp/libao2/ao_jack.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_jack.c 2010-01-23 17:56:40 UTC (rev 121) @@ -51,7 +51,7 @@ //! maximum number of channels supported, avoids lots of mallocs #define MAX_CHANS 6 static jack_port_t *ports[MAX_CHANS]; -static int num_ports; ///< Number of used ports == number of channels +static unsigned num_ports; ///< Number of used ports == number of channels static jack_client_t *client; static float jack_latency; static int estimate; @@ -121,9 +121,9 @@ * If there is not enough data in the buffer remaining parts will be filled * with silence. */ -static int read_buffer(float **bufs, int cnt, int num_bufs) { +static unsigned read_buffer(float **bufs, unsigned cnt, unsigned num_bufs) { struct deinterleave di = {bufs, num_bufs, 0, 0}; - int buffered = cb_fifo_size(buffer); + unsigned buffered = cb_fifo_size(buffer); if (cnt * sizeof(float) * num_bufs > buffered) { silence(bufs, cnt, num_bufs); cnt = buffered / sizeof(float) / num_bufs; @@ -135,6 +135,8 @@ // end ring buffer stuff static int control(int cmd, long arg) { + UNUSED(cmd); + UNUSED(arg); return CONTROL_UNKNOWN; } @@ -160,7 +162,8 @@ */ static int outputaudio(jack_nframes_t nframes, void *arg) { float *bufs[MAX_CHANS]; - int i; + unsigned i; + UNUSED(arg); for (i = 0; i < num_ports; i++) bufs[i] = jack_port_get_buffer(ports[i], nframes); if (paused || underrun) @@ -180,6 +183,7 @@ return 0; } +#if 0 /** * \brief print suboption usage help */ @@ -200,10 +204,10 @@ " Automatically start JACK server if necessary\n" ); } +#endif +static int init(unsigned flags) { UNUSED(flags); return 1; } -static int init(int flags) { return 1; } - -static int configure(int rate, int channels, int format) { +static int configure(unsigned rate,unsigned channels,unsigned format) { const char **matching_ports = NULL; char *port_name = NULL; char *client_name = NULL; @@ -219,8 +223,9 @@ */ jack_options_t open_options = JackUseExactName; int port_flags = JackPortIsInput; - int i; + unsigned i; estimate = 1; + UNUSED(format); /* if (subopt_parse(ao_subdevice, subopts) != 0) { print_help(); @@ -338,15 +343,16 @@ paused = 0; } -static int get_space(void) { +static unsigned get_space(void) { return cb_fifo_space(buffer); } /** * \brief write data into buffer and reset underrun flag */ -static int play(void *data, int len, int flags) { +static unsigned play(void *data, unsigned len, unsigned flags) { underrun = 0; + UNUSED(flags); return write_buffer(data, len); } Modified: mplayerxp/libao2/ao_nas.c =================================================================== --- mplayerxp/libao2/ao_nas.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_nas.c 2010-01-23 17:56:40 UTC (rev 121) @@ -413,20 +413,21 @@ } -static int init(int flags) +static int init(unsigned flags) { + UNUSED(flags); return 1; } // open & setup audio device // return: 1=success 0=fail -static int configure(int rate,int channels,int format) +static int configure(unsigned rate,unsigned channels,unsigned format) { AuElement elms[3]; AuStatus as; char str[256]; unsigned char auformat = nas_aformat_to_auformat(&format); - int bytes_per_sample = channels * AuSizeofFormat(auformat); - int buffer_size; + unsigned bytes_per_sample = channels * AuSizeofFormat(auformat); + unsigned buffer_size; char *server; nas_data=malloc(sizeof(struct ao_nas_data)); @@ -574,9 +575,9 @@ // return: how many bytes can be played without blocking -static int get_space(void) +static unsigned get_space(void) { - int result; + unsigned result; MSG_DBG3("ao_nas: get_space()\n"); @@ -590,11 +591,11 @@ // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static int play(void* data,int len,int flags) +static unsigned play(void* data,unsigned len,unsigned flags) { - int written, maxbursts = 0, playbursts = 0; + unsigned written, maxbursts = 0, playbursts = 0; AuStatus as; - + UNUSED(flags); MSG_DBG3( "ao_nas: play(%p, %d, %d)\n", data, len, flags); Modified: mplayerxp/libao2/ao_null.c =================================================================== --- mplayerxp/libao2/ao_null.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_null.c 2010-01-23 17:56:40 UTC (rev 121) @@ -94,13 +94,16 @@ // to set/get/query special features/parameters static int __FASTCALL__ control(int cmd,long arg){ + UNUSED(cmd); + UNUSED(arg); return CONTROL_TRUE; } // open & setup audio device // return: 1=success 0=fail -static int __FASTCALL__ init(int flags){ +static int __FASTCALL__ init(unsigned flags){ char *null_dev=NULL,*mode=NULL; + UNUSED(flags); if (ao_subdevice) { mrl_parse_line(ao_subdevice,NULL,NULL,&null_dev,&mode); fd=NULL; @@ -111,8 +114,8 @@ return 1; } -static int __FASTCALL__ configure(int rate,int channels,int format){ - int bits; +static int __FASTCALL__ configure(unsigned rate,unsigned channels,unsigned format){ + unsigned bits; ao_data.buffersize= 0xFFFFF; ao_data.outburst=0xFFFF;//4096; ao_data.channels=channels; @@ -145,7 +148,7 @@ ao_data.bps *= 3; break; default: - break; + break; } buffer=0; gettimeofday(&last_tv, 0); @@ -194,7 +197,7 @@ } // return: how many bytes can be played without blocking -static int get_space(void){ +static unsigned get_space(void){ drain(); return fast_mode?INT_MAX:ao_data.outburst - buffer; @@ -203,12 +206,11 @@ // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static int __FASTCALL__ play(void* data,int len,int flags){ - - - int maxbursts = (ao_data.buffersize - buffer) / ao_data.outburst; - int playbursts = len / ao_data.outburst; - int bursts = playbursts > maxbursts ? maxbursts : playbursts; +static unsigned __FASTCALL__ play(void* data,unsigned len,unsigned flags) +{ + unsigned maxbursts = (ao_data.buffersize - buffer) / ao_data.outburst; + unsigned playbursts = len / ao_data.outburst; + unsigned bursts = playbursts > maxbursts ? maxbursts : playbursts; buffer += bursts * ao_data.outburst; if(fd && len) Modified: mplayerxp/libao2/ao_openal.c =================================================================== --- mplayerxp/libao2/ao_openal.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_openal.c 2010-01-23 17:56:40 UTC (rev 121) @@ -75,6 +75,7 @@ return CONTROL_UNKNOWN; } +#if 0 /** * \brief print suboption usage help */ @@ -85,10 +86,11 @@ "\nOptions:\n" ); } - +#endif static ALCdevice* alc_dev; -static int init(int flags) +static int init(unsigned flags) { + UNUSED(flags); alc_dev = alcOpenDevice(NULL); if (!alc_dev) { MSG_ERR("[OpenAL] could not open device\n"); @@ -97,7 +99,7 @@ return 1; } -static int configure(int rate, int channels, int format) +static int configure(unsigned rate, unsigned channels, unsigned format) { ALCcontext *ctx = NULL; float position[3] = {0, 0, 0}; @@ -110,7 +112,7 @@ }; ALCint freq = 0; ALCint attribs[] = {ALC_FREQUENCY, rate, 0, 0}; - int i; + unsigned i; /* const opt_t subopts[] = { {NULL} @@ -120,6 +122,7 @@ return 0; } */ + UNUSED(format); if (channels > MAX_CHANS) { MSG_ERR("[OpenAL] Invalid number of channels: %i\n", channels); goto err_out; @@ -176,7 +179,7 @@ static void unqueue_buffers(void) { ALint p; - int s; + unsigned s; for (s = 0; s < ao_data.channels; s++) { int till_wrap = NUM_BUF - unqueue_buf[s]; alGetSourcei(sources[s], AL_BUFFERS_PROCESSED, &p); @@ -214,7 +217,7 @@ alSourcePlayv(ao_data.channels, sources); } -static int get_space(void) { +static unsigned get_space(void) { ALint queued; unqueue_buffers(); alGetSourcei(sources[0], AL_BUFFERS_QUEUED, &queued); @@ -226,11 +229,12 @@ /** * \brief write data into buffer and reset underrun flag */ -static int play(void *data, int len, int flags) { +static unsigned play(void *data, unsigned len, unsigned flags) { ALint state; - int i, j, k; - int ch; + unsigned i, j, k; + unsigned ch; int16_t *d = data; + UNUSED(flags); len /= ao_data.channels * CHUNK_SIZE; for (i = 0; i < len; i++) { for (ch = 0; ch < ao_data.channels; ch++) { Modified: mplayerxp/libao2/ao_oss.c =================================================================== --- mplayerxp/libao2/ao_oss.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_oss.c 2010-01-23 17:56:40 UTC (rev 121) @@ -189,9 +189,9 @@ } // open & setup audio device // return: 1=success 0=fail -static int __FASTCALL__ init(int flags){ +static int __FASTCALL__ init(unsigned flags){ char *mixer_channels [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; - + UNUSED(flags); if (ao_subdevice) { char *p; @@ -228,8 +228,8 @@ return 1; } -static int __FASTCALL__ configure(int rate,int channels,int format){ - +static int __FASTCALL__ configure(unsigned rate,unsigned channels,unsigned format) +{ MSG_V("ao2: %d Hz %d chans %s\n",rate,channels, ao_format_name(format)); @@ -238,10 +238,10 @@ ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate); } -ac3_retry: +ac3_retry: ao_data.format=format; if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &ao_data.format)<0 || - ao_data.format != format) + ao_data.format != format) { if(format == AFMT_AC3){ MSG_WARN("OSS-CONF: Can't set audio device %s to AC3 output, trying S16...\n", dsp); @@ -297,11 +297,11 @@ } else { MSG_V("OSS-CONF: frags: %3d/%d (%d bytes/frag) free: %6d\n", zz.fragments, zz.fragstotal, zz.fragsize, zz.bytes); - if(ao_data.buffersize==-1) ao_data.buffersize=zz.bytes; + if(ao_data.buffersize==0) ao_data.buffersize=zz.bytes; ao_data.outburst=zz.fragsize; } - if(ao_data.buffersize==-1){ + if(ao_data.buffersize==0){ // Measuring buffer size: void* data; ao_data.buffersize=0; @@ -332,7 +332,7 @@ ao_data.outburst-=ao_data.outburst % ao_data.bps; // round down ao_data.bps*=ao_data.samplerate; - return 1; + return 1; } // close audio device @@ -384,8 +384,8 @@ // return: how many bytes can be played without blocking -static int get_space(void){ - int playsize=ao_data.outburst; +static unsigned get_space(void){ + unsigned playsize=ao_data.outburst; #ifdef SNDCTL_DSP_GETOSPACE if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)!=-1){ @@ -415,7 +415,8 @@ // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static int __FASTCALL__ play(void* data,int len,int flags){ +static unsigned __FASTCALL__ play(void* data,unsigned len,unsigned flags){ + UNUSED(flags); len/=ao_data.outburst; len=write(audio_fd,data,len*ao_data.outburst); return len; Modified: mplayerxp/libao2/ao_sdl.c =================================================================== --- mplayerxp/libao2/ao_sdl.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_sdl.c 2010-01-23 17:56:40 UTC (rev 121) @@ -135,15 +135,17 @@ } // SDL Callback function -void outputaudio(void *unused, Uint8 *stream, int len) { - read_buffer(stream, len); +static void outputaudio(void *unused, Uint8 *stream, int len) { + UNUSED(unused); + read_buffer(stream, len); } // open & setup audio device // return: 1=success 0=fail -static int __FASTCALL__ init(int flags) +static int __FASTCALL__ init(unsigned flags) { - int i; + unsigned i; + UNUSED(flags); /* Allocate ring-buffer memory */ for(i=0;i<NUM_BUFS;i++) buffer[i]=(unsigned char *) malloc(BUFFSIZE); @@ -153,11 +155,11 @@ return 1; } -static int __FASTCALL__ configure(int rate,int channels,int format){ - +static int __FASTCALL__ configure(unsigned rate,unsigned channels,unsigned format) +{ /* SDL Audio Specifications */ SDL_AudioSpec aspec, obtained; - char drv_name[80]; + char drv_name[80]; ao_data.channels=channels; ao_data.samplerate=rate; @@ -209,16 +211,16 @@ aspec.userdata = NULL; /* initialize the SDL Audio system */ - if (SDL_Init (SDL_INIT_AUDIO/*|SDL_INIT_NOPARACHUTE*/)) { - MSG_ERR("SDL: Initializing of SDL Audio failed: %s.\n", SDL_GetError()); - return 0; + if (SDL_Init (SDL_INIT_AUDIO/*|SDL_INIT_NOPARACHUTE*/)) { + MSG_ERR("SDL: Initializing of SDL Audio failed: %s.\n", SDL_GetError()); + return 0; } /* Open the audio device and start playing sound! */ if(SDL_OpenAudio(&aspec, &obtained) < 0) { - MSG_ERR("SDL: Unable to open audio: %s\n", SDL_GetError()); - return(0); - } + MSG_ERR("SDL: Unable to open audio: %s\n", SDL_GetError()); + return(0); + } /* did we got what we wanted ? */ ao_data.channels=obtained.channels; @@ -244,8 +246,8 @@ ao_data.format = AFMT_U16_BE; break; default: - MSG_WARN("SDL: Unsupported SDL audio format: 0x%x.\n", obtained.format); - return 0; + MSG_WARN("SDL: Unsupported SDL audio format: 0x%x.\n", obtained.format); + return 0; } MSG_V("SDL: buf size = %d\n",aspec.size); @@ -299,16 +301,17 @@ // return: how many bytes can be played without blocking -static int get_space(void){ +static unsigned get_space(void){ return (NUM_BUFS-full_buffers)*BUFFSIZE - buf_write_pos; } // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static int __FASTCALL__ play(void* data,int len,int flags){ - -#if 0 +static unsigned __FASTCALL__ play(void* data,unsigned len,unsigned flags) +{ + UNUSED(flags); +#if 0 int ret; /* Audio locking prohibits call of outputaudio */ @@ -317,7 +320,7 @@ ret = write_buffer(data, len); SDL_UnlockAudio(); - return ret; + return ret; #else return write_buffer(data, len); #endif Modified: mplayerxp/libao2/ao_wav.c =================================================================== --- mplayerxp/libao2/ao_wav.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/ao_wav.c 2010-01-23 17:56:40 UTC (rev 121) @@ -85,18 +85,22 @@ // to set/get/query special features/parameters static int control(int cmd,long arg){ + UNUSED(cmd); + UNUSED(arg); return -1; } // open & setup audio device // return: 1=success 0=fail -static int init(int flags) { +static int init(unsigned flags) { // set defaults + UNUSED(flags); ao_pcm_waveheader = 1; + return 1; } -static int configure(int rate,int channels,int format){ - int bits; +static int configure(unsigned rate,unsigned channels,unsigned format){ + unsigned bits; char str[256]; if(ao_subdevice) ao_outputfilename = ao_subdevice; @@ -205,7 +209,7 @@ } // return: how many bytes can be played without blocking -static int get_space(void){ +static unsigned get_space(void){ if(vo_pts) return ao_data.pts < vo_pts + fast * 30000 ? ao_data.outburst : 0; return ao_data.outburst; @@ -214,8 +218,8 @@ // plays 'len' bytes of 'data' // it should round it down to outburst*n // return: number of bytes played -static int play(void* data,int len,int flags){ - //printf("PCM: Writing chunk!\n"); +static unsigned play(void* data,unsigned len,unsigned flags){ + UNUSED(flags); fwrite(data,len,1,fp); if(ao_pcm_waveheader) data_length += len; Modified: mplayerxp/libao2/audio_out.c =================================================================== --- mplayerxp/libao2/audio_out.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/audio_out.c 2010-01-23 17:56:40 UTC (rev 121) @@ -207,7 +207,7 @@ return audio_out->info; } -int __FASTCALL__ ao_init(int flags) +int __FASTCALL__ ao_init(unsigned flags) { int retval; retval = audio_out->init(flags); @@ -215,7 +215,7 @@ return retval; } -int __FASTCALL__ ao_configure(int rate,int channels,int format) +int __FASTCALL__ ao_configure(unsigned rate,unsigned channels,unsigned format) { int retval; retval=audio_out->configure(rate,channels,format); @@ -233,7 +233,7 @@ if(ao_inited) audio_out->reset(); } -int ao_get_space(void) +unsigned ao_get_space(void) { return ao_inited?audio_out->get_space():0; } @@ -243,7 +243,7 @@ return ao_inited?audio_out->get_delay():0; } -int __FASTCALL__ ao_play(void* data,int len,int flags) +unsigned __FASTCALL__ ao_play(void* data,unsigned len,unsigned flags) { return ao_inited?audio_out->play(data,len,flags):0; } Modified: mplayerxp/libao2/audio_out.h =================================================================== --- mplayerxp/libao2/audio_out.h 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/audio_out.h 2010-01-23 17:56:40 UTC (rev 121) @@ -20,31 +20,31 @@ * @param arg argument associated with command * @return CONTROL_OK if success CONTROL_FALSE CONTROL_ERROR CONTROL_NA otherwise **/ - int (* __FASTCALL__ control)(int cmd,long arg); + int (* __FASTCALL__ control)(int cmd,long arg); /** Preinitializes driver * @param flag currently unused * @return 1 on successful initialization, 0 on error. **/ - int (* __FASTCALL__ init)(int flags); + int (* __FASTCALL__ init)(unsigned flags); /** Configures the audio driver. * @param rate specifies samplerate in Hz - * @param channels specifies number of channels (1 - mono, 2 - stereo, 6 - surround) + * @param channels specifies number of channels (1 - mono, 2 - stereo, 6 - surround) * @param format specifies format of audio samples (see AFMT_* for detail) * @return 1 on successful configuration, 0 on error. - **/ - int (* __FASTCALL__ configure)(int rate,int channels,int format); + **/ + int (* __FASTCALL__ configure)(unsigned rate,unsigned channels,unsigned format); - /** Closes driver. Should restore the original state of the system. - **/ - void (*uninit)(void); + /** Closes driver. Should restore the original state of the system. + **/ + void (*uninit)(void); /** Stops playing and empties buffers (for seeking/pause) **/ void (*reset)(void); /** Returns how many bytes can be played without blocking **/ - int (*get_space)(void); + unsigned (*get_space)(void); /** Plays decoded (PCM) audio buffer * @param data buffer with PCM data @@ -52,28 +52,28 @@ * @param flags currently unused * return number of bytes which were copied into audio card **/ - int (* __FASTCALL__ play)(void* data,int len,int flags); + unsigned (* __FASTCALL__ play)(void* data,unsigned len,unsigned flags); /** Returns delay in seconds between first and last sample in buffer **/ - float (*get_delay)(void); - + float (*get_delay)(void); + /** Stops playing, keep buffers (for pause) */ - void (*pause)(void); + void (*pause)(void); /** Resumes playing, after audio_pause() */ - void (*resume)(void); + void (*resume)(void); } ao_functions_t; /** Global data used by mplayerxp and plugins */ typedef struct ao_data_s { - int samplerate; /**< rate of samples in Hz */ - int channels; /**< number of audio channels */ - int format; /**< format of audio samples */ - int bps; /**< bytes per second */ - int outburst; /**< outburst */ - int buffersize; /**< suize of audio buffer */ - int pts; /**< PTS of audio buffer */ + unsigned samplerate; /**< rate of samples in Hz */ + unsigned channels; /**< number of audio channels */ + unsigned format; /**< format of audio samples */ + unsigned bps; /**< bytes per second */ + unsigned outburst; /**< outburst */ + unsigned buffersize; /**< suize of audio buffer */ + float pts; /**< PTS of audio buffer */ } ao_data_t; extern char *ao_subdevice; @@ -108,12 +108,12 @@ extern void ao_print_help( void ); extern const ao_functions_t* __FASTCALL__ ao_register(const char *driver_name); extern const ao_info_t* ao_get_info( void ); -extern int __FASTCALL__ ao_init(int flags); -extern int __FASTCALL__ ao_configure(int rate,int channels,int format); +extern int __FASTCALL__ ao_init(unsigned flags); +extern int __FASTCALL__ ao_configure(unsigned rate,unsigned channels,unsigned format); extern void ao_uninit(void); extern void ao_reset(void); -extern int ao_get_space(void); -extern int __FASTCALL__ ao_play(void* data,int len,int flags); +extern unsigned ao_get_space(void); +extern unsigned __FASTCALL__ ao_play(void* data,unsigned len,unsigned flags); extern float ao_get_delay(void); extern void ao_pause(void); extern void ao_resume(void); Modified: mplayerxp/libao2/audio_out_internal.h =================================================================== --- mplayerxp/libao2/audio_out_internal.h 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libao2/audio_out_internal.h 2010-01-23 17:56:40 UTC (rev 121) @@ -2,12 +2,12 @@ // prototypes: //static ao_info_t info; static int __FASTCALL__ control(int cmd,long arg); -static int __FASTCALL__ init(int flags); -static int __FASTCALL__ configure(int rate,int channels,int format); +static int __FASTCALL__ init(unsigned flags); +static int __FASTCALL__ configure(unsigned rate,unsigned channels,unsigned format); static void uninit(void); static void reset(void); -static int get_space(void); -static int __FASTCALL__ play(void* data,int len,int flags); +static unsigned get_space(void); +static unsigned __FASTCALL__ play(void* data,unsigned len,unsigned flags); static float get_delay(void); static void audio_pause(void); static void audio_resume(void); Modified: mplayerxp/libmpcodecs/ad.h =================================================================== --- mplayerxp/libmpcodecs/ad.h 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad.h 2010-01-23 17:56:40 UTC (rev 121) @@ -32,10 +32,10 @@ const ad_info_t *info; const config_t* options;/**< Optional: MPlayerXP's option related */ int (*preinit)(sh_audio_t *); - int (*init)(sh_audio_t *sh); - void (*uninit)(sh_audio_t *sh); - int (*control)(sh_audio_t *sh,int cmd,void* arg, ...); - int (*decode_audio)(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts); + int (*init)(sh_audio_t *sh); + void (*uninit)(sh_audio_t *sh); + int (*control)(sh_audio_t *sh,int cmd,void* arg, ...); + unsigned (*decode_audio)(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); } ad_functions_t; // NULL terminated array of all drivers Modified: mplayerxp/libmpcodecs/ad_a52.c =================================================================== --- mplayerxp/libmpcodecs/ad_a52.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_a52.c 2010-01-23 17:56:40 UTC (rev 121) @@ -195,6 +195,7 @@ int control(sh_audio_t *sh,int cmd,void* arg, ...) { + UNUSED(arg); switch(cmd) { case ADCTRL_RESYNC_STREAM: @@ -212,13 +213,16 @@ return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { sample_t level=1, bias=384; int flags=mpxp_a52_flags|A52_ADJUST_LEVEL; - int i,len=-1; + unsigned i; + unsigned len=0; + UNUSED(minlen); + UNUSED(maxlen); a52_priv_t *a52_priv=sh_audio->context; - if(!sh_audio->a_in_buffer_len) + if(!sh_audio->a_in_buffer_len) { if(a52_fillbuff(sh_audio,pts)<0) return len; /* EOF */ } Modified: mplayerxp/libmpcodecs/ad_acm.c =================================================================== --- mplayerxp/libmpcodecs/ad_acm.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_acm.c 2010-01-23 17:56:40 UTC (rev 121) @@ -183,7 +183,7 @@ return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { ACMSTREAMHEADER ash; HRESULT hr; Modified: mplayerxp/libmpcodecs/ad_dca.c =================================================================== --- mplayerxp/libmpcodecs/ad_dca.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_dca.c 2010-01-23 17:56:40 UTC (rev 121) @@ -196,6 +196,7 @@ int control(sh_audio_t *sh,int cmd,void* arg, ...) { + UNUSED(arg); switch(cmd) { case ADCTRL_RESYNC_STREAM: @@ -213,13 +214,15 @@ return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { sample_t level=1, bias=384; unsigned i,nblocks,flags=mpxp_dca_flags|DCA_ADJUST_LEVEL; - int len=-1; + unsigned len=0; dca_priv_t *dca_priv=sh_audio->context; - if(!sh_audio->a_in_buffer_len) + UNUSED(minlen); + UNUSED(maxlen); + if(!sh_audio->a_in_buffer_len) { if(dca_fillbuff(sh_audio,pts)<0) return len; /* EOF */ } Modified: mplayerxp/libmpcodecs/ad_dmo.c =================================================================== --- mplayerxp/libmpcodecs/ad_dmo.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_dmo.c 2010-01-23 17:56:40 UTC (rev 121) @@ -35,6 +35,7 @@ static int init(sh_audio_t *sh) { + UNUSED(sh); return 1; } @@ -73,6 +74,7 @@ static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) { int skip; + UNUSED(arg); switch(cmd) { case ADCTRL_SKIP_FRAME: @@ -90,34 +92,37 @@ return CONTROL_UNKNOWN; } -static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +static unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { - dmo_priv_t *priv=sh_audio->context; -// int len=-1; - int size_in=0; - int size_out=0; - int srcsize=DMO_AudioDecoder_GetSrcSize(priv->ds_adec, maxlen); - MSG_DBG3("DMO says: srcsize=%d (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen); - if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!! - if(sh_audio->a_in_buffer_len<srcsize){ - int l; - l=demux_read_data_r(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len], - srcsize-sh_audio->a_in_buffer_len,pts); - *pts=FIX_APTS(sh_audio,*pts,-sh_audio->a_in_buffer_len); - sh_audio->a_in_buffer_len+=l; + dmo_priv_t* priv = sh_audio->context; + unsigned len=0; + UNUSED(minlen); + { + unsigned size_in=0; + unsigned size_out=0; + unsigned srcsize=DMO_AudioDecoder_GetSrcSize(priv->ds_adec, maxlen); + MSG_DBG2("DMO says: srcsize=%d (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen); + if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!! + if((unsigned)sh_audio->a_in_buffer_len<srcsize){ + unsigned l; + l=demux_read_data_r(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len], + srcsize-sh_audio->a_in_buffer_len,pts); + sh_audio->a_in_buffer_len+=l; priv->pts=*pts; - } + } else *pts=priv->pts; - DMO_AudioDecoder_Convert(priv->ds_adec, sh_audio->a_in_buffer,sh_audio->a_in_buffer_len, - buf,maxlen, &size_in,&size_out); - MSG_DBG2("DMO: audio %d -> %d converted (in_buf_len=%d of %d) %d\n",size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,ds_tell_pts(sh_audio->ds)); - if(size_in>=sh_audio->a_in_buffer_len){ - sh_audio->a_in_buffer_len=0; - } else { - sh_audio->a_in_buffer_len-=size_in; - memmove(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[size_in],sh_audio->a_in_buffer_len); + DMO_AudioDecoder_Convert(priv->ds_adec, sh_audio->a_in_buffer,sh_audio->a_in_buffer_len, + buf,maxlen, &size_in,&size_out); + MSG_DBG2("DMO: audio %d -> %d converted (in_buf_len=%d of %d) %f\n" + ,size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,*pts); + if(size_in>=(unsigned)sh_audio->a_in_buffer_len){ + sh_audio->a_in_buffer_len=0; + } else { + sh_audio->a_in_buffer_len-=size_in; + memcpy(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[size_in],sh_audio->a_in_buffer_len); priv->pts=FIX_APTS(sh_audio,priv->pts,size_in); - } -// len=size_out; - return size_out; + } + len=size_out; + } + return len; } Modified: mplayerxp/libmpcodecs/ad_dshow.c =================================================================== --- mplayerxp/libmpcodecs/ad_dshow.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_dshow.c 2010-01-23 17:56:40 UTC (rev 121) @@ -30,6 +30,7 @@ int init(sh_audio_t *sh) { + UNUSED(sh); return 1; } @@ -64,6 +65,7 @@ int control(sh_audio_t *sh_audio,int cmd,void* arg, ...) { int skip; + UNUSED(arg); switch(cmd) { case ADCTRL_RESYNC_STREAM: @@ -86,35 +88,36 @@ return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { dshow_priv_t* priv = sh_audio->context; - int len=-1; - { int size_in=0; - int size_out=0; - int srcsize=DS_AudioDecoder_GetSrcSize(priv->ds_adec, maxlen); - MSG_DBG3("DShow says: srcsize=%d (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen); - if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!! - if(sh_audio->a_in_buffer_len<srcsize){ - int l; - l=demux_read_data_r(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len], - srcsize-sh_audio->a_in_buffer_len,pts); - *pts=FIX_APTS(sh_audio,*pts,-sh_audio->a_in_buffer_len); - sh_audio->a_in_buffer_len+=l; + unsigned len=0; + UNUSED(minlen); + { unsigned size_in=0; + unsigned size_out=0; + unsigned srcsize=DS_AudioDecoder_GetSrcSize(priv->ds_adec, maxlen); + MSG_DBG3("DShow says: srcsize=%d (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,maxlen); + if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!! + if((unsigned)sh_audio->a_in_buffer_len<srcsize){ + unsigned l; + l=demux_read_data_r(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len], + srcsize-sh_audio->a_in_buffer_len,pts); + sh_audio->a_in_buffer_len+=l; priv->pts=*pts; - } + } else *pts=priv->pts; - DS_AudioDecoder_Convert(priv->ds_adec, sh_audio->a_in_buffer,sh_audio->a_in_buffer_len, - buf,maxlen, &size_in,&size_out); - MSG_DBG2("DShow: audio %d -> %d converted (in_buf_len=%d of %d) %d\n",size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,ds_tell_pts_r(sh_audio->ds)); - if(size_in>=sh_audio->a_in_buffer_len){ - sh_audio->a_in_buffer_len=0; - } else { - sh_audio->a_in_buffer_len-=size_in; - memcpy(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[size_in],sh_audio->a_in_buffer_len); + DS_AudioDecoder_Convert(priv->ds_adec, sh_audio->a_in_buffer,sh_audio->a_in_buffer_len, + buf,maxlen, &size_in,&size_out); + MSG_DBG2("DShow: audio %d -> %d converted (in_buf_len=%d of %d) %f\n" + ,size_in,size_out,sh_audio->a_in_buffer_len,sh_audio->a_in_buffer_size,*pts); + if(size_in>=(unsigned)sh_audio->a_in_buffer_len){ + sh_audio->a_in_buffer_len=0; + } else { + sh_audio->a_in_buffer_len-=size_in; + memcpy(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[size_in],sh_audio->a_in_buffer_len); priv->pts=FIX_APTS(sh_audio,priv->pts,size_in); - } - len=size_out; + } + len=size_out; } return len; } Modified: mplayerxp/libmpcodecs/ad_dvdpcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_dvdpcm.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_dvdpcm.c 2010-01-23 17:56:40 UTC (rev 121) @@ -69,11 +69,13 @@ void uninit(sh_audio_t *sh) { + UNUSED(sh); } int control(sh_audio_t *sh,int cmd,void* arg, ...) { int skip; + UNUSED(arg); switch(cmd) { case ADCTRL_SKIP_FRAME: @@ -90,10 +92,12 @@ return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { - int j,len; + int j; + unsigned len; float null_pts; + UNUSED(maxlen); if (sh_audio->samplesize == 3) { if (((sh_audio->codecdata[1] >> 6) & 3) == 1) { // 20 bit @@ -146,7 +150,7 @@ } len = j; } - } else + } else len=demux_read_data_r(sh_audio->ds,buf,(minlen+3)&(~3),pts); return len; } Modified: mplayerxp/libmpcodecs/ad_faad.c =================================================================== --- mplayerxp/libmpcodecs/ad_faad.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_faad.c 2010-01-23 17:56:40 UTC (rev 121) @@ -253,9 +253,9 @@ if(!sh->i_bps) { MSG_WARN("FAAD: compressed input bitrate missing, assuming 128kbit/s!\n"); sh->i_bps = 128*1000/8; // XXX: HACK!!! ::atmos - } else + } else MSG_V("FAAD: got %dkbit/s bitrate from MP4 header!\n",sh->i_bps*8/1000); - } + } return 1; } @@ -274,10 +274,11 @@ return CONTROL_UNKNOWN; } -static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen,float *pts) +static unsigned decode_audio(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { faad_priv_t *priv=sh->context; - int j = 0, len = 0; + int j = 0; + unsigned len = 0; void *NeAAC_sample_buffer; UNUSED(maxlen); while(len < minlen) { @@ -294,7 +295,7 @@ } else *pts=priv->pts; #ifdef DUMP_AAC_COMPRESSED - {int i; + {unsigned i; for (i = 0; i < 16; i++) printf ("%02X ", sh->a_in_buffer[i]); printf ("\n");} @@ -304,9 +305,9 @@ // raw aac stream: do { NeAAC_sample_buffer = NeAACDecDecode(NeAAC_hdec, &NeAAC_finfo, sh->a_in_buffer+j, sh->a_in_buffer_len); - + /* update buffer index after NeAACDecDecode */ - if(NeAAC_finfo.bytesconsumed >= sh->a_in_buffer_len) { + if(NeAAC_finfo.bytesconsumed >= (unsigned)sh->a_in_buffer_len) { sh->a_in_buffer_len=0; } else { sh->a_in_buffer_len-=NeAAC_finfo.bytesconsumed; @@ -320,7 +321,7 @@ j++; } else break; - } while(j < FAAD_BUFFLEN); + } while(j < FAAD_BUFFLEN); } else { // packetized (.mp4) aac stream: unsigned char* bufptr=NULL; @@ -329,7 +330,7 @@ NeAAC_sample_buffer = NeAACDecDecode(NeAAC_hdec, &NeAAC_finfo, bufptr, buflen); // printf("NeAAC decoded %d of %d (err: %d) \n",NeAAC_finfo.bytesconsumed,buflen,NeAAC_finfo.error); } - + if(NeAAC_finfo.error > 0) { MSG_WARN("FAAD: Failed to decode frame: %s \n", NeAACDecGetErrorMessage(NeAAC_finfo.error)); Modified: mplayerxp/libmpcodecs/ad_ffmp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_ffmp3.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_ffmp3.c 2010-01-23 17:56:40 UTC (rev 121) @@ -123,6 +123,7 @@ int control(sh_audio_t *sh,int cmd,void* arg, ...) { + UNUSED(arg); AVCodecContext *lavc_context = sh->context; switch(cmd){ case ADCTRL_RESYNC_STREAM: @@ -133,10 +134,11 @@ return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { unsigned char *start=NULL; - int y,len=-1; + int y; + unsigned len=0; float apts=0.,null_pts; while(len<minlen){ int len2=maxlen; @@ -153,7 +155,7 @@ } if(len2>0){ //len=len2;break; - if(len<0) len=len2; else len+=len2; + if(len==0) len=len2; else len+=len2; buf+=len2; } MSG_DBG2("Decoded %d -> %d \n",y,len2); Modified: mplayerxp/libmpcodecs/ad_hwac3.c =================================================================== --- mplayerxp/libmpcodecs/ad_hwac3.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_hwac3.c 2010-01-23 17:56:40 UTC (rev 121) @@ -204,10 +204,11 @@ int control(sh_audio_t *sh,int cmd,void* arg, ...) { + UNUSED(arg); switch(cmd) { case ADCTRL_RESYNC_STREAM: - sh->a_in_buffer_len=0; // reset ACM/DShow audio buffer + sh->a_in_buffer_len=0; // reset ACM/DShow audio buffer return CONTROL_TRUE; case ADCTRL_SKIP_FRAME: { @@ -221,11 +222,13 @@ return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { - int len=-1; + unsigned len=0; + UNUSED(minlen); + UNUSED(maxlen); if(!sh_audio->a_in_buffer_len) - if((len=a52_fillbuff(sh_audio,pts))<0) return len; /*EOF*/ + if((int)(len=a52_fillbuff(sh_audio,pts))<0) return 0; /*EOF*/ sh_audio->a_in_buffer_len=0; len = ac3_iec958_build_burst(len, 0x01, 1, sh_audio->a_in_buffer, buf); return len; Modified: mplayerxp/libmpcodecs/ad_internal.h =================================================================== --- mplayerxp/libmpcodecs/ad_internal.h 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_internal.h 2010-01-23 17:56:40 UTC (rev 121) @@ -17,7 +17,7 @@ static int preinit(sh_audio_t *sh); static void uninit(sh_audio_t *sh); static int control(sh_audio_t *sh,int cmd,void* arg, ...); -static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts); +static unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts); #define LIBAD_EXTERN(x) const ad_functions_t mpcodecs_ad_##x = {\ &info,\ Modified: mplayerxp/libmpcodecs/ad_libdv.c =================================================================== --- mplayerxp/libmpcodecs/ad_libdv.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_libdv.c 2010-01-23 17:56:40 UTC (rev 121) @@ -40,11 +40,16 @@ return 1; } -static int16_t *audioBuffers[4]={NULL,NULL,NULL,NULL}; +typedef struct libdv_priv_s +{ + dv_decoder_t* decoder; + int16_t *audioBuffers[4]; +}libdv_priv_t; static int init(sh_audio_t *sh) { - int i; + unsigned i; + libdv_priv_t *priv; WAVEFORMATEX *h=sh->wf; if(!h) return 0; @@ -53,45 +58,53 @@ sh->channels=h->nChannels; sh->samplerate=h->nSamplesPerSec; sh->samplesize=(h->wBitsPerSample+7)/8; - - sh->context=init_global_rawdv_decoder(); - + priv = malloc(sizeof(libdv_priv_t)); + memset(priv,0,sizeof(libdv_priv_t)); + priv->decoder=init_global_rawdv_decoder(); + sh->context = priv; for (i=0; i < 4; i++) - audioBuffers[i] = malloc(2*DV_AUDIO_MAX_SAMPLES); + priv->audioBuffers[i] = malloc(2*DV_AUDIO_MAX_SAMPLES); return 1; } static void uninit(sh_audio_t *sh_audio) { - int i; + libdv_priv_t *priv = sh_audio->context; + unsigned i; + UNUSED(sh_audio); for (i=0; i < 4; i++) - free(audioBuffers[i]); + free(priv->audioBuffers[i]); } static int control(sh_audio_t *sh,int cmd,void* arg, ...) { // TODO!!! + UNUSED(sh); + UNUSED(cmd); + UNUSED(arg); return CONTROL_UNKNOWN; } -static int decode_audio(sh_audio_t *audio, unsigned char *buf, int minlen, int maxlen,float *pts) +static unsigned decode_audio(sh_audio_t *sh, unsigned char *buf, unsigned minlen, unsigned maxlen,float *pts) { - dv_decoder_t* decoder=audio->context; //global_rawdv_decoder; + libdv_priv_t *priv = sh->context; + dv_decoder_t* decoder=priv->decoder; //global_rawdv_decoder; unsigned char* dv_audio_frame=NULL; - int xx; + unsigned xx; size_t len=0; float apts; + UNUSED(maxlen); while(len<minlen) { - xx=ds_get_packet_r(audio->ds,&dv_audio_frame,len>0?&apts:pts); - if(xx<=0 || !dv_audio_frame) return 0; // EOF? + xx=ds_get_packet_r(sh->ds,&dv_audio_frame,len>0?&apts:pts); + if((int)xx<=0 || !dv_audio_frame) return 0; // EOF? dv_parse_header(decoder, dv_audio_frame); if(xx!=decoder->frame_size) MSG_WARN("AudioFramesize differs %u %u\n",xx, decoder->frame_size); - if (dv_decode_full_audio(decoder, dv_audio_frame,(int16_t**) audioBuffers)) { + if (dv_decode_full_audio(decoder, dv_audio_frame,(int16_t**)priv->audioBuffers)) { /* Interleave the audio into a single buffer */ int i=0; int16_t *bufP=(int16_t*)buf; @@ -100,7 +113,7 @@ { int ch; for (ch=0; ch < decoder->audio->num_channels; ch++) - bufP[len++] = audioBuffers[ch][i]; + bufP[len++] = priv->audioBuffers[ch][i]; } } len+=decoder->audio->samples_this_frame; Modified: mplayerxp/libmpcodecs/ad_mp3.c =================================================================== --- mplayerxp/libmpcodecs/ad_mp3.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_mp3.c 2010-01-23 17:56:40 UTC (rev 121) @@ -348,10 +348,13 @@ int control(sh_audio_t *sh,int cmd,void* arg, ...) { + UNUSED(sh); + UNUSED(cmd); + UNUSED(arg); return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { mp3_priv_t *priv=sh->context; unsigned char *indata=NULL,*outdata=NULL; Modified: mplayerxp/libmpcodecs/ad_null.c =================================================================== --- mplayerxp/libmpcodecs/ad_null.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_null.c 2010-01-23 17:56:40 UTC (rev 121) @@ -19,23 +19,35 @@ int init(sh_audio_t *sh) { + UNUSED(sh); return 1; } int preinit(sh_audio_t *sh) { + UNUSED(sh); return 1; } -void uninit(sh_audio_t *sh){} +void uninit(sh_audio_t *sh) +{ + UNUSED(sh); +} int control(sh_audio_t *sh,int cmd,void* arg, ...) { + UNUSED(sh); + UNUSED(cmd); + UNUSED(arg); return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { + UNUSED(sh_audio); + UNUSED(buf); + UNUSED(minlen); + UNUSED(maxlen); *pts=0; - return -1; + return 0; } Modified: mplayerxp/libmpcodecs/ad_pcm.c =================================================================== --- mplayerxp/libmpcodecs/ad_pcm.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_pcm.c 2010-01-23 17:56:40 UTC (rev 121) @@ -64,11 +64,13 @@ void uninit(sh_audio_t *sh) { + UNUSED(sh); } int control(sh_audio_t *sh,int cmd,void* arg, ...) { int skip; + UNUSED(arg); switch(cmd) { case ADCTRL_SKIP_FRAME: @@ -85,7 +87,7 @@ return CONTROL_UNKNOWN; } -int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen,float *pts) +unsigned decode_audio(sh_audio_t *sh_audio,unsigned char *buf,unsigned minlen,unsigned maxlen,float *pts) { unsigned len = sh_audio->channels*sh_audio->samplesize; len = (minlen + len - 1) / len * len; Modified: mplayerxp/libmpcodecs/ad_qtaudio.c =================================================================== --- mplayerxp/libmpcodecs/ad_qtaudio.c 2010-01-23 13:25:30 UTC (rev 120) +++ mplayerxp/libmpcodecs/ad_qtaudio.c 2010-01-23 17:56:40 UTC (rev 121) @@ -25,7 +25,7 @@ }; static const config_t options[] = { - { NULL, NULL, 0, 0, 0, 0, NULL} + { NULL, NULL, 0, 0, 0, 0, NULL, NULL} }; LIBAD_EXTERN(qtaudio) @@ -89,62 +89,62 @@ #ifdef WIN32_LOADER Setup_LDT_Keeper(); #endif - qtml_dll = LoadLibraryA("qtmlClient.dll"); + qtml_dll = LoadLibraryA((LPCSTR)"qtmlClient.dll"); if( qtml_dll == NULL ) { MSG_ERR("failed loading dll\n" ); return 1; } #if 1 - InitializeQTML = (LPFUNC1)GetProcAddress(qtml_dll,"InitializeQTML"); + InitializeQTML = (LPFUNC1)GetProcAddress(qtml_dll,(LPCSTR)"InitializeQTML"); if ( InitializeQTML == NULL ) { MSG_ERR("failed geting proc address InitializeQTML\n"); return 1; } - SoundConverterOpen = (LPFUNC2)GetProcAddress(qtml_dll,"SoundConverterOpen"); + SoundConverterOpen = (LPFUNC2)GetProcAddress(qtml_dll,(LPCSTR)"SoundConverterOpen"); if ( SoundConverterOpen == NULL ) { MSG_ERR("failed getting proc address SoundConverterOpen\n"); return 1; } - SoundConverterClose = (LPFUNC3)GetProcAddress(qtml_dll,"SoundConverterClose"); + SoundConverterClose = (LPFUNC3)GetProcAddress(qtml_dll,(LPCSTR)"SoundConverterClose"); if ( SoundConverterClose == NULL ) { MSG_ERR("failed getting proc address SoundConverterClose\n"); return 1; } - TerminateQTML = (LPFUNC4)GetProcAddress(qtml_dll,"TerminateQTML"); + TerminateQTML = (LPFUNC4)GetProcAddress(qtml_dll,(LPCSTR)"TerminateQTML"); if ( TerminateQTML == NULL ) { MSG_ERR("failed getting proc address TerminateQTML\n"); return 1; } - SoundConverterSetInfo = (LPFUNC5)GetProcAddress(qtml_dll,"SoundConverterSetInfo"); + SoundConverterSetInfo = (LPFUNC5)GetProcAddress(qtml_dll,(LPCSTR)"SoundConverterSetInfo"); if ( SoundConverterSetInfo == NULL ) { MSG_ERR("failed getting proc address SoundConverterSetInfo\n"); return 1; } - SoundConverterGetBufferSizes = (LPFUNC6)GetProcAddress(qtml_dll,"SoundConverterGetBufferSizes"); + SoundConverterGetBufferSizes = (LPFUNC6)GetProcAddress(qtml_dll,(LPCSTR)"SoundConverterGetBufferSizes"); if ( SoundConverterGetBufferSizes == NULL ) { MSG_ERR("failed getting proc address SoundConverterGetBufferSizes\n"); return 1; } - SoundConverterConvertBuffer = (LPFUNC7)GetProcAddress(qtml_dll,"SoundConverterConvertBuffer"); + SoundConverterConvertBuffer = (LPFUNC7)GetProcAddress(qtml_dll,(LPCSTR)"SoundConverterConvertBuffer"); if ( SoundConverterConvertBuffer == NULL ) { MSG_ERR("failed getting proc address SoundConverterConvertBuffer1\n"); return 1; } - SoundConverterEndConversion = (LPFUNC8)GetProcAddress(qtml_dll,"SoundConverterEndConversion"); + SoundConverterEndConversion = (LPFUNC8)GetProcAddress(qtml_dll,(LPCSTR)"SoundConverterEndConversion"); if ( SoundConverterEndConversion == NULL ) { MSG_ERR("failed getting proc address SoundConverterEndConversion\n"); return 1; } - SoundConverterBeginConversion = (LPFUNC9)GetProcAddress(qtml_dll,"SoundConverterBeginConversion"); + SoundConverterBeginConversion = (LPFUNC9)GetProcAddress(qtml_dll,(LPCSTR)"SoundConverterBeginConversion"); if ( SoundConverterBeginConversion == NULL ) { MSG_ERR("failed getting proc address SoundConverterBeginConversion\n"); @@ -230,7 +230,7 @@ sh->audio_out_minsize=OutputBufferSize; sh->audio_in_minsize=InputBufferSize; - + sh->channels=sh->wf->nChannels; sh->samplerate=sh->wf->nSamplesPerSec; sh->samplesize=2; //(sh->wf->wBitsPerSample+7)/8; @@ -254,8 +254,9 @@ return 1; // return values: 1=OK 0=ERROR } -static int init(sh_audio_t *sh_audio){ - +static int init(sh_audio_t *sh_audio) +{ + UNUSED(sh_audio); return 1; // return values: 1=OK 0=ERROR } @@ -263,6 +264,7 @@ int error; unsigned long ConvertedFrames=0; unsigned long ConvertedBytes=0; + UNUSED(sh); error=SoundConverterEndConversion(myConverter,NULL,&ConvertedFrames,&ConvertedBytes); MSG_V("SoundConverterEndConversion:%i\n",e... [truncated message content] |