summaryrefslogtreecommitdiff
path: root/src/audio_out
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2003-11-26 23:44:08 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2003-11-26 23:44:08 +0000
commite76d60c53d666cc42408bcea5e4060ac173798dd (patch)
treea2b395870a898ad7bdfe1f49a7717499f40e1386 /src/audio_out
parent23176d5f3aaafdf90795fb847a064d0bb1b8d198 (diff)
downloadxine-lib-e76d60c53d666cc42408bcea5e4060ac173798dd.tar.gz
xine-lib-e76d60c53d666cc42408bcea5e4060ac173798dd.tar.bz2
xprintf clean pass. xprintf now log into new XINE_LOG_TRACE log buffer. scratch buffer enhancement (thanks Thibaut for the malloc tips), enlarge log buffer from 25 lines (very useless), to 150 (better).
CVS patchset: 5801 CVS date: 2003/11/26 23:44:08
Diffstat (limited to 'src/audio_out')
-rw-r--r--src/audio_out/audio_alsa_out.c68
-rw-r--r--src/audio_out/audio_oss_out.c106
-rw-r--r--src/audio_out/audio_sun_out.c14
3 files changed, 79 insertions, 109 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index 24be52470..2d851b30b 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.117 2003/11/07 18:25:35 jcdutton Exp $
+ * $Id: audio_alsa_out.c,v 1.118 2003/11/26 23:44:08 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -522,8 +522,7 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int
/* Check for pause/resume support */
this->has_pause_resume = ( snd_pcm_hw_params_can_pause (params)
&& snd_pcm_hw_params_can_resume (params) );
- if (this->class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume);
+ xprintf(this->class->xine, XINE_VERBOSITY_LOG, "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);
/*
@@ -1301,22 +1300,18 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
this->capabilities = 0;
- if(class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("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;
- if(class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("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;
- if(class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("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;
- if(class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("stereo ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "stereo ");
}
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 4)) &&
config->register_bool (config,
@@ -1327,11 +1322,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
0, NULL,
NULL) ) {
this->capabilities |= AO_CAP_MODE_4CHANNEL;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("4-channel ");
- } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) {
- printf ("(4-channel not enabled in xine config) " );
- }
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "4-channel ");
+ }
+ else
+ 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,
"audio.four_lfe_channel",
@@ -1341,11 +1336,11 @@ 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;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("4.1-channel ");
- } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) {
- printf ("(4.1-channel not enabled in xine config) " );
- }
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "4.1-channel ");
+ }
+ else
+ 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,
"audio.five_channel",
@@ -1355,11 +1350,11 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
0, NULL,
NULL) ) {
this->capabilities |= AO_CAP_MODE_5CHANNEL;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("5-channel ");
- } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) {
- printf ("(5-channel not enabled in xine config) " );
- }
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "5-channel ");
+ }
+ else
+ 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,
"audio.five_lfe_channel",
@@ -1369,11 +1364,11 @@ 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;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("5.1-channel ");
- } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) {
- printf ("(5.1-channel not enabled in xine config) " );
- }
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "5.1-channel ");
+ }
+ else
+ 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 */
@@ -1407,13 +1402,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;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("a/52 and DTS pass-through ");
- } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG) {
- printf ("(a/52 and DTS pass-through not enabled in xine config)");
- }
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("\n");
+ 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)");
/* printf("audio_alsa_out: capabilities 0x%X\n",this->capabilities); */
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index 6f4df2f05..af3d6207a 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.93 2003/11/26 19:43:26 f1rmb Exp $
+ * $Id: audio_oss_out.c,v 1.94 2003/11/26 23:44:08 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,9 +165,8 @@ static int ao_oss_open(ao_driver_t *this_gen,
oss_driver_t *this = (oss_driver_t *) this_gen;
int tmp;
- if (this->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_oss_out: ao_open rate=%d, mode=%d, dev=%s\n",
- rate, mode, this->audio_dev);
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "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);
@@ -218,8 +217,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) {
- if (this->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_oss_out: warning: sampling rate %d Hz not supported, trying 44100 Hz\n", this->input_sample_rate);
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ "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) {
@@ -229,9 +228,9 @@ static int ao_oss_open(ao_driver_t *this_gen,
}
this->output_sample_rate = tmp;
this->output_sample_k_rate = this->output_sample_rate / 1000;
- if (this->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_oss_out: audio rate : %d requested, %d provided by device/sec\n",
- this->input_sample_rate, this->output_sample_rate);
+ xprintf(this->xine, XINE_VERBOSITY_LOG,
+ "audio_oss_out: audio rate : %d requested, %d provided by device/sec\n",
+ this->input_sample_rate, this->output_sample_rate);
}
/*
* set number of channels / a52 passthrough
@@ -269,13 +268,11 @@ static int ao_oss_open(ao_driver_t *this_gen,
this->num_channels = 2; /* FIXME: is this correct ? */
this->output_sample_rate = this->input_sample_rate;
this->output_sample_k_rate = this->output_sample_rate / 1000;
- if (this->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- printf ("audio_oss_out: AO_CAP_MODE_A52\n");
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: AO_CAP_MODE_A52\n");
break;
}
- if (this->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("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;
/*
@@ -703,8 +700,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
* find best device driver/channel
*/
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_oss_out: Opening audio device...\n");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: Opening audio device...\n");
best_rate = 0;
devnum = config->register_num (config, "audio.oss_device_num", -1,
@@ -748,9 +744,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
* open that device
*/
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_oss_out: using device >%s<\n",
- this->audio_dev);
+ xprintf(class->xine, XINE_VERBOSITY_LOG,
+ "audio_oss_out: using device >%s<\n", this->audio_dev);
audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK);
@@ -789,12 +784,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) {
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf("audio_oss_out: using SNDCTL_DSP_GETODELAY\n");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: using SNDCTL_DSP_GETODELAY\n");
this->sync_method = OSS_SYNC_GETODELAY;
} else if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) != -1) {
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf("audio_oss_out: using SNDCTL_DSP_GETOPTR\n");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "audio_oss_out: using SNDCTL_DSP_GETOPTR\n");
this->sync_method = OSS_SYNC_GETOPTR;
} else {
this->sync_method = OSS_SYNC_SOFTSYNC;
@@ -802,12 +795,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
}
if (this->sync_method == OSS_SYNC_SOFTSYNC) {
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG) {
- printf ("audio_oss_out: Audio driver realtime sync disabled...\n");
- printf ("audio_oss_out: ...will use system real-time clock for soft-sync instead\n");
- printf ("audio_oss_out: ...there may be audio/video synchronization issues\n");
- }
-
+ 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");
gettimeofday(&this->start_time, NULL);
}
@@ -815,10 +806,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
char *buf;
int c;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG) {
- printf ("audio_oss_out: Audio driver realtime sync disabled...\n");
- printf ("audio_oss_out: ...probing output buffer size: ");
- }
+ xprintf(class->xine, XINE_VERBOSITY_LOG,
+ "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 ) {
@@ -833,10 +823,9 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
free(buf);
}
close(audio_fd);
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG) {
- printf ("%d bytes\n", this->buffer_size );
- printf ("audio_oss_out: ...there may be audio/video synchronization issues\n");
- }
+ xprintf(class->xine, XINE_VERBOSITY_LOG,
+ "%d bytes\n"
+ "audio_oss_out: ...there may be audio/video synchronization issues\n", this->buffer_size);
audio_fd=open(this->audio_dev, O_WRONLY|O_NONBLOCK);
@@ -870,21 +859,18 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
return NULL;
}
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_oss_out: supported modes are ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "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;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("mono ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "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;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("stereo ");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "stereo ");
}
num_channels = 4;
status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels);
@@ -893,10 +879,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;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("4-channel ");
- } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("(4-channel not enabled in xine config) " );
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "4-channel ");
+ }
+ else
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "(4-channel not enabled in xine config) " );
}
num_channels = 5;
status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels);
@@ -905,10 +891,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;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("5-channel ");
- } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("(5-channel not enabled in xine config) " );
+ xprintf(class->xine, XINE_VERBOSITY_LOG,"5-channel ");
+ }
+ else
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "(5-channel not enabled in xine config) " );
}
num_channels = 6;
status = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &num_channels);
@@ -917,10 +903,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;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("5.1-channel ");
- } else if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("(5.1-channel not enabled in xine config) " );
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "5.1-channel ");
+ }
+ else
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "(5.1-channel not enabled in xine config) " );
}
ioctl(audio_fd,SNDCTL_DSP_GETFMTS,&caps);
@@ -933,16 +919,12 @@ 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;
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("a/52-pass-through ");
- } else
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("(a/52-pass-through not enabled in xine config)");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "a/52-pass-through ");
+ }
+ else
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "(a/52-pass-through not enabled in xine config)");
}
- if (class->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("\n");
-
/*
* mixer initialisation.
*/
diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c
index 07835a455..9e7587398 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.30 2003/10/06 15:27:10 mroi Exp $
+ * $Id: audio_sun_out.c,v 1.31 2003/11/26 23:44:08 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -412,12 +412,10 @@ static int ao_sun_open(ao_driver_t *this_gen,
int pass;
int ok;
- if (this->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_sun_out: ao_sun_open rate=%d, mode=%d\n", rate, mode);
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: ao_sun_open rate=%d, mode=%d\n", rate, mode);
if ( (mode & this->capabilities) == 0 ) {
- if (this->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_sun_out: unsupported mode %08x\n", mode);
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: unsupported mode %08x\n", mode);
return 0;
}
@@ -544,8 +542,7 @@ static int ao_sun_open(ao_driver_t *this_gen,
this->input_sample_rate, this->output_sample_rate);
*/
- if (this->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_sun_out: %d channels output\n",this->num_channels);
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: %d channels output\n",this->num_channels);
return this->output_sample_rate;
}
@@ -894,8 +891,7 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v
* find best device driver/channel
*/
- if (this->xine->verbosity >= XINE_VERBOSITY_LOG)
- printf ("audio_sun_out: Opening audio device %s...\n", devname);
+ xprintf(this->xine, XINE_VERBOSITY_LOG, "audio_sun_out: Opening audio device %s...\n", devname);
/*
* open the device