Ignore:
Timestamp:
Mar 14, 2014 4:09:50 AM (10 years ago)
Author:
bennylp
Message:

Closed #1748: enhancements to WAV player API

File:
1 edited

Legend:

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

    r4537 r4793  
    426426 
    427427/* 
     428 * Get additional info about the file player. 
     429 */ 
     430PJ_DEF(pj_status_t) pjmedia_wav_player_get_info( 
     431                                        pjmedia_port *port, 
     432                                        pjmedia_wav_player_info *info) 
     433{ 
     434    struct file_reader_port *fport; 
     435    PJ_ASSERT_RETURN(port && info, PJ_EINVAL); 
     436 
     437    pj_bzero(info, sizeof(*info)); 
     438 
     439    /* Check that this is really a player port */ 
     440    PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, PJ_EINVALIDOP); 
     441 
     442    fport = (struct file_reader_port*) port; 
     443 
     444    if (fport->fmt_tag == PJMEDIA_WAVE_FMT_TAG_PCM) { 
     445        info->fmt_id = PJMEDIA_FORMAT_PCM; 
     446        info->payload_bits_per_sample = 16; 
     447    } else if (fport->fmt_tag == PJMEDIA_WAVE_FMT_TAG_ULAW) { 
     448        info->fmt_id = PJMEDIA_FORMAT_ULAW; 
     449        info->payload_bits_per_sample = 8; 
     450    } else if (fport->fmt_tag == PJMEDIA_WAVE_FMT_TAG_ALAW) { 
     451        info->fmt_id = PJMEDIA_FORMAT_ALAW; 
     452        info->payload_bits_per_sample = 8; 
     453    } else { 
     454        pj_assert(!"Unsupported format"); 
     455        return PJ_ENOTSUP; 
     456    } 
     457 
     458    info->size_bytes = pjmedia_wav_player_get_len(port); 
     459    info->size_samples = info->size_bytes / 
     460                         (info->payload_bits_per_sample / 8); 
     461 
     462    return PJ_SUCCESS; 
     463} 
     464 
     465/* 
    428466 * Get the data length, in bytes. 
    429467 */ 
     
    485523 
    486524/* 
    487  * Get the file play position of WAV player. 
     525 * Get the file play position of WAV player (in bytes). 
    488526 */ 
    489527PJ_DEF(pj_ssize_t) pjmedia_wav_player_port_get_pos( pjmedia_port *port ) 
Note: See TracChangeset for help on using the changeset viewer.