diff options
Diffstat (limited to 'pjmedia/include/pjmedia/master_port.h')
-rw-r--r-- | pjmedia/include/pjmedia/master_port.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/pjmedia/include/pjmedia/master_port.h b/pjmedia/include/pjmedia/master_port.h new file mode 100644 index 00000000..44b7db78 --- /dev/null +++ b/pjmedia/include/pjmedia/master_port.h @@ -0,0 +1,105 @@ +/* $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_MASTER_PORT_H__ +#define __PJMEDIA_MASTER_PORT_H__ + + +/** + * @file master_port.h + * @brief Master port. + */ +#include <pjmedia/port.h> + + +PJ_BEGIN_DECL + + +/** + * Opaque declaration for master port. + * A master port has two media ports connected to it, i.e. downstream and + * upstream ports. The media stream flowing to the downstream port is called + * encoding or send direction, and media stream flowing to the upstream port + * is called decoding or receive direction. + * + * A master port has a "clock" that periodically passes the media frame from + * downstream to upstream ports, and vice versa. In each run, it retrieves + * media frame from one side with #pjmedia_port_get_frame(), and passes the + * media frame to the other side with #pjmedia_port_put_frame(). In each run, + * this process is done for twice, i.e. one for each direction. + */ +typedef struct pjmedia_master_port pjmedia_master_port; + + +/** + * Create a master port. + * + * @param pool Pool to allocate master port from. + * @param u_port Upstream port. + * @param d_port Downstream port. + * @param options Options flags. + * @param p_m Pointer to receive the master port instance. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_master_port_create(pj_pool_t *pool, + pjmedia_port *u_port, + pjmedia_port *d_port, + unsigned options, + pjmedia_master_port **p_m); + + + +/** + * Start the media flow. + * + * @param m The master port. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_master_port_start(pjmedia_master_port *m); + + + +/** + * Stop the media flow. + * + * @param m The master port. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_master_port_stop(pjmedia_master_port *m); + + +/** + * Destroy the master port, and optionally destroy the upstream and + * downstream ports. + * + * @param m The master port. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_master_port_destroy(pjmedia_master_port *m); + + + +PJ_END_DECL + + +#endif /* __PJMEDIA_MASTER_PORT_H__ */ + |