Index: pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/pa_dev.c
===================================================================
--- pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/pa_dev.c	(revision 2469)
+++ pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-audiodev/pa_dev.c	(revision 2488)
@@ -19,5 +19,4 @@
  */
 #include <pjmedia-audiodev/audiodev_imp.h>
-#include <pjmedia/errno.h>
 #include <pj/assert.h>
 #include <pj/log.h>
@@ -25,4 +24,7 @@
 #include <pj/string.h>
 #include <portaudio.h>
+
+#if PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO
+
 
 #define THIS_FILE	"pa_dev.c"
@@ -452,5 +454,5 @@
 			 pa_get_dev_count(f)));
 
-    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
+    return err ? PJMEDIA_AUDIODEV_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
 }
 
@@ -471,5 +473,5 @@
     pj_pool_release(pool);
     
-    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
+    return err ? PJMEDIA_AUDIODEV_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
 }
 
@@ -693,5 +695,5 @@
 	if (rec_id < 0) {
 	    /* No such device. */
-	    return PJMEDIA_ENOSNDREC;
+	    return PJMEDIA_EAUD_NODEFDEV;
 	}
     }
@@ -700,5 +702,5 @@
     if (!paDevInfo) {
 	/* Assumed it is "No such device" error. */
-	return PJMEDIA_ESNDINDEVID;
+	return PJMEDIA_EAUD_INVDEV;
     }
 
@@ -710,5 +712,5 @@
 	sampleFormat = paInt32;
     else
-	return PJMEDIA_ESNDINSAMPLEFMT;
+	return PJMEDIA_EAUD_SAMPFORMAT;
     
     pool = pj_pool_create(pa->pf, "recstrm", 1024, 1024, NULL);
@@ -753,5 +755,5 @@
     if (err != paNoError) {
 	pj_pool_release(pool);
-	return PJMEDIA_ERRNO_FROM_PORTAUDIO(err);
+	return PJMEDIA_AUDIODEV_ERRNO_FROM_PORTAUDIO(err);
     }
 
@@ -798,5 +800,5 @@
 	if (play_id < 0) {
 	    /* No such device. */
-	    return PJMEDIA_ENOSNDPLAY;
+	    return PJMEDIA_EAUD_NODEFDEV;
 	}
     } 
@@ -805,5 +807,5 @@
     if (!paDevInfo) {
 	/* Assumed it is "No such device" error. */
-	return PJMEDIA_ESNDINDEVID;
+	return PJMEDIA_EAUD_INVDEV;
     }
 
@@ -815,5 +817,5 @@
 	sampleFormat = paInt32;
     else
-	return PJMEDIA_ESNDINSAMPLEFMT;
+	return PJMEDIA_EAUD_SAMPFORMAT;
     
     pool = pj_pool_create(pa->pf, "playstrm", 1024, 1024, NULL);
@@ -859,5 +861,5 @@
     if (err != paNoError) {
 	pj_pool_release(pool);
-	return PJMEDIA_ERRNO_FROM_PORTAUDIO(err);
+	return PJMEDIA_AUDIODEV_ERRNO_FROM_PORTAUDIO(err);
     }
 
@@ -910,5 +912,5 @@
 	if (rec_id < 0) {
 	    /* No such device. */
-	    return PJMEDIA_ENOSNDREC;
+	    return PJMEDIA_EAUD_NODEFDEV;
 	}
     }
@@ -917,5 +919,5 @@
     if (!paRecDevInfo) {
 	/* Assumed it is "No such device" error. */
-	return PJMEDIA_ESNDINDEVID;
+	return PJMEDIA_EAUD_INVDEV;
     }
 
@@ -925,5 +927,5 @@
 	if (play_id < 0) {
 	    /* No such device. */
-	    return PJMEDIA_ENOSNDPLAY;
+	    return PJMEDIA_EAUD_NODEFDEV;
 	}
     } 
@@ -932,5 +934,5 @@
     if (!paPlayDevInfo) {
 	/* Assumed it is "No such device" error. */
-	return PJMEDIA_ESNDINDEVID;
+	return PJMEDIA_EAUD_INVDEV;
     }
 
@@ -943,5 +945,5 @@
 	sampleFormat = paInt32;
     else
-	return PJMEDIA_ESNDINSAMPLEFMT;
+	return PJMEDIA_EAUD_SAMPFORMAT;
     
     pool = pj_pool_create(pa->pf, "sndstream", 1024, 1024, NULL);
@@ -1034,5 +1036,5 @@
     if (err != paNoError) {
 	pj_pool_release(pool);
-	return PJMEDIA_ERRNO_FROM_PORTAUDIO(err);
+	return PJMEDIA_AUDIODEV_ERRNO_FROM_PORTAUDIO(err);
     }
 
@@ -1143,5 +1145,5 @@
 	const PaStreamInfo *si = Pa_GetStreamInfo(strm->rec_strm);
 	if (!si)
-	    return PJ_EINVALIDOP;
+	    return PJMEDIA_EAUD_SYSERR;
 
 	*(unsigned*)pval = (unsigned)(si->inputLatency * 1000);
@@ -1150,10 +1152,10 @@
 	const PaStreamInfo *si = Pa_GetStreamInfo(strm->play_strm);
 	if (!si)
-	    return PJ_EINVALIDOP;
+	    return PJMEDIA_EAUD_SYSERR;
 
 	*(unsigned*)pval = (unsigned)(si->outputLatency * 1000);
 	return PJ_SUCCESS;
     } else {
-	return PJ_ENOTSUP;
+	return PJMEDIA_EAUD_INVCAP;
     }
 }
@@ -1170,5 +1172,5 @@
 
     /* Nothing is supported */
-    return PJ_ENOTSUP;
+    return PJMEDIA_EAUD_INVCAP;
 }
 
@@ -1193,5 +1195,5 @@
     PJ_LOG(5,(THIS_FILE, "Done, status=%d", err));
 
-    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
+    return err ? PJMEDIA_AUDIODEV_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
 }
 
@@ -1224,5 +1226,5 @@
     PJ_LOG(5,(THIS_FILE, "Done, status=%d", err));
 
-    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
+    return err ? PJMEDIA_AUDIODEV_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
 }
 
@@ -1255,5 +1257,7 @@
     pj_pool_release(stream->pool);
 
-    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
-}
-
+    return err ? PJMEDIA_AUDIODEV_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS;
+}
+
+#endif	/* PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO */
+
