Ignore:
Timestamp:
Dec 10, 2010 11:04:30 AM (13 years ago)
Author:
bennylp
Message:

Migration of current video works from private repository to this repository. This closed #1176

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjsip-apps/src/samples/playsine.c

    r2408 r3392  
    8787 
    8888    /* Get number of samples */ 
    89     count = frame->size / 2 / port->info.channel_count; 
     89    count = frame->size / 2 / PJMEDIA_PIA_CCNT(&port->info); 
    9090 
    9191    left = 0; 
     
    9696        ++left; 
    9797 
    98         if (port->info.channel_count == 2) { 
     98        if (PJMEDIA_PIA_CCNT(&port->info) == 2) { 
    9999            *samples++ = sine->samples[right]; 
    100100            right += 2; /* higher pitch so we can distinguish left and right. */ 
     
    127127    unsigned i; 
    128128    unsigned count; 
     129    pj_str_t name; 
    129130    port_data *sine; 
    130131 
     
    136137 
    137138    /* Fill in port info. */ 
    138     port->info.bits_per_sample = 16; 
    139     port->info.channel_count = channel_count; 
    140     port->info.encoding_name = pj_str("pcm"); 
    141     port->info.has_info = 1; 
    142     port->info.name = pj_str("sine generator"); 
    143     port->info.need_info = 0; 
    144     port->info.pt = 0xFF; 
    145     port->info.clock_rate = sampling_rate; 
    146     port->info.samples_per_frame = sampling_rate * 20 / 1000 * channel_count; 
    147     port->info.bytes_per_frame = port->info.samples_per_frame * 2; 
    148     port->info.type = PJMEDIA_TYPE_AUDIO; 
     139    name = pj_str("sine generator"); 
     140    pjmedia_port_info_init(&port->info, &name, 
     141                           PJMEDIA_PORT_SIGNATURE('s', 'i', 'n', 'e'), 
     142                           sampling_rate, 
     143                           channel_count, 
     144                           16, sampling_rate * 20 / 1000 * channel_count); 
    149145     
    150146    /* Set the function to feed frame */ 
     
    155151 
    156152    /* Create samples */ 
    157     count = port->info.samples_per_frame / channel_count; 
     153    count = PJMEDIA_PIA_SPF(&port->info) / channel_count; 
    158154    sine->samples = pj_pool_alloc(pool, count * sizeof(pj_int16_t)); 
    159155    PJ_ASSERT_RETURN(sine->samples != NULL, PJ_ENOMEM); 
     
    245241                 pool,                              /* pool                 */ 
    246242                 -1,                                /* use default dev.     */ 
    247                  sine_port->info.clock_rate,        /* clock rate.          */ 
    248                  sine_port->info.channel_count,     /* # of channels.       */ 
    249                  sine_port->info.samples_per_frame, /* samples per frame.   */ 
    250                  sine_port->info.bits_per_sample,   /* bits per sample.     */ 
     243                 PJMEDIA_PIA_SRATE(&sine_port->info),/* clock rate.         */ 
     244                 PJMEDIA_PIA_CCNT(&sine_port->info),/* # of channels.       */ 
     245                 PJMEDIA_PIA_SPF(&sine_port->info), /* samples per frame.   */ 
     246                 PJMEDIA_PIA_BITS(&sine_port->info),/* bits per sample.     */ 
    251247                 0,                                 /* options              */ 
    252248                 &snd_port                          /* returned port        */ 
Note: See TracChangeset for help on using the changeset viewer.