summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-10-21 09:23:37 +0000
committerBenny Prijono <bennylp@teluu.com>2006-10-21 09:23:37 +0000
commit059af568d6c275b40d241716155fbfe4f27f2e5b (patch)
treed7a8b60bd39cdf137b0b3ed440650d173b384c4c /pjmedia
parentf7d8a18e6d9b7591884c9afa2501ef49a490d4ad (diff)
Fixed quality setting in MP3 writer (thanks Toni again)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@786 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/include/pjmedia/mp3_port.h8
-rw-r--r--pjmedia/src/pjmedia/mp3_writer.c6
2 files changed, 10 insertions, 4 deletions
diff --git a/pjmedia/include/pjmedia/mp3_port.h b/pjmedia/include/pjmedia/mp3_port.h
index 279ab1ab..db4b3477 100644
--- a/pjmedia/include/pjmedia/mp3_port.h
+++ b/pjmedia/include/pjmedia/mp3_port.h
@@ -65,9 +65,11 @@ typedef struct pjmedia_mp3_encoder_option
*/
pj_bool_t vbr;
- /** 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.
+ /** Target bitrate, in bps. If VBR is enabled, this settings specifies
+ * the average bit-rate requested, and will make the encoder ignore
+ * the quality setting. For CBR, this specifies the actual bitrate,
+ * and if this option is zero, it will be set to the sampling rate
+ * multiplied by number of channels.
*/
unsigned bit_rate;
diff --git a/pjmedia/src/pjmedia/mp3_writer.c b/pjmedia/src/pjmedia/mp3_writer.c
index 74098ff4..ed6646f8 100644
--- a/pjmedia/src/pjmedia/mp3_writer.c
+++ b/pjmedia/src/pjmedia/mp3_writer.c
@@ -200,10 +200,14 @@ static pj_status_t init_mp3_encoder(struct mp3_file_port *fport,
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.nVBRQuality = (pj_uint16_t)
+ fport->mp3_option.quality;
LConfig.format.LHV1.bEnableVBR = 1;
}
- LConfig.format.LHV1.nQuality = (pj_uint16_t)fport->mp3_option.quality;
+ LConfig.format.LHV1.nQuality = (pj_uint16_t)
+ (((0-fport->mp3_option.quality-1)<<8) |
+ fport->mp3_option.quality);
/*
* Init MP3 stream.