Ignore:
Timestamp:
Jun 20, 2006 3:39:07 PM (18 years ago)
Author:
bennylp
Message:

Yet again large diffs because of documentation/doxygen update

File:
1 edited

Legend:

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

    r411 r531  
    2929 
    3030#define THIS_FILE           "wav_writer.c" 
    31 #define SIGNATURE           ('F'<<24|'W'<<16|'R'<<8|'T') 
     31#define SIGNATURE           PJMEDIA_PORT_SIGNATURE('F', 'W', 'R', 'T') 
    3232#define BYTES_PER_SAMPLE    2 
    3333 
     
    3939    char            *buf; 
    4040    char            *writepos; 
     41    pj_size_t        total; 
    4142 
    4243    pj_oshandle_t    fd; 
     44 
     45    pj_size_t        cb_size; 
     46    pj_status_t    (*cb)(pjmedia_port*, void*); 
    4347}; 
    4448 
     
    178182 
    179183 
     184 
     185/* 
     186 * Get current writing position.  
     187 */ 
     188PJ_DEF(pj_ssize_t) pjmedia_wav_writer_port_get_pos( pjmedia_port *port ) 
     189{ 
     190    struct file_port *fport; 
     191 
     192    /* Sanity check */ 
     193    PJ_ASSERT_RETURN(port, -PJ_EINVAL); 
     194 
     195    /* Check that this is really a writer port */ 
     196    PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, -PJ_EINVALIDOP); 
     197 
     198    fport = (struct file_port*) port; 
     199 
     200    return fport->total; 
     201} 
     202 
     203 
     204/* 
     205 * Register callback. 
     206 */ 
     207PJ_DEF(pj_status_t)  
     208pjmedia_wav_writer_port_set_cb( pjmedia_port *port, 
     209                                pj_size_t pos, 
     210                                void *user_data, 
     211                                pj_status_t (*cb)(pjmedia_port *port, 
     212                                                  void *usr_data)) 
     213{ 
     214    struct file_port *fport; 
     215 
     216    /* Sanity check */ 
     217    PJ_ASSERT_RETURN(port && cb, PJ_EINVAL); 
     218 
     219    /* Check that this is really a writer port */ 
     220    PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, PJ_EINVALIDOP); 
     221 
     222    fport = (struct file_port*) port; 
     223 
     224    fport->cb_size = pos; 
     225    fport->base.user_data = user_data; 
     226    fport->cb = cb; 
     227 
     228    return PJ_SUCCESS; 
     229} 
     230 
     231 
    180232#if defined(PJ_IS_BIG_ENDIAN) && PJ_IS_BIG_ENDIAN!=0 
    181233    static void swap_samples(pj_int16_t *samples, unsigned count) 
     
    235287    fport->writepos += frame->size; 
    236288 
     289    /* Increment total written, and check if we need to call callback */ 
     290    fport->total += frame->size; 
     291    if (fport->cb && fport->total >= fport->cb_size) { 
     292        pj_status_t (*cb)(pjmedia_port*, void*); 
     293        pj_status_t status; 
     294 
     295        cb = fport->cb; 
     296        fport->cb = NULL; 
     297 
     298        status = (*cb)(this_port, this_port->user_data); 
     299        return status; 
     300    } 
     301 
    237302    return PJ_SUCCESS; 
    238303} 
Note: See TracChangeset for help on using the changeset viewer.