summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-06-05 13:46:38 +0000
committerBenny Prijono <bennylp@teluu.com>2006-06-05 13:46:38 +0000
commitf5e5d9d039d9664e6f90fb6297e372d58371f7fa (patch)
tree1257275e9fa2e475ac6adf53ad5ae19e79ab98df /pjmedia
parent45edf54f6aaf54adb7b42f786b60cd3f23d9be2f (diff)
Uploaded splitter/combiner API draft
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@488 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/include/pjmedia/splitcomb.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/pjmedia/include/pjmedia/splitcomb.h b/pjmedia/include/pjmedia/splitcomb.h
new file mode 100644
index 00000000..1bd1bd23
--- /dev/null
+++ b/pjmedia/include/pjmedia/splitcomb.h
@@ -0,0 +1,113 @@
+/* $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_SPLITCOMB_H__
+#define __PJMEDIA_SPLITCOMB_H__
+
+
+/**
+ * Create a media splitter/combiner with the specified parameters.
+ * A splitter/combiner splits a single stereo/multichannel audio frame into
+ * multiple mono audio frames to each channel when put_frame() is called,
+ * and combines mono frames from each channel into a stereo/multichannel
+ * frame when get_frame() is called.
+ *
+ * When the splitter/combiner is created, it creates an instance of
+ * pjmedia_port. This media port represents the stereo/multichannel side
+ * of the splitter/combiner. Application needs to supply the splitter/
+ * combiner with a media port for each audio channels.
+ *
+ * @param pool Pool to allocate memory to create the splitter/
+ * combiner.
+ * @param clock_rate Audio clock rate/sampling rate.
+ * @param channel_count Number of channels.
+ * @param samples_per_frame Number of samples per frame.
+ * @param bits_per_sample Bits per sample.
+ * @param options Optional flags.
+ * @param p_splitcomb Pointer to receive the splitter/combiner.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate
+ * error code.
+ */
+PJ_DECL(pj_status_t) pjmedia_splitcomb_create(pj_pool_t *pool,
+ unsigned clock_rate,
+ unsigned channel_count,
+ unsigned samples_per_frame,
+ unsigned bits_per_sample,
+ unsigned options,
+ pjmedia_port **p_splitcomb);
+
+/**
+ * Supply the splitter/combiner with media port for the specified channel
+ * number. The media port will be called at the
+ * same phase as the splitter/combiner; which means that when application
+ * calls get_frame() of the splitter/combiner, it will call get_frame()
+ * for all ports that have the same phase. And similarly for put_frame().
+ *
+ * @param splitcomb The splitter/combiner.
+ * @param ch_num Audio channel number.
+ * @param options Valid options are:
+ * - PJMEDIA_SPLITCOMB_AUTO_DESTROY to destroy the
+ * media port when the splitter is destroyed.
+ * @param port The media port.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error
+ * code.
+ */
+PJ_DECL(pj_status_t) pjmedia_splitcomb_set_channel(pjmedia_port *splitcomb,
+ unsigned ch_num,
+ unsigned options,
+ pjmedia_port *port);
+
+/**
+ * Create a reverse phase media port for the specified channel number.
+ * For channels with reversed phase, when application calls put_frame() to
+ * the splitter/combiner, the splitter/combiner will only put the frame to
+ * a buffer. Later on, when application calls get_frame() on the channel's
+ * media port, it will return the frame that are available in the buffer.
+ * The same process happens when application calls put_frame() to the
+ * channel's media port, it will only put the frame to another buffer, which
+ * will be returned when application calls get_frame() to the splitter's
+ * media port. So this effectively reverse the phase of the media port.
+ *
+ * @param pool The pool to allocate memory for the port and
+ * buffers.
+ * @param splitcomb The splitter/combiner.
+ * @param ch_num Audio channel number.
+ * @param options Valid options are:
+ * - PJMEDIA_SPLITCOMB_AUTO_DESTROY to destroy the
+ * media port when the splitter is destroyed.
+ * @param p_chport The media port created with reverse phase for
+ * the specified audio channel.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error
+ * code.
+ */
+PJ_DECL(pj_status_t)
+pjmedia_splitcomb_create_rev_channel( pj_pool_t *pool,
+ pjmedia_port *splitcomb,
+ unsigned ch_num,
+ unsigned options,
+ pjmedia_port **p_chport);
+
+
+
+
+#endif /* __PJMEDIA_SPLITCOMB_H__ */
+
+