media/libsydneyaudio/bug495558_alsa_endian.patch
author Mitchell Field <mitchell.field@live.com.au>
Wed, 26 Jan 2011 07:14:30 +1100
changeset 63450 261f1a85206a2cc3ddc483d6d86e388c3c6ca1c6
parent 32273 7b926534c36808011dc6e30bd4955fab0d459c78
permissions -rw-r--r--
Bug 462361 - Remove support for building with Cygwin. r=khuey

diff --git a/media/libsydneyaudio/src/sydney_audio_alsa.c b/media/libsydneyaudio/src/sydney_audio_alsa.c
--- a/media/libsydneyaudio/src/sydney_audio_alsa.c
+++ b/media/libsydneyaudio/src/sydney_audio_alsa.c
@@ -93,17 +93,17 @@ sa_stream_create_pcm(
   if (_s == NULL) {
     return SA_ERROR_INVALID;
   }
   *_s = NULL;
 
   if (mode != SA_MODE_WRONLY) {
     return SA_ERROR_NOT_SUPPORTED;
   }
-  if (format != SA_PCM_FORMAT_S16_LE) {
+  if (format != SA_PCM_FORMAT_S16_NE) {
     return SA_ERROR_NOT_SUPPORTED;
   }
 
   /*
    * Allocate the instance and required resources.
    */
   if ((s = malloc(sizeof(sa_stream_t))) == NULL) {
     return SA_ERROR_OOM;
@@ -137,17 +137,21 @@ sa_stream_open(sa_stream_t *s) {
   if (snd_pcm_open(&s->output_unit, 
                    "default", 
                    SND_PCM_STREAM_PLAYBACK, 
                    0) < 0) {
     return SA_ERROR_NO_DEVICE;
   }
   
   if (snd_pcm_set_params(s->output_unit,
+#ifdef SA_LITTLE_ENDIAN
                          SND_PCM_FORMAT_S16_LE,
+#else
+                         SND_PCM_FORMAT_S16_BE,
+#endif
                          SND_PCM_ACCESS_RW_INTERLEAVED,
                          s->n_channels,
                          s->rate,
                          1,
                          500000) < 0) {
     snd_pcm_close(s->output_unit);
     s->output_unit = NULL;
     return SA_ERROR_NOT_SUPPORTED;