Group PJMEDIA_WAV_PLAYLIST
- group PJMEDIA_WAV_PLAYLIST
Audio playback of multiple WAV files.
The WAV play list port enables application to play back multiple WAV files in a playlist.
Functions
-
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.
- Parameters:
pool – Pool to create memory buffers for this port.
port_label – Optional label to set as the port name.
file_list – Array of WAV file names. Each filename’s length must be smaller than PJ_MAXPATH.
file_count – Number of files in the array.
ptime – The duration (in miliseconds) of each frame read from this port. If the value is zero, the default duration (20ms) will be used.
options – Optional options. Application may specify PJMEDIA_FILE_NO_LOOP to prevent play back loop.
buff_size – Buffer size to be allocated. If the value is zero or negative, the port will use default buffer size (which is about 4KB).
p_port – Pointer to receive the file port instance.
- Returns:
PJ_SUCCESS on success, or the appropriate error code.
-
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))
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.
- Parameters:
port – The WAV play list port.
user_data – User data to be specified in the callback
cb – Callback 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.
- Returns:
PJ_SUCCESS on success.
-
pj_status_t pjmedia_wav_playlist_set_eof_cb2(pjmedia_port *port, void *user_data, void (*cb)(pjmedia_port *port, void *usr_data))
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.
- Parameters:
port – The WAV play list port.
user_data – User data to be specified in the callback
cb – Callback to be called. Note that if application wishes to stop the playback, it can disconnect the port in the callback, and only after all connections have been removed could the application safely destroy the port.
- Returns:
PJ_SUCCESS on success.
-
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)