Changeset 631 for pjproject


Ignore:
Timestamp:
Jul 27, 2006 10:03:51 PM (18 years ago)
Author:
bennylp
Message:
  • Added splitter/combiner port (splitcomb.c)
  • Added function to initialize pjmedia_port_info (still unused though)
Location:
pjproject/trunk/pjmedia
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/build/Makefile

    r628 r631  
    6969                        g711.o jbuf.o master_port.o mem_capture.o mem_player.o \ 
    7070                        null_port.o plc_common.o plc_g711.o \ 
    71                         port.o resample.o \ 
     71                        port.o splitcomb.o resample.o \ 
    7272                        resample_port.o rtcp.o rtp.o sdp.o sdp_cmp.o sdp_neg.o \ 
    7373                        session.o silencedet.o sound_port.o stream.o \ 
  • pjproject/trunk/pjmedia/build/pjmedia.dsp

    r584 r631  
    200200# Begin Source File 
    201201 
     202SOURCE=..\src\pjmedia\splitcomb.c 
     203# End Source File 
     204# Begin Source File 
     205 
    202206SOURCE=..\src\pjmedia\stream.c 
    203207# End Source File 
  • pjproject/trunk/pjmedia/include/pjmedia/port.h

    r622 r631  
    357357 
    358358/** 
     359 * This is an auxiliary function to initialize port info for 
     360 * ports which deal with PCM audio. 
     361 * 
     362 * @param info              The port info to be initialized. 
     363 * @param name              Port name. 
     364 * @param signature         Port signature. 
     365 * @param channel_count     Number of channels. 
     366 * @param bits_per_sample   Bits per sample. 
     367 * @param samples_per_frame Number of samples per frame. 
     368 * 
     369 * @return                  PJ_SUCCESS on success. 
     370 */ 
     371PJ_DECL(pj_status_t) pjmedia_port_info_init( pjmedia_port_info *info, 
     372                                             const pj_str_t *name, 
     373                                             unsigned signature, 
     374                                             unsigned clock_rate, 
     375                                             unsigned channel_count, 
     376                                             unsigned bits_per_sample, 
     377                                             unsigned samples_per_frame); 
     378 
     379 
     380/** 
    359381 * Get a frame from the port (and subsequent downstream ports). 
     382 * 
     383 * @param port      The media port. 
     384 * @param frame     Frame to store samples. 
     385 * 
     386 * @return          PJ_SUCCESS on success, or the appropriate error code. 
    360387 */ 
    361388PJ_DECL(pj_status_t) pjmedia_port_get_frame( pjmedia_port *port, 
     
    364391/** 
    365392 * Put a frame to the port (and subsequent downstream ports). 
     393 * 
     394 * @param port      The media port. 
     395 * @param frame     Frame to the put to the port. 
     396 * 
     397 * @return          PJ_SUCCESS on success, or the appropriate error code. 
    366398 */ 
    367399PJ_DECL(pj_status_t) pjmedia_port_put_frame( pjmedia_port *port, 
     
    371403/** 
    372404 * Destroy port (and subsequent downstream ports) 
     405 * 
     406 * @param port      The media port. 
     407 * 
     408 * @return          PJ_SUCCESS on success, or the appropriate error code. 
    373409 */ 
    374410PJ_DECL(pj_status_t) pjmedia_port_destroy( pjmedia_port *port ); 
  • pjproject/trunk/pjmedia/include/pjmedia/splitcomb.h

    r531 r631  
    2525 * @brief Media channel splitter/combiner port. 
    2626 */ 
    27 #include <pjmedia/types.h> 
     27#include <pjmedia/port.h> 
    2828 
    2929 
     
    3535 * This section describes media port to split and combine media 
    3636 * channels in the stream. 
     37 * 
     38 * A splitter/combiner splits a single stereo/multichannels audio frame into 
     39 * multiple audio frames to each channel when put_frame() is called,  
     40 * and combines mono frames from each channel into a stereo/multichannel  
     41 * frame when get_frame() is called. A common application for the splitter/ 
     42 * combiner is to split frames from stereo to mono and vise versa. 
    3743 */ 
    3844 
     
    4248/** 
    4349 * Create a media splitter/combiner with the specified parameters. 
    44  * A splitter/combiner splits a single stereo/multichannel audio frame into 
    45  * multiple mono audio frames to each channel when put_frame() is called,  
    46  * and combines mono frames from each channel into a stereo/multichannel  
    47  * frame when get_frame() is called. 
    48  * 
    4950 * When the splitter/combiner is created, it creates an instance of 
    5051 * pjmedia_port. This media port represents the stereo/multichannel side 
     
    8081 * 
    8182 * @param splitcomb         The splitter/combiner. 
    82  * @param ch_num            Audio channel number. 
    83  * @param options           Valid options are: 
    84  *                          - PJMEDIA_SPLITCOMB_AUTO_DESTROY to destroy the 
    85  *                            media port when the splitter is destroyed. 
     83 * @param ch_num            Audio channel starting number (zero based). 
     84 * @param options           Must be zero at the moment. 
    8685 * @param port              The media port. 
    8786 * 
     
    108107 *                          buffers. 
    109108 * @param splitcomb         The splitter/combiner. 
    110  * @param ch_num            Audio channel number. 
    111  * @param options           Valid options are: 
    112  *                          - PJMEDIA_SPLITCOMB_AUTO_DESTROY to destroy the 
    113  *                            media port when the splitter is destroyed. 
     109 * @param ch_num            Audio channel starting number (zero based). 
     110 * @param options           Normally is zero, but the lower 8-bit of the  
     111 *                          options can be used to specify the number of  
     112 *                          buffers in the circular buffer. If zero, then 
     113 *                          default number will be used (default: 8). 
    114114 * @param p_chport          The media port created with reverse phase for 
    115115 *                          the specified audio channel. 
  • pjproject/trunk/pjmedia/src/pjmedia/port.c

    r518 r631  
    2323 
    2424#define THIS_FILE       "port.c" 
     25 
     26 
     27/** 
     28 * This is an auxiliary function to initialize port info for 
     29 * ports which deal with PCM audio. 
     30 */ 
     31PJ_DEF(pj_status_t) pjmedia_port_info_init( pjmedia_port_info *info, 
     32                                            const pj_str_t *name, 
     33                                            unsigned signature, 
     34                                            unsigned clock_rate, 
     35                                            unsigned channel_count, 
     36                                            unsigned bits_per_sample, 
     37                                            unsigned samples_per_frame) 
     38{ 
     39    pj_bzero(info, sizeof(*info)); 
     40 
     41    info->name = *name; 
     42    info->signature = signature; 
     43    info->type = PJMEDIA_TYPE_AUDIO; 
     44    info->has_info = PJ_TRUE; 
     45    info->need_info = PJ_FALSE; 
     46    info->pt = 0xFF; 
     47    info->encoding_name = pj_str("pcm"); 
     48    info->clock_rate = clock_rate; 
     49    info->channel_count = channel_count; 
     50    info->bits_per_sample = bits_per_sample; 
     51    info->samples_per_frame = samples_per_frame; 
     52    info->bytes_per_frame = samples_per_frame * bits_per_sample / 8; 
     53 
     54    return PJ_SUCCESS; 
     55} 
    2556 
    2657 
Note: See TracChangeset for help on using the changeset viewer.