diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-10-20 11:08:49 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-10-20 11:08:49 +0000 |
commit | f7d8a18e6d9b7591884c9afa2501ef49a490d4ad (patch) | |
tree | 0046bc15f908fde324f49512104819086c0186d1 /pjmedia | |
parent | 79e3a3d40d3caab81b8ec0200f58e0aac2a03243 (diff) |
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
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@785 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/include/pjmedia/mp3_port.h | 14 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/mp3_writer.c | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/pjmedia/include/pjmedia/mp3_port.h b/pjmedia/include/pjmedia/mp3_port.h index 4d980b9c..279ab1ab 100644 --- a/pjmedia/include/pjmedia/mp3_port.h +++ b/pjmedia/include/pjmedia/mp3_port.h @@ -59,13 +59,21 @@ PJ_BEGIN_DECL */ typedef struct pjmedia_mp3_encoder_option { - /** Specify whether variable bit rate should be used (say Yes!). */ + /** Specify whether variable bit rate should be used. Variable bitrate + * would normally produce better quality at the expense of probably + * larger file. + */ pj_bool_t vbr; - /** Target bitrate, in bps. If zero, bitrate will be calculated. */ + /** Target bitrate, in bps. For VBR, if the bitrate is specified, then + * the encoder will ignore the quality settings and instead will try to + * limit the bitrate to the desired value in this setting. + */ unsigned bit_rate; - /** Encoding quality, 0-9, with 0 is the highest. */ + /** Encoding quality, 0-9, with 0 is the highest quality. For VBR, the + * quality setting will only take effect when bit_rate setting is zero. + */ unsigned quality; } pjmedia_mp3_encoder_option; diff --git a/pjmedia/src/pjmedia/mp3_writer.c b/pjmedia/src/pjmedia/mp3_writer.c index 5506f52b..74098ff4 100644 --- a/pjmedia/src/pjmedia/mp3_writer.c +++ b/pjmedia/src/pjmedia/mp3_writer.c @@ -199,7 +199,7 @@ static pj_status_t init_mp3_encoder(struct mp3_file_port *fport, } else { LConfig.format.LHV1.nVbrMethod = VBR_METHOD_DEFAULT; LConfig.format.LHV1.bWriteVBRHeader = 1; - //LConfig.format.LHV1.dwVbrAbr_bps = fport->mp3_option.bit_rate; + LConfig.format.LHV1.dwVbrAbr_bps = fport->mp3_option.bit_rate; LConfig.format.LHV1.bEnableVBR = 1; } @@ -294,8 +294,8 @@ pjmedia_mp3_writer_port_create( pj_pool_t *pool, fport->mp3_option.vbr = PJ_TRUE; } - /* Calculate bitrate if it's not specified */ - if (fport->mp3_option.bit_rate == 0) + /* Calculate bitrate if it's not specified, only if it's not VBR. */ + if (fport->mp3_option.bit_rate == 0 && !fport->mp3_option.vbr) fport->mp3_option.bit_rate = sampling_rate * channel_count; /* Set default quality if it's not specified */ |