Home --> Documentations --> PJMEDIA Reference

WAV File Play List

Audio playback of multiple WAV files. More...


pj_status_t pjmedia_wav_playlist_create (pj_pool_t *pool, const pj_str_t *port_label, const pj_str_t file_list[], int file_count, unsigned ptime, unsigned options, pj_ssize_t buff_size, pjmedia_port **p_port)
pj_status_t pjmedia_wav_playlist_set_eof_cb (pjmedia_port *port, void *user_data, pj_status_t(*cb)(pjmedia_port *port, void *usr_data))

Detailed Description

The WAV play list port enables application to play back multiple WAV files in a playlist.

Function Documentation

◆ pjmedia_wav_playlist_create()

pj_status_t pjmedia_wav_playlist_create ( pj_pool_t pool,
const pj_str_t port_label,
const pj_str_t  file_list[],
int  file_count,
unsigned  ptime,
unsigned  options,
pj_ssize_t  buff_size,
pjmedia_port **  p_port 

Create a WAV playlist from the array of WAV file names. The WAV files must have the same clock rate, number of channels, and bits per sample, or otherwise this function will return error.

poolPool to create memory buffers for this port.
port_labelOptional label to set as the port name.
file_listArray of WAV file names.
file_countNumber of files in the array.
ptimeThe duration (in miliseconds) of each frame read from this port. If the value is zero, the default duration (20ms) will be used.
optionsOptional options. Application may specify PJMEDIA_FILE_NO_LOOP to prevent play back loop.
buff_sizeBuffer size to be allocated. If the value is zero or negative, the port will use default buffer size (which is about 4KB).
p_portPointer to receive the file port instance.
PJ_SUCCESS on success, or the appropriate error code.

◆ pjmedia_wav_playlist_set_eof_cb()

pj_status_t pjmedia_wav_playlist_set_eof_cb ( pjmedia_port port,
void *  user_data,
pj_status_t(*)(pjmedia_port *port, void *usr_data)  cb 

Register a callback to be called when the file reading has reached the end of file of the last file. If the file is set to play repeatedly, then the callback will be called multiple times. Note that only one callback can be registered for each file port.

portThe WAV play list port.
user_dataUser data to be specified in the callback
cbCallback to be called. If the callback returns non- PJ_SUCCESS, the playback will stop. Note that if application destroys the file port in the callback, it must return non-PJ_SUCCESS here.
PJ_SUCCESS on success.


PJMEDIA small footprint Open Source media stack
Copyright (C) 2006-2008 Teluu Inc.