Ignore:
Timestamp:
Feb 11, 2015 5:15:29 AM (7 years ago)
Author:
nanang
Message:

Close #1814: Add audio frame preview callbacks.

File:
1 edited

Legend:

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

    r4537 r4982  
    6262    unsigned             ec_suspend_count; 
    6363    unsigned             ec_suspend_limit; 
     64 
     65    /* audio frame preview callbacks */ 
     66    void                *user_data; 
     67    pjmedia_aud_play_cb  on_play_frame; 
     68    pjmedia_aud_rec_cb   on_rec_frame; 
    6469}; 
    6570 
     
    101106    } 
    102107 
     108    /* Invoke preview callback */ 
     109    if (snd_port->on_play_frame) 
     110        (*snd_port->on_play_frame)(snd_port->user_data, frame); 
    103111 
    104112    return PJ_SUCCESS; 
     
    121129    } 
    122130 
     131    /* Invoke preview callback */ 
     132    if (snd_port->on_play_frame) 
     133        (*snd_port->on_play_frame)(snd_port->user_data, frame); 
     134 
    123135    return PJ_SUCCESS; 
    124136} 
     
    135147 
    136148    pjmedia_clock_src_update(&snd_port->cap_clocksrc, &frame->timestamp); 
     149 
     150    /* Invoke preview callback */ 
     151    if (snd_port->on_rec_frame) 
     152        (*snd_port->on_rec_frame)(snd_port->user_data, frame); 
    137153 
    138154    port = snd_port->port; 
     
    167183    pjmedia_port_get_frame(port, frame); 
    168184 
     185    /* Invoke preview callback */ 
     186    if (snd_port->on_play_frame) 
     187        (*snd_port->on_play_frame)(snd_port->user_data, frame); 
     188 
    169189    return PJ_SUCCESS; 
    170190} 
     
    179199    pjmedia_snd_port *snd_port = (pjmedia_snd_port*) user_data; 
    180200    pjmedia_port *port; 
     201 
     202    /* Invoke preview callback */ 
     203    if (snd_port->on_rec_frame) 
     204        (*snd_port->on_rec_frame)(snd_port->user_data, frame); 
    181205 
    182206    port = snd_port->port; 
     
    465489    snd_port->options = prm->options; 
    466490    snd_port->prm_ec_options = prm->ec_options; 
     491    snd_port->user_data = prm->user_data; 
     492    snd_port->on_play_frame = prm->on_play_frame; 
     493    snd_port->on_rec_frame = prm->on_rec_frame; 
    467494 
    468495    ptime_usec = prm->base.samples_per_frame * 1000 / prm->base.channel_count / 
Note: See TracChangeset for help on using the changeset viewer.