Changeset 1680


Ignore:
Timestamp:
Jan 12, 2008 11:11:58 AM (12 years ago)
Author:
bennylp
Message:

Added new WAV player API: pjmedia_wav_player_get_len()

Location:
pjproject/trunk/pjmedia
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/wav_port.h

    r974 r1680  
    7373                                                     pj_ssize_t buff_size, 
    7474                                                     pjmedia_port **p_port ); 
     75 
     76 
     77/** 
     78 * Get the data length, in bytes. 
     79 * 
     80 * @param port          The file player port. 
     81 * 
     82 * @return              The length of the data, in bytes. Upon error it will 
     83 *                      return negative value. 
     84 */ 
     85PJ_DECL(pj_ssize_t) pjmedia_wav_player_get_len(pjmedia_port *port); 
    7586 
    7687 
  • pjproject/trunk/pjmedia/src/pjmedia/wav_player.c

    r1417 r1680  
    401401 
    402402/* 
     403 * Get the data length, in bytes. 
     404 */ 
     405PJ_DEF(pj_ssize_t) pjmedia_wav_player_get_len(pjmedia_port *port) 
     406{ 
     407    struct file_port *fport; 
     408    pj_ssize_t size; 
     409 
     410    /* Sanity check */ 
     411    PJ_ASSERT_RETURN(port, -PJ_EINVAL); 
     412 
     413    /* Check that this is really a player port */ 
     414    PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, -PJ_EINVALIDOP); 
     415 
     416    fport = (struct file_port*) port; 
     417 
     418    size = (pj_ssize_t) fport->fsize; 
     419    return size - fport->start_data; 
     420} 
     421 
     422 
     423/* 
    403424 * Set position. 
    404425 */ 
     
    409430 
    410431    /* Sanity check */ 
    411     PJ_ASSERT_RETURN(port, -PJ_EINVAL); 
     432    PJ_ASSERT_RETURN(port, PJ_EINVAL); 
    412433 
    413434    /* Check that this is really a player port */ 
    414     PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, -PJ_EINVALIDOP); 
     435    PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, PJ_EINVALIDOP); 
    415436 
    416437 
Note: See TracChangeset for help on using the changeset viewer.