Merge #1051 into the main trunk.



git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3174 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjmedia/include/pjmedia-audiodev/audiodev.h b/pjmedia/include/pjmedia-audiodev/audiodev.h
index 5a523ca..09c6209 100644
--- a/pjmedia/include/pjmedia-audiodev/audiodev.h
+++ b/pjmedia/include/pjmedia-audiodev/audiodev.h
@@ -201,7 +201,10 @@
     PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER = 1,
 
     /** Route to earpiece */
-    PJMEDIA_AUD_DEV_ROUTE_EARPIECE = 2
+    PJMEDIA_AUD_DEV_ROUTE_EARPIECE = 2,
+
+    /** Route to paired Bluetooth device */
+    PJMEDIA_AUD_DEV_ROUTE_BLUETOOTH = 4
 
 } pjmedia_aud_dev_route;
 
diff --git a/pjmedia/include/pjmedia-audiodev/config.h b/pjmedia/include/pjmedia-audiodev/config.h
index 15e5a14..b137afa 100644
--- a/pjmedia/include/pjmedia-audiodev/config.h
+++ b/pjmedia/include/pjmedia-audiodev/config.h
@@ -75,6 +75,14 @@
 
 
 /**
+ * This setting controls whether coreaudio support should be included.
+ */
+#ifndef PJMEDIA_AUDIO_DEV_HAS_COREAUDIO
+#   define PJMEDIA_AUDIO_DEV_HAS_COREAUDIO	1
+#endif
+
+
+/**
  * This setting controls whether WMME support should be included.
  */
 #ifndef PJMEDIA_AUDIO_DEV_HAS_WMME
diff --git a/pjmedia/include/pjmedia-audiodev/errno.h b/pjmedia/include/pjmedia-audiodev/errno.h
index 1283035..4f92f51 100644
--- a/pjmedia/include/pjmedia-audiodev/errno.h
+++ b/pjmedia/include/pjmedia-audiodev/errno.h
@@ -90,6 +90,20 @@
 	    ((int)PJMEDIA_AUDIODEV_WMME_OUT_ERROR_START+err)
 
 
+/**
+ * Mapping from CoreAudio error codes to pjmedia error space.
+ */
+#define PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_START \
+	    (PJMEDIA_AUDIODEV_ERRNO_START+20000)
+#define PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_END   \
+	    (PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_START + 20000 -1)
+/**
+ * Convert CoreAudio error code to PJLIB error code.
+ * CoreAudio error code range: 0 >= err >= -10000
+ */
+#define PJMEDIA_AUDIODEV_ERRNO_FROM_COREAUDIO(err) \
+	    ((int)PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_START-err)
+
 /************************************************************
  * Audio Device API error codes
  ***********************************************************/