Ignore:
Timestamp:
Jul 29, 2006 11:14:47 AM (18 years ago)
Author:
bennylp
Message:

Added pjmedia_port_info_init() to fill in pjmedia_port_info structure, avoiding manual initialization and thus improves consistency (and probably reduces size by a tiny bit). This involves modification in quite few places.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/splitcomb.c

    r631 r633  
    2525 
    2626#define SIGNATURE           PJMEDIA_PORT_SIGNATURE('S', 'p', 'C', 'b') 
     27#define SIGNATURE_PORT      PJMEDIA_PORT_SIGNATURE('S', 'p', 'C', 'P') 
    2728#define THIS_FILE           "splitcomb.c" 
    2829#define TMP_SAMP_TYPE       pj_int16_t 
     
    129130                                              pjmedia_port **p_splitcomb) 
    130131{ 
     132    const pj_str_t name = pj_str("splitcomb"); 
    131133    struct splitcomb *sc; 
    132134 
     
    161163 
    162164    /* Initialize port */ 
    163     sc->base.info.name = pj_str("splitcomb"); 
    164     sc->base.info.signature = SIGNATURE; 
    165     sc->base.info.type = PJMEDIA_TYPE_AUDIO; 
    166     sc->base.info.has_info = PJ_TRUE; 
    167     sc->base.info.need_info = PJ_FALSE; 
    168     sc->base.info.pt = 0xFF; 
    169     sc->base.info.encoding_name = pj_str("pcm"); 
    170     sc->base.info.clock_rate = clock_rate; 
    171     sc->base.info.channel_count = channel_count; 
    172     sc->base.info.bits_per_sample = bits_per_sample; 
    173     sc->base.info.samples_per_frame = samples_per_frame; 
    174     sc->base.info.bytes_per_frame = samples_per_frame * bits_per_sample / 8; 
     165    pjmedia_port_info_init(&sc->base.info, &name, SIGNATURE, clock_rate, 
     166                           channel_count, bits_per_sample, samples_per_frame); 
    175167 
    176168    sc->base.put_frame = &put_frame; 
     
    227219                                      pjmedia_port **p_chport) 
    228220{ 
     221    const pj_str_t name = pj_str("splitcomb-ch"); 
    229222    struct splitcomb *sc = (struct splitcomb*) splitcomb; 
    230223    struct reverse_port *rport; 
     
    251244    /* Initialize port info... */ 
    252245    port = &rport->base; 
    253     port->info.name = pj_str("splitcomb-ch"); 
    254     port->info.signature = 0; 
    255     port->info.type = PJMEDIA_TYPE_AUDIO; 
    256     port->info.has_info = PJ_TRUE; 
    257     port->info.need_info = PJ_FALSE; 
    258     port->info.pt = 0xFF; 
    259     port->info.encoding_name = pj_str("pcm"); 
    260     port->info.clock_rate = splitcomb->info.clock_rate; 
    261     port->info.channel_count = 1; 
    262     port->info.bits_per_sample = splitcomb->info.bits_per_sample; 
    263     port->info.samples_per_frame = splitcomb->info.samples_per_frame / 
    264                                    splitcomb->info.channel_count; 
    265     port->info.bytes_per_frame = port->info.samples_per_frame *  
    266                                  port->info.bits_per_sample / 8; 
     246    pjmedia_port_info_init(&port->info, &name, SIGNATURE_PORT,  
     247                           splitcomb->info.clock_rate, 1,  
     248                           splitcomb->info.bits_per_sample,  
     249                           splitcomb->info.samples_per_frame /  
     250                                   splitcomb->info.channel_count); 
    267251 
    268252    /* ... and the callbacks */ 
Note: See TracChangeset for help on using the changeset viewer.