Tristan Matthews | 0a329cc | 2013-07-17 13:20:14 -0400 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
| 3 | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) |
| 4 | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | #ifndef __PJMEDIA_WAV_PLAYLIST_H__ |
| 21 | #define __PJMEDIA_WAV_PLAYLIST_H__ |
| 22 | |
| 23 | /** |
| 24 | * @file wav_playlist.h |
| 25 | * @brief WAV file playlist. |
| 26 | */ |
| 27 | #include <pjmedia/wav_port.h> |
| 28 | |
| 29 | |
| 30 | |
| 31 | PJ_BEGIN_DECL |
| 32 | |
| 33 | |
| 34 | /** |
| 35 | * @defgroup PJMEDIA_WAV_PLAYLIST WAV File Play List |
| 36 | * @ingroup PJMEDIA_PORT |
| 37 | * @brief Audio playback of multiple WAV files |
| 38 | * @{ |
| 39 | * |
| 40 | * The WAV play list port enables application to play back multiple |
| 41 | * WAV files in a playlist. |
| 42 | */ |
| 43 | |
| 44 | /** |
| 45 | * Create a WAV playlist from the array of WAV file names. The WAV |
| 46 | * files must have the same clock rate, number of channels, and bits |
| 47 | * per sample, or otherwise this function will return error. |
| 48 | * |
| 49 | * @param pool Pool to create memory buffers for this port. |
| 50 | * @param port_label Optional label to set as the port name. |
| 51 | * @param file_list Array of WAV file names. |
| 52 | * @param file_count Number of files in the array. |
| 53 | * @param ptime The duration (in miliseconds) of each frame read |
| 54 | * from this port. If the value is zero, the default |
| 55 | * duration (20ms) will be used. |
| 56 | * @param options Optional options. Application may specify |
| 57 | * PJMEDIA_FILE_NO_LOOP to prevent play back loop. |
| 58 | * @param buff_size Buffer size to be allocated. If the value is zero or |
| 59 | * negative, the port will use default buffer size (which |
| 60 | * is about 4KB). |
| 61 | * @param p_port Pointer to receive the file port instance. |
| 62 | * |
| 63 | * @return PJ_SUCCESS on success, or the appropriate error code. |
| 64 | */ |
| 65 | PJ_DECL(pj_status_t) pjmedia_wav_playlist_create(pj_pool_t *pool, |
| 66 | const pj_str_t *port_label, |
| 67 | const pj_str_t file_list[], |
| 68 | int file_count, |
| 69 | unsigned ptime, |
| 70 | unsigned options, |
| 71 | pj_ssize_t buff_size, |
| 72 | pjmedia_port **p_port); |
| 73 | |
| 74 | |
| 75 | /** |
| 76 | * Register a callback to be called when the file reading has reached the |
| 77 | * end of file of the last file. If the file is set to play repeatedly, |
| 78 | * then the callback will be called multiple times. Note that only one |
| 79 | * callback can be registered for each file port. |
| 80 | * |
| 81 | * @param port The WAV play list port. |
| 82 | * @param user_data User data to be specified in the callback |
| 83 | * @param cb Callback to be called. If the callback returns non- |
| 84 | * PJ_SUCCESS, the playback will stop. Note that if |
| 85 | * application destroys the file port in the callback, |
| 86 | * it must return non-PJ_SUCCESS here. |
| 87 | * |
| 88 | * @return PJ_SUCCESS on success. |
| 89 | */ |
| 90 | PJ_DECL(pj_status_t) |
| 91 | pjmedia_wav_playlist_set_eof_cb(pjmedia_port *port, |
| 92 | void *user_data, |
| 93 | pj_status_t (*cb)(pjmedia_port *port, |
| 94 | void *usr_data)); |
| 95 | |
| 96 | |
| 97 | /** |
| 98 | * @} |
| 99 | */ |
| 100 | |
| 101 | |
| 102 | PJ_END_DECL |
| 103 | |
| 104 | |
| 105 | #endif /* __PJMEDIA_WAV_PLAYLIST_H__ */ |