pjsip logo pjsip.org
Open source SIP stack and media stack for presence, im/instant messaging, and multimedia communication

HOME

SIP/media Features
High Performance SIP
Small Footprint SIP
Symbian Port

FAQ

Documentation

Licensing

Download

Development (Trac)

Projects using pjsip

Mailing List

Open Source Links


About: PJLIB, PJLIB-UTIL, PJSIP, and PJMEDIA are created by: Benny Prijono
<bennylp@pjsip.org>


 

Home --> Documentations --> PJMEDIA Reference

Media channel splitter/combiner
[Media Ports Framework]


Detailed Description

This section describes media port to split and combine media channels in the stream.

A splitter/combiner splits a single stereo/multichannels audio frame into multiple 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. A common application for the splitter/ combiner is to split frames from stereo to mono and vise versa.


Functions

PJ_BEGIN_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)
pj_status_t pjmedia_splitcomb_set_channel (pjmedia_port *splitcomb, unsigned ch_num, unsigned options, pjmedia_port *port)
pj_status_t pjmedia_splitcomb_create_rev_channel (pj_pool_t *pool, pjmedia_port *splitcomb, unsigned ch_num, unsigned options, pjmedia_port **p_chport)


Function Documentation

PJ_BEGIN_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 
)

Create a media splitter/combiner with the specified parameters. 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.

Parameters:
pool Pool to allocate memory to create the splitter/ combiner.
clock_rate Audio clock rate/sampling rate.
channel_count Number of channels.
samples_per_frame Number of samples per frame.
bits_per_sample Bits per sample.
options Optional flags.
p_splitcomb Pointer to receive the splitter/combiner.
Returns:
PJ_SUCCESS on success, or the appropriate error code.

pj_status_t pjmedia_splitcomb_set_channel ( pjmedia_port splitcomb,
unsigned  ch_num,
unsigned  options,
pjmedia_port port 
)

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().

Parameters:
splitcomb The splitter/combiner.
ch_num Audio channel starting number (zero based).
options Must be zero at the moment.
port The media port.
Returns:
PJ_SUCCESS on success, or the appropriate error code.

pj_status_t pjmedia_splitcomb_create_rev_channel ( pj_pool_t pool,
pjmedia_port splitcomb,
unsigned  ch_num,
unsigned  options,
pjmedia_port **  p_chport 
)

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.

Parameters:
pool The pool to allocate memory for the port and buffers.
splitcomb The splitter/combiner.
ch_num Audio channel starting number (zero based).
options Normally is zero, but the lower 8-bit of the options can be used to specify the number of buffers in the circular buffer. If zero, then default number will be used (default: 8).
p_chport The media port created with reverse phase for the specified audio channel.
Returns:
PJ_SUCCESS on success, or the appropriate error code.

 


PJMEDIA small footprint Open Source media stack
(C)2003-2008 Benny Prijono