Changeset 321 for pjproject/trunk/pjmedia/src/pjmedia/pasound.c
- Timestamp:
- Mar 16, 2006 6:52:55 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/pasound.c
r320 r321 33 33 } snd_mgr; 34 34 35 struct pj _snd_stream35 struct pjmedia_snd_stream 36 36 { 37 37 pj_pool_t *pool; … … 46 46 pj_uint32_t overflow; 47 47 void *user_data; 48 pj _snd_rec_cb rec_cb;49 pj _snd_play_cb play_cb;48 pjmedia_snd_rec_cb rec_cb; 49 pjmedia_snd_play_cb play_cb; 50 50 pj_bool_t quit_flag; 51 51 pj_bool_t thread_has_exited; … … 63 63 void *userData ) 64 64 { 65 pj _snd_stream *stream = userData;65 pjmedia_snd_stream *stream = userData; 66 66 pj_status_t status; 67 67 … … 103 103 void *userData ) 104 104 { 105 pj _snd_stream *stream = userData;105 pjmedia_snd_stream *stream = userData; 106 106 pj_status_t status; 107 107 unsigned size = frameCount * stream->bytes_per_sample; … … 141 141 * Init sound library. 142 142 */ 143 PJ_DEF(pj_status_t) pj _snd_init(pj_pool_factory *factory)143 PJ_DEF(pj_status_t) pjmedia_snd_init(pj_pool_factory *factory) 144 144 { 145 145 int err; … … 152 152 Pa_GetHostApiCount())); 153 153 PJ_LOG(4,(THIS_FILE, "Sound device count=%d", 154 pj _snd_get_dev_count()));155 156 return err ;154 pjmedia_snd_get_dev_count())); 155 156 return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS; 157 157 } 158 158 … … 161 161 * Get device count. 162 162 */ 163 PJ_DEF(int) pj _snd_get_dev_count(void)163 PJ_DEF(int) pjmedia_snd_get_dev_count(void) 164 164 { 165 165 return Pa_GetDeviceCount(); … … 170 170 * Get device info. 171 171 */ 172 PJ_DEF(const pj _snd_dev_info*) pj_snd_get_dev_info(unsigned index)173 { 174 static pj _snd_dev_info info;172 PJ_DEF(const pjmedia_snd_dev_info*) pjmedia_snd_get_dev_info(unsigned index) 173 { 174 static pjmedia_snd_dev_info info; 175 175 const PaDeviceInfo *pa_info; 176 176 … … 193 193 * Open stream. 194 194 */ 195 PJ_DEF(pj_status_t) pj _snd_open_recorder( int index,195 PJ_DEF(pj_status_t) pjmedia_snd_open_recorder( int index, 196 196 unsigned clock_rate, 197 197 unsigned channel_count, 198 198 unsigned samples_per_frame, 199 199 unsigned bits_per_sample, 200 pj _snd_rec_cb rec_cb,200 pjmedia_snd_rec_cb rec_cb, 201 201 void *user_data, 202 pj _snd_stream **p_snd_strm)202 pjmedia_snd_stream **p_snd_strm) 203 203 { 204 204 pj_pool_t *pool; 205 pj _snd_stream *stream;205 pjmedia_snd_stream *stream; 206 206 PaStreamParameters inputParam; 207 207 int sampleFormat; … … 278 278 279 279 280 PJ_DEF(pj_status_t) pj _snd_open_player( int index,280 PJ_DEF(pj_status_t) pjmedia_snd_open_player( int index, 281 281 unsigned clock_rate, 282 282 unsigned channel_count, 283 283 unsigned samples_per_frame, 284 284 unsigned bits_per_sample, 285 pj _snd_play_cb play_cb,285 pjmedia_snd_play_cb play_cb, 286 286 void *user_data, 287 pj _snd_stream **p_snd_strm)287 pjmedia_snd_stream **p_snd_strm) 288 288 { 289 289 pj_pool_t *pool; 290 pj _snd_stream *stream;290 pjmedia_snd_stream *stream; 291 291 PaStreamParameters outputParam; 292 292 int sampleFormat; … … 367 367 * Start stream. 368 368 */ 369 PJ_DEF(pj_status_t) pj _snd_stream_start(pj_snd_stream *stream)370 { 371 pj_status_t status;369 PJ_DEF(pj_status_t) pjmedia_snd_stream_start(pjmedia_snd_stream *stream) 370 { 371 pj_status_t err; 372 372 373 373 PJ_LOG(5,(THIS_FILE, "Starting %s stream..", stream->name.ptr)); 374 374 375 status= Pa_StartStream(stream->stream);376 377 PJ_LOG(5,(THIS_FILE, "Done, status=%d", status));378 379 return status;375 err = Pa_StartStream(stream->stream); 376 377 PJ_LOG(5,(THIS_FILE, "Done, status=%d", err)); 378 379 return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS; 380 380 } 381 381 … … 383 383 * Stop stream. 384 384 */ 385 PJ_DEF(pj_status_t) pj _snd_stream_stop(pj_snd_stream *stream)385 PJ_DEF(pj_status_t) pjmedia_snd_stream_stop(pjmedia_snd_stream *stream) 386 386 { 387 387 int i, err; … … 399 399 PJ_LOG(5,(THIS_FILE, "Done, status=%d", err)); 400 400 401 return err ;401 return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS; 402 402 } 403 403 … … 405 405 * Destroy stream. 406 406 */ 407 PJ_DEF(pj_status_t) pj _snd_stream_close(pj_snd_stream *stream)407 PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream) 408 408 { 409 409 int i, err; … … 424 424 err = Pa_CloseStream(stream->stream); 425 425 pj_pool_release(stream->pool); 426 return err; 426 427 return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS; 427 428 } 428 429 … … 430 431 * Deinitialize sound library. 431 432 */ 432 PJ_DEF(pj_status_t) pj_snd_deinit(void) 433 { 433 PJ_DEF(pj_status_t) pjmedia_snd_deinit(void) 434 { 435 int err; 436 434 437 PJ_LOG(4,(THIS_FILE, "PortAudio sound library shutting down..")); 435 438 436 return Pa_Terminate(); 439 err = Pa_Terminate(); 440 441 return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS; 437 442 } 438 443
Note: See TracChangeset
for help on using the changeset viewer.