summaryrefslogtreecommitdiff
path: root/src/audio_out
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2003-12-05 15:54:56 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2003-12-05 15:54:56 +0000
commit7958ce62d6ae127ee9b8664c8afae5754063389f (patch)
tree658e11edf004b0ae3ac3114ffe8ed5f8604ccefd /src/audio_out
parentb529e4b1f1668c03d3cb35c0c742f301b8c415db (diff)
downloadxine-lib-7958ce62d6ae127ee9b8664c8afae5754063389f.tar.gz
xine-lib-7958ce62d6ae127ee9b8664c8afae5754063389f.tar.bz2
cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued...
CVS patchset: 5844 CVS date: 2003/12/05 15:54:56
Diffstat (limited to 'src/audio_out')
-rw-r--r--src/audio_out/audio_alsa_out.c204
-rw-r--r--src/audio_out/audio_arts_out.c50
-rwxr-xr-xsrc/audio_out/audio_directx_out.c37
-rw-r--r--src/audio_out/audio_esd_out.c42
-rw-r--r--src/audio_out/audio_none_out.c27
-rw-r--r--src/audio_out/audio_oss_out.c113
-rw-r--r--src/audio_out/audio_sun_out.c45
7 files changed, 293 insertions, 225 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index 2d851b30b..890a0e280 100644
--- a/src/audio_out/audio_alsa_out.c
+++ b/src/audio_out/audio_alsa_out.c
@@ -26,7 +26,7 @@
* (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk>
*
*
- * $Id: audio_alsa_out.c,v 1.118 2003/11/26 23:44:08 f1rmb Exp $
+ * $Id: audio_alsa_out.c,v 1.119 2003/12/05 15:54:56 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -150,13 +150,15 @@ static void *ao_alsa_handle_event_thread(void *data) {
if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT,
&left_vol)) < 0) {
- printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
continue;
}
if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT,
&right_vol)) < 0) {
- printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
continue;
}
@@ -239,7 +241,7 @@ static void error_callback(const char *file, int line,
int n, size = 100;
printf("%s:%s:%d entered\n", __FILE__, __FUNCTION__, __LINE__ );
- if((buf = xine_xmalloc(size)) == NULL)
+ if(!(buf = xine_xmalloc(size)))
return;
while(1) {
@@ -352,7 +354,8 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
NULL);
break;
default:
- printf ("audio_alsa_out: ALSA Driver does not support the requested mode: 0x%X\n",mode);
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: ALSA Driver does not support the requested mode: 0x%X\n",mode);
return 0;
}
@@ -362,8 +365,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
#endif
if (this->audio_fd) {
- xine_log (this->class->xine, XINE_LOG_MSG,
- "audio_alsa_out:Already open...WHY!");
+ xine_log (this->class->xine, XINE_LOG_MSG, _("audio_alsa_out:Already open...WHY!"));
snd_pcm_close (this->audio_fd);
this->audio_fd = NULL;
}
@@ -377,8 +379,10 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
*/
err=snd_pcm_open(&this->audio_fd, pcm_device, direction, open_mode);
if(err <0 ) {
- printf ("audio_alsa_out: snd_pcm_open() of %s failed: %s\n", pcm_device, snd_strerror(err));
- printf ("audio_alsa_out: >>> check if another program don't already use PCM <<<\n");
+ 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 don't already use PCM <<<\n"));
return 0;
}
/* printf ("audio_alsa_out: snd_pcm_open() opened %s\n", pcm_device); */
@@ -390,7 +394,9 @@ 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) {
- printf ("audio_alsa_out: broken configuration for this PCM: no configurations available: %s\n", snd_strerror(err));
+ 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;
}
/* set interleaved access */
@@ -402,7 +408,8 @@ 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) {
- printf ("audio_alsa_out: mmap not availiable, falling back to compatiblity mode\n");
+ 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,
SND_PCM_ACCESS_RW_INTERLEAVED);
@@ -413,7 +420,8 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
}
if (err < 0) {
- printf ("audio_alsa_out: access type not available: %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: access type not available: %s\n", snd_strerror(err));
goto __close;
}
/* set the sample format ([SU]{8,16{LE,BE}})*/
@@ -425,26 +433,31 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
#endif
: SND_PCM_FORMAT_U8);
if (err < 0) {
- printf ("audio_alsa_out: sample format non available: %s\n", snd_strerror(err));
+ 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) {
- printf ("audio_alsa_out: Cannot set number of channels to %d (err=%d:%s)\n", this->num_channels, err, snd_strerror(err));
+ 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;
}
/* set the stream rate [Hz] */
dir=0;
err = snd_pcm_hw_params_set_rate_near(this->audio_fd, params, &rate, &dir);
if (err < 0) {
- printf ("audio_alsa_out: rate not available: %s\n", snd_strerror(err));
+ 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) {
- printf ("audio_alsa_out: audio rate : %d requested, %d provided by device/sec\n",
- this->input_sample_rate, this->output_sample_rate);
+ 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);
}
buffer_time_to_size = ( (uint64_t)buffer_time * rate) / 1000000;
err = snd_pcm_hw_params_get_buffer_size_min(params, &buffer_size_min);
@@ -474,14 +487,16 @@ 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) {
- printf ("audio_alsa_out: unable to set any periods: %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: unable to set any periods: %s\n", snd_strerror(err));
goto __close;
}
/* set the ring-buffer time [us] (large enough for x us|y samples ...) */
dir=0;
err = snd_pcm_hw_params_set_buffer_time_near(this->audio_fd, params, &buffer_time, &dir);
if (err < 0) {
- printf ("audio_alsa_out: buffer time not available: %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: buffer time not available: %s\n", snd_strerror(err));
goto __close;
}
#endif
@@ -490,7 +505,8 @@ 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) {
- printf ("audio_alsa_out: period time not available: %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: period time not available: %s\n", snd_strerror(err));
goto __close;
}
#endif
@@ -500,7 +516,8 @@ 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) {
- printf ("audio_alsa_out: buffer time not available: %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: buffer time not available: %s\n", snd_strerror(err));
goto __close;
}
err = snd_pcm_hw_params_get_buffer_size(params, &(this->buffer_size));
@@ -509,20 +526,23 @@ 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) {
- printf ("audio_alsa_out: buffer to small, could not use\n");
+ 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) {
- printf ("audio_alsa_out: pcm hw_params failed: %s\n", snd_strerror(err));
+ 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_LOG, "audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume);
+ 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);
/*
@@ -531,39 +551,45 @@ 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) {
- printf ("audio_alsa_out: Unable to determine current swparams: %s\n", snd_strerror(err));
+ 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) {
- printf ("audio_alsa_out: Unable to set transfer alignment: %s\n", snd_strerror(err));
+ 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) {
- printf ("audio_alsa_out: Unable to set available min: %s\n", snd_strerror(err));
+ 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) {
- printf ("audio_alsa_out: Unable to set start threshold: %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: Unable to set start threshold: %s\n", snd_strerror(err));
goto __close;
}
/* 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) {
- printf ("audio_alsa_out: Unable to set stop threshold: %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: Unable to set stop threshold: %s\n", snd_strerror(err));
goto __close;
}
/* Install swparams into current parameters */
err = snd_pcm_sw_params(this->audio_fd, swparams);
if (err < 0) {
- printf ("audio_alsa_out: Unable to set swparams: %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: Unable to set swparams: %s\n", snd_strerror(err));
goto __close;
}
#ifdef ALSA_LOG
@@ -652,9 +678,9 @@ static void xrun(alsa_driver_t *this)
timersub(&now, &tstamp, &diff);
printf ("audio_alsa_out: xrun!!! (at least %.3f ms long)\n", diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
*/
- printf ("audio_alsa_out: XRUN!!!\n");
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: XRUN!!!\n");
if ((res = snd_pcm_prepare(this->audio_fd))<0) {
- printf ("audio_alsa_out: xrun: prepare error: %s", snd_strerror(res));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: xrun: prepare error: %s", snd_strerror(res));
return;
}
return; /* ok, data should be accepted again */
@@ -704,7 +730,8 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) {
if ( (state != SND_PCM_STATE_PREPARED) &&
(state != SND_PCM_STATE_RUNNING) &&
(state != SND_PCM_STATE_DRAINING) ) {
- printf("audio_alsa_out:write:BAD STATE, state = %d\n",state);
+ xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out:write:BAD STATE, state = %d\n",state);
}
while( number_of_frames > 0) {
@@ -732,7 +759,8 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) {
if ( (state != SND_PCM_STATE_PREPARED) &&
(state != SND_PCM_STATE_RUNNING) &&
(state != SND_PCM_STATE_DRAINING) ) {
- printf("audio_alsa_out:write:BAD STATE2, state = %d, going to try XRUN\n",state);
+ 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) {
XINE_ASSERT(0, "audio_alsa_out: xrun: prepare error: %s", snd_strerror(res));
}
@@ -823,13 +851,15 @@ static int ao_alsa_get_property (ao_driver_t *this_gen, int property) {
if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT,
&this->mixer.left_vol)) < 0) {
- printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ 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) {
- printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
goto __done;
}
@@ -869,14 +899,16 @@ static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value)
if((err = snd_mixer_selem_set_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_LEFT,
this->mixer.left_vol)) < 0) {
- printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ 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) {
- printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ 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;
}
@@ -938,19 +970,23 @@ 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) {
- printf("audio_alsa_out: Pause call failed. (err=%d:%s)\n",err, snd_strerror(err));
+ 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);
}
} else {
if ((err=snd_pcm_reset(this->audio_fd)) < 0) {
- printf("audio_alsa_out: Reset call failed. (err=%d:%s)\n",err, snd_strerror(err));
+ 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) {
- printf("audio_alsa_out: Drain call failed. (err=%d:%s)\n",err, snd_strerror(err));
+ 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) {
- printf("audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err));
+ xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err));
}
}
}
@@ -961,10 +997,13 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) {
if (this->has_pause_resume) {
if ((err=snd_pcm_pause(this->audio_fd, 0)) < 0) {
if (err == -77) {
- printf("audio_alsa_out: Warning: How am I supposed to RESUME, if I am not PAUSED. audio_out.c, please don't call me!\n");
+ 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;
}
- printf("audio_alsa_out: Resume call failed. (err=%d:%s)\n",err, snd_strerror(err));
+ 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;
}
}
@@ -974,10 +1013,12 @@ 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) {
- printf("audio_alsa_out: Drop call failed. (err=%d:%s)\n",err, snd_strerror(err));
+ 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) {
- printf("audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err));
+ xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: Prepare call failed. (err=%d:%s)\n",err, snd_strerror(err));
}
}
break;
@@ -1015,12 +1056,13 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) {
NULL);
if ((err = snd_ctl_open (&ctl_handle, pcm_device, 0)) < 0) {
- printf ("audio_alsa_out: snd_ctl_open(): %s\n", snd_strerror(err));
+ 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) {
- printf ("audio_alsa_out: snd_ctl_card_info(): %s\n", snd_strerror(err));
+ 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;
}
@@ -1031,31 +1073,36 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) {
* Open mixer device
*/
if ((err = snd_mixer_open (&this->mixer.handle, 0)) < 0) {
- printf ("audio_alsa_out: snd_mixer_open(): %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: snd_mixer_open(): %s\n", snd_strerror(err));
return;
}
if ((err = snd_mixer_attach (this->mixer.handle, pcm_device)) < 0) {
- printf ("audio_alsa_out: snd_mixer_attach(): %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: snd_mixer_attach(): %s\n", snd_strerror(err));
snd_mixer_close(this->mixer.handle);
return;
}
if ((err = snd_mixer_selem_register (this->mixer.handle, NULL, NULL)) < 0) {
- printf ("audio_alsa_out: snd_mixer_selem_register(): %s\n", snd_strerror(err));
+ 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);
return;
}
if ((err = snd_mixer_load (this->mixer.handle)) < 0) {
- printf ("audio_alsa_out: snd_mixer_load(): %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: snd_mixer_load(): %s\n", snd_strerror(err));
snd_mixer_close(this->mixer.handle);
return;
}
mixer_sid = alloca(snd_mixer_selem_id_sizeof() * snd_mixer_get_count(this->mixer.handle));
if (mixer_sid == NULL) {
- printf ("audio_alsa_out: alloca() failed: %s\n", strerror(errno));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: alloca() failed: %s\n", strerror(errno));
snd_mixer_close(this->mixer.handle);
return;
}
@@ -1084,14 +1131,16 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) {
&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) {
- printf("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
snd_mixer_close(this->mixer.handle);
return;
}
if((err = snd_mixer_selem_get_playback_volume(this->mixer.elem, SND_MIXER_SCHN_FRONT_RIGHT,
&this->mixer.right_vol)) < 0) {
- printf ("audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: snd_mixer_selem_get_playback_volume(): %s\n", snd_strerror(err));
snd_mixer_close(this->mixer.handle);
return;
}
@@ -1205,14 +1254,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
char *pcm_device;
snd_pcm_hw_params_t *params;
- this = (alsa_driver_t *) malloc (sizeof (alsa_driver_t));
- memset( this, 0, sizeof( alsa_driver_t ) ); /* Set all those pointers to 0 (NULL) */
+ this = (alsa_driver_t *) xine_xmalloc (sizeof (alsa_driver_t));
this->class = class;
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(&params);
/* Fill the .xinerc file with options */
@@ -1277,9 +1325,9 @@ 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 don't already use PCM <<<\n");
+ _(">>> Check if another program don't already use PCM <<<\n"));
return NULL;
}
@@ -1288,30 +1336,32 @@ 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) {
- printf ("audio_alsa_out: broken configuration for this PCM: no configurations available\n");
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: broken configuration for this PCM: no configurations available\n");
return NULL;
}
err = snd_pcm_hw_params_set_access(this->audio_fd, params,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
- printf ("audio_alsa_out: access type not available");
+ xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: access type not available");
return NULL;
}
this->capabilities = 0;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_alsa_out : supported modes are ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_alsa_out : supported modes are "));
if (!(snd_pcm_hw_params_test_format(this->audio_fd, params, SND_PCM_FORMAT_U8))) {
this->capabilities |= AO_CAP_8BITS;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "8bit ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("8bit "));
}
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 1))) {
this->capabilities |= AO_CAP_MODE_MONO;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "mono ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("mono "));
}
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 2))) {
this->capabilities |= AO_CAP_MODE_STEREO;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "stereo ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("stereo "));
}
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 4)) &&
config->register_bool (config,
@@ -1322,10 +1372,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
0, NULL,
NULL) ) {
this->capabilities |= AO_CAP_MODE_4CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "4-channel ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("4-channel "));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, "(4-channel not enabled in xine config) ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("(4-channel not enabled in xine config) "));
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) &&
config->register_bool (config,
@@ -1336,10 +1386,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
0, NULL,
NULL) ) {
this->capabilities |= AO_CAP_MODE_4_1CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "4.1-channel ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("4.1-channel "));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, "(4.1-channel not enabled in xine config) ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("(4.1-channel not enabled in xine config) "));
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) &&
config->register_bool (config,
@@ -1350,10 +1400,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
0, NULL,
NULL) ) {
this->capabilities |= AO_CAP_MODE_5CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "5-channel ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("5-channel "));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, "(5-channel not enabled in xine config) ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("(5-channel not enabled in xine config) "));
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) &&
config->register_bool (config,
@@ -1364,10 +1414,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
0, NULL,
NULL) ) {
this->capabilities |= AO_CAP_MODE_5_1CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "5.1-channel ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("5.1-channel "));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, "(5.1-channel not enabled in xine config) ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("(5.1-channel not enabled in xine config) "));
this->has_pause_resume = 0; /* This is checked at open time instead */
@@ -1402,10 +1452,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
this) ) {
this->capabilities |= AO_CAP_MODE_A52;
this->capabilities |= AO_CAP_MODE_AC5;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "a/52 and DTS pass-through ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("a/52 and DTS pass-through "));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, "(a/52 and DTS pass-through not enabled in xine config)");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("(a/52 and DTS pass-through not enabled in xine config)"));
/* printf("audio_alsa_out: capabilities 0x%X\n",this->capabilities); */
@@ -1459,7 +1509,7 @@ static void *init_class (xine_t *xine, void *data) {
alsa_class_t *this;
- this = (alsa_class_t *) malloc (sizeof (alsa_class_t));
+ this = (alsa_class_t *) xine_xmalloc (sizeof (alsa_class_t));
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c
index 9b93f0ea4..143e3db6e 100644
--- a/src/audio_out/audio_arts_out.c
+++ b/src/audio_out/audio_arts_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_arts_out.c,v 1.20 2002/12/21 12:56:46 miguelfreitas Exp $
+ * $Id: audio_arts_out.c,v 1.21 2003/12/05 15:54:56 f1rmb Exp $
*/
#ifndef __sun /* _XOPEN_SOURCE causes build prob's on sunos */
@@ -54,6 +54,8 @@ typedef struct arts_driver_s {
ao_driver_t ao_driver;
+ xine_t *xine;
+
arts_stream_t audio_stream;
int capabilities;
int mode;
@@ -75,9 +77,9 @@ typedef struct arts_driver_s {
} arts_driver_t;
typedef struct {
- audio_driver_class_t driver_class;
+ audio_driver_class_t driver_class;
- config_values_t *config;
+ xine_t *xine;
} arts_class_t;
/*
@@ -103,10 +105,11 @@ static int ao_arts_open(ao_driver_t *this_gen,
{
arts_driver_t *this = (arts_driver_t *) this_gen;
- printf ("audio_arts_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode);
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG,
+ "audio_arts_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode);
if ( (mode & this->capabilities) == 0 ) {
- printf ("audio_arts_out: unsupported mode %08x\n", mode);
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out: unsupported mode %08x\n", mode);
return 0;
}
@@ -134,7 +137,7 @@ static int ao_arts_open(ao_driver_t *this_gen,
this->bytes_per_frame=(this->bits_per_sample*this->num_channels)/8;
- printf ("audio_arts_out: %d channels output\n",this->num_channels);
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out: %d channels output\n", this->num_channels);
this->audio_stream=arts_play_stream(this->sample_rate, bits, this->num_channels, "xine");
@@ -152,7 +155,7 @@ static int ao_arts_open(ao_driver_t *this_gen,
this->latency = arts_stream_get (this->audio_stream, ARTS_P_TOTAL_LATENCY);
}
- printf ("audio_arts_out : latency %d ms\n", this->latency);
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out : latency %d ms\n", this->latency);
return this->sample_rate;
}
@@ -293,21 +296,18 @@ static int ao_arts_ctrl(ao_driver_t *this_gen, int cmd, ...) {
return 0;
}
-static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
- const void *data) {
-
- /* arts_class_t *class = (arts_class_t *) class_gen; */
- /* config_values_t *config = class->config; */
- arts_driver_t *this;
- int rc;
+static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) {
+ arts_class_t *class = (arts_class_t *) class_gen;
+ arts_driver_t *this;
+ int rc;
- printf ("audio_arts_out: open_plugin called\n");
+ lprintf ("audio_arts_out: open_plugin called\n");
- this = (arts_driver_t *) malloc (sizeof (arts_driver_t));
+ this = (arts_driver_t *) xine_xmalloc (sizeof (arts_driver_t));
rc = arts_init();
if (rc < 0) {
- printf ("audio_arts_out: arts_init failed: %s\n", arts_error_text(rc));
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG,"audio_arts_out: arts_init failed: %s\n", arts_error_text(rc));
return NULL;
}
@@ -317,17 +317,17 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
this->mixer.mute = 0;
this->mixer.vol_scale = 60;
this->mixer.v_mixer = 0;
-
+
+ this->xine = class->xine;
/*
* set capabilities
*/
this->capabilities = 0;
- printf ("audio_arts_out : supported modes are ");
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_arts_out : supported modes are ");
this->capabilities |= AO_CAP_MODE_MONO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL;
- printf ("mono ");
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "mono ");
this->capabilities |= AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL;
- printf ("stereo ");
- printf ("\n");
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "stereo ");
this->sample_rate = 0;
this->audio_stream = NULL;
@@ -371,16 +371,16 @@ static void *init_class (xine_t *xine, void *data) {
arts_class_t *this;
- printf ("audio_arts_out: init class\n");
+ lprintf ("audio_arts_out: init class\n");
- this = (arts_class_t *) malloc (sizeof (arts_class_t));
+ this = (arts_class_t *) xine_xmalloc (sizeof (arts_class_t));
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
this->driver_class.get_description = get_description;
this->driver_class.dispose = dispose_class;
- this->config = xine->config;
+ this->xine = xine;
return this;
}
diff --git a/src/audio_out/audio_directx_out.c b/src/audio_out/audio_directx_out.c
index 1956eccd3..c4de81cff 100755
--- a/src/audio_out/audio_directx_out.c
+++ b/src/audio_out/audio_directx_out.c
@@ -20,7 +20,7 @@
* audio_directx_out.c, direct sound audio output plugin for xine
* by Matthew Grooms <elon@altavista.com>
*
- * $Id: audio_directx_out.c,v 1.5 2003/11/26 19:43:26 f1rmb Exp $
+ * $Id: audio_directx_out.c,v 1.6 2003/12/05 15:54:56 f1rmb Exp $
*/
typedef unsigned char boolean;
@@ -57,6 +57,8 @@ typedef unsigned char boolean;
typedef struct {
ao_driver_t ao_driver;
int capabilities;
+
+ xine_t *xine;
/* directx objects */
LPDIRECTSOUND dsobj;
@@ -89,6 +91,7 @@ typedef struct {
audio_driver_class_t driver_class;
config_values_t *config;
char *device_name;
+ xine_t *xine;
} audiox_class_t;
/* -------------------------------------------
@@ -523,27 +526,27 @@ static int ao_directx_open( ao_driver_t * ao_driver, uint32_t bits, uint32_t rat
{
case AO_CAP_MODE_MONO:
ao_directx->chnn = 1;
- printf( "ao_directx : opened in AO_CAP_MODE_MONO mode\n" );
+ xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_MONO mode\n" );
break;
case AO_CAP_MODE_STEREO:
ao_directx->chnn = 2;
- printf( "ao_directx : opened in AO_CAP_MODE_STEREO mode\n" );
+ xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_STEREO mode\n" );
break;
case AO_CAP_MODE_4CHANNEL:
ao_directx->chnn = 4;
- printf( "ao_directx : opened in AO_CAP_MODE_4CHANNEL mode\n" );
+ xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_4CHANNEL mode\n" );
break;
case AO_CAP_MODE_5CHANNEL:
ao_directx->chnn = 5;
- printf( "ao_directx : opened in AO_CAP_MODE_5CHANNEL mode\n" );
+ xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_5CHANNEL mode\n" );
break;
case AO_CAP_MODE_5_1CHANNEL:
ao_directx->chnn = 6;
- printf( "ao_directx : opened in AO_CAP_MODE_5_1CHANNEL mode\n" );
+ xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : opened in AO_CAP_MODE_5_1CHANNEL mode\n" );
break;
case AO_CAP_MODE_A52:
@@ -739,7 +742,8 @@ 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 );
- printf( "ao_directx : volume set to %d - directX volume = %d\n", value, ao_directx->volume);
+ xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG,
+ "ao_directx : volume set to %d - directX volume = %d\n", value, ao_directx->volume);
return value;
@@ -756,7 +760,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, DSBVOLUME_MIN );
- printf( "ao_directx : mute toggled" );
+ xprintf(ao_directx->xine, XINE_VERBOSITY_DEBUG, "ao_directx : mute toggled" );
return value;
@@ -770,13 +774,16 @@ static int ao_directx_set_property( ao_driver_t * ao_driver, int property, int v
static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data)
{
- ao_directx_t *ao_directx = ( ao_directx_t * ) malloc( sizeof( ao_directx_t ) );
-
- memset( ao_directx, 0, sizeof( ao_directx_t ) );
-
+ audiox_class_t *class = (audiox_class_t *) class_gen;
+ ao_directx_t *ao_directx;
+
+ ao_directx = ( ao_directx_t * ) xine_xmalloc( sizeof( ao_directx_t ) );
+
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);
+ ao_driverx->xine = class->xine;
+
ao_directx->ao_driver.get_capabilities = ao_directx_get_capabilities;
ao_directx->ao_driver.get_property = ao_directx_get_property;
ao_directx->ao_driver.set_property = ao_directx_set_property;
@@ -825,14 +832,14 @@ static void *init_class (xine_t *xine, void *data) {
/*
* from this point on, nothing should go wrong anymore
*/
- audiox = (audiox_class_t *) malloc (sizeof (audiox_class_t));
- memset( audiox, 0, sizeof( audiox_class_t ) );
-
+ audiox = (audiox_class_t *) xine_xmalloc (sizeof (audiox_class_t));
+
audiox->driver_class.open_plugin = open_plugin;
audiox->driver_class.get_identifier = get_identifier;
audiox->driver_class.get_description = get_description;
audiox->driver_class.dispose = dispose_class;
+ audiox->xine = xine;
audiox->config = xine->config;
audiox->device_name = device_name;
diff --git a/src/audio_out/audio_esd_out.c b/src/audio_out/audio_esd_out.c
index 402858e11..b12634c75 100644
--- a/src/audio_out/audio_esd_out.c
+++ b/src/audio_out/audio_esd_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_esd_out.c,v 1.27 2003/10/06 15:27:10 mroi Exp $
+ * $Id: audio_esd_out.c,v 1.28 2003/12/05 15:54:56 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -49,6 +49,8 @@ typedef struct esd_driver_s {
ao_driver_t ao_driver;
+ xine_t *xine;
+
int audio_fd;
int capabilities;
int mode;
@@ -94,8 +96,7 @@ typedef struct esd_driver_s {
typedef struct {
audio_driver_class_t driver_class;
-
- config_values_t *config;
+ xine_t *xine;
} esd_class_t;
@@ -108,11 +109,11 @@ static int ao_esd_open(ao_driver_t *this_gen,
esd_driver_t *this = (esd_driver_t *) this_gen;
esd_format_t format;
- printf ("audio_esd_out: ao_open bits=%d rate=%d, mode=%d\n",
- bits, rate, mode);
+ 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 ) {
- printf ("audio_esd_out: unsupported mode %08x\n", mode);
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: unsupported mode %08x\n", mode);
return 0;
}
@@ -145,7 +146,7 @@ static int ao_esd_open(ao_driver_t *this_gen,
this->num_channels = 2;
break;
}
- printf ("audio_esd_out: %d channels output\n",this->num_channels);
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: %d channels output\n",this->num_channels);
this->bytes_per_frame=(bits*this->num_channels)/8;
@@ -162,8 +163,9 @@ static int ao_esd_open(ao_driver_t *this_gen,
this->audio_fd = esd_play_stream(format, this->output_sample_rate, NULL, this->pname);
if (this->audio_fd < 0) {
char *server = getenv("ESPEAKER");
- printf("audio_esd_out: connecting to ESD server %s: %s\n",
- server ? server : "<default>", strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ _("audio_esd_out: connecting to ESD server %s: %s\n"),
+ server ? server : "<default>", strerror(errno));
return 0;
}
@@ -295,9 +297,9 @@ static int ao_esd_write(ao_driver_t *this_gen,
nwritten = writev(this->audio_fd, iov, iovcnt);
if (nwritten != num_bytes) {
if (nwritten < 0)
- printf("audio_esd_out: writev failed: %s\n", strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: writev failed: %s\n", strerror(errno));
else
- printf("audio_esd_out: warning, incomplete write: %d\n", nwritten);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: warning, incomplete write: %d\n", nwritten);
}
if (nwritten > 0)
this->bytes_in_buffer += nwritten;
@@ -469,7 +471,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
const void *data) {
esd_class_t *class = (esd_class_t *) class_gen;
- config_values_t *config = class->config;
+ config_values_t *config = class->xine->config;
esd_driver_t *this;
int audio_fd;
int err;
@@ -492,21 +494,22 @@ 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))
- printf("audio_esd_out: cannot unblock SIGALRM: %s\n", strerror(errno));
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: cannot unblock SIGALRM: %s\n", strerror(errno));
- printf("audio_esd_out: connecting to esd server...\n");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_esd_out: connecting to esd server...\n"));
audio_fd = esd_open_sound(NULL);
err = errno;
if (sigprocmask(SIG_SETMASK, &vo_mask_orig, NULL))
- printf("audio_esd_out: cannot block SIGALRM: %s\n", strerror(errno));
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_esd_out: cannot block SIGALRM: %s\n", strerror(errno));
if(audio_fd < 0) {
char *server = getenv("ESPEAKER");
/* print a message so the user knows why ESD failed */
- printf("audio_esd_out: can't connect to %s ESD server: %s\n",
- server ? server : "<default>", strerror(err));
+ xprintf(class->xine, XINE_VERBOSITY_LOG,
+ _("audio_esd_out: can't connect to %s ESD server: %s\n"),
+ server ? server : "<default>", strerror(err));
return NULL;
}
@@ -522,6 +525,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
this = (esd_driver_t *) xine_xmalloc (sizeof (esd_driver_t));
+ this->xine = class->xine;
this->pname = strdup("xine esd audio output plugin");
this->output_sample_rate = 0;
this->server_sample_rate = server_sample_rate;
@@ -571,14 +575,14 @@ static void *init_class (xine_t *xine, void *data) {
esd_class_t *this;
- this = (esd_class_t *) malloc (sizeof (esd_class_t));
+ this = (esd_class_t *) xine_xmalloc (sizeof (esd_class_t));
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
this->driver_class.get_description = get_description;
this->driver_class.dispose = dispose_class;
- this->config = xine->config;
+ this->xine = xine;
return this;
}
diff --git a/src/audio_out/audio_none_out.c b/src/audio_out/audio_none_out.c
index 1db1cbbe8..56b93de16 100644
--- a/src/audio_out/audio_none_out.c
+++ b/src/audio_out/audio_none_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_none_out.c,v 1.4 2003/10/06 15:27:10 mroi Exp $
+ * $Id: audio_none_out.c,v 1.5 2003/12/05 15:54:56 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -48,6 +48,8 @@ typedef struct none_driver_s {
ao_driver_t ao_driver;
+ xine_t *xine;
+
int capabilities;
int mode;
@@ -61,20 +63,21 @@ typedef struct none_driver_s {
} none_driver_t;
typedef struct {
- audio_driver_class_t driver_class;
+ audio_driver_class_t driver_class;
- config_values_t *config;
+ config_values_t *config;
+ xine_t *xine;
} none_class_t;
/*
* open the audio device for writing to
*/
-static int ao_none_open(ao_driver_t *this_gen,
- uint32_t bits, uint32_t rate, int mode)
+static int ao_none_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode)
{
none_driver_t *this = (none_driver_t *) this_gen;
- printf ("audio_none_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode);
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG,
+ "audio_none_out: ao_open bits=%d rate=%d, mode=%d\n", bits, rate, mode);
this->mode = mode;
this->sample_rate = rate;
@@ -179,14 +182,15 @@ static int ao_none_ctrl(ao_driver_t *this_gen, int cmd, ...) {
static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
const void *data) {
- /* none_class_t *class = (none_class_t *) class_gen; */
+ none_class_t *class = (none_class_t *) class_gen;
/* config_values_t *config = class->config; */
none_driver_t *this;
- printf ("audio_none_out: open_plugin called\n");
+ lprintf ("audio_none_out: open_plugin called\n");
- this = (none_driver_t *) malloc (sizeof (none_driver_t));
+ this = (none_driver_t *) xine_xmalloc (sizeof (none_driver_t));
+ this->xine = class->xine;
this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO;
this->sample_rate = 0;
@@ -230,9 +234,9 @@ static void *init_class (xine_t *xine, void *data) {
none_class_t *this;
- printf ("audio_none_out: init class\n");
+ lprintf ("audio_none_out: init class\n");
- this = (none_class_t *) malloc (sizeof (none_class_t));
+ this = (none_class_t *) xine_xmalloc (sizeof (none_class_t));
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
@@ -240,6 +244,7 @@ static void *init_class (xine_t *xine, void *data) {
this->driver_class.dispose = dispose_class;
this->config = xine->config;
+ this->xine = xine;
return this;
}
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index af3d6207a..8a6ac5d92 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_oss_out.c,v 1.94 2003/11/26 23:44:08 f1rmb Exp $
+ * $Id: audio_oss_out.c,v 1.95 2003/12/05 15:54:56 f1rmb Exp $
*
* 20-8-2001 First implementation of Audio sync and Audio driver separation.
* Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk
@@ -165,11 +165,11 @@ static int ao_oss_open(ao_driver_t *this_gen,
oss_driver_t *this = (oss_driver_t *) this_gen;
int tmp;
- xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_oss_out: ao_open rate=%d, mode=%d, dev=%s\n",
- rate, mode, this->audio_dev);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG,
+ "audio_oss_out: ao_open rate=%d, mode=%d, dev=%s\n", rate, mode, this->audio_dev);
if ( (mode & this->capabilities) == 0 ) {
- printf ("audio_oss_out: unsupported mode %08x\n", mode);
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: unsupported mode %08x\n", mode);
return 0;
}
@@ -195,8 +195,8 @@ 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) {
- printf("audio_oss_out: Opening audio device %s: %s\n",
- this->audio_dev, strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ _("audio_oss_out: Opening audio device %s: %s\n"), this->audio_dev, strerror(errno));
return 0;
}
@@ -216,20 +216,21 @@ 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,
- "audio_oss_out: warning: sampling rate %d Hz not supported, trying 44100 Hz\n", this->input_sample_rate);
+ _("audio_oss_out: warning: sampling rate %d Hz not supported, trying 44100 Hz\n"),
+ this->input_sample_rate);
tmp = 44100;
if (ioctl(this->audio_fd,SNDCTL_DSP_SPEED, &tmp) == -1) {
- printf ("audio_oss_out: error: 44100 Hz sampling rate not supported\n");
+ xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: error: 44100 Hz sampling rate not supported\n");
return 0;
}
}
this->output_sample_rate = tmp;
this->output_sample_k_rate = this->output_sample_rate / 1000;
xprintf(this->xine, XINE_VERBOSITY_LOG,
- "audio_oss_out: audio rate : %d requested, %d provided by device/sec\n",
+ _("audio_oss_out: audio rate : %d requested, %d provided by device/sec\n"),
this->input_sample_rate, this->output_sample_rate);
}
/*
@@ -272,7 +273,7 @@ static int ao_oss_open(ao_driver_t *this_gen,
break;
}
- xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_oss_out: %d channels output\n",this->num_channels);
+ 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;
/*
@@ -292,18 +293,18 @@ static int ao_oss_open(ao_driver_t *this_gen,
if (ioctl(this->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0
|| (tmp!=AFMT_S16_NE && tmp!=AFMT_U8)) {
if (bits==8) {
- printf("audio_oss_out: SNDCTL_DSP_SETFMT failed for AFMT_U8.\n");
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: SNDCTL_DSP_SETFMT failed for AFMT_U8.\n");
if (tmp != AFMT_U8)
- printf("audio_oss_out: ioctl succeeded but set format to 0x%x.\n",tmp);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: ioctl succeeded but set format to 0x%x.\n",tmp);
else
- printf("audio_oss_out: The AFMT_U8 ioctl failed.\n");
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: The AFMT_U8 ioctl failed.\n");
return 0;
} else {
- printf("audio_oss_out: SNDCTL_DSP_SETFMT failed for AFMT_S16_NE.\n");
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: SNDCTL_DSP_SETFMT failed for AFMT_S16_NE.\n");
if (tmp != AFMT_S16_NE)
- printf("audio_oss_out: ioctl succeeded but set format to 0x%x.\n",tmp);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: ioctl succeeded but set format to 0x%x.\n",tmp);
else
- printf("audio_oss_out: The AFMT_S16_NE ioctl failed.\n");
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: The AFMT_S16_NE ioctl failed.\n");
return 0;
}
}
@@ -319,7 +320,8 @@ 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) {
- printf("audio_oss_out: AC3 SNDCTL_DSP_SETFMT failed. %d. Using alternative.\n",tmp);
+ 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);
}
@@ -536,8 +538,8 @@ static int ao_oss_get_property (ao_driver_t *this_gen, int property) {
this->mixer.volume = (((v & 0xFF00) >> 8) + (v & 0x00FF)) / 2;
close(mixer_fd);
} else {
- printf("audio_oss_out: open() %s failed: %s\n",
- this->mixer.name, strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ _("audio_oss_out: open() %s failed: %s\n"), this->mixer.name, strerror(errno));
return -1;
}
}
@@ -587,8 +589,8 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value)
}
else
- printf("audio_oss_out: open() %s failed: %s\n",
- this->mixer.name, strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ _("audio_oss_out: open() %s failed: %s\n"), this->mixer.name, strerror(errno));
}
else
this->mixer.volume = value;
@@ -623,8 +625,8 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value)
}
else
- printf("audio_oss_out: open() %s failed: %s\n",
- this->mixer.name, strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ _("audio_oss_out: open() %s failed: %s\n"), this->mixer.name, strerror(errno));
}
else
(void) ao_oss_set_property(&this->ao_driver, this->mixer.prop, this->mixer.volume);
@@ -694,13 +696,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
int num_channels, bits, status, arg;
static char *sync_methods[] = {"auto", "getodelay", "getoptr", "softsync", "probebuffer", NULL};
- this = (oss_driver_t *) malloc (sizeof (oss_driver_t));
+ this = (oss_driver_t *) xine_xmalloc (sizeof (oss_driver_t));
/*
* find best device driver/channel
*/
- xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: Opening audio device...\n");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: Opening audio device...\n");
best_rate = 0;
devnum = config->register_num (config, "audio.oss_device_num", -1,
@@ -745,13 +747,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
*/
xprintf(class->xine, XINE_VERBOSITY_LOG,
- "audio_oss_out: using device >%s<\n", this->audio_dev);
+ _("audio_oss_out: using device >%s<\n"), this->audio_dev);
audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK);
if (audio_fd < 0) {
- printf("audio_oss_out: opening audio device %s failed:\n%s\n",
- this->audio_dev, strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ _("audio_oss_out: opening audio device %s failed:\n%s\n"), this->audio_dev, strerror(errno));
free (this);
return NULL;
@@ -784,10 +786,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
*/
if (ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &info) != -1) {
- xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: using SNDCTL_DSP_GETODELAY\n");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: using SNDCTL_DSP_GETODELAY\n");
this->sync_method = OSS_SYNC_GETODELAY;
} else if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) != -1) {
- xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: using SNDCTL_DSP_GETOPTR\n");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: using SNDCTL_DSP_GETOPTR\n");
this->sync_method = OSS_SYNC_GETOPTR;
} else {
this->sync_method = OSS_SYNC_SOFTSYNC;
@@ -796,9 +798,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
if (this->sync_method == OSS_SYNC_SOFTSYNC) {
xprintf(class->xine, XINE_VERBOSITY_LOG,
- "audio_oss_out: Audio driver realtime sync disabled...\n"
- "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");
+ _("audio_oss_out: Audio driver realtime sync disabled...\n"
+ "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"));
gettimeofday(&this->start_time, NULL);
}
@@ -807,8 +809,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
int c;
xprintf(class->xine, XINE_VERBOSITY_LOG,
- "audio_oss_out: Audio driver realtime sync disabled...\n"
- "audio_oss_out: ...probing output buffer size: ");
+ _("audio_oss_out: Audio driver realtime sync disabled...\n"
+ "audio_oss_out: ...probing output buffer size: "));
this->buffer_size = 0;
if( (buf=malloc(1024)) != NULL ) {
@@ -824,15 +826,14 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
}
close(audio_fd);
xprintf(class->xine, XINE_VERBOSITY_LOG,
- "%d bytes\n"
- "audio_oss_out: ...there may be audio/video synchronization issues\n", this->buffer_size);
+ _("%d bytes\naudio_oss_out: ...there may be audio/video synchronization issues\n"), this->buffer_size);
audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK);
if(audio_fd < 0)
{
- printf("audio_oss_out: opening audio device %s failed:\n%s\n",
- this->audio_dev, strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ _("audio_oss_out: opening audio device %s failed:\n%s\n"), this->audio_dev, strerror(errno));
free (this);
return NULL;
@@ -854,23 +855,23 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
/* switch back to 16bits, because some soundcards otherwise do not report all their capabilities */
bits = 16;
if (ioctl(audio_fd, SNDCTL_DSP_SAMPLESIZE, &bits) == -1) {
- printf("audio_oss_out: switching the soundcard to 16 bits mode failed\n");
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: switching the soundcard to 16 bits mode failed\n");
free(this);
return NULL;
}
-
- xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: supported modes are ");
+
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: supported modes are ");
num_channels = 1;
status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels);
if ( (status != -1) && (num_channels==1) ) {
this->capabilities |= AO_CAP_MODE_MONO;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "mono ");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "mono ");
}
num_channels = 2;
status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels);
if ( (status != -1) && (num_channels==2) ) {
this->capabilities |= AO_CAP_MODE_STEREO;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "stereo ");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "stereo ");
}
num_channels = 4;
status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels);
@@ -879,10 +880,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
_("Enable 4.0 channel analog surround output"),
NULL, 0, NULL, NULL)) {
this->capabilities |= AO_CAP_MODE_4CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "4-channel ");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "4-channel ");
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, "(4-channel not enabled in xine config) " );
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(4-channel not enabled in xine config) " );
}
num_channels = 5;
status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels);
@@ -891,10 +892,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
_("Enable 5.0 channel analog surround output"),
NULL, 0, NULL, NULL)) {
this->capabilities |= AO_CAP_MODE_5CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG,"5-channel ");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "5-channel ");
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, "(5-channel not enabled in xine config) " );
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(5-channel not enabled in xine config) " );
}
num_channels = 6;
status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels);
@@ -903,10 +904,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
_("Enable 5.1 channel analog surround output"),
NULL, 0, NULL, NULL)) {
this->capabilities |= AO_CAP_MODE_5_1CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "5.1-channel ");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "5.1-channel ");
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, "(5.1-channel not enabled in xine config) " );
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(5.1-channel not enabled in xine config) " );
}
ioctl(audio_fd,SNDCTL_DSP_GETFMTS,&caps);
@@ -919,10 +920,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
NULL, 0, NULL, NULL)) {
this->capabilities |= AO_CAP_MODE_A52;
this->capabilities |= AO_CAP_MODE_AC5;
- xprintf(class->xine, XINE_VERBOSITY_LOG, "a/52-pass-through ");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "a/52-pass-through ");
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, "(a/52-pass-through not enabled in xine config)");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(a/52-pass-through not enabled in xine config)");
}
/*
@@ -965,8 +966,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
close(mixer_fd);
} else
- printf ("audio_oss_out: open() mixer %s failed: %s\n",
- this->mixer.name, strerror(errno));
+ 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);
@@ -1019,7 +1020,7 @@ static void *init_class (xine_t *xine, void *data) {
oss_class_t *this;
- this = (oss_class_t *) malloc (sizeof (oss_class_t));
+ this = (oss_class_t *) xine_xmalloc (sizeof (oss_class_t));
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c
index 5de3841d9..8a8882761 100644
--- a/src/audio_out/audio_sun_out.c
+++ b/src/audio_out/audio_sun_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_sun_out.c,v 1.32 2003/11/29 15:41:37 miguelfreitas Exp $
+ * $Id: audio_sun_out.c,v 1.33 2003/12/05 15:54:56 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -126,7 +126,7 @@ typedef struct sun_driver_s {
* try to figure out, if the soundcard driver provides usable (precise)
* sample counter information
*/
-static int realtime_samplecounter_available(char *dev)
+static int realtime_samplecounter_available(xine_t *xine, char *dev)
{
int fd = -1;
audio_info_t info;
@@ -162,17 +162,17 @@ static int realtime_samplecounter_available(char *dev)
info.play.encoding = AUDIO_ENCODING_LINEAR;
info.play.samples = 0;
if (ioctl(fd, AUDIO_SETINFO, &info)) {
- fprintf(stderr, "rtsc: SETINFO failed\n");
+ xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: SETINFO failed\n");
goto error;
}
if (write(fd, silence, len) != len) {
- fprintf(stderr, "rtsc: write failed\n");
+ xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: write failed\n");
goto error;
}
if (ioctl(fd, AUDIO_GETINFO, &info)) {
- fprintf(stderr, "rtsc: GETINFO1, %s\n", strerror(errno));
+ xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: GETINFO1, %s\n", strerror(errno));
goto error;
}
@@ -194,11 +194,11 @@ static int realtime_samplecounter_available(char *dev)
break;
if (ioctl(fd, AUDIO_GETINFO, &info)) {
- fprintf(stderr, "rtsc: GETINFO2 failed, %s\n", strerror(errno));
+ xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: GETINFO2 failed, %s\n", strerror(errno));
goto error;
}
if (info.play.samples < last_samplecnt) {
- fprintf(stderr, "rtsc: %u > %u?\n", last_samplecnt, info.play.samples);
+ xprintf(xine, XINE_VERBOSITY_DEBUG, "rtsc: %u > %u?\n", last_samplecnt, info.play.samples);
goto error;
}
@@ -412,10 +412,10 @@ static int ao_sun_open(ao_driver_t *this_gen,
int pass;
int ok;
- xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: ao_sun_open rate=%d, mode=%d\n", rate, mode);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: ao_sun_open rate=%d, mode=%d\n", rate, mode);
if ( (mode & this->capabilities) == 0 ) {
- xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: unsupported mode %08x\n", mode);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: unsupported mode %08x\n", mode);
return 0;
}
@@ -437,8 +437,8 @@ 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) {
- fprintf(stderr, "audio_sun_out: Opening audio device %s failed: %s\n",
- this->audio_dev, strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ _("audio_sun_out: Opening audio device %s failed: %s\n"), this->audio_dev, strerror(errno));
return 0;
}
@@ -514,8 +514,8 @@ static int ao_sun_open(ao_driver_t *this_gen,
}
if (!ok) {
- fprintf(stderr, "audio_sun_out: Cannot configure audio device for "
- "%dhz, %d channel, %d bits: %s\n",
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG,
+ "audio_sun_out: Cannot configure audio device for %dhz, %d channel, %d bits: %s\n",
rate, info.play.channels, bits, strerror(errno));
close(this->audio_fd);
this->audio_fd = -1;
@@ -542,7 +542,7 @@ static int ao_sun_open(ao_driver_t *this_gen,
this->input_sample_rate, this->output_sample_rate);
*/
- xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: %d channels output\n",this->num_channels);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: %d channels output\n",this->num_channels);
return this->output_sample_rate;
}
@@ -567,8 +567,9 @@ 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) {
- fprintf(stderr, "audio_sun_out: broken sound driver, sample counter runs backwards, cur %u < prev %u\n",
- info.play.samples, this->last_samplecnt);
+ 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);
}
this->last_samplecnt = info.play.samples;
@@ -875,7 +876,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v
int status;
audio_info_t info;
- this = (sun_driver_t *) malloc (sizeof (sun_driver_t));
+ this = (sun_driver_t *) xine_xmalloc (sizeof (sun_driver_t));
this->xine = class->xine;
@@ -894,7 +895,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v
* find best device driver/channel
*/
- xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: Opening audio device %s...\n", devname);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_sun_out: Opening audio device %s...\n", devname);
/*
* open the device
@@ -904,8 +905,8 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v
if(audio_fd < 0)
{
- fprintf(stderr, "audio_sun_out: opening audio device %s failed: %s\n",
- devname, strerror(errno));
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ _("audio_sun_out: opening audio device %s failed: %s\n"), devname, strerror(errno));
free (this);
return NULL;
@@ -933,7 +934,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v
this->xine = class->xine;
this->audio_fd = -1;
- this->use_rtsc = realtime_samplecounter_available(this->audio_dev);
+ this->use_rtsc = realtime_samplecounter_available(this->xine, this->audio_dev);
this->output_sample_rate = 0;
this->ao_driver.get_capabilities = ao_sun_get_capabilities;
@@ -974,7 +975,7 @@ static void ao_sun_dispose_class (audio_driver_class_t *this_gen) {
static void *ao_sun_init_class (xine_t *xine, void *data) {
sun_class_t *this;
- this = (sun_class_t *) malloc (sizeof (sun_class_t));
+ this = (sun_class_t *) xine_xmalloc (sizeof (sun_class_t));
this->driver_class.open_plugin = ao_sun_open_plugin;
this->driver_class.get_identifier = ao_sun_get_identifier;