summaryrefslogtreecommitdiff
path: root/pjmedia/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-03-15 20:56:04 +0000
committerBenny Prijono <bennylp@teluu.com>2006-03-15 20:56:04 +0000
commit91329274db688fbb43ce0dc80f9174cc82489a48 (patch)
treea77eb32372530104d0f85de738e34e726cec6dce /pjmedia/include
parentb50cc8a5b479f2bece31381846bc5c63c5e8cdff (diff)
Tidying up sound device, register PortAudio error codes, and initial support for stereo sound device (untested)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@319 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r--pjmedia/include/pjmedia/errno.h11
-rw-r--r--pjmedia/include/pjmedia/sound.h37
2 files changed, 27 insertions, 21 deletions
diff --git a/pjmedia/include/pjmedia/errno.h b/pjmedia/include/pjmedia/errno.h
index 354383b2..7537744a 100644
--- a/pjmedia/include/pjmedia/errno.h
+++ b/pjmedia/include/pjmedia/errno.h
@@ -30,6 +30,17 @@ PJ_BEGIN_DECL
#define PJMEDIA_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE)
+/*
+ * Mapping from PortAudio error codes to pjmedia error space.
+ */
+#define PJMEDIA_PORTAUDIO_ERRNO_START (PJMEDIA_ERRNO_START+PJ_ERRNO_SPACE_SIZE-1000)
+
+/*
+ * Convert PortAudio error code to PJMEDIA error code.
+ */
+#define PJMEDIA_ERRNO_FROM_PORTAUDIO(err) (err+PJMEDIA_PORTAUDIO_ERRNO_START)
+
+
/************************************************************
* GENERIC/GENERAL PJMEDIA ERRORS
***********************************************************/
diff --git a/pjmedia/include/pjmedia/sound.h b/pjmedia/include/pjmedia/sound.h
index 53c0907d..ec7564fa 100644
--- a/pjmedia/include/pjmedia/sound.h
+++ b/pjmedia/include/pjmedia/sound.h
@@ -49,19 +49,6 @@ typedef struct pj_snd_dev_info
unsigned default_samples_per_sec;/**< Default sampling rate. */
} pj_snd_dev_info;
-/**
- * Sound device parameter, to be specified when calling #pj_snd_open_recorder
- * or #pj_snd_open_player.
- */
-typedef struct pj_snd_stream_info
-{
- unsigned samples_per_sec; /**< Sampling rate. */
- unsigned bits_per_sample; /**< No of bits per sample. */
- unsigned samples_per_frame; /**< No of samples per frame. */
- unsigned bytes_per_frame; /**< No of bytes per frame. */
- unsigned frames_per_packet; /**< No of frames per packet. */
-} pj_snd_stream_info;
-
/**
* This callback is called by player stream when it needs additional data
* to be played by the device. Application must fill in the whole of output
@@ -134,10 +121,14 @@ PJ_DECL(const pj_snd_dev_info*) pj_snd_get_dev_info(unsigned index);
*
* @return Audio stream, or NULL if failed.
*/
-PJ_DECL(pj_snd_stream*) pj_snd_open_recorder(int index,
- const pj_snd_stream_info *param,
- pj_snd_rec_cb rec_cb,
- void *user_data);
+PJ_DECL(pj_status_t) pj_snd_open_recorder( int index,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ pj_snd_rec_cb rec_cb,
+ void *user_data,
+ pj_snd_stream **p_snd_strm);
/**
* Create a new audio stream for playing audio samples.
@@ -150,10 +141,14 @@ PJ_DECL(pj_snd_stream*) pj_snd_open_recorder(int index,
*
* @return Audio stream, or NULL if failed.
*/
-PJ_DECL(pj_snd_stream*) pj_snd_open_player(int index,
- const pj_snd_stream_info *param,
- pj_snd_play_cb play_cb,
- void *user_data);
+PJ_DECL(pj_status_t) pj_snd_open_player( int index,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ pj_snd_play_cb play_cb,
+ void *user_data,
+ pj_snd_stream **p_snd_strm );
/**
* Start the stream.