Changeset 785 for pjproject/trunk


Ignore:
Timestamp:
Oct 20, 2006 11:08:49 AM (18 years ago)
Author:
bennylp
Message:

Changed the processing of mp3 _options in mp3 writer with regard to bit_rate and quality to comply with LAME, also changed the pjsua_recorder_create() parameter to allow specifying mp3 options in one of the parameter

Location:
pjproject/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/mp3_port.h

    r783 r785  
    6060typedef struct pjmedia_mp3_encoder_option 
    6161{ 
    62     /** Specify whether variable bit rate should be used (say Yes!).        */ 
     62    /** Specify whether variable bit rate should be used. Variable bitrate 
     63     *  would normally produce better quality at the expense of probably 
     64     *  larger file. 
     65     */ 
    6366    pj_bool_t   vbr; 
    6467 
    65     /** Target bitrate, in bps. If zero, bitrate will be  calculated.       */ 
     68    /** Target bitrate, in bps. For VBR, if the bitrate is specified, then  
     69     *  the encoder will ignore the quality settings and instead will try to  
     70     *  limit the bitrate to the desired value in this setting. 
     71     */ 
    6672    unsigned    bit_rate; 
    6773 
    68     /** Encoding quality, 0-9, with 0 is the highest.                       */ 
     74    /** Encoding quality, 0-9, with 0 is the highest quality. For VBR, the  
     75     *  quality setting will only take effect when bit_rate setting is zero. 
     76     */ 
    6977    unsigned    quality; 
    7078 
  • pjproject/trunk/pjmedia/src/pjmedia/mp3_writer.c

    r783 r785  
    200200        LConfig.format.LHV1.nVbrMethod = VBR_METHOD_DEFAULT; 
    201201        LConfig.format.LHV1.bWriteVBRHeader = 1; 
    202         //LConfig.format.LHV1.dwVbrAbr_bps = fport->mp3_option.bit_rate; 
     202        LConfig.format.LHV1.dwVbrAbr_bps = fport->mp3_option.bit_rate; 
    203203        LConfig.format.LHV1.bEnableVBR = 1; 
    204204    } 
     
    295295    } 
    296296 
    297     /* Calculate bitrate if it's not specified */ 
    298     if (fport->mp3_option.bit_rate == 0)  
     297    /* Calculate bitrate if it's not specified, only if it's not VBR. */ 
     298    if (fport->mp3_option.bit_rate == 0 && !fport->mp3_option.vbr)  
    299299        fport->mp3_option.bit_rate = sampling_rate * channel_count; 
    300300 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r783 r785  
    25302530/** 
    25312531 * Create a file recorder, and automatically connect this recorder to 
    2532  * the conference bridge. 
     2532 * the conference bridge. The recorder currently supports recording WAV file, 
     2533 * and on Windows, MP3 file. The type of the recorder to use is determined 
     2534 * by the extension of the file (e.g. ".wav" or ".mp3"). 
    25332535 * 
    25342536 * @param filename      Output file name. The function will determine the 
     
    25362538 *                      Currently ".wav" is supported on all platforms, and 
    25372539 *                      also ".mp3" is support on Windows. 
    2538  * @param file_format   This option is obsolete. 
    2539  * @param encoding      Optionally specify the encoding to be applied to the 
    2540  *                      file. By default (if NULL is specified), the encoding 
    2541  *                      is determined from the file extension (i.e. 16bit PCM 
    2542  *                      is used for the WAV files). 
    2543  * @param max_size      Maximum file size. Specify -1 to remove size 
    2544  *                      limitation. 
     2540 * @param enc_type      Optionally specify the type of encoder to be used to 
     2541 *                      compress the media, if the file can support different 
     2542 *                      encodings. This value must be zero for now. 
     2543 * @param enc_param     Optionally specify codec specific parameter to be  
     2544 *                      passed to the file writer. For .MP3 recorder, this 
     2545 *                      can point to pjmedia_mp3_encoder_option structure to 
     2546 *                      specify additional settings for the .mp3 recorder. 
     2547 *                      For .WAV recorder, this value must be NULL. 
     2548 * @param max_size      Maximum file size. Specify zero or -1 to remove size 
     2549 *                      limitation. This value must be zero or -1 for now. 
    25452550 * @param options       Optional options. 
    25462551 * @param p_id          Pointer to receive the recorder instance. 
     
    25492554 */ 
    25502555PJ_DECL(pj_status_t) pjsua_recorder_create(const pj_str_t *filename, 
    2551                                            unsigned file_format, 
    2552                                            const pj_str_t *encoding, 
     2556                                           unsigned enc_type, 
     2557                                           void *enc_param, 
    25532558                                           pj_ssize_t max_size, 
    25542559                                           unsigned options, 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r783 r785  
    797797 */ 
    798798PJ_DEF(pj_status_t) pjsua_recorder_create( const pj_str_t *filename, 
    799                                            unsigned file_format, 
    800                                            const pj_str_t *encoding, 
     799                                           unsigned enc_type, 
     800                                           void *enc_param, 
    801801                                           pj_ssize_t max_size, 
    802802                                           unsigned options, 
     
    812812    char path[128]; 
    813813    pj_str_t ext; 
     814    int file_format; 
    814815    pjmedia_port *port; 
    815816    pj_status_t status; 
     
    821822    PJ_ASSERT_RETURN(max_size == 0 || max_size == -1, PJ_EINVAL); 
    822823 
    823     /* Don't support file format at present */ 
    824     PJ_ASSERT_RETURN(file_format == 0, PJ_EINVAL); 
    825  
    826     /* Don't support encoding at present */ 
    827     PJ_ASSERT_RETURN(encoding == NULL, PJ_EINVAL); 
     824    /* Don't support encoding type at present */ 
     825    PJ_ASSERT_RETURN(enc_type == 0, PJ_EINVAL); 
    828826 
    829827    if (pjsua_var.rec_cnt >= PJ_ARRAY_SIZE(pjsua_var.recorder)) 
     
    875873                                                pjsua_var.mconf_cfg.samples_per_frame, 
    876874                                                pjsua_var.mconf_cfg.bits_per_sample, 
    877                                                 NULL, &port); 
     875                                                enc_param, &port); 
    878876    } else { 
    879877        port = NULL; 
Note: See TracChangeset for help on using the changeset viewer.