summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio_out/audio_alsa_out.c44
-rw-r--r--src/audio_out/audio_oss_out.c33
-rw-r--r--src/xine-utils/utils.c8
-rw-r--r--src/xine-utils/xineutils.h7
4 files changed, 57 insertions, 35 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index e68d80a71..470cd953a 100644
--- a/src/audio_out/audio_alsa_out.c
+++ b/src/audio_out/audio_alsa_out.c
@@ -1497,70 +1497,73 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
"formats you want to play to your sound card's digital output."),
0, alsa_speaker_arrangement_cb, this);
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("audio_alsa_out : supported modes are "));
+ char *logmsg = strdup (_("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 "));
+ xine_strcat_realloc (&logmsg, _(" 8bit"));
}
/* ALSA automatically appends _LE or _BE depending on the CPU */
if (!(snd_pcm_hw_params_test_format(this->audio_fd, params, SND_PCM_FORMAT_S16))) {
this->capabilities |= AO_CAP_16BITS;
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("16bit "));
+ xine_strcat_realloc (&logmsg, _(" 16bit"));
}
if (!(snd_pcm_hw_params_test_format(this->audio_fd, params, SND_PCM_FORMAT_S24))) {
this->capabilities |= AO_CAP_24BITS;
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("24bit "));
+ xine_strcat_realloc (&logmsg, _(" 24bit"));
}
if (!(snd_pcm_hw_params_test_format(this->audio_fd, params, SND_PCM_FORMAT_FLOAT))) {
this->capabilities |= AO_CAP_FLOAT32;
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("32bit "));
+ xine_strcat_realloc (&logmsg, _(" 32bit"));
}
if (0 == (this->capabilities & (AO_CAP_FLOAT32 | AO_CAP_24BITS | AO_CAP_16BITS | AO_CAP_8BITS))) {
- xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
- "\naudio_alsa_out: no supported PCM format found\n");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "%s\n", logmsg);
+ free (logmsg);
+ xprintf (class->xine, XINE_VERBOSITY_DEBUG,
+ "audio_alsa_out: no supported PCM format found\n");
snd_pcm_close(this->audio_fd);
free(this);
return NULL;
}
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 "));
+ xine_strcat_realloc (&logmsg, _(" 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 "));
+ xine_strcat_realloc (&logmsg, _(" stereo"));
}
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 4)) &&
( speakers == SURROUND4 )) {
this->capabilities |= AO_CAP_MODE_4CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("4-channel "));
+ xine_strcat_realloc (&logmsg, _(" 4-channel"));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("(4-channel not enabled in xine config) "));
+ xine_strcat_realloc (&logmsg, _(" (4-channel not enabled in xine config)"));
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) &&
( speakers == SURROUND41 )) {
this->capabilities |= AO_CAP_MODE_4_1CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("4.1-channel "));
+ xine_strcat_realloc (&logmsg, _(" 4.1-channel"));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("(4.1-channel not enabled in xine config) "));
+ xine_strcat_realloc (&logmsg, _(" (4.1-channel not enabled in xine config)"));
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) &&
( speakers == SURROUND5 )) {
this->capabilities |= AO_CAP_MODE_5CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("5-channel "));
+ xine_strcat_realloc (&logmsg, _(" 5-channel"));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("(5-channel not enabled in xine config) "));
+ xine_strcat_realloc (&logmsg, _(" (5-channel not enabled in xine config)"));
if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 6)) &&
( speakers >= SURROUND51 )) {
this->capabilities |= AO_CAP_MODE_5_1CHANNEL;
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("5.1-channel "));
+ xine_strcat_realloc (&logmsg, _(" 5.1-channel"));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("(5.1-channel not enabled in xine config) "));
+ xine_strcat_realloc (&logmsg, _(" (5.1-channel not enabled in xine config)"));
this->has_pause_resume = 0; /* This is checked at open time instead */
this->is_paused = 0;
@@ -1583,10 +1586,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
if ( speakers == A52_PASSTHRU ) {
this->capabilities |= AO_CAP_MODE_A52;
this->capabilities |= AO_CAP_MODE_AC5;
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("a/52 and DTS pass-through\n"));
+ xine_strcat_realloc (&logmsg, _(" a/52 and DTS pass-through"));
}
else
- xprintf(class->xine, XINE_VERBOSITY_LOG, _("(a/52 and DTS pass-through not enabled in xine config)\n"));
+ xine_strcat_realloc (&logmsg, _(" (a/52 and DTS pass-through not enabled in xine config)"));
+
+ xprintf(class->xine, XINE_VERBOSITY_LOG, "%s\n", logmsg);
+ free (logmsg);
/* 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 df29a43ea..2ae116970 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_out.c
@@ -877,10 +877,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
if (this->sync_method == OSS_SYNC_PROBEBUFFER) {
char *buf;
int c;
-
- 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=calloc(1, 1024)) != NULL ) {
@@ -894,7 +891,8 @@ 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\naudio_oss_out: ...there may be audio/video synchronization issues\n"), this->buffer_size);
+ _("audio_oss_out: Audio driver realtime sync disabled...\n"
+ "audio_oss_out: ...probing output 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);
@@ -957,48 +955,48 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
0, oss_speaker_arrangement_cb, this);
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "audio_oss_out: supported modes are ");
+ char *logmsg = strdup (_("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_DEBUG, "mono ");
+ xine_strcat_realloc (&logmsg, _(" 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_DEBUG, "stereo ");
+ xine_strcat_realloc (&logmsg, _(" stereo"));
}
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;
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "4-channel ");
+ xine_strcat_realloc (&logmsg, _(" 4-channel"));
}
else
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(4-channel not enabled in xine config) " );
+ xine_strcat_realloc (&logmsg, _(" (4-channel not enabled in xine config)"));
}
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;
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "5-channel ");
+ xine_strcat_realloc (&logmsg, _(" 5-channel"));
}
else
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(5-channel not enabled in xine config) " );
+ xine_strcat_realloc (&logmsg, _(" (5-channel not enabled in xine config)"));
}
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;
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "5.1-channel ");
+ xine_strcat_realloc (&logmsg, _(" 5.1-channel"));
}
else
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(5.1-channel not enabled in xine config) " );
+ xine_strcat_realloc (&logmsg, _(" (5.1-channel not enabled in xine config)"));
}
ioctl(audio_fd,SNDCTL_DSP_GETFMTS,&caps);
@@ -1008,10 +1006,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
if ( speakers == A52_PASSTHRU ) {
this->capabilities |= AO_CAP_MODE_A52;
this->capabilities |= AO_CAP_MODE_AC5;
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "a/52-pass-through ");
+ xine_strcat_realloc (&logmsg, _(" a/52 pass-through"));
}
else
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "(a/52-pass-through not enabled in xine config)");
+ 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.
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index 9f5d122cb..f533d69e5 100644
--- a/src/xine-utils/utils.c
+++ b/src/xine-utils/utils.c
@@ -692,3 +692,11 @@ int xine_monotonic_clock(struct timeval *tv, struct timezone *tz)
#endif
}
+
+char *xine_strcat_realloc (char **dest, char *append)
+{
+ char *newstr = realloc (*dest, (*dest ? strlen (*dest) : 0) + strlen (append) + 1);
+ if (newstr)
+ strcat (*dest = newstr, append);
+ return newstr;
+}
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index 3d630b066..2d6425b00 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.h
@@ -969,6 +969,13 @@ const char *xine_guess_spu_encoding(void) XINE_PROTECTED;
*/
int xine_monotonic_clock(struct timeval *tv, struct timezone *tz) XINE_PROTECTED;
+/**
+ * append to a string, reallocating
+ * normally, updates & returns *dest
+ * on error, *dest is unchanged & NULL is returned.
+ */
+char *xine_strcat_realloc (char **dest, char *append) XINE_PROTECTED;
+
/* don't harm following code */
#ifdef extern
# undef extern