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/stream.c

    r569 r633  
    144144static pj_status_t get_frame( pjmedia_port *port, pjmedia_frame *frame) 
    145145{ 
    146     pjmedia_stream *stream = port->user_data; 
     146    pjmedia_stream *stream = port->port_data.pdata; 
    147147    pjmedia_channel *channel = stream->dec; 
    148148    unsigned samples_count, samples_per_frame, samples_required; 
     
    439439                              const pjmedia_frame *frame ) 
    440440{ 
    441     pjmedia_stream *stream = port->user_data; 
     441    pjmedia_stream *stream = port->port_data.pdata; 
    442442    pjmedia_channel *channel = stream->enc; 
    443443    pj_status_t status = 0; 
     
    914914{ 
    915915    pjmedia_stream *stream; 
     916    pj_str_t name; 
    916917    unsigned jb_init, jb_max, jb_min_pre, jb_max_pre; 
    917918    pj_status_t status; 
     
    926927 
    927928    /* Init stream/port name */ 
    928     stream->port.info.name.ptr = pj_pool_alloc(pool, 24); 
    929     pj_ansi_sprintf(stream->port.info.name.ptr, 
    930                     "strm%p", stream); 
    931     stream->port.info.name.slen = pj_ansi_strlen(stream->port.info.name.ptr); 
     929    name.ptr = pj_pool_alloc(pool, 24); 
     930    name.slen = pj_ansi_snprintf(name.ptr, 24, "strm%p", stream); 
     931 
     932 
     933    /* Init some port-info. Some parts of the info will be set later 
     934     * once we have more info about the codec. 
     935     */ 
     936    pjmedia_port_info_init(&stream->port.info, &name, 
     937                           PJMEDIA_PORT_SIGNATURE('S', 'T', 'R', 'M'), 
     938                           info->fmt.clock_rate, info->fmt.channel_cnt, 
     939                           16, 80); 
    932940 
    933941    /* Init port. */ 
    934     stream->port.info.signature = ('S'<<3 | 'T'<<2 | 'R'<<1 | 'M'); 
    935     stream->port.info.type = PJMEDIA_TYPE_AUDIO; 
    936     stream->port.info.has_info = 1; 
    937     stream->port.info.need_info = 0; 
    938     stream->port.info.pt = info->fmt.pt; 
     942 
    939943    pj_strdup(pool, &stream->port.info.encoding_name, &info->fmt.encoding_name); 
    940944    stream->port.info.clock_rate = info->fmt.clock_rate; 
    941945    stream->port.info.channel_count = info->fmt.channel_cnt; 
    942     stream->port.user_data = stream; 
     946    stream->port.port_data.pdata = stream; 
    943947    stream->port.put_frame = &put_frame; 
    944948    stream->port.get_frame = &get_frame; 
Note: See TracChangeset for help on using the changeset viewer.