Ignore:
Timestamp:
Mar 16, 2006 6:52:55 PM (18 years ago)
Author:
bennylp
Message:

Added sound port (sound_port.h/c), and changed sound and RTCP names from pj_* to pjmedia_*

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/pasound.c

    r320 r321  
    3333} snd_mgr; 
    3434 
    35 struct pj_snd_stream 
     35struct pjmedia_snd_stream 
    3636{ 
    3737    pj_pool_t       *pool; 
     
    4646    pj_uint32_t      overflow; 
    4747    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; 
    5050    pj_bool_t        quit_flag; 
    5151    pj_bool_t        thread_has_exited; 
     
    6363                              void *userData ) 
    6464{ 
    65     pj_snd_stream *stream = userData; 
     65    pjmedia_snd_stream *stream = userData; 
    6666    pj_status_t status; 
    6767 
     
    103103                             void *userData ) 
    104104{ 
    105     pj_snd_stream *stream = userData; 
     105    pjmedia_snd_stream *stream = userData; 
    106106    pj_status_t status; 
    107107    unsigned size = frameCount * stream->bytes_per_sample; 
     
    141141 * Init sound library. 
    142142 */ 
    143 PJ_DEF(pj_status_t) pj_snd_init(pj_pool_factory *factory) 
     143PJ_DEF(pj_status_t) pjmedia_snd_init(pj_pool_factory *factory) 
    144144{ 
    145145    int err; 
     
    152152                         Pa_GetHostApiCount())); 
    153153    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; 
    157157} 
    158158 
     
    161161 * Get device count. 
    162162 */ 
    163 PJ_DEF(int) pj_snd_get_dev_count(void) 
     163PJ_DEF(int) pjmedia_snd_get_dev_count(void) 
    164164{ 
    165165    return Pa_GetDeviceCount(); 
     
    170170 * Get device info. 
    171171 */ 
    172 PJ_DEF(const pj_snd_dev_info*) pj_snd_get_dev_info(unsigned index) 
    173 { 
    174     static pj_snd_dev_info info; 
     172PJ_DEF(const pjmedia_snd_dev_info*) pjmedia_snd_get_dev_info(unsigned index) 
     173{ 
     174    static pjmedia_snd_dev_info info; 
    175175    const PaDeviceInfo *pa_info; 
    176176 
     
    193193 * Open stream. 
    194194 */ 
    195 PJ_DEF(pj_status_t) pj_snd_open_recorder( int index, 
     195PJ_DEF(pj_status_t) pjmedia_snd_open_recorder( int index, 
    196196                                          unsigned clock_rate, 
    197197                                          unsigned channel_count, 
    198198                                          unsigned samples_per_frame, 
    199199                                          unsigned bits_per_sample, 
    200                                           pj_snd_rec_cb rec_cb, 
     200                                          pjmedia_snd_rec_cb rec_cb, 
    201201                                          void *user_data, 
    202                                           pj_snd_stream **p_snd_strm) 
     202                                          pjmedia_snd_stream **p_snd_strm) 
    203203{ 
    204204    pj_pool_t *pool; 
    205     pj_snd_stream *stream; 
     205    pjmedia_snd_stream *stream; 
    206206    PaStreamParameters inputParam; 
    207207    int sampleFormat; 
     
    278278 
    279279 
    280 PJ_DEF(pj_status_t) pj_snd_open_player( int index, 
     280PJ_DEF(pj_status_t) pjmedia_snd_open_player( int index, 
    281281                                        unsigned clock_rate, 
    282282                                        unsigned channel_count, 
    283283                                        unsigned samples_per_frame, 
    284284                                        unsigned bits_per_sample, 
    285                                         pj_snd_play_cb play_cb, 
     285                                        pjmedia_snd_play_cb play_cb, 
    286286                                        void *user_data, 
    287                                         pj_snd_stream **p_snd_strm) 
     287                                        pjmedia_snd_stream **p_snd_strm) 
    288288{ 
    289289    pj_pool_t *pool; 
    290     pj_snd_stream *stream; 
     290    pjmedia_snd_stream *stream; 
    291291    PaStreamParameters outputParam; 
    292292    int sampleFormat; 
     
    367367 * Start stream. 
    368368 */ 
    369 PJ_DEF(pj_status_t) pj_snd_stream_start(pj_snd_stream *stream) 
    370 { 
    371     pj_status_t status; 
     369PJ_DEF(pj_status_t) pjmedia_snd_stream_start(pjmedia_snd_stream *stream) 
     370{ 
     371    pj_status_t err; 
    372372 
    373373    PJ_LOG(5,(THIS_FILE, "Starting %s stream..", stream->name.ptr)); 
    374374 
    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; 
    380380} 
    381381 
     
    383383 * Stop stream. 
    384384 */ 
    385 PJ_DEF(pj_status_t) pj_snd_stream_stop(pj_snd_stream *stream) 
     385PJ_DEF(pj_status_t) pjmedia_snd_stream_stop(pjmedia_snd_stream *stream) 
    386386{ 
    387387    int i, err; 
     
    399399    PJ_LOG(5,(THIS_FILE, "Done, status=%d", err)); 
    400400 
    401     return err; 
     401    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS; 
    402402} 
    403403 
     
    405405 * Destroy stream. 
    406406 */ 
    407 PJ_DEF(pj_status_t) pj_snd_stream_close(pj_snd_stream *stream) 
     407PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream) 
    408408{ 
    409409    int i, err; 
     
    424424    err = Pa_CloseStream(stream->stream); 
    425425    pj_pool_release(stream->pool); 
    426     return err; 
     426 
     427    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS; 
    427428} 
    428429 
     
    430431 * Deinitialize sound library. 
    431432 */ 
    432 PJ_DEF(pj_status_t) pj_snd_deinit(void) 
    433 { 
     433PJ_DEF(pj_status_t) pjmedia_snd_deinit(void) 
     434{ 
     435    int err; 
     436 
    434437    PJ_LOG(4,(THIS_FILE, "PortAudio sound library shutting down..")); 
    435438 
    436     return Pa_Terminate(); 
     439    err = Pa_Terminate(); 
     440 
     441    return err ? PJMEDIA_ERRNO_FROM_PORTAUDIO(err) : PJ_SUCCESS; 
    437442} 
    438443 
Note: See TracChangeset for help on using the changeset viewer.