Index: pjproject/branches/projects/android/pjmedia/src/pjmedia-audiodev/opensl_dev.c
===================================================================
--- pjproject/branches/projects/android/pjmedia/src/pjmedia-audiodev/opensl_dev.c	(revision 4215)
+++ pjproject/branches/projects/android/pjmedia/src/pjmedia-audiodev/opensl_dev.c	(revision 4226)
@@ -34,7 +34,19 @@
 
 #include <SLES/OpenSLES.h>
-#include <SLES/OpenSLES_Android.h>
-#include <sys/system_properties.h>
-#include <android/api-level.h>
+
+#ifdef __ANDROID__
+    #include <SLES/OpenSLES_Android.h>
+    #include <SLES/OpenSLES_AndroidConfiguration.h>
+    #include <sys/system_properties.h>
+    #include <android/api-level.h>
+
+    #define W_SLBufferQueueItf SLAndroidSimpleBufferQueueItf
+    #define W_SLBufferQueueState SLAndroidSimpleBufferQueueState
+    #define W_SL_IID_BUFFERQUEUE SL_IID_ANDROIDSIMPLEBUFFERQUEUE
+#else
+    #define W_SLBufferQueueItf SLBufferQueueItf
+    #define W_SLBufferQueueState SLBufferQueueState
+    #define W_SL_IID_BUFFERQUEUE SL_IID_BUFFERQUEUE
+#endif
 
 #define THIS_FILE	"opensl_dev.c"
@@ -98,6 +110,6 @@
     int                 recordBufIdx;
 
-    SLAndroidSimpleBufferQueueItf playerBufQ;
-    SLAndroidSimpleBufferQueueItf recordBufQ;
+    W_SLBufferQueueItf  playerBufQ;
+    W_SLBufferQueueItf  recordBufQ;
 };
 
@@ -155,5 +167,5 @@
 
 /* This callback is called every time a buffer finishes playing. */
-void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
+void bqPlayerCallback(W_SLBufferQueueItf bq, void *context)
 {
     struct opensl_aud_stream *stream = (struct opensl_aud_stream*) context;
@@ -201,5 +213,5 @@
 
 /* This callback handler is called every time a buffer finishes recording */
-void bqRecorderCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
+void bqRecorderCallback(W_SLBufferQueueItf bq, void *context)
 {
     struct opensl_aud_stream *stream = (struct opensl_aud_stream*) context;
@@ -449,6 +461,11 @@
 {
     /* Audio sink for recorder and audio source for player */
+#ifdef __ANDROID__
     SLDataLocator_AndroidSimpleBufferQueue loc_bq =
         { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, NUM_BUFFERS };
+#else
+    SLDataLocator_BufferQueue loc_bq =
+        { SL_DATALOCATOR_BUFFERQUEUE, NUM_BUFFERS };
+#endif
     struct opensl_aud_factory *pa = (struct opensl_aud_factory*)f;
     pj_pool_t *pool;
@@ -497,4 +514,6 @@
         SLDataSink audioSnk = {&loc_outmix, NULL};
         /* Audio interface */
+#ifdef __ANDROID__
+        int numIface = 3;
         const SLInterfaceID ids[3] = {SL_IID_BUFFERQUEUE,
                                       SL_IID_VOLUME,
@@ -504,4 +523,10 @@
         SLAndroidConfigurationItf playerConfig;
         SLint32 streamType = SL_ANDROID_STREAM_VOICE;
+#else
+        int numIface = 2;
+        const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE,
+                                      SL_IID_VOLUME};
+        const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
+#endif
         
         /* Create audio player */
@@ -509,5 +534,5 @@
                                                         &stream->playerObj,
                                                         &audioSrc, &audioSnk,
-                                                        3, ids, req);
+                                                        numIface, ids, req);
         if (result != SL_RESULT_SUCCESS) {
             PJ_LOG(3, (THIS_FILE, "Cannot create audio player: %d", result));
@@ -515,4 +540,5 @@
         }
 
+#ifdef __ANDROID__
         /* Set Android configuration */
         result = (*stream->playerObj)->GetInterface(stream->playerObj,
@@ -528,5 +554,6 @@
                                   "player configuration"));
         }
-        
+#endif
+
         /* Realize the player */
         result = (*stream->playerObj)->Realize(stream->playerObj,
@@ -587,8 +614,15 @@
         SLDataSink audioSnk = {&loc_bq, &format_pcm};
         /* Audio interface */
-        const SLInterfaceID ids[2] = {SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
+#ifdef __ANDROID__
+        int numIface = 2;
+        const SLInterfaceID ids[2] = {W_SL_IID_BUFFERQUEUE,
                                       SL_IID_ANDROIDCONFIGURATION};
         const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_FALSE};
         SLAndroidConfigurationItf recorderConfig;
+#else
+        int numIface = 1;
+        const SLInterfaceID ids[1] = {W_SL_IID_BUFFERQUEUE};
+        const SLboolean req[1] = {SL_BOOLEAN_TRUE};
+#endif
         
         /* Create audio recorder
@@ -598,5 +632,5 @@
                                                           &stream->recordObj,
                                                           &audioSrc, &audioSnk,
-                                                          2, ids, req);
+                                                          numIface, ids, req);
         if (result != SL_RESULT_SUCCESS) {
             PJ_LOG(3, (THIS_FILE, "Cannot create recorder: %d", result));
@@ -604,4 +638,5 @@
         }
 
+#ifdef __ANDROID__
         /* Set Android configuration */
         result = (*stream->recordObj)->GetInterface(stream->recordObj,
@@ -631,4 +666,5 @@
                                   "recorder configuration"));
         }
+#endif
         
         /* Realize the recorder */
@@ -651,5 +687,5 @@
         /* Get the buffer queue interface */
         result = (*stream->recordObj)->GetInterface(
-                     stream->recordObj, SL_IID_ANDROIDSIMPLEBUFFERQUEUE,
+                     stream->recordObj, W_SL_IID_BUFFERQUEUE,
                      &stream->recordBufQ);
         if (result != SL_RESULT_SUCCESS) {
@@ -861,5 +897,5 @@
 /*      
         SLresult result;
-        SLAndroidSimpleBufferQueueState state;
+        W_SLBufferQueueState state;
 
         result = (*stream->playerBufQ)->GetState(stream->playerBufQ, &state);
