~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.1.0/pjmedia/include/pjmedia/splitcomb.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: splitcomb.h 3553 2011-05-05 06:14:19Z nanang $ */
 
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_SPLITCOMB_H__
 
21
#define __PJMEDIA_SPLITCOMB_H__
 
22
 
 
23
 
 
24
/**
 
25
 * @file splitcomb.h
 
26
 * @brief Media channel splitter/combiner port.
 
27
 */
 
28
#include <pjmedia/port.h>
 
29
 
 
30
 
 
31
/**
 
32
 * @addtogroup PJMEDIA_SPLITCOMB Media channel splitter/combiner
 
33
 * @ingroup PJMEDIA_PORT
 
34
 * @brief Split and combine multiple mono-channel media ports into
 
35
 *  a single multiple-channels media port
 
36
 * @{
 
37
 *
 
38
 * This section describes media port to split and combine media
 
39
 * channels in the stream.
 
40
 *
 
41
 * A splitter/combiner splits a single stereo/multichannels audio frame into
 
42
 * multiple audio frames to each channel when put_frame() is called, 
 
43
 * and combines mono frames from each channel into a stereo/multichannel 
 
44
 * frame when get_frame() is called. A common application for the splitter/
 
45
 * combiner is to split frames from stereo to mono and vise versa.
 
46
 */
 
47
 
 
48
PJ_BEGIN_DECL
 
49
 
 
50
 
 
51
/**
 
52
 * Create a media splitter/combiner with the specified parameters.
 
53
 * When the splitter/combiner is created, it creates an instance of
 
54
 * pjmedia_port. This media port represents the stereo/multichannel side
 
55
 * of the splitter/combiner. Application needs to supply the splitter/
 
56
 * combiner with a media port for each audio channels.
 
57
 *
 
58
 * @param pool              Pool to allocate memory to create the splitter/
 
59
 *                          combiner.
 
60
 * @param clock_rate        Audio clock rate/sampling rate.
 
61
 * @param channel_count     Number of channels.
 
62
 * @param samples_per_frame Number of samples per frame.
 
63
 * @param bits_per_sample   Bits per sample.
 
64
 * @param options           Optional flags.
 
65
 * @param p_splitcomb       Pointer to receive the splitter/combiner.
 
66
 *
 
67
 * @return                  PJ_SUCCESS on success, or the appropriate
 
68
 *                          error code.
 
69
 */
 
70
PJ_DECL(pj_status_t) pjmedia_splitcomb_create(pj_pool_t *pool,
 
71
                                              unsigned clock_rate,
 
72
                                              unsigned channel_count,
 
73
                                              unsigned samples_per_frame,
 
74
                                              unsigned bits_per_sample,
 
75
                                              unsigned options,
 
76
                                              pjmedia_port **p_splitcomb);
 
77
 
 
78
/**
 
79
 * Supply the splitter/combiner with media port for the specified channel 
 
80
 * number. The media port will be called at the
 
81
 * same phase as the splitter/combiner; which means that when application
 
82
 * calls get_frame() of the splitter/combiner, it will call get_frame()
 
83
 * for all ports that have the same phase. And similarly for put_frame().
 
84
 *
 
85
 * @param splitcomb         The splitter/combiner.
 
86
 * @param ch_num            Audio channel starting number (zero based).
 
87
 * @param options           Must be zero at the moment.
 
88
 * @param port              The media port.
 
89
 *
 
90
 * @return                  PJ_SUCCESS on success, or the appropriate error
 
91
 *                          code.
 
92
 */
 
93
PJ_DECL(pj_status_t) pjmedia_splitcomb_set_channel(pjmedia_port *splitcomb,
 
94
                                                   unsigned ch_num,
 
95
                                                   unsigned options,
 
96
                                                   pjmedia_port *port);
 
97
 
 
98
/**
 
99
 * Create a reverse phase media port for the specified channel number.
 
100
 * For channels with reversed phase, when application calls put_frame() to
 
101
 * the splitter/combiner, the splitter/combiner will only put the frame to
 
102
 * a buffer. Later on, when application calls get_frame() on the channel's
 
103
 * media port, it will return the frame that are available in the buffer.
 
104
 * The same process happens when application calls put_frame() to the
 
105
 * channel's media port, it will only put the frame to another buffer, which
 
106
 * will be returned when application calls get_frame() to the splitter's 
 
107
 * media port. So this effectively reverse the phase of the media port.
 
108
 *
 
109
 * @param pool              The pool to allocate memory for the port and
 
110
 *                          buffers.
 
111
 * @param splitcomb         The splitter/combiner.
 
112
 * @param ch_num            Audio channel starting number (zero based).
 
113
 * @param options           Normally is zero, but the lower 8-bit of the 
 
114
 *                          options can be used to specify the number of 
 
115
 *                          buffers in the circular buffer. If zero, then
 
116
 *                          default number will be used (default: 8).
 
117
 * @param p_chport          The media port created with reverse phase for
 
118
 *                          the specified audio channel.
 
119
 *
 
120
 * @return                  PJ_SUCCESS on success, or the appropriate error
 
121
 *                          code.
 
122
 */
 
123
PJ_DECL(pj_status_t) 
 
124
pjmedia_splitcomb_create_rev_channel( pj_pool_t *pool,
 
125
                                      pjmedia_port *splitcomb,
 
126
                                      unsigned ch_num,
 
127
                                      unsigned options,
 
128
                                      pjmedia_port **p_chport);
 
129
 
 
130
 
 
131
 
 
132
PJ_END_DECL
 
133
 
 
134
/**
 
135
 * @}
 
136
 */
 
137
 
 
138
#endif  /* __PJMEDIA_SPLITCOMB_H__ */
 
139
 
 
140