diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-02-23 02:09:10 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-02-23 02:09:10 +0000 |
commit | 6d68baecdefbc8b90749dc7cff8def2a5a88af30 (patch) | |
tree | 6a83cbd3ae5c1246a443293b09606e658e211342 /pjmedia/include | |
parent | 084ee2728e8ee98944c9b8525704d5937aafa3b3 (diff) |
Added support for playing WAV file
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@222 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r-- | pjmedia/include/pjmedia.h | 2 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/conference.h | 23 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/errno.h | 19 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/file_port.h | 47 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/vad.h | 2 | ||||
-rw-r--r-- | pjmedia/include/pjmedia/wave.h | 80 |
6 files changed, 172 insertions, 1 deletions
diff --git a/pjmedia/include/pjmedia.h b/pjmedia/include/pjmedia.h index 66ba4e0c..b59ca2ab 100644 --- a/pjmedia/include/pjmedia.h +++ b/pjmedia/include/pjmedia.h @@ -29,6 +29,7 @@ #include <pjmedia/conference.h> #include <pjmedia/endpoint.h> #include <pjmedia/errno.h> +#include <pjmedia/file_port.h> #include <pjmedia/jbuf.h> #include <pjmedia/port.h> #include <pjmedia/rtcp.h> @@ -37,6 +38,7 @@ #include <pjmedia/sdp_neg.h> #include <pjmedia/session.h> #include <pjmedia/sound.h> +#include <pjmedia/wave.h> #endif /* __PJMEDIA_H__ */ diff --git a/pjmedia/include/pjmedia/conference.h b/pjmedia/include/pjmedia/conference.h index ffa44371..775e2ff7 100644 --- a/pjmedia/include/pjmedia/conference.h +++ b/pjmedia/include/pjmedia/conference.h @@ -40,6 +40,7 @@ typedef struct pjmedia_conf pjmedia_conf; */ typedef struct pjmedia_conf_port_info { + unsigned slot; pj_str_t name; pjmedia_port_op tx_setting; pjmedia_port_op rx_setting; @@ -150,12 +151,34 @@ PJ_DECL(pj_status_t) pjmedia_conf_remove_port( pjmedia_conf *conf, /** * Get port info. + * + * @param conf The conference bridge. + * @param slot Port index. + * @param info Pointer to receive the info. + * + * @return PJ_SUCCESS on success. */ PJ_DECL(pj_status_t) pjmedia_conf_get_port_info( pjmedia_conf *conf, unsigned slot, pjmedia_conf_port_info *info); +/** + * Get occupied ports info. + * + * @param conf The conference bridge. + * @param size On input, contains maximum number of infos + * to be retrieved. On output, contains the actual + * number of infos that have been copied. + * @param info Array of info. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_conf_get_ports_info(pjmedia_conf *conf, + unsigned *size, + pjmedia_conf_port_info info[]); + + PJ_END_DECL diff --git a/pjmedia/include/pjmedia/errno.h b/pjmedia/include/pjmedia/errno.h index accf3fd1..354383b2 100644 --- a/pjmedia/include/pjmedia/errno.h +++ b/pjmedia/include/pjmedia/errno.h @@ -406,6 +406,25 @@ PJ_BEGIN_DECL #define PJMEDIA_ENCBYTES (PJMEDIA_ERRNO_START+165) /* 220165 */ +/************************************************************ + * FILE ERRORS + ***********************************************************/ +/** + * @hideinitializer + * Not a valid WAVE file. + */ +#define PJMEDIA_ENOTVALIDWAVE (PJMEDIA_ERRNO_START+180) /* 220180 */ +/** + * @hideinitializer + * Unsupported WAVE file. + */ +#define PJMEDIA_EWAVEUNSUPP (PJMEDIA_ERRNO_START+181) /* 220181 */ +/** + * @hideinitializer + * Wave file too short. + */ +#define PJMEDIA_EWAVETOOSHORT (PJMEDIA_ERRNO_START+182) /* 220182 */ + PJ_END_DECL diff --git a/pjmedia/include/pjmedia/file_port.h b/pjmedia/include/pjmedia/file_port.h new file mode 100644 index 00000000..75482c70 --- /dev/null +++ b/pjmedia/include/pjmedia/file_port.h @@ -0,0 +1,47 @@ +/* $Id$ */ +/* + * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PJMEDIA_FILE_PORT_H__ +#define __PJMEDIA_FILE_PORT_H__ + +/** + * @file file_port.h + * @brief File player and recorder. + */ +#include <pjmedia/port.h> + + +PJ_BEGIN_DECL + + +/** + * Create file player port. + */ +PJ_DECL(pj_status_t) pjmedia_file_player_port_create( pj_pool_t *pool, + const char *filename, + unsigned flags, + pj_ssize_t buff_size, + void *user_data, + pjmedia_port **p_port ); + + + +PJ_END_DECL + + +#endif /* __PJMEDIA_FILE_PORT_H__ */ diff --git a/pjmedia/include/pjmedia/vad.h b/pjmedia/include/pjmedia/vad.h index a7da42d2..fc7f3b2f 100644 --- a/pjmedia/include/pjmedia/vad.h +++ b/pjmedia/include/pjmedia/vad.h @@ -22,7 +22,7 @@ /** * @file vad.h - * @brief Voice Activity Detector. + * @brief Simple, adaptive silence detector. */ #include <pjmedia/types.h> diff --git a/pjmedia/include/pjmedia/wave.h b/pjmedia/include/pjmedia/wave.h new file mode 100644 index 00000000..b42206fa --- /dev/null +++ b/pjmedia/include/pjmedia/wave.h @@ -0,0 +1,80 @@ +/* $Id$ */ +/* + * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef __PJMEDIA_WAVE_H__ +#define __PJMEDIA_WAVE_H__ + + +/** + * @file wave.h + * @brief WAVE file manipulation. + */ +#include <pjmedia/types.h> + + +PJ_BEGIN_DECL + +#if PJ_IS_BIG_ENDIAN +# define PJMEDIA_RIFF_TAG ('R'<<24|'I'<<16|'F'<<8|'F') +# define PJMEDIA_WAVE_TAG ('W'<<24|'A'<<16|'V'<<8|'E') +# define PJMEDIA_FMT_TAG ('f'<<24|'m'<<16|'t'<<8|' ') +#else +# define PJMEDIA_RIFF_TAG ('F'<<24|'F'<<16|'I'<<8|'R') +# define PJMEDIA_WAVE_TAG ('E'<<24|'V'<<16|'A'<<8|'W') +# define PJMEDIA_FMT_TAG (' '<<24|'t'<<16|'m'<<8|'f') +#endif + + +/** + * This file describes the simpler/canonical version of a WAVE file. + * It does not support the full RIFF format specification. + */ +struct pjmedia_wave_hdr +{ + struct { + pj_uint32_t riff; + pj_uint32_t file_len; + pj_uint32_t wave; + } riff_hdr; + + struct { + pj_uint32_t fmt; + pj_uint32_t len; + pj_uint16_t fmt_tag; + pj_uint16_t nchan; + pj_uint32_t sample_rate; + pj_uint32_t bytes_per_sec; + pj_uint16_t block_align; + pj_uint16_t bits_per_sample; + } fmt_hdr; + + struct { + pj_uint32_t data; + pj_uint32_t len; + } data_hdr; +}; + +/** + * @see pjmedia_wave_hdr + */ +typedef struct pjmedia_wave_hdr pjmedia_wave_hdr; + + +PJ_END_DECL + +#endif /* __PJMEDIA_WAVE_H__ */ |