From 91329274db688fbb43ce0dc80f9174cc82489a48 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 15 Mar 2006 20:56:04 +0000 Subject: 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 --- pjmedia/include/pjmedia/errno.h | 11 +++++++++++ pjmedia/include/pjmedia/sound.h | 37 ++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 21 deletions(-) (limited to 'pjmedia/include') 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. -- cgit v1.2.3