Changeset 4483


Ignore:
Timestamp:
Apr 19, 2013 9:52:02 AM (6 years ago)
Author:
ming
Message:

Re #1630: Fixed mp3 writer to work with PJSIP 2.x (thanks to Toni Rutar for the fix)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/third_party/mp3/mp3_writer.c

    r1233 r4483  
    3838 
    3939#define THIS_FILE           "mp3_writer.c" 
    40 #define SIGNATURE           PJMEDIA_PORT_SIGNATURE('F', 'W', 'M', '3') 
     40#define SIGNATURE           PJMEDIA_SIG_CLASS_PORT_AUD('M','W') 
    4141#define BYTES_PER_SAMPLE    2 
    4242 
     
    176176    LConfig.format.LHV1.dwStructVersion = 1; 
    177177    LConfig.format.LHV1.dwStructSize = sizeof(BE_CONFIG); 
    178     LConfig.format.LHV1.dwSampleRate = fport->base.info.clock_rate; 
     178    LConfig.format.LHV1.dwSampleRate = PJMEDIA_PIA_SRATE(&fport->base.info); 
    179179    LConfig.format.LHV1.dwReSampleRate = 0; 
    180180 
    181     if (fport->base.info.channel_count==1) 
     181    if (PJMEDIA_PIA_CCNT(&fport->base.info)==1) 
    182182        LConfig.format.LHV1.nMode = BE_MP3_MODE_MONO; 
    183     else if (fport->base.info.channel_count==2) 
     183    else if (PJMEDIA_PIA_CCNT(&fport->base.info)==2) 
    184184        LConfig.format.LHV1.nMode = BE_MP3_MODE_STEREO; 
    185185    else 
     
    323323              (int)fport->base.info.name.slen, 
    324324              fport->base.info.name.ptr, 
    325               fport->base.info.clock_rate/1000, 
     325                  PJMEDIA_PIA_SRATE(&fport->base.info), 
    326326              fport->mp3_option.bit_rate/1000, 
    327327              (fport->mp3_option.vbr ? " (VBR)" : ""), 
     
    377377    /* Record silence if input is no-frame */ 
    378378    if (frame->type == PJMEDIA_FRAME_TYPE_NONE || frame->size == 0) { 
    379         unsigned samples_left = fport->base.info.samples_per_frame; 
     379        unsigned samples_left = PJMEDIA_PIA_SPF(&fport->base.info); 
    380380        unsigned samples_copied = 0; 
    381381 
    382382        /* Only want to record at most 1 second of silence */ 
    383         if (fport->silence_duration >= fport->base.info.clock_rate) 
     383        if (fport->silence_duration >= PJMEDIA_PIA_SRATE(&fport->base.info)) 
    384384            return PJ_SUCCESS; 
    385385 
     
    422422        } 
    423423 
    424         fport->silence_duration += fport->base.info.samples_per_frame; 
     424        fport->silence_duration += PJMEDIA_PIA_SPF(&fport->base.info); 
    425425 
    426426    } 
     
    429429     */ 
    430430    else if (fport->mp3_samples_per_frame !=  
    431              fport->base.info.samples_per_frame)  
     431             PJMEDIA_PIA_SPF(&fport->base.info))  
    432432    { 
    433433        unsigned samples_left = frame->size / 2; 
Note: See TracChangeset for help on using the changeset viewer.