[xiph-commits] r3697 - browser_plugin/trunk/src/audio
j at svn.annodex.net
j at svn.annodex.net
Fri Aug 8 12:35:04 PDT 2008
Author: j
Date: 2008-08-08 12:35:04 -0700 (Fri, 08 Aug 2008)
New Revision: 3697
Modified:
browser_plugin/trunk/src/audio/sydney_audio_oss.c
Log:
cleanup whitespace
Modified: browser_plugin/trunk/src/audio/sydney_audio_oss.c
===================================================================
--- browser_plugin/trunk/src/audio/sydney_audio_oss.c 2008-08-08 19:10:48 UTC (rev 3696)
+++ browser_plugin/trunk/src/audio/sydney_audio_oss.c 2008-08-08 19:35:04 UTC (rev 3697)
@@ -65,8 +65,8 @@
};
struct sa_stream {
- char* output_unit;
- int output_fd;
+ char* output_unit;
+ int output_fd;
pthread_t thread_id;
pthread_mutex_t mutex;
char playing;
@@ -75,7 +75,7 @@
/* audio format info */
unsigned int rate;
unsigned int channels;
- int format;
+ int format;
/* buffer list */
sa_buf * bl_head;
@@ -108,48 +108,48 @@
* \return - Sydney API error value as in ::sa_pcm_format_t
* */
static int oss_audio_format(sa_pcm_format_t sa_format, int *fmt) {
- *fmt = -1;
- switch (sa_format) {
- case SA_PCM_FORMAT_U8:
- *fmt = AFMT_U8;
- break;
- case SA_PCM_FORMAT_ULAW:
- *fmt = AFMT_MU_LAW;
- break;
- case SA_PCM_FORMAT_ALAW:
- *fmt = AFMT_A_LAW;
- break;
- /* 16-bit little endian (LE) format */
- case SA_PCM_FORMAT_S16_LE:
- *fmt = AFMT_S16_LE;
- break;
- /* 16-bit big endian (BE) format */
- case SA_PCM_FORMAT_S16_BE:
- *fmt = AFMT_S16_BE;
- break;
+ *fmt = -1;
+ switch (sa_format) {
+ case SA_PCM_FORMAT_U8:
+ *fmt = AFMT_U8;
+ break;
+ case SA_PCM_FORMAT_ULAW:
+ *fmt = AFMT_MU_LAW;
+ break;
+ case SA_PCM_FORMAT_ALAW:
+ *fmt = AFMT_A_LAW;
+ break;
+ /* 16-bit little endian (LE) format */
+ case SA_PCM_FORMAT_S16_LE:
+ *fmt = AFMT_S16_LE;
+ break;
+ /* 16-bit big endian (BE) format */
+ case SA_PCM_FORMAT_S16_BE:
+ *fmt = AFMT_S16_BE;
+ break;
#if SOUND_VERSION >= OSS_VERSION(4,0,0)
- /* 24-bit formats (LSB aligned in 32 bit word) */
- case SA_PCM_FORMAT_S24_LE:
- *fmt = AFMT_S24_LE;
- break;
- /* 24-bit formats (LSB aligned in 32 bit word) */
- case SA_PCM_FORMAT_S24_BE:
- *fmt = AFMT_S24_BE;
- break;
- /* 32-bit format little endian */
- case SA_PCM_FORMAT_S32_LE:
- *fmt = AFMT_S32_LE;
- break;
- /* 32-bit format big endian */
- case SA_PCM_FORMAT_S32_BE:
- *fmt = AFMT_S32_BE;
- break;
+ /* 24-bit formats (LSB aligned in 32 bit word) */
+ case SA_PCM_FORMAT_S24_LE:
+ *fmt = AFMT_S24_LE;
+ break;
+ /* 24-bit formats (LSB aligned in 32 bit word) */
+ case SA_PCM_FORMAT_S24_BE:
+ *fmt = AFMT_S24_BE;
+ break;
+ /* 32-bit format little endian */
+ case SA_PCM_FORMAT_S32_LE:
+ *fmt = AFMT_S32_LE;
+ break;
+ /* 32-bit format big endian */
+ case SA_PCM_FORMAT_S32_BE:
+ *fmt = AFMT_S32_BE;
+ break;
#endif
- default:
- return SA_ERROR_NOT_SUPPORTED;
- break;
- }
- return SA_SUCCESS;
+ default:
+ return SA_ERROR_NOT_SUPPORTED;
+ break;
+ }
+ return SA_SUCCESS;
}
/*
@@ -243,7 +243,7 @@
close(s->output_fd);
s->output_fd = -1;
return SA_ERROR_NOT_SUPPORTED;
- }
+ }
if (ioctl(s->output_fd, SNDCTL_DSP_SETFMT, &(s->format)) < 0 ) {
close(s->output_fd);
@@ -345,7 +345,7 @@
data = ((unsigned char *)data) + avail;
nbytes -= avail;
- /*
+ /*
* If we still have data left to copy but we've hit the limit of
* allowable buffer allocations, we need to spin for a bit to allow
* the audio callback function to slurp some more data up.
@@ -373,7 +373,7 @@
}
}
- /*
+ /*
* Allocate a new tail buffer, and go 'round again to fill it up.
*/
if ((s->bl_tail->next = new_buffer()) == NULL) {
@@ -382,7 +382,7 @@
}
s->n_bufs++;
s->bl_tail = s->bl_tail->next;
-
+
} /* if (nbytes <= avail), else */
} /* while (1) */
@@ -420,7 +420,7 @@
ioctl(s->output_fd, SNDCTL_DSP_GETOSPACE, &info);
buffer = malloc(info.bytes);
-
+
while(1) {
char* dst = buffer;
unsigned int bytes_to_copy = info.bytes;
@@ -473,13 +473,13 @@
free(s->bl_head);
s->bl_head = next;
s->n_bufs--;
-
+
} /* if (avail >= bytes_to_copy), else */
-
+
} /* while (1) */
-
+
pthread_mutex_unlock(&s->mutex);
-
+
frames = write(s->output_fd, buffer, info.bytes);
if (frames < 0) {
printf("error writing to sound device\n");
More information about the commits
mailing list