diff options
Diffstat (limited to 'src/audio_out')
-rw-r--r-- | src/audio_out/Makefile.am | 6 | ||||
-rw-r--r-- | src/audio_out/audio_alsa_out.c | 322 | ||||
-rw-r--r-- | src/audio_out/audio_arts_out.c | 30 | ||||
-rw-r--r-- | src/audio_out/audio_coreaudio_out.c | 68 | ||||
-rw-r--r-- | src/audio_out/audio_directx2_out.c | 34 | ||||
-rw-r--r-- | src/audio_out/audio_directx_out.c | 70 | ||||
-rw-r--r-- | src/audio_out/audio_esd_out.c | 86 | ||||
-rw-r--r-- | src/audio_out/audio_file_out.c | 18 | ||||
-rw-r--r-- | src/audio_out/audio_fusionsound_out.c | 76 | ||||
-rw-r--r-- | src/audio_out/audio_irixal_out.c | 28 | ||||
-rw-r--r-- | src/audio_out/audio_jack_out.c | 2 | ||||
-rw-r--r-- | src/audio_out/audio_none_out.c | 24 | ||||
-rw-r--r-- | src/audio_out/audio_oss_out.c | 162 | ||||
-rw-r--r-- | src/audio_out/audio_sun_out.c | 64 |
14 files changed, 495 insertions, 495 deletions
diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index 07ad19c8d..745fafadd 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -57,7 +57,7 @@ endif ## # IMPORTANT: # --------- -# all xine audio out plugins should be named like the +# all xine audio out plugins should be named like the # scheme "xineplug_ao_out_" # xineplug_LTLIBRARIES = xineplug_ao_out_none.la xineplug_ao_out_file.la \ @@ -94,7 +94,7 @@ xineplug_ao_out_alsa_la_LIBADD = $(XINE_LIB) $(ALSA_LIBS) $(PTHREAD_LIBS) $(LTLI xineplug_ao_out_alsa_la_CFLAGS = $(VISIBILITY_FLAG) $(ALSA_CFLAGS) xineplug_ao_out_alsa_la_LDFLAGS = -avoid-version -module -xineplug_ao_out_esd_la_SOURCES = audio_esd_out.c +xineplug_ao_out_esd_la_SOURCES = audio_esd_out.c xineplug_ao_out_esd_la_LIBADD = $(XINE_LIB) $(ESD_LIBS) $(LTLIBINTL) xineplug_ao_out_esd_la_CFLAGS = $(VISIBILITY_FLAG) $(ESD_CFLAGS) xineplug_ao_out_esd_la_LDFLAGS = -avoid-version -module @@ -104,7 +104,7 @@ xineplug_ao_out_sun_la_LIBADD = $(XINE_LIB) xineplug_ao_out_sun_la_CFLAGS = $(VISIBILITY_FLAG) xineplug_ao_out_sun_la_LDFLAGS = -avoid-version -module -#xineplug_ao_out_irixal_la_SOURCES = audio_irixal_out.c +#xineplug_ao_out_irixal_la_SOURCES = audio_irixal_out.c #xineplug_ao_out_irixal_la_LIBADD = $(IRIXAL_LIBS) #xineplug_ao_out_irixal_la_CFLAGS = $(VISIBILITY_FLAG) $(IRIXAL_CFLAGS) #xineplug_ao_out_irixal_la_LDFLAGS = -avoid-version -module diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 470cd953a..b18637a7b 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -1,23 +1,23 @@ -/* +/* * Copyright (C) 2000-2006 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * Credits go + * Credits go * - for the SPDIF A/52 sync part * - frame size calculation added (16-08-2001) * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -99,7 +99,7 @@ typedef struct alsa_driver_s { uint32_t bytes_per_frame; uint32_t bytes_in_buffer; /* number of bytes writen to audio hardware */ snd_pcm_uframes_t buffer_size; - int32_t mmap; + int32_t mmap; struct { pthread_t thread; @@ -136,10 +136,10 @@ static int my_snd_mixer_wait(snd_mixer_t *mixer, int timeout) { if (count < 0) return count; - + if ((unsigned int) count > sizeof(spfds) / sizeof(spfds[0])) { pfds = malloc(count * sizeof(*pfds)); - + if (!pfds) return -ENOMEM; @@ -169,44 +169,44 @@ static void *ao_alsa_handle_event_thread(void *data) { int old_mute; pthread_mutex_lock(&this->mixer.mutex); - + old_mute = (this->mixer.mute & MIXER_MASK_MUTE) ? 1 : 0; if((err = snd_mixer_handle_events(this->mixer.handle)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_handle_events(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); continue; } - + if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &left_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); continue; } - + if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &right_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); continue; } - + if(this->mixer.mute & MIXER_HAS_MUTE_SWITCH) { - + if(this->mixer.mute & MIXER_MASK_STEREO) { snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); mute = (swl) ? 0 : 1; } else { - + if (this->mixer.mute & MIXER_MASK_LEFT) snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); - + if ((SND_MIXER_SCHN_FRONT_RIGHT != SND_MIXER_SCHN_UNKNOWN) && (this->mixer.mute & MIXER_MASK_RIGHT)) snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &swr); - + mute = (swl || swr) ? 0 : 1; } } @@ -216,26 +216,26 @@ static void *ao_alsa_handle_event_thread(void *data) { xine_audio_level_data_t data; xine_stream_t *stream; xine_list_iterator_t ite; - + this->mixer.right_vol = right_vol; this->mixer.left_vol = left_vol; if(mute) this->mixer.mute |= MIXER_MASK_MUTE; else this->mixer.mute &= ~MIXER_MASK_MUTE; - - data.right = ao_alsa_get_percent_from_volume(this->mixer.right_vol, + + data.right = ao_alsa_get_percent_from_volume(this->mixer.right_vol, this->mixer.min, this->mixer.max); - data.left = ao_alsa_get_percent_from_volume(this->mixer.left_vol, + data.left = ao_alsa_get_percent_from_volume(this->mixer.left_vol, this->mixer.min, this->mixer.max); data.mute = (this->mixer.mute & MIXER_MASK_MUTE) ? 1 : 0; - + event.type = XINE_EVENT_AUDIO_LEVEL; event.data = &data; event.data_length = sizeof(data); - + pthread_mutex_lock(&this->class->xine->streams_lock); - for(ite = xine_list_front(this->class->xine->streams); + for(ite = xine_list_front(this->class->xine->streams); ite; ite = xine_list_next(this->class->xine->streams, ite)) { stream = xine_list_get_value(this->class->xine->streams, ite); event.stream = stream; @@ -243,12 +243,12 @@ static void *ao_alsa_handle_event_thread(void *data) { } pthread_mutex_unlock(&this->class->xine->streams_lock); } - + pthread_mutex_unlock(&this->mixer.mutex); } } while(this->mixer.running); - + pthread_exit(NULL); } @@ -261,11 +261,11 @@ static long ao_alsa_get_volume_from_percent(int val, long min, long max) { } /* - * Error callback, we need to control this, + * Error callback, we need to control this, * error message should be printed only in DEBUG mode. */ static void XINE_FORMAT_PRINTF(5, 6) - error_callback(const char *file, int line, + error_callback(const char *file, int line, const char *function, int err, const char *fmt, ...) { #ifdef DEBUG va_list args; @@ -286,13 +286,13 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int alsa_driver_t *this = (alsa_driver_t *) this_gen; config_values_t *config = this->class->xine->config; char *pcm_device; - snd_pcm_stream_t direction = SND_PCM_STREAM_PLAYBACK; + snd_pcm_stream_t direction = SND_PCM_STREAM_PLAYBACK; snd_pcm_hw_params_t *params; snd_pcm_sw_params_t *swparams; snd_pcm_access_mask_t *mask; snd_pcm_uframes_t period_size; - snd_pcm_uframes_t period_size_min; - snd_pcm_uframes_t period_size_max; + snd_pcm_uframes_t period_size_min; + snd_pcm_uframes_t period_size_max; snd_pcm_uframes_t buffer_size_min; snd_pcm_uframes_t buffer_size_max; snd_pcm_format_t format; @@ -310,7 +310,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int snd_pcm_hw_params_alloca(¶ms); snd_pcm_sw_params_alloca(&swparams); err = snd_output_stdio_attach(&jcd_out, stdout, 0); - + switch (mode) { case AO_CAP_MODE_MONO: this->num_channels = 1; @@ -336,10 +336,10 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int pcm_device = config->lookup_entry(config, "audio.device.alsa_passthrough_device")->str_value; break; default: - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: ALSA Driver does not support the requested mode: 0x%X\n",mode); return 0; - } + } #ifdef ALSA_LOG printf("audio_alsa_out: Audio Device name = %s\n",pcm_device); @@ -362,25 +362,25 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int */ gettimeofday(&start_time, NULL); do { - err = snd_pcm_open(&this->audio_fd, pcm_device, direction, open_mode); + err = snd_pcm_open(&this->audio_fd, pcm_device, direction, open_mode); gettimeofday(&end_time, NULL); if( err == -EBUSY ) { - if( (double)end_time.tv_sec + 1E-6*end_time.tv_usec + if( (double)end_time.tv_sec + 1E-6*end_time.tv_usec - (double)start_time.tv_sec - 1E-6*start_time.tv_usec > 0.8) break; else usleep(10000); } } while( err == -EBUSY ); - - if(err <0 ) { - xprintf (this->class->xine, XINE_VERBOSITY_LOG, - _("audio_alsa_out: snd_pcm_open() of %s failed: %s\n"), pcm_device, snd_strerror(err)); - xprintf (this->class->xine, XINE_VERBOSITY_LOG, + + if(err <0 ) { + xprintf (this->class->xine, XINE_VERBOSITY_LOG, + _("audio_alsa_out: snd_pcm_open() of %s failed: %s\n"), pcm_device, snd_strerror(err)); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("audio_alsa_out: >>> check if another program already uses PCM <<<\n")); return 0; } - /* printf ("audio_alsa_out: snd_pcm_open() opened %s\n", pcm_device); */ + /* printf ("audio_alsa_out: snd_pcm_open() opened %s\n", pcm_device); */ /* We wanted non blocking open but now put it back to normal */ //snd_pcm_nonblock(this->audio_fd, 0); snd_pcm_nonblock(this->audio_fd, 1); @@ -389,7 +389,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int */ err = snd_pcm_hw_params_any(this->audio_fd, params); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_LOG, + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("audio_alsa_out: broken configuration for this PCM: no configurations available: %s\n"), snd_strerror(err)); goto close; @@ -403,7 +403,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX); err = snd_pcm_hw_params_set_access_mask(this->audio_fd, params, mask); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: mmap not availiable, falling back to compatiblity mode\n"); this->mmap=0; err = snd_pcm_hw_params_set_access(this->audio_fd, params, @@ -413,9 +413,9 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int err = snd_pcm_hw_params_set_access(this->audio_fd, params, SND_PCM_ACCESS_RW_INTERLEAVED); } - + if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: access type not available: %s\n", snd_strerror(err)); goto close; } @@ -438,23 +438,23 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int case 4: format = SND_PCM_FORMAT_FLOAT; break; - default: + default: format = SND_PCM_FORMAT_S16; - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: pcm format bits=%d unknown. failed: %s\n", bits, snd_strerror(err)); break; } err = snd_pcm_hw_params_set_format(this->audio_fd, params, format ); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: sample format non available: %s\n", snd_strerror(err)); goto close; } /* set the number of channels */ err = snd_pcm_hw_params_set_channels(this->audio_fd, params, this->num_channels); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, - "audio_alsa_out: Cannot set number of channels to %d (err=%d:%s)\n", + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "audio_alsa_out: Cannot set number of channels to %d (err=%d:%s)\n", this->num_channels, err, snd_strerror(err)); goto close; } @@ -466,13 +466,13 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_rate_near(this->audio_fd, params, &rate, &dir); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: rate not available: %s\n", snd_strerror(err)); goto close; } this->output_sample_rate = (uint32_t)rate; if (this->input_sample_rate != this->output_sample_rate) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: audio rate : %d requested, %d provided by device/sec\n", this->input_sample_rate, this->output_sample_rate); } @@ -504,7 +504,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int periods=8; err = snd_pcm_hw_params_set_periods_near(this->audio_fd, params, &periods ,&dir); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: unable to set any periods: %s\n", snd_strerror(err)); goto close; } @@ -512,7 +512,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_buffer_time_near(this->audio_fd, params, &buffer_time, &dir); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: buffer time not available: %s\n", snd_strerror(err)); goto close; } @@ -522,7 +522,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_period_size_near(this->audio_fd, params, &period_size, &dir); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: period time not available: %s\n", snd_strerror(err)); goto close; } @@ -533,7 +533,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int dir=0; err = snd_pcm_hw_params_set_buffer_size_near(this->audio_fd, params, &this->buffer_size); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: buffer time not available: %s\n", snd_strerror(err)); goto close; } @@ -543,22 +543,22 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int printf("was set buffer_size = %ld\n",this->buffer_size); #endif if (2*period_size > this->buffer_size) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: buffer to small, could not use\n"); goto close; } - + /* write the parameters to device */ err = snd_pcm_hw_params(this->audio_fd, params); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: pcm hw_params failed: %s\n", snd_strerror(err)); goto close; } /* Check for pause/resume support */ this->has_pause_resume = ( snd_pcm_hw_params_can_pause (params) && snd_pcm_hw_params_can_resume (params) ); - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume); this->sample_rate_factor = (double) this->output_sample_rate / (double) this->input_sample_rate; this->bytes_per_frame = snd_pcm_frames_to_bytes (this->audio_fd, 1); @@ -568,28 +568,28 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int /* Copy current parameters into swparams */ err = snd_pcm_sw_params_current(this->audio_fd, swparams); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to determine current swparams: %s\n", snd_strerror(err)); goto close; } /* align all transfers to 1 sample */ err = snd_pcm_sw_params_set_xfer_align(this->audio_fd, swparams, 1); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set transfer alignment: %s\n", snd_strerror(err)); goto close; } /* allow the transfer when at least period_size samples can be processed */ err = snd_pcm_sw_params_set_avail_min(this->audio_fd, swparams, period_size); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set available min: %s\n", snd_strerror(err)); goto close; } /* start the transfer when the buffer contains at least period_size samples */ err = snd_pcm_sw_params_set_start_threshold(this->audio_fd, swparams, period_size); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set start threshold: %s\n", snd_strerror(err)); goto close; } @@ -597,7 +597,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int /* never stop the transfer, even on xruns */ err = snd_pcm_sw_params_set_stop_threshold(this->audio_fd, swparams, this->buffer_size); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set stop threshold: %s\n", snd_strerror(err)); goto close; } @@ -605,15 +605,15 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int /* Install swparams into current parameters */ err = snd_pcm_sw_params(this->audio_fd, swparams); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Unable to set swparams: %s\n", snd_strerror(err)); goto close; } #ifdef ALSA_LOG - snd_pcm_dump_setup(this->audio_fd, jcd_out); + snd_pcm_dump_setup(this->audio_fd, jcd_out); snd_pcm_sw_params_dump(swparams, jcd_out); #endif - + return this->output_sample_rate; close: @@ -648,7 +648,7 @@ static int ao_alsa_get_gap_tolerance (ao_driver_t *this_gen) { /* * Return the delay. is frames measured by looking at pending samples */ -/* FIXME: delay returns invalid data if status is not RUNNING. +/* FIXME: delay returns invalid data if status is not RUNNING. * e.g When there is an XRUN or we are in PREPARED mode. */ static int ao_alsa_delay (ao_driver_t *this_gen) { @@ -678,12 +678,12 @@ static int ao_alsa_delay (ao_driver_t *this_gen) { /* * Handle over/under-run */ -static void xrun(alsa_driver_t *this) +static void xrun(alsa_driver_t *this) { /* snd_pcm_status_t *status; */ int res; - /* + /* snd_pcm_status_alloca(&status); if ((res = snd_pcm_status(this->audio_fd, status))<0) { printf ("audio_alsa_out: status error: %s\n", snd_strerror(res)); @@ -759,7 +759,7 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { #ifdef LOG_DEBUG printf("audio_alsa_out:write:XRUN before\n"); snd_pcm_status(this->audio_fd, pcm_stat); - snd_pcm_status_dump(pcm_stat, jcd_out); + snd_pcm_status_dump(pcm_stat, jcd_out); #endif if ((res = snd_pcm_prepare(this->audio_fd))<0) { return 0; @@ -771,14 +771,14 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { #ifdef LOG_DEBUG printf("audio_alsa_out:write:XRUN after\n"); #endif - } + } if ( (state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_DRAINING) ) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out:write:BAD STATE, state = %d\n",state); } - + while( number_of_frames > 0) { if ( (state == SND_PCM_STATE_RUNNING) ) { #ifdef LOG_DEBUG @@ -816,7 +816,7 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { } else if ( (state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_DRAINING) ) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out:write:BAD STATE2, state = %d, going to try XRUN\n",state); if ((res = snd_pcm_prepare(this->audio_fd))<0) { xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, @@ -895,7 +895,7 @@ static void ao_alsa_exit(ao_driver_t *this_gen) { this->mixer.handle=0; } pthread_mutex_destroy(&this->mixer.mutex); - + if (this->audio_fd) snd_pcm_close(this->audio_fd); this->audio_fd=NULL; free (this); @@ -913,45 +913,45 @@ static int ao_alsa_get_property (ao_driver_t *this_gen, int property) { case AO_PROP_PCM_VOL: if(this->mixer.elem) { int vol; - + pthread_mutex_lock(&this->mixer.mutex); if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &this->mixer.left_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); goto done; } - + if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &this->mixer.right_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); goto done; } - + done: vol = (((ao_alsa_get_percent_from_volume(this->mixer.left_vol, this->mixer.min, this->mixer.max)) + (ao_alsa_get_percent_from_volume(this->mixer.right_vol, this->mixer.min, this->mixer.max))) /2); pthread_mutex_unlock(&this->mixer.mutex); - + return vol; } break; - + case AO_PROP_MUTE_VOL: { int mute; - + pthread_mutex_lock(&this->mixer.mutex); mute = ((this->mixer.mute & MIXER_HAS_MUTE_SWITCH) && (this->mixer.mute & MIXER_MASK_MUTE)) ? 1 : 0; pthread_mutex_unlock(&this->mixer.mutex); - + return mute; } break; } - + return 0; } @@ -970,18 +970,18 @@ static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value) pthread_mutex_lock(&this->mixer.mutex); this->mixer.left_vol = this->mixer.right_vol = ao_alsa_get_volume_from_percent(value, this->mixer.min, this->mixer.max); - + if((err = snd_mixer_selem_set_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, this->mixer.left_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); return ~value; } - + if((err = snd_mixer_selem_set_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, this->mixer.right_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); pthread_mutex_unlock(&this->mixer.mutex); return ~value; @@ -997,20 +997,20 @@ static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value) if(this->mixer.mute & MIXER_HAS_MUTE_SWITCH) { int swl = 0, swr = 0; int old_mute; - + pthread_mutex_lock(&this->mixer.mutex); - + old_mute = this->mixer.mute; if(value) this->mixer.mute |= MIXER_MASK_MUTE; else this->mixer.mute &= ~MIXER_MASK_MUTE; - + if ((this->mixer.mute & MIXER_MASK_MUTE) != (old_mute & MIXER_MASK_MUTE)) { if(this->mixer.mute & MIXER_MASK_STEREO) { snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); snd_mixer_selem_set_playback_switch_all(this->mixer.elem, !swl); - } + } else { if (this->mixer.mute & MIXER_MASK_LEFT) { snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); @@ -1050,7 +1050,7 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { if (this->audio_fd) { if (this->has_pause_resume) { if ((err=snd_pcm_pause(this->audio_fd, 1)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Pause call failed. (err=%d:%s)\n",err, snd_strerror(err)); this->has_pause_resume = 0; ao_alsa_ctrl(this_gen, AO_CTRL_PLAY_PAUSE, NULL); @@ -1059,15 +1059,15 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { } } else { if ((err=snd_pcm_reset(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Reset call failed. (err=%d:%s)\n",err, snd_strerror(err)); } if ((err=snd_pcm_drain(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Drain call failed. (err=%d:%s)\n",err, snd_strerror(err)); } if ((err=snd_pcm_prepare(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err)); } } @@ -1079,12 +1079,12 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { if (this->has_pause_resume && this->is_paused) { if ((err=snd_pcm_pause(this->audio_fd, 0)) < 0) { if (err == -77) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Warning: How am I supposed to RESUME, if I am not PAUSED. " "audio_out.c, please don't call me!\n"); break; } - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Resume call failed. (err=%d:%s)\n",err, snd_strerror(err)); this->has_pause_resume = 0; } else { @@ -1097,11 +1097,11 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { case AO_CTRL_FLUSH_BUFFERS: if (this->audio_fd) { if ((err=snd_pcm_drop(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Drop call failed. (err=%d:%s)\n",err, snd_strerror(err)); } if ((err=snd_pcm_prepare(this->audio_fd)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err)); } } @@ -1129,43 +1129,43 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { int found; int swl = 0, swr = 0, send_events; - this->mixer.elem = 0; + this->mixer.elem = 0; snd_ctl_card_info_alloca(&hw_info); pcm_device = config->lookup_entry(config, "audio.device.alsa_default_device")->str_value; if ((err = snd_ctl_open (&ctl_handle, pcm_device, 0)) < 0) { xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_ctl_open(): %s\n", snd_strerror(err)); return; } - + if ((err = snd_ctl_card_info (ctl_handle, hw_info)) < 0) { xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_ctl_card_info(): %s\n", snd_strerror(err)); snd_ctl_close(ctl_handle); return; } - + snd_ctl_close (ctl_handle); - /* + /* * Open mixer device */ if ((err = snd_mixer_open (&this->mixer.handle, 0)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_open(): %s\n", snd_strerror(err)); this->mixer.handle=0; return; } - + if ((err = snd_mixer_attach (this->mixer.handle, pcm_device)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_attach(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); this->mixer.handle=0; return; } - + if ((err = snd_mixer_selem_register (this->mixer.handle, NULL, NULL)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_register(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); this->mixer.handle=0; @@ -1173,77 +1173,77 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { } if ((err = snd_mixer_load (this->mixer.handle)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_load(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); this->mixer.handle=0; return; } - + mixer_sid = alloca(snd_mixer_selem_id_sizeof() * snd_mixer_get_count(this->mixer.handle)); if (mixer_sid == NULL) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: alloca() failed: %s\n", strerror(errno)); snd_mixer_close(this->mixer.handle); this->mixer.handle=0; return; } - + again: found = 0; mixer_n_selems = 0; for (elem = snd_mixer_first_elem(this->mixer.handle); elem; elem = snd_mixer_elem_next(elem)) { sid = (snd_mixer_selem_id_t *)(((char *)mixer_sid) + snd_mixer_selem_id_sizeof() * mixer_n_selems); - + if ((snd_mixer_elem_get_type(elem) != SND_MIXER_ELEM_SIMPLE) || !snd_mixer_selem_is_active(elem)) continue; - + snd_mixer_selem_get_id(elem, sid); mixer_n_selems++; if(!strcmp((snd_mixer_selem_get_name(elem)), this->mixer.name)) { /* printf("found %s\n", snd_mixer_selem_get_name(elem)); */ - + this->mixer.elem = elem; - - snd_mixer_selem_get_playback_volume_range(this->mixer.elem, + + snd_mixer_selem_get_playback_volume_range(this->mixer.elem, &this->mixer.min, &this->mixer.max); if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &this->mixer.left_vol)) < 0) { - xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); this->mixer.elem = NULL; continue; } - + if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &this->mixer.right_vol)) < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err)); this->mixer.elem = NULL; continue; } - + /* Channels mute */ this->mixer.mute = 0; if(snd_mixer_selem_has_playback_switch(this->mixer.elem)) { this->mixer.mute |= MIXER_HAS_MUTE_SWITCH; - + if (snd_mixer_selem_has_playback_switch_joined(this->mixer.elem)) { this->mixer.mute |= MIXER_MASK_STEREO; snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); - } + } else { this->mixer.mute |= MIXER_MASK_LEFT; snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT, &swl); - + if (SND_MIXER_SCHN_FRONT_RIGHT != SND_MIXER_SCHN_UNKNOWN) { this->mixer.mute |= MIXER_MASK_RIGHT; snd_mixer_selem_get_playback_switch(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT, &swr); } - + if(!swl || !swr) this->mixer.mute |= MIXER_MASK_MUTE; } @@ -1256,10 +1256,10 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { goto mixer_found; } } - + if(loop) goto mixer_found; /* Yes, untrue but... ;-) */ - + if(!strcmp(this->mixer.name, "PCM")) { config->update_string(config, "audio.device.alsa_mixer_name", "Master"); loop++; @@ -1267,14 +1267,14 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { else { config->update_string(config, "audio.device.alsa_mixer_name", "PCM"); } - + this->mixer.name = config->lookup_entry(config, "audio.device.alsa_mixer_name")->str_value; - + goto again; mixer_found: - - /* + + /* * Ugly: yes[*] no[ ] */ if(found) { @@ -1301,11 +1301,11 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { if (send_events && found) { pthread_attr_t pth_attrs; struct sched_param pth_params; - + this->mixer.running = 1; pthread_attr_init(&pth_attrs); - + pthread_attr_getschedparam(&pth_attrs, &pth_params); pth_params.sched_priority = sched_get_priority_min(SCHED_OTHER); pthread_attr_setschedparam(&pth_attrs, &pth_params); @@ -1317,7 +1317,7 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { } static void alsa_speaker_arrangement_cb (void *user_data, - xine_cfg_entry_t *entry); + xine_cfg_entry_t *entry); /* * Initialize plugin @@ -1358,8 +1358,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da err = snd_lib_error_set_handler(error_callback); if(err < 0) - xine_log(this->class->xine, XINE_LOG_MSG, _("snd_lib_error_set_handler() failed: %d"), err); - + xine_log(this->class->xine, XINE_LOG_MSG, _("snd_lib_error_set_handler() failed: %d"), err); + snd_pcm_hw_params_alloca(¶ms); this->mmap = config->register_bool (config, @@ -1424,7 +1424,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da /* Use the default device to open first */ pcm_device = config->lookup_entry(config, "audio.device.alsa_default_device")->str_value; - + /* * find best device driver/channel */ @@ -1434,11 +1434,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da err=snd_pcm_open(&this->audio_fd, pcm_device, SND_PCM_STREAM_PLAYBACK, 1); /* NON-BLOCK mode */ if(err <0 ) { xine_log (this->class->xine, XINE_LOG_MSG, - _("snd_pcm_open() failed:%d:%s\n"), err, snd_strerror(err)); + _("snd_pcm_open() failed:%d:%s\n"), err, snd_strerror(err)); xine_log (this->class->xine, XINE_LOG_MSG, - _(">>> Check if another program already uses PCM <<<\n")); + _(">>> Check if another program already uses PCM <<<\n")); free(this); - return NULL; + return NULL; } /* @@ -1446,7 +1446,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da */ err = snd_pcm_hw_params_any(this->audio_fd, params); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: broken configuration for this PCM: no configurations available\n"); snd_pcm_close(this->audio_fd); free(this); @@ -1455,7 +1455,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da err = snd_pcm_hw_params_set_access(this->audio_fd, params, SND_PCM_ACCESS_RW_INTERLEAVED); if (err < 0) { - xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: access type not available"); snd_pcm_close(this->audio_fd); free(this); @@ -1537,31 +1537,31 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da ( speakers == SURROUND4 )) { this->capabilities |= AO_CAP_MODE_4CHANNEL; xine_strcat_realloc (&logmsg, _(" 4-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (4-channel not enabled in xine config)")); - - if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && + + if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && ( speakers == SURROUND41 )) { this->capabilities |= AO_CAP_MODE_4_1CHANNEL; xine_strcat_realloc (&logmsg, _(" 4.1-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (4.1-channel not enabled in xine config)")); - if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && + if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && ( speakers == SURROUND5 )) { this->capabilities |= AO_CAP_MODE_5CHANNEL; xine_strcat_realloc (&logmsg, _(" 5-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (5-channel not enabled in xine config)")); - if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && + if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) && ( speakers >= SURROUND51 )) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; xine_strcat_realloc (&logmsg, _(" 5.1-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (5.1-channel not enabled in xine config)")); @@ -1587,7 +1587,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; xine_strcat_realloc (&logmsg, _(" a/52 and DTS pass-through")); - } + } else xine_strcat_realloc (&logmsg, _(" (a/52 and DTS pass-through not enabled in xine config)")); @@ -1622,7 +1622,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->ao_driver.num_channels = ao_alsa_num_channels; this->ao_driver.bytes_per_frame = ao_alsa_bytes_per_frame; this->ao_driver.delay = ao_alsa_delay; - this->ao_driver.write = ao_alsa_write; + this->ao_driver.write = ao_alsa_write; this->ao_driver.close = ao_alsa_close; this->ao_driver.exit = ao_alsa_exit; this->ao_driver.get_gap_tolerance = ao_alsa_get_gap_tolerance; @@ -1711,7 +1711,7 @@ static ao_info_t ao_info_alsa = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_ALSA_IFACE_VERSION, "alsa", XINE_VERSION_CODE, &ao_info_alsa, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c index 14bf5c965..7f796f2b3 100644 --- a/src/audio_out/audio_arts_out.c +++ b/src/audio_out/audio_arts_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -42,7 +42,7 @@ #define AUDIO_NUM_FRAGMENTS 15 #define AUDIO_FRAGMENT_SIZE 8192 -#define GAP_TOLERANCE AO_MAX_GAP +#define GAP_TOLERANCE AO_MAX_GAP typedef struct arts_driver_s { @@ -84,7 +84,7 @@ typedef struct { static void ao_arts_volume(void *buffer, int length, int volume) { int v; short *data = (short *)buffer; - + while (length--) { v=(int) ((*(data) * volume) / 100); *(data)=(v>32767) ? 32767 : ((v<-32768) ? -32768 : v); @@ -118,7 +118,7 @@ static int ao_arts_open(ao_driver_t *this_gen, sleep(2); /* arts might segfault if we are still playing */ arts_close_stream(this->audio_stream); } - + this->mode = mode; this->sample_rate = rate; this->bits_per_sample = bits; @@ -139,7 +139,7 @@ static int ao_arts_open(ao_driver_t *this_gen, this->audio_stream=arts_play_stream(this->sample_rate, bits, this->num_channels, "xine"); this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY); - + /* try to keep latency low, if we don't do this we might end with very high latencies for low quality sound and audio_out will try to fill gaps every time...(values in ms) */ @@ -181,7 +181,7 @@ static int ao_arts_write(ao_driver_t *this_gen, int16_t *data, arts_driver_t *this = (arts_driver_t *) this_gen; int size = num_frames * this->bytes_per_frame; - ao_arts_volume(data, num_frames * this->num_channels, this->mixer.vol_scale ); + ao_arts_volume(data, num_frames * this->num_channels, this->mixer.vol_scale ); arts_write(this->audio_stream, data, size ); return 1; @@ -220,7 +220,7 @@ static uint32_t ao_arts_get_capabilities (ao_driver_t *this_gen) { static void ao_arts_exit(ao_driver_t *this_gen) { arts_driver_t *this = (arts_driver_t *) this_gen; - + ao_arts_close(this_gen); /* FIXME: arts_free() freezes on BSD, so don't use it there */ #if !defined(__OpenBSD__) && !defined (__FreeBSD__) && !defined(__NetBSD__) @@ -233,7 +233,7 @@ static void ao_arts_exit(ao_driver_t *this_gen) static int ao_arts_get_property (ao_driver_t *this_gen, int property) { arts_driver_t *this = (arts_driver_t *) this_gen; - + switch(property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: @@ -269,7 +269,7 @@ static int ao_arts_set_property (ao_driver_t *this_gen, int property, int value) } else { this->mixer.volume = this->mixer.v_mixer; this->mixer.vol_scale = this->mixer.volume; - } + } this->mixer.mute = mute; return value; break; @@ -323,7 +323,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da free(this); return NULL; } - + /* * set volume control */ @@ -409,7 +409,7 @@ static ao_info_t ao_info_arts = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_ARTS_IFACE_VERSION, "arts", XINE_VERSION_CODE, &ao_info_arts, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_coreaudio_out.c b/src/audio_out/audio_coreaudio_out.c index 642f920c7..5e31a15e5 100644 --- a/src/audio_out/audio_coreaudio_out.c +++ b/src/audio_out/audio_coreaudio_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -54,7 +54,7 @@ #define AO_OUT_COREAUDIO_IFACE_VERSION 8 -#define GAP_TOLERANCE AO_MAX_GAP +#define GAP_TOLERANCE AO_MAX_GAP #define BUFSIZE 30720 /* Number of seconds to wait for buffered data to arrive/be used * before giving up. */ @@ -75,7 +75,7 @@ typedef struct coreaudio_driver_s { Component au_component; Component converter_component; - + AudioUnit au_unit; AudioUnit converter_unit; @@ -86,7 +86,7 @@ typedef struct coreaudio_driver_s { int mute; Float32 pre_mute_volume; - + pthread_mutex_t mutex; pthread_cond_t buffer_ready_for_reading; pthread_cond_t buffer_ready_for_writing; @@ -131,7 +131,7 @@ static OSStatus ao_coreaudio_render_proc (coreaudio_driver_t *this, pthread_mutex_lock (&this->mutex); if(this->buf_head < ((BUFSIZE) >> 2)) { set_to_future(&future); - if(pthread_cond_timedwait + if(pthread_cond_timedwait (&this->buffer_ready_for_reading, &this->mutex, &future) == ETIMEDOUT) { /* Timed out, give up and fill remainder with silence. */ @@ -143,13 +143,13 @@ static OSStatus ao_coreaudio_render_proc (coreaudio_driver_t *this, return noErr; } } - + if(this->buf_head < buffer_size - buffer_progress) { chunk_size = this->buf_head; } else { chunk_size = buffer_size - buffer_progress; } - + xine_fast_memcpy (ioData->mBuffers[i].mData, this->buf, chunk_size); if(chunk_size < this->buf_head) { memmove(this->buf, &(this->buf[chunk_size]), this->buf_head - chunk_size); @@ -188,7 +188,7 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate AudioStreamBasicDescription format; AudioUnitConnection connection; ComponentDescription desc; - + switch (mode) { case AO_CAP_MODE_MONO: this->num_channels = 1; @@ -209,7 +209,7 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate pthread_cond_init (&this->buffer_ready_for_reading, NULL); pthread_cond_init (&this->buffer_ready_for_writing, NULL); - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_coreaudio_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); /* find an audio output unit */ @@ -218,17 +218,17 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentFlags = 0; desc.componentFlagsMask = 0; - + this->au_component = FindNextComponent (NULL, &desc); if (this->au_component == NULL) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_coreaudio_out: Unable to find a usable audio output unit component\n"); return 0; } - + OpenAComponent (this->au_component, &this->au_unit); - + /* find a converter unit */ desc.componentType = kAudioUnitType_FormatConverter; desc.componentSubType = kAudioUnitSubType_AUConverter; @@ -236,11 +236,11 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate this->converter_component = FindNextComponent (NULL, &desc); if (this->converter_component == NULL) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_coreaudio_out: Unable to find a usable audio converter unit component\n"); return 0; } - + OpenAComponent (this->converter_component, &this->converter_unit); /* set up the render procedure */ @@ -258,7 +258,7 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate connection.destInputNumber = 0; AudioUnitSetProperty (this->au_unit, kAudioUnitProperty_MakeConnection, - kAudioUnitScope_Input, 0, + kAudioUnitScope_Input, 0, &connection, sizeof(connection)); /* set up the audio format we want to use */ @@ -274,7 +274,7 @@ static int ao_coreaudio_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate format.mBytesPerFrame = this->bytes_per_frame; format.mFramesPerPacket = 1; format.mBytesPerPacket = format.mBytesPerFrame; - + AudioUnitSetProperty (this->converter_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, @@ -339,7 +339,7 @@ static int ao_coreaudio_write(ao_driver_t *this_gen, int16_t *data, pthread_mutex_lock (&this->mutex); if(this->buf_head > ((3 * BUFSIZE)>>2)) { set_to_future(&future); - if(pthread_cond_timedwait + if(pthread_cond_timedwait (&this->buffer_ready_for_writing, &this->mutex, &future) == ETIMEDOUT) { /* Timed out, give up. */ @@ -354,10 +354,10 @@ static int ao_coreaudio_write(ao_driver_t *this_gen, int16_t *data, } else { chunk_size = remaining_bytes; } - + xine_fast_memcpy(&(this->buf[this->buf_head]), data, chunk_size); this->buf_head += chunk_size; - remaining_bytes -= chunk_size; + remaining_bytes -= chunk_size; if(this->buf_head > 0) { pthread_cond_broadcast (&this->buffer_ready_for_reading); @@ -389,13 +389,13 @@ static void ao_coreaudio_close(ao_driver_t *this_gen) CloseComponent (this->au_unit); this->au_unit = 0; } - + if (this->converter_unit) { AudioUnitUninitialize (this->converter_unit); CloseComponent (this->converter_unit); this->converter_unit = 0; } - + if (this->au_component) { this->au_component = NULL; } @@ -417,7 +417,7 @@ static uint32_t ao_coreaudio_get_capabilities (ao_driver_t *this_gen) { static void ao_coreaudio_exit(ao_driver_t *this_gen) { coreaudio_driver_t *this = (coreaudio_driver_t *) this_gen; - + ao_coreaudio_close(this_gen); free (this); @@ -436,7 +436,7 @@ static int ao_coreaudio_get_property (ao_driver_t *this_gen, int property) { kAudioUnitScope_Output, 0, &val); } else { - val = this->pre_mute_volume; + val = this->pre_mute_volume; } return (int) (val * 12); break; @@ -472,12 +472,12 @@ static int ao_coreaudio_set_property (ao_driver_t *this_gen, int property, int v kHALOutputParam_Volume, kAudioUnitScope_Output, 0, &(this->pre_mute_volume)); - + AudioUnitSetParameter (this->au_unit, kHALOutputParam_Volume, kAudioUnitScope_Output, 0, 0, 0); - + this->mute = 1; } } else { @@ -487,14 +487,14 @@ static int ao_coreaudio_set_property (ao_driver_t *this_gen, int property, int v kHALOutputParam_Volume, kAudioUnitScope_Output, 0, this->pre_mute_volume, 0); - + this->mute = 0; } } return value; break; } - + return ~value; } @@ -521,7 +521,7 @@ static int ao_coreaudio_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, +static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { coreaudio_class_t *class = (coreaudio_class_t *) class_gen; @@ -606,7 +606,7 @@ static const ao_info_t ao_info_coreaudio = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_COREAUDIO_IFACE_VERSION, "coreaudio", XINE_VERSION_CODE, &ao_info_coreaudio, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_directx2_out.c b/src/audio_out/audio_directx2_out.c index 6bee2066c..4d7fe4e65 100644 --- a/src/audio_out/audio_directx2_out.c +++ b/src/audio_out/audio_directx2_out.c @@ -70,14 +70,14 @@ /* * If GAP_TOLERANCE is lower than AO_MAX_GAP, xine will - * try to smooth playback without skipping frames or + * try to smooth playback without skipping frames or * inserting silence. */ #define GAP_TOLERANCE (AO_MAX_GAP/3) -/* - * buffer size in miliseconds - * (one second takes 11-192 KB) +/* + * buffer size in miliseconds + * (one second takes 11-192 KB) */ #define BUFFER_MS 1000 @@ -86,7 +86,7 @@ */ #define BUFFER_MIN_MS 200 -/* +/* * base power factor for volume remapping */ #define FACTOR 60.0 @@ -117,8 +117,8 @@ typedef struct { LPDIRECTSOUNDBUFFER dsbuffer; /* DirectSound buffer */ size_t buffer_size; /* size of the buffer */ - size_t write_pos; /* positition in ring buffer for writing*/ - + size_t write_pos; /* positition in ring buffer for writing*/ + int status; /* current status of the driver */ int paused; /* paused mode */ int finished; /* driver finished */ @@ -356,7 +356,7 @@ static int audio_flush(dx2_driver_t *this) { } -/* +/* * set the volume * * DirecSound can only lower the volume by software way. @@ -403,7 +403,7 @@ static int audio_fill(dx2_driver_t *this, char *data, size_t size) { // this->read_size += size; this->write_pos = (this->write_pos + size ) % this->buffer_size; - lprintf("size %u, write_pos %u\n", size, this->write_pos); + lprintf("size %u, write_pos %u\n", size, this->write_pos); if ((err = IDirectSoundBuffer_Unlock(this->dsbuffer, ptr1, size1, ptr2, size2)) != DS_OK) { audio_error(this, err, _("Couldn't unlock direct sound buffer")); @@ -467,8 +467,8 @@ static int test_capability(LPDIRECTSOUNDBUFFER buffer, uint32_t bits, uint32_t r } -/* - * test capabilities of driver before opening +/* + * test capabilities of driver before opening * * Passed only 8 bit and 16 bit with mono or stereo. */ @@ -517,7 +517,7 @@ static int test_capabilities(dx2_driver_t *this) { /* size of free space in the ring buffer */ static size_t buffer_free_size(dx2_driver_t *this) { - + int ret; size_t play_pos; size_t free_space; @@ -526,10 +526,10 @@ static size_t buffer_free_size(dx2_driver_t *this) { ret = audio_tell(this, &play_pos); if (!ret) return 0; - + // calc free space (-1) free_space = (this->buffer_size + play_pos - this->write_pos - 1) % this->buffer_size; - + return free_space; } @@ -543,10 +543,10 @@ static size_t buffer_occupied_size(dx2_driver_t *this) { // get current play pos ret = audio_tell(this, &play_pos); if (!ret) return 0; - + // calc used space used_space = (this->buffer_size + this->write_pos - play_pos) % this->buffer_size; - + return used_space; } @@ -759,7 +759,7 @@ static int ao_dx2_delay(ao_driver_t *this_gen) { if (ret){ frames = buffer_occupied_size(this) / this->frame_size; } - } + } pthread_mutex_unlock(&this->data_mutex); diff --git a/src/audio_out/audio_directx_out.c b/src/audio_out/audio_directx_out.c index 21ba23d91..893a11976 100644 --- a/src/audio_out/audio_directx_out.c +++ b/src/audio_out/audio_directx_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2001-2003 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -81,14 +81,14 @@ typedef struct { int capabilities; xine_t *xine; - + /* directx objects */ LPDIRECTSOUND dsobj; LPDIRECTSOUNDBUFFER dsbuffer; DSBCAPS dsbcaps; LPDIRECTSOUNDNOTIFY notify; DSBPOSITIONNOTIFY notify_events[ 2 ]; - + /* buffer vars */ long buffer_size; int write_status; @@ -96,13 +96,13 @@ typedef struct { uint8_t prebuff[ SOUND_BUFFER_MAX ]; uint32_t prebuff_size; - + /* current buffer properties */ int bits; int rate; int chnn; int frsz; - + /* current mixer settings */ int mute; int volume; @@ -118,7 +118,7 @@ typedef struct { * * BEGIN : Direct Sound and win32 handlers * for xine audio output plugins. - * + * * ------------------------------------------- */ void Error( HWND hwnd, LPSTR szfmt, ... ); @@ -128,7 +128,7 @@ boolean CreateSoundBuffer( ao_directx_t * ao_directx ); void DestroySoundBuffer( ao_directx_t * ao_directx ); uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * samples ); -/* Display formatted error message in +/* Display formatted error message in * popup message box. */ void Error( HWND hwnd, LPSTR szfmt, ... ) @@ -229,25 +229,25 @@ boolean CreateSoundBuffer( ao_directx_t * ao_directx ) * related resources */ DestroySoundBuffer( ao_directx ); - + /* create a secondary sound buffer */ - - memset( &pcmwf, 0, sizeof( PCMWAVEFORMAT ) ); + + memset( &pcmwf, 0, sizeof( PCMWAVEFORMAT ) ); pcmwf.wBitsPerSample = ( unsigned short ) ao_directx->bits; - pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; + pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; pcmwf.wf.nChannels = ao_directx->chnn; - pcmwf.wf.nSamplesPerSec = ao_directx->rate; + pcmwf.wf.nSamplesPerSec = ao_directx->rate; pcmwf.wf.nBlockAlign = ao_directx->frsz; - pcmwf.wf.nAvgBytesPerSec = ao_directx->rate * ao_directx->frsz; + pcmwf.wf.nAvgBytesPerSec = ao_directx->rate * ao_directx->frsz; - memset( &dsbdesc, 0, sizeof( DSBUFFERDESC ) ); - dsbdesc.dwSize = sizeof( DSBUFFERDESC ); - dsbdesc.dwFlags = (DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS | + memset( &dsbdesc, 0, sizeof( DSBUFFERDESC ) ); + dsbdesc.dwSize = sizeof( DSBUFFERDESC ); + dsbdesc.dwFlags = (DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY); dsbdesc.dwBufferBytes = ao_directx->buffer_size; dsbdesc.lpwfxFormat = ( LPWAVEFORMATEX ) &pcmwf; - if( IDirectSound_CreateSoundBuffer( ao_directx->dsobj, &dsbdesc, + if( IDirectSound_CreateSoundBuffer( ao_directx->dsobj, &dsbdesc, &ao_directx->dsbuffer, 0 ) != DS_OK ) { Error( 0, "IDirectSound_CreateSoundBuffer : Unable to create secondary sound buffer" ); @@ -282,7 +282,7 @@ boolean CreateSoundBuffer( ao_directx_t * ao_directx ) /* get the direct sound notification interface */ if( IDirectSoundBuffer_QueryInterface( ao_directx->dsbuffer, - &IID_IDirectSoundNotify, + &IID_IDirectSoundNotify, (LPVOID *)&ao_directx->notify ) != DS_OK ) { Error( 0, "IDirectSoundBuffer_QueryInterface : Unable to get notification interface" ); @@ -380,9 +380,9 @@ uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * s #ifdef LOG if ((void*)samples != (void*)0) - printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); + printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); else - printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); + printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); #endif half_size = ao_directx->buffer_size / 2; @@ -485,7 +485,7 @@ uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * s } /* write data to our sound buffer */ - + memcpy( buff_pointer, samples, buff_length ); /* unlock our sound buffer */ @@ -512,7 +512,7 @@ uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * s * ----------------------------------------- */ static int ao_directx_control(ao_driver_t *this_gen, int cmd, ...) { - switch (cmd) + switch (cmd) { case AO_CTRL_PLAY_PAUSE: @@ -539,7 +539,7 @@ static int ao_directx_open( ao_driver_t * ao_driver, uint32_t bits, uint32_t rat ao_directx->bits = bits; ao_directx->rate = rate; - + /* store channel count */ switch( mode ) @@ -628,7 +628,7 @@ static int ao_directx_write( ao_driver_t * ao_driver, int16_t * frame_buffer, ui uint32_t wrote; /* number of bytes written */ uint32_t half_size; /* half our sound buffer size */ - lprintf("ao_directx_write(%08x, %08x, %d) Enter\n", + lprintf("ao_directx_write(%08x, %08x, %d) Enter\n", (unsigned long)ao_directx, (unsigned long)frame_buffer, num_frames); /* zero write counter */ @@ -745,7 +745,7 @@ static int ao_directx_set_property( ao_driver_t * ao_driver, int property, int v { ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; - lprintf("ao_directx_set_property(%08x, %d, %d) Enter\n", + lprintf("ao_directx_set_property(%08x, %d, %d) Enter\n", (unsigned long)ao_directx, property, value); switch( property ) @@ -759,7 +759,7 @@ static int ao_directx_set_property( ao_driver_t * ao_driver, int property, int v if( !ao_directx->mute && ao_directx->dsbuffer ) IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, ao_directx->volume ); - xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, + xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : volume set to %d - directX volume = %d\n", value, ao_directx->volume); return value; @@ -793,11 +793,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da { audiox_class_t *class = (audiox_class_t *) class_gen; ao_directx_t *ao_directx; - + ao_directx = calloc(1, sizeof(ao_directx_t)); if (!ao_directx) return NULL; - + lprintf("open_plugin(%08x, %08x) Enter\n", (unsigned long)class_gen, (unsigned long)data); lprintf("open_plugin: ao_directx=%08x\n", (unsigned long)ao_directx); @@ -848,7 +848,7 @@ static void *init_class (xine_t *xine, void *data) { audiox = calloc(1, sizeof (audiox_class_t)); if (!audiox) return NULL; - + audiox->driver_class.open_plugin = open_plugin; audiox->driver_class.get_identifier = get_identifier; audiox->driver_class.get_description = get_description; @@ -858,7 +858,7 @@ static void *init_class (xine_t *xine, void *data) { audiox->config = xine->config; lprintf("init_class() Exit! Returning audiox=%08x\n", audiox); - + return audiox; } @@ -870,7 +870,7 @@ static const ao_info_t ao_info_directx = { * exported plugin catalog entry */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_DIRECTX_IFACE_VERSION, "directx", XINE_VERSION_CODE, &ao_info_directx, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_esd_out.c b/src/audio_out/audio_esd_out.c index 63c54b546..ae7576259 100644 --- a/src/audio_out/audio_esd_out.c +++ b/src/audio_out/audio_esd_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -77,7 +77,7 @@ typedef struct esd_driver_s { /* * Temporary sample buffer used to reblock the sample output stream * to writes using buffer sizes of n*ESD_BUF_SIZE bytes. - * + * * The reblocking avoids a bug with esd 0.2.18 servers and reduces * cpu load with newer versions of the esd server. * @@ -99,7 +99,7 @@ typedef struct { /* - * connect to esd + * connect to esd */ static int ao_esd_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode) @@ -107,7 +107,7 @@ static int ao_esd_open(ao_driver_t *this_gen, esd_driver_t *this = (esd_driver_t *) this_gen; esd_format_t format; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); if ( (mode & this->capabilities) == 0 ) { @@ -117,12 +117,12 @@ static int ao_esd_open(ao_driver_t *this_gen, if (this->audio_fd>=0) { - if ( (mode == this->mode) && (rate == this->input_sample_rate) ) + if ( (mode == this->mode) && (rate == this->input_sample_rate) ) return this->output_sample_rate; esd_close (this->audio_fd); } - + this->mode = mode; this->input_sample_rate = rate; this->output_sample_rate = rate; @@ -170,7 +170,7 @@ static int ao_esd_open(ao_driver_t *this_gen, return this->output_sample_rate; } -static int ao_esd_num_channels(ao_driver_t *this_gen) +static int ao_esd_num_channels(ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; return this->num_channels; @@ -200,14 +200,14 @@ static int ao_esd_delay(ao_driver_t *this_gen) frames += (tv.tv_sec - this->start_time.tv_sec) * this->output_sample_rate; - frames -= this->latency; + frames -= this->latency; if (frames < 0) frames = 0; - + /* calc delay */ - + bytes_left = this->bytes_in_buffer - frames * this->bytes_per_frame; - + if (bytes_left<=0) /* buffer ran dry */ bytes_left = 0; return bytes_left / this->bytes_per_frame; @@ -230,18 +230,18 @@ static int ao_esd_write(ao_driver_t *this_gen, /* check if simulated buffer ran dry */ gettimeofday(&tv, NULL); - + frames = (tv.tv_usec - this->start_time.tv_usec) * this->output_sample_k_rate / 1000; frames += (tv.tv_sec - this->start_time.tv_sec) * this->output_sample_rate; - - frames -= this->latency; + + frames -= this->latency; if (frames < 0) frames = 0; /* calc delay */ - + simulated_bytes_in_buffer = frames * this->bytes_per_frame; if (this->bytes_in_buffer < simulated_bytes_in_buffer) @@ -296,7 +296,7 @@ static int ao_esd_write(ao_driver_t *this_gen, if (nwritten != num_bytes) { if (nwritten < 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: writev failed: %s\n", strerror(errno)); - else + else xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: warning, incomplete write: %d\n", nwritten); } if (nwritten > 0) @@ -337,7 +337,7 @@ static int ao_esd_get_gap_tolerance (ao_driver_t *this_gen) { static void ao_esd_exit(ao_driver_t *this_gen) { esd_driver_t *this = (esd_driver_t *) this_gen; - + if (this->audio_fd != -1) esd_close(this->audio_fd); @@ -351,19 +351,19 @@ static int ao_esd_get_property (ao_driver_t *this_gen, int property) { int mixer_fd; esd_player_info_t *esd_pi; esd_info_t *esd_i; - + switch(property) { case AO_PROP_MIXER_VOL: - + if((mixer_fd = esd_open_sound(NULL)) >= 0) { if((esd_i = esd_get_all_info(mixer_fd)) != NULL) { for(esd_pi = esd_i->player_list; esd_pi != NULL; esd_pi = esd_pi->next) { if(!strcmp(this->pname, esd_pi->name)) { this->mixer.source_id = esd_pi->source_id; - + if(!this->mixer.mute) - this->mixer.volume = (((esd_pi->left_vol_scale * 100) / 256) + + this->mixer.volume = (((esd_pi->left_vol_scale * 100) / 256) + ((esd_pi->right_vol_scale * 100) / 256)) >> 1; } @@ -372,7 +372,7 @@ static int ao_esd_get_property (ao_driver_t *this_gen, int property) { } esd_close(mixer_fd); } - + return this->mixer.volume; break; @@ -390,39 +390,39 @@ static int ao_esd_set_property (ao_driver_t *this_gen, int property, int value) switch(property) { case AO_PROP_MIXER_VOL: - + if(!this->mixer.mute) { - + /* need this to get source_id */ (void) ao_esd_get_property(&this->ao_driver, AO_PROP_MIXER_VOL); if((mixer_fd = esd_open_sound(NULL)) >= 0) { int v = (value * 256) / 100; - + esd_set_stream_pan(mixer_fd, this->mixer.source_id, v, v); - + if(!this->mixer.mute) this->mixer.volume = value; - + esd_close(mixer_fd); } } else this->mixer.volume = value; - + return this->mixer.volume; break; - + case AO_PROP_MUTE_VOL: { int mute = (value) ? 1 : 0; - + /* need this to get source_id */ (void) ao_esd_get_property(&this->ao_driver, AO_PROP_MIXER_VOL); - + if(mute) { if((mixer_fd = esd_open_sound(NULL)) >= 0) { int v = 0; - + esd_set_stream_pan(mixer_fd, this->mixer.source_id, v, v); esd_close(mixer_fd); } @@ -430,14 +430,14 @@ static int ao_esd_set_property (ao_driver_t *this_gen, int property, int value) else { if((mixer_fd = esd_open_sound(NULL)) >= 0) { int v = (this->mixer.volume * 256) / 100; - + esd_set_stream_pan(mixer_fd, this->mixer.source_id, v, v); esd_close(mixer_fd); } } - + this->mixer.mute = mute; - + return value; } break; @@ -465,7 +465,7 @@ static int ao_esd_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, +static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { esd_class_t *class = (esd_class_t *) class_gen; @@ -491,7 +491,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, sigemptyset(&vo_mask); sigaddset(&vo_mask, SIGALRM); - if (sigprocmask(SIG_UNBLOCK, &vo_mask, &vo_mask_orig)) + if (sigprocmask(SIG_UNBLOCK, &vo_mask, &vo_mask_orig)) xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: cannot unblock SIGALRM: %s\n", strerror(errno)); xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_esd_out: connecting to esd server...\n")); @@ -511,7 +511,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, return NULL; } - + esd_svinfo = esd_get_server_info(audio_fd); if (esd_svinfo) { server_sample_rate = esd_svinfo->rate; @@ -606,7 +606,7 @@ static const ao_info_t ao_info_esd = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_ESD_IFACE_VERSION, "esd", XINE_VERSION_CODE, &ao_info_esd, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_file_out.c b/src/audio_out/audio_file_out.c index 699a5cf54..7b7bfe950 100644 --- a/src/audio_out/audio_file_out.c +++ b/src/audio_out/audio_file_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -46,7 +46,7 @@ struct wavhdr { unsigned char bRiffMagic[4]; // 'RIFF' uint32_t wRiffLength ; // length of file minus the 8 byte riff header unsigned char bWaveMagic[8]; // 'WAVEfmt ' - uint32_t wFmtSize; // length of format chunk minus 8 byte header + uint32_t wFmtSize; // length of format chunk minus 8 byte header uint16_t wFormatTag; // identifies PCM, ULAW etc uint16_t wChannels; uint32_t dwSamplesPerSecond; // samples per second per channel @@ -93,7 +93,7 @@ static int ao_file_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int file_driver_t *this = (file_driver_t *) this_gen; struct wavhdr w; - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_file_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); this->mode = mode; @@ -314,7 +314,7 @@ static int ao_file_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, +static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { file_class_t *class = (file_class_t *) class_gen; @@ -399,7 +399,7 @@ static const ao_info_t ao_info_file = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_FILE_IFACE_VERSION, "file", XINE_VERSION_CODE, &ao_info_file, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_fusionsound_out.c b/src/audio_out/audio_fusionsound_out.c index 6c3a0ae33..873ab32e9 100644 --- a/src/audio_out/audio_fusionsound_out.c +++ b/src/audio_out/audio_fusionsound_out.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2006 the xine project and Claudio Ciccani - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -69,10 +69,10 @@ typedef struct fusionsound_driver_s { float vol; int vol_mute; - + float amp; int amp_mute; - + int paused; } fusionsound_driver_t; @@ -90,12 +90,12 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver, DFBResult ret; lprintf ("ao_open( bits=%d, rate=%d, mode=%d )\n", bits, rate, mode); - - dsc.flags = FSSDF_BUFFERSIZE | FSBDF_CHANNELS | + + dsc.flags = FSSDF_BUFFERSIZE | FSBDF_CHANNELS | FSSDF_SAMPLEFORMAT | FSSDF_SAMPLERATE; switch (mode) { - case AO_CAP_MODE_MONO: + case AO_CAP_MODE_MONO: dsc.channels = 1; break; case AO_CAP_MODE_STEREO: @@ -140,13 +140,13 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver, this->playback->Release (this->playback); this->playback = NULL; } - + if (this->stream) { this->stream->Release (this->stream); this->stream = NULL; } - - ret = this->sound->CreateStream (this->sound, &dsc, &this->stream); + + ret = this->sound->CreateStream (this->sound, &dsc, &this->stream); if (ret != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_fusionsound_out: IFusionSound::CreateStream() failed [%s]\n", @@ -160,10 +160,10 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver, this->channels = dsc.channels; this->rate = dsc.samplerate; this->bytes_per_frame = this->channels * FS_BYTES_PER_SAMPLE(this->format); - + ret = this->stream->GetPlayback (this->stream, &this->playback); if (ret == DFB_OK) { - this->playback->SetVolume (this->playback, + this->playback->SetVolume (this->playback, (this->vol_mute ? 0 : this->vol) * (this->amp_mute ? 0 : this->amp)); if (this->paused) @@ -182,22 +182,22 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver, static int ao_fusionsound_num_channels(ao_driver_t *ao_driver) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; - + return this->channels; } static int ao_fusionsound_bytes_per_frame(ao_driver_t *ao_driver) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; - + return this->bytes_per_frame; } static int ao_fusionsound_delay(ao_driver_t *ao_driver) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; int delay = 0; - + this->stream->GetPresentationDelay (this->stream, &delay); - + return (delay * this->rate / 1000); } @@ -209,7 +209,7 @@ static int ao_fusionsound_write(ao_driver_t *ao_driver, int16_t *data, uint32_t num_frames) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; DFBResult ret; - + if (this->paused) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: " @@ -226,7 +226,7 @@ static int ao_fusionsound_write(ao_driver_t *ao_driver, FusionSoundErrorString (ret)); return 0; } - + return num_frames; } @@ -264,13 +264,13 @@ static void ao_fusionsound_exit(ao_driver_t *ao_driver) { if (this->playback) this->playback->Release (this->playback); - + if (this->stream) this->stream->Release (this->stream); if (this->sound) this->sound->Release (this->sound); - + free (this); } @@ -287,17 +287,17 @@ static int ao_fusionsound_get_property(ao_driver_t *ao_driver, int property) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: volume mute is %d\n", this->vol_mute); return this->vol_mute; - + case AO_PROP_AMP: xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: amplifier is %.2f\n", this->amp); return (int) (this->amp * 100.0); - + case AO_PROP_AMP_MUTE: xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: amplifier mute is %d\n", this->amp_mute); return this->amp_mute; - + default: break; } @@ -305,10 +305,10 @@ static int ao_fusionsound_get_property(ao_driver_t *ao_driver, int property) { return 0; } -static int ao_fusionsound_set_property(ao_driver_t *ao_driver, +static int ao_fusionsound_set_property(ao_driver_t *ao_driver, int property, int value ) { fusionsound_driver_t *this = (fusionsound_driver_t *) ao_driver; - + if (!this->playback) return 0; @@ -318,11 +318,11 @@ static int ao_fusionsound_set_property(ao_driver_t *ao_driver, xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: volume set to %.2f\n", this->vol); break; - + case AO_PROP_MUTE_VOL: this->vol_mute = value ? 1 : 0; xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "audio_fusionsound_out: volume mute set to %d\n", + "audio_fusionsound_out: volume mute set to %d\n", this->vol_mute); break; @@ -331,20 +331,20 @@ static int ao_fusionsound_set_property(ao_driver_t *ao_driver, xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_fusionsound_out: amplifier set to %.2f\n", this->amp); break; - + case AO_PROP_AMP_MUTE: this->amp_mute = value ? 1 : 0; xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "audio_fusionsound_out: amplifier mute set to %d\n", + "audio_fusionsound_out: amplifier mute set to %d\n", this->amp_mute); break; default: return 0; } - + if (this->playback) { - this->playback->SetVolume (this->playback, + this->playback->SetVolume (this->playback, (this->vol_mute ? 0 : this->vol) * (this->amp_mute ? 0 : this->amp)); } @@ -362,10 +362,10 @@ static int ao_fusionsound_control(ao_driver_t *ao_driver, int cmd, ...) { this->playback->Stop (this->playback); this->paused = 1; return 1; - + case AO_CTRL_PLAY_RESUME: lprintf ("Resume()\n"); - if (this->playback) + if (this->playback) this->playback->Continue (this->playback); this->paused = 0; return 1; @@ -384,7 +384,7 @@ static int ao_fusionsound_control(ao_driver_t *ao_driver, int cmd, ...) { } -static ao_driver_t* open_plugin(audio_driver_class_t *ao_class, +static ao_driver_t* open_plugin(audio_driver_class_t *ao_class, const void *data ) { fusionsound_class_t *class = (fusionsound_class_t *) ao_class; fusionsound_driver_t *this; @@ -424,7 +424,7 @@ static ao_driver_t* open_plugin(audio_driver_class_t *ao_class, this->ao_driver.exit = ao_fusionsound_exit; this->ao_driver.get_gap_tolerance = ao_fusionsound_get_gap_tolerance; this->ao_driver.control = ao_fusionsound_control; - + this->vol = this->amp = 1.0; return &this->ao_driver; @@ -449,7 +449,7 @@ static void dispose_class(audio_driver_class_t *ao_class) { static void* init_class(xine_t *xine, void *data) { fusionsound_class_t *class; const char *error; - + /* check FusionSound version */ error = FusionSoundCheckVersion( FUSIONSOUND_MAJOR_VERSION, FUSIONSOUND_MINOR_VERSION, @@ -485,7 +485,7 @@ static const ao_info_t ao_info_fusionsound = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_FS_IFACE_VERSION, "FusionSound", XINE_VERSION_CODE, &ao_info_fusionsound, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/audio_out/audio_irixal_out.c b/src/audio_out/audio_irixal_out.c index 1654cc1a7..336996a99 100644 --- a/src/audio_out/audio_irixal_out.c +++ b/src/audio_out/audio_irixal_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -113,7 +113,7 @@ static int ao_irixal_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, i default: xlerror ("irixal Driver does not support the requested mode: 0x%x",mode); return 0; - } + } if (! (config = alNewConfig ())) { @@ -126,7 +126,7 @@ static int ao_irixal_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, i alFreeConfig (config); return 0; } - + switch (bits) { case 8: if ( (alSetWidth (config, AL_SAMPLE_8)) == -1) @@ -211,7 +211,7 @@ static int ao_irixal_get_gap_tolerance (ao_driver_t *this_gen) return this->gap_tolerance; } -static int ao_irixal_delay (ao_driver_t *this_gen) +static int ao_irixal_delay (ao_driver_t *this_gen) { irixal_driver_t *this = (irixal_driver_t *) this_gen; stamp_t stamp, time; @@ -230,7 +230,7 @@ static int ao_irixal_write(ao_driver_t *this_gen,int16_t *data, uint32_t num_fra { irixal_driver_t *this = (irixal_driver_t *) this_gen; stamp_t stamp; - + /* Grmbf. IRIX audio does not tell us, wenn we run dry. * We have to detect this ourself. */ /* get absolute number of samples played so far @@ -249,7 +249,7 @@ static int ao_irixal_write(ao_driver_t *this_gen,int16_t *data, uint32_t num_fra * alGetFillable() would tell us, whether space was available */ alWriteFrames (this->port, data, num_frames); this->frames_in_buffer += num_frames; - + return num_frames; } @@ -376,9 +376,9 @@ static void *init_audio_out_plugin (config_values_t *config) } } } - + printf (" capabilities 0x%X\n",this->capabilities); - + /* TODO: anything can change during runtime... move check to the right location */ this->gap_tolerance = config->register_range (config, "audio.device.irixal_gap_tolerance", DEFAULT_GAP_TOLERANCE, 0, 90000, @@ -396,7 +396,7 @@ static void *init_audio_out_plugin (config_values_t *config) this->ao_driver.num_channels = ao_irixal_num_channels; this->ao_driver.bytes_per_frame = ao_irixal_bytes_per_frame; this->ao_driver.delay = ao_irixal_delay; - this->ao_driver.write = ao_irixal_write; + this->ao_driver.write = ao_irixal_write; this->ao_driver.close = ao_irixal_close; this->ao_driver.exit = ao_irixal_exit; this->ao_driver.get_gap_tolerance = ao_irixal_get_gap_tolerance; @@ -421,7 +421,7 @@ ao_info_t *get_audio_out_plugin_info() */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_IRIXAL_IFACE_VERSION, "irixal", XINE_VERSION_CODE, &ao_info_irixal, init_audio_out_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_jack_out.c b/src/audio_out/audio_jack_out.c index 6394fd3e3..a343310f0 100644 --- a/src/audio_out/audio_jack_out.c +++ b/src/audio_out/audio_jack_out.c @@ -89,7 +89,7 @@ typedef struct /** * \brief get the number of free bytes in the buffer * \return number of free bytes in buffer - * + * * may only be called by Xine's thread * return value may change between immediately following two calls, * and the real number of free bytes might be larger! diff --git a/src/audio_out/audio_none_out.c b/src/audio_out/audio_none_out.c index 9ba9a00ca..c3d351035 100644 --- a/src/audio_out/audio_none_out.c +++ b/src/audio_out/audio_none_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -40,7 +40,7 @@ #define AUDIO_NUM_FRAGMENTS 15 #define AUDIO_FRAGMENT_SIZE 8192 -#define GAP_TOLERANCE AO_MAX_GAP +#define GAP_TOLERANCE AO_MAX_GAP typedef struct none_driver_s { @@ -74,7 +74,7 @@ static int ao_none_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int { none_driver_t *this = (none_driver_t *) this_gen; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_none_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode); this->mode = mode; @@ -115,13 +115,13 @@ static int ao_none_write(ao_driver_t *this_gen, int16_t *data, uint32_t num_frames) { none_driver_t *this = (none_driver_t *) this_gen; - + /* take some time to pretend we are doing something. * avoids burning cpu. */ if( (1000 * num_frames / this->sample_rate) > 10 ) xine_usec_sleep ((1000 * num_frames / this->sample_rate)*1000/2); - + return 1; } @@ -143,7 +143,7 @@ static uint32_t ao_none_get_capabilities (ao_driver_t *this_gen) { static void ao_none_exit(ao_driver_t *this_gen) { none_driver_t *this = (none_driver_t *) this_gen; - + ao_none_close(this_gen); free (this); @@ -177,7 +177,7 @@ static int ao_none_ctrl(ao_driver_t *this_gen, int cmd, ...) { return 0; } -static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, +static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { none_class_t *class = (none_class_t *) class_gen; @@ -260,7 +260,7 @@ static const ao_info_t ao_info_none = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_NONE_IFACE_VERSION, "none", XINE_VERSION_CODE, &ao_info_none, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index ba1044ed4..bd16a6dd3 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -1,25 +1,25 @@ -/* +/* * Copyright (C) 2000-2008 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk - * + * * General Programming Guidelines: - * New concept of an "audio_frame". * An audio_frame consists of all the samples required to fill every audio channel @@ -90,7 +90,7 @@ #endif #ifndef AFMT_AC3 -# define AFMT_AC3 0x00000400 +# define AFMT_AC3 0x00000400 #endif #define AO_OUT_OSS_IFACE_VERSION 8 @@ -127,7 +127,7 @@ typedef struct oss_driver_s { uint32_t bytes_per_frame; uint32_t bytes_in_buffer; /* number of bytes writen to audio hardware */ uint32_t last_getoptr; - + int audio_started; int sync_method; int latency; @@ -178,7 +178,7 @@ static int ao_oss_open(ao_driver_t *this_gen, close (this->audio_fd); } - + this->mode = mode; this->input_sample_rate = rate; this->bits_per_sample = bits; @@ -192,11 +192,11 @@ static int ao_oss_open(ao_driver_t *this_gen, this->audio_fd=open(this->audio_dev,O_WRONLY|O_NONBLOCK); if (this->audio_fd < 0) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: Opening audio device %s: %s\n"), this->audio_dev, strerror(errno)); return 0; } - + /* We wanted non blocking open but now put it back to normal */ fcntl(this->audio_fd, F_SETFL, fcntl(this->audio_fd, F_GETFL)&~O_NONBLOCK); @@ -213,8 +213,8 @@ static int ao_oss_open(ao_driver_t *this_gen, tmp = this->input_sample_rate; if (ioctl(this->audio_fd,SNDCTL_DSP_SPEED, &tmp) == -1) { - - xprintf(this->xine, XINE_VERBOSITY_LOG, + + xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: warning: sampling rate %d Hz not supported, trying 44100 Hz\n"), this->input_sample_rate); @@ -272,7 +272,7 @@ static int ao_oss_open(ao_driver_t *this_gen, xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_oss_out: %d channels output\n", this->num_channels); this->bytes_per_frame=(this->bits_per_sample*this->num_channels)/8; - + /* * set format */ @@ -303,7 +303,7 @@ static int ao_oss_open(ao_driver_t *this_gen, else xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: The AFMT_S16_NE ioctl failed.\n"); return 0; - } + } } break; case AO_CAP_MODE_A52: @@ -317,7 +317,7 @@ static int ao_oss_open(ao_driver_t *this_gen, ioctl(this->audio_fd, SNDCTL_DSP_CHANNELS, &tmp); tmp = AFMT_AC3; if (ioctl(this->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != AFMT_AC3) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: AC3 SNDCTL_DSP_SETFMT failed. %d. Using alternative.\n",tmp); tmp = AFMT_S16_LE; ioctl(this->audio_fd, SNDCTL_DSP_SETFMT, &tmp); @@ -344,7 +344,7 @@ static int ao_oss_open(ao_driver_t *this_gen, printf ("audio_oss_out: audio buffer fragment info : %x\n",tmp); - ioctl(this->audio_fd,SNDCTL_DSP_SETFRAGMENT,&tmp); + ioctl(this->audio_fd,SNDCTL_DSP_SETFRAGMENT,&tmp); */ return this->output_sample_rate; @@ -395,9 +395,9 @@ static int ao_oss_delay(ao_driver_t *this_gen) { * this->output_sample_k_rate / 1000; frames += (tv.tv_sec - this->start_time.tv_sec) * this->output_sample_rate; - + frames -= this->latency * this->output_sample_k_rate; - + /* calc delay */ bytes_left = this->bytes_in_buffer - frames * this->bytes_per_frame; @@ -421,15 +421,15 @@ static int ao_oss_delay(ao_driver_t *this_gen) { if (ioctl (this->audio_fd, SNDCTL_DSP_GETOPTR, &info)) { perror ("audio_oss_out: SNDCTL_DSP_GETOPTR failed:"); } - + lprintf ("%d bytes output\n", info.bytes); if (this->bytes_in_buffer < info.bytes) { this->bytes_in_buffer -= this->last_getoptr; /* GETOPTR wrapped */ - } - + } + bytes_left = this->bytes_in_buffer - info.bytes; /* calc delay */ - + if (bytes_left<=0) { /* buffer ran dry */ bytes_left = 0; this->bytes_in_buffer = info.bytes; @@ -476,7 +476,7 @@ static int ao_oss_write(ao_driver_t *this_gen, this->bytes_in_buffer += num_frames * this->bytes_per_frame; - n = write(this->audio_fd, frame_buffer, num_frames * this->bytes_per_frame); + n = write(this->audio_fd, frame_buffer, num_frames * this->bytes_per_frame); lprintf ("ao_oss_write done\n"); @@ -520,20 +520,20 @@ static int ao_oss_get_property (ao_driver_t *this_gen, int property) { case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: if(!this->mixer.mute) { - + if(this->mixer.fd != -1) { IOCTL_REQUEST_TYPE cmd = 0; int v; - + ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); - + if(audio_devs & SOUND_MASK_PCM) cmd = SOUND_MIXER_READ_PCM; else if(audio_devs & SOUND_MASK_VOLUME) cmd = SOUND_MIXER_READ_VOLUME; else return -1; - + ioctl(this->mixer.fd, cmd, &v); this->mixer.volume = (((v & 0xFF00) >> 8) + (v & 0x00FF)) / 2; } else @@ -559,20 +559,20 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) case AO_PROP_PCM_VOL: case AO_PROP_MIXER_VOL: if(!this->mixer.mute) { - + if(this->mixer.fd != -1) { IOCTL_REQUEST_TYPE cmd = 0; int v; - + ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); - + if(audio_devs & SOUND_MASK_PCM) cmd = SOUND_MIXER_WRITE_PCM; else if(audio_devs & SOUND_MASK_VOLUME) cmd = SOUND_MIXER_WRITE_VOLUME; else return -1; - + v = (value << 8) | value; ioctl(this->mixer.fd, cmd, &v); this->mixer.volume = value; @@ -588,26 +588,26 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) this->mixer.mute = (value) ? 1 : 0; if(this->mixer.mute) { - + if(this->mixer.fd != -1) { IOCTL_REQUEST_TYPE cmd = 0; int v = 0; - + ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); - + if(audio_devs & SOUND_MASK_PCM) cmd = SOUND_MIXER_WRITE_PCM; else if(audio_devs & SOUND_MASK_VOLUME) cmd = SOUND_MIXER_WRITE_VOLUME; else return -1; - + ioctl(this->mixer.fd, cmd, &v); } else return -1; } else (void) ao_oss_set_property(&this->ao_driver, this->mixer.prop, this->mixer.volume); - + return value; break; } @@ -625,7 +625,7 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { if (this->sync_method != OSS_SYNC_SOFTSYNC) ioctl(this->audio_fd, SNDCTL_DSP_RESET, NULL); - + /* close/reopen if RESET causes problems */ if (this->sync_method == OSS_SYNC_GETOPTR) { ao_oss_close(this_gen); @@ -641,7 +641,7 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { lprintf ("AO_CTRL_FLUSH_BUFFERS\n"); if (this->sync_method != OSS_SYNC_SOFTSYNC) ioctl(this->audio_fd, SNDCTL_DSP_RESET, NULL); - + if (this->sync_method == OSS_SYNC_GETOPTR) { ao_oss_close(this_gen); ao_oss_open(this_gen, this->bits_per_sample, this->input_sample_rate, this->mode); @@ -687,14 +687,14 @@ static int probe_audio_devices(oss_driver_t *this) { strcpy(this->audio_dev, devname); /* Better, keep this one */ best_rate = rate; } - + close (audio_fd); } } } return best_rate; /* Will be zero if we did not find one */ -} - +} + static void oss_speaker_arrangement_cb (void *user_data, xine_cfg_entry_t *entry); @@ -728,7 +728,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da #define A52_PASSTHRU 12 int speakers; - + this = calloc(1, sizeof (oss_driver_t)); if (!this) return NULL; @@ -762,7 +762,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: audio.device.oss_device_name = auto, probing devs\n")); if ( ! probe_audio_devices(this)) { /* Returns zero on fail */ - xprintf(class->xine, XINE_VERBOSITY_LOG, + xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: Auto probe for audio device failed\n")); free (this); return NULL; @@ -784,18 +784,18 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da audio_fd = open(this->audio_dev, O_WRONLY|O_NONBLOCK); if (audio_fd < 0) { - xprintf(class->xine, XINE_VERBOSITY_LOG, + xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: opening audio device %s failed:\n%s\n"), this->audio_dev, strerror(errno)); free (this); return NULL; - } + } /* * set up driver to reasonable values for capabilities tests */ - arg = AFMT_S16_NE; + arg = AFMT_S16_NE; status = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &arg); arg = 44100; status = ioctl(audio_fd, SNDCTL_DSP_SPEED, &arg); @@ -805,7 +805,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da */ this->sync_method = config->register_enum (config, "audio.oss_sync_method", OSS_SYNC_AUTO_DETECT, - sync_methods, + sync_methods, _("a/v sync method to use by OSS"), _("xine can use different methods to keep audio and video " "synchronized. Which setting works best depends on the " @@ -862,9 +862,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da "audio_oss_out: ...will use system real-time clock for soft-sync instead\n" "audio_oss_out: ...there may be audio/video synchronization issues\n")); xine_monotonic_clock(&this->start_time, NULL); - + this->latency = config->register_range (config, "audio.oss_latency", 0, - -3000, 3000, + -3000, 3000, _("OSS audio output latency (adjust a/v sync)"), _("If you experience audio being not in sync " "with the video, you can enter a fixed offset " @@ -873,20 +873,20 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da "of a second."), 20, NULL, NULL); } - + if (this->sync_method == OSS_SYNC_PROBEBUFFER) { char *buf; int c; this->buffer_size = 0; - + if( (buf=calloc(1, 1024)) != NULL ) { do { c = write(audio_fd,buf,1024); if( c != -1 ) this->buffer_size += c; } while( c == 1024 ); - + free(buf); } close(audio_fd); @@ -896,7 +896,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK); - if(audio_fd < 0) + if(audio_fd < 0) { xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: opening audio device %s failed:\n%s\n"), this->audio_dev, strerror(errno)); @@ -907,11 +907,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da } this->capabilities = 0; - + arg = AFMT_U8; if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &arg) != -1 && arg == AFMT_U8) this->capabilities |= AO_CAP_8BITS; - + /* switch back to 16bits, because some soundcards otherwise do not report all their capabilities */ arg = AFMT_S16_NE; if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &arg) == -1 || arg != AFMT_S16_NE) { @@ -956,30 +956,30 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da char *logmsg = strdup (_("audio_oss_out: supported modes are")); - num_channels = 1; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 1; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==1) ) { this->capabilities |= AO_CAP_MODE_MONO; xine_strcat_realloc (&logmsg, _(" mono")); } - num_channels = 2; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 2; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==2) ) { this->capabilities |= AO_CAP_MODE_STEREO; xine_strcat_realloc (&logmsg, _(" stereo")); } - num_channels = 4; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 4; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==4) ) { if ( speakers == SURROUND4 ) { this->capabilities |= AO_CAP_MODE_4CHANNEL; xine_strcat_realloc (&logmsg, _(" 4-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (4-channel not enabled in xine config)")); } - num_channels = 5; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 5; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==5) ) { if ( speakers == SURROUND5 ) { this->capabilities |= AO_CAP_MODE_5CHANNEL; @@ -988,13 +988,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da else xine_strcat_realloc (&logmsg, _(" (5-channel not enabled in xine config)")); } - num_channels = 6; - status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); + num_channels = 6; + status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels); if ( (status != -1) && (num_channels==6) ) { if ( speakers == SURROUND51 ) { this->capabilities |= AO_CAP_MODE_5_1CHANNEL; xine_strcat_realloc (&logmsg, _(" 5.1-channel")); - } + } else xine_strcat_realloc (&logmsg, _(" (5.1-channel not enabled in xine config)")); } @@ -1007,13 +1007,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_MODE_A52; this->capabilities |= AO_CAP_MODE_AC5; xine_strcat_realloc (&logmsg, _(" a/52 pass-through")); - } - else + } + else xine_strcat_realloc (&logmsg, _(" (a/52 pass-through not enabled in xine config)")); xprintf(class->xine, XINE_VERBOSITY_DEBUG, "%s\n", logmsg); free (logmsg); - + /* * mixer initialisation. */ @@ -1022,7 +1022,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da int mixer_num; int audio_devs; char *parse; - + mixer_num = config->register_num(config, "audio.device.oss_mixer_number", -1, _("OSS audio mixer number, -1 for none"), _("The full mixer device name is created by taking the " @@ -1033,7 +1033,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da "The range of this value is -1 or 0-15. This setting is " "ignored, when the OSS audio device name is set to \"auto\"."), 10, NULL, NULL); - + /* get the mixer device name from the audio device name by replacing "dsp" with "mixer" */ strcpy(mixer_name, this->audio_dev); if ((parse = strstr(mixer_name, "dsp"))) { @@ -1050,13 +1050,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da } else { _x_abort(); } - + this->mixer.fd = open(this->mixer.name, O_RDONLY); if(this->mixer.fd != -1) { ioctl(this->mixer.fd, SOUND_MIXER_READ_DEVMASK, &audio_devs); - + if(audio_devs & SOUND_MASK_PCM) { this->capabilities |= AO_CAP_PCM_VOL; this->mixer.prop = AO_PROP_PCM_VOL; @@ -1065,9 +1065,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_MIXER_VOL; this->mixer.prop = AO_PROP_MIXER_VOL; } - + /* - * This is obsolete in Linux kernel OSS + * This is obsolete in Linux kernel OSS * implementation, so this will certainly doesn't work. * So we just simulate the mute stuff */ @@ -1076,11 +1076,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_MUTE_VOL; */ this->capabilities |= AO_CAP_MUTE_VOL; - - } else + + } else xprintf (class->xine, XINE_VERBOSITY_LOG, _("audio_oss_out: open() mixer %s failed: %s\n"), this->mixer.name, strerror(errno)); - + this->mixer.mute = 0; this->mixer.volume = ao_oss_get_property (&this->ao_driver, this->mixer.prop); @@ -1190,7 +1190,7 @@ static const ao_info_t ao_info_oss = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_OUT_OSS_IFACE_VERSION, "oss", XINE_VERSION_CODE, &ao_info_oss, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c index 048db6b86..2a154c09d 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2001-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -159,7 +159,7 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) silence = calloc(1, len); if (silence == NULL) goto error; - + if ((fd = open(dev, O_WRONLY|O_NONBLOCK)) < 0) goto error; @@ -176,7 +176,7 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: SETINFO failed\n"); goto error; } - + if (write(fd, silence, len) != len) { xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: write failed\n"); goto error; @@ -195,7 +195,7 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) delay.tv_sec = 0; delay.tv_nsec = 10000000; nanosleep(&delay, NULL); - + gettimeofday(&end, NULL); usec_delay = (end.tv_sec - start.tv_sec) * 1000000 + end.tv_usec - start.tv_usec; @@ -230,7 +230,7 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) * sample counter increment from the soundcard driver of less than * 2000 samples, we assume that the driver provides a useable realtime * sample counter in the AUDIO_INFO play.samples field. Timing based - * on sample counts should be much more accurate than counting whole + * on sample counts should be much more accurate than counting whole * 16kbyte chunks. */ if (min_increment < 2000) @@ -238,10 +238,10 @@ static int realtime_samplecounter_available(xine_t *xine, char *dev) /* printf("audio_sun_out: minimum sample counter increment per 10msec interval: %d\n" - "\t%susing sample counter based timing code\n", + "\t%susing sample counter based timing code\n", min_increment, rtsc_ok == RTSC_ENABLED ? "" : "not "); */ - + error: if (silence != NULL) free(silence); @@ -263,7 +263,7 @@ error: } -/* +/* * match the requested sample rate |sample_rate| against the * sample rates supported by the audio device |dev|. Return * a supported sample rate, it that sample rate is close to @@ -294,7 +294,7 @@ find_close_samplerate_match(int dev, int sample_rate) if (sr->flags & MIXER_SR_LIMITS) { /* - * HW can playback any rate between + * HW can playback any rate between * sr->samp_rates[0] .. sr->samp_rates[1] */ free(sr); @@ -340,7 +340,7 @@ find_close_samplerate_match(int dev, int sample_rate) for (i = 0; audiocs_rates[i]; i++) { err = abs(audiocs_rates[i] - sample_rate); if (err == 0) { - /* + /* * exact supported sample rate match, no need to * retry something elise */ @@ -385,7 +385,7 @@ find_highest_samplerate(int dev) if (sr->flags & MIXER_SR_LIMITS) { /* - * HW can playback any rate between + * HW can playback any rate between * sr->samp_rates[0] .. sr->samp_rates[1] */ max_rate = sr->samp_rates[1]; @@ -412,7 +412,7 @@ find_highest_samplerate(int dev) * Implicit assumptions about audio format (bits/rate/mode): * * bits == 16: We always get 16-bit samples in native endian format, - * using signed linear encoding + * using signed linear encoding * * bits == 8: 8-bit samples use unsigned linear encoding, * other 8-bit formats (uLaw, aLaw, etc) are currently not supported @@ -440,7 +440,7 @@ static int ao_sun_open(ao_driver_t *this_gen, close (this->audio_fd); } - + this->mode = mode; this->input_sample_rate = rate; #ifdef __svr4__ @@ -453,11 +453,11 @@ static int ao_sun_open(ao_driver_t *this_gen, this->audio_fd = open(this->audio_dev, O_WRONLY|O_NONBLOCK); if(this->audio_fd < 0) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_sun_out: opening audio device %s failed: %s\n"), this->audio_dev, strerror(errno)); return 0; } - + /* We wanted non blocking open but now put it back to normal */ fcntl(this->audio_fd, F_SETFL, fcntl(this->audio_fd, F_GETFL) & ~O_NONBLOCK); @@ -485,7 +485,7 @@ static int ao_sun_open(ao_driver_t *this_gen, if (pass & 1) { /* - * on some sun audio drivers, 8-bit unsigned LINEAR8 encoding is + * on some sun audio drivers, 8-bit unsigned LINEAR8 encoding is * not supported, but 8-bit signed encoding is. * * Try S8, and if it works, use our own U8->S8 conversion before @@ -511,7 +511,7 @@ static int ao_sun_open(ao_driver_t *this_gen, */ if (!(info.play.sample_rate = find_close_samplerate_match(this->audio_fd, - this->input_sample_rate))) + this->input_sample_rate))) continue; } @@ -567,7 +567,7 @@ static int ao_sun_open(ao_driver_t *this_gen, return this->output_sample_rate; } -static int ao_sun_num_channels(ao_driver_t *this_gen) +static int ao_sun_num_channels(ao_driver_t *this_gen) { sun_driver_t *this = (sun_driver_t *) this_gen; return this->num_channels; @@ -589,7 +589,7 @@ static int ao_sun_delay(ao_driver_t *this_gen) (this->frames_in_buffer == 0 || info.play.samples > 0)) { if (info.play.samples < this->last_samplecnt) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: broken sound driver, sample counter runs backwards, cur %u < prev %u\n", info.play.samples, this->last_samplecnt); } @@ -728,7 +728,7 @@ static int ao_sun_write(ao_driver_t *this_gen, int num_written; if (this->convert_u8_s8) { - /* + /* * Audio hardware does not support 8-bit unsigned format, * only 8-bit signed. Convert to 8-bit unsigned before sending * the data to the audio device. @@ -736,7 +736,7 @@ static int ao_sun_write(ao_driver_t *this_gen, uint8_t *p = (void *)frame_buffer; int i; - for (i = num_frames * this->bytes_per_frame; --i >= 0; p++) + for (i = num_frames * this->bytes_per_frame; --i >= 0; p++) *p ^= 0x80; } num_written = sun_audio_write(this, frame_buffer, num_frames * this->bytes_per_frame); @@ -747,7 +747,7 @@ static int ao_sun_write(ao_driver_t *this_gen, this->frames_in_buffer += num_written / this->bytes_per_frame; #endif - /* + /* * Avoid storing too much data in the sound driver's buffers. * * When we find more than 3 seconds of buffered audio data in the @@ -783,7 +783,7 @@ static uint32_t ao_sun_get_capabilities (ao_driver_t *this_gen) { static void ao_sun_exit(ao_driver_t *this_gen) { sun_driver_t *this = (sun_driver_t *) this_gen; - + if (this->audio_fd >= 0) close(this->audio_fd); @@ -869,7 +869,7 @@ static int ao_sun_ctrl(ao_driver_t *this_gen, int cmd, ...) { /* flush buffered STEAMS data first */ ioctl(this->audio_fd, I_FLUSH, FLUSHW); - /* + /* * the flush above discarded an unknown amount of data from the * audio device. To get the "*_delay" computation in sync again, * reset the audio device's sample counter to 0, after waiting @@ -944,7 +944,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v this->audio_fd = open(this->audio_dev = devname, O_WRONLY|O_NONBLOCK); - if(this->audio_fd < 0) + if(this->audio_fd < 0) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_sun_out: opening audio device %s failed: %s\n"), devname, strerror(errno)); @@ -962,7 +962,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v info.play.precision = AUDIO_PRECISION_16; info.play.sample_rate = 44100; status = ioctl(this->audio_fd, AUDIO_SETINFO, &info); - + if (status < 0) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("audio_sun_out: audio ioctl on device %s failed: %s\n"), devname, strerror(errno)); @@ -976,7 +976,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v */ this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | AO_CAP_8BITS - | AO_CAP_16BITS | AO_CAP_PCM_VOL; + | AO_CAP_16BITS | AO_CAP_PCM_VOL; #ifdef __svr4__ this->capabilities |= AO_CAP_MUTE_VOL; #endif @@ -1056,7 +1056,7 @@ static const ao_info_t ao_info_sun = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_AUDIO_OUT, AO_SUN_IFACE_VERSION, "sun", XINE_VERSION_CODE, &ao_info_sun, ao_sun_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |