aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llaudio/vorbisencode.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llaudio/vorbisencode.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/linden/indra/llaudio/vorbisencode.cpp b/linden/indra/llaudio/vorbisencode.cpp
index 4e85685..805e666 100644
--- a/linden/indra/llaudio/vorbisencode.cpp
+++ b/linden/indra/llaudio/vorbisencode.cpp
@@ -12,12 +12,12 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2 15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 * 16 *
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception 20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 21 *
22 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -195,11 +195,6 @@ S32 check_for_invalid_wav_formats(const char *in_fname, char *error_msg)
195 195
196S32 encode_vorbis_file(const char *in_fname, const char *out_fname) 196S32 encode_vorbis_file(const char *in_fname, const char *out_fname)
197{ 197{
198 return(encode_vorbis_file_at(in_fname,out_fname, 128000));
199}
200
201S32 encode_vorbis_file_at(const char *in_fname, const char *out_fname, S32 bitrate)
202{
203#define READ_BUFFER 1024 198#define READ_BUFFER 1024
204 unsigned char readbuffer[READ_BUFFER*4+44]; /* out of the data segment, not the stack */ /*Flawfinder: ignore*/ 199 unsigned char readbuffer[READ_BUFFER*4+44]; /* out of the data segment, not the stack */ /*Flawfinder: ignore*/
205 200
@@ -294,20 +289,21 @@ S32 encode_vorbis_file_at(const char *in_fname, const char *out_fname, S32 bitra
294 vorbis_info_init(&vi); 289 vorbis_info_init(&vi);
295 290
296 // always encode to mono 291 // always encode to mono
297// vorbis_encode_init(&vi, /* num_channels */ 1 ,sample_rate, -1, bitrate, -1);
298// if (vorbis_encode_init(&vi, /* num_channels */ 1 ,sample_rate, -1, bitrate, -1))
299 292
300// F32 quality = 0; 293 // SL-52913 & SL-53779 determined this quality level to be our 'good
294 // enough' general-purpose quality level with a nice low bitrate.
295 // Equivalent to oggenc -q0.5
296 F32 quality = 0.05f;
301// quality = (bitrate==128000 ? 0.4f : 0.1); 297// quality = (bitrate==128000 ? 0.4f : 0.1);
302 298
303 if (vorbis_encode_init(&vi, /* num_channels */ 1 ,sample_rate, -1, bitrate, -1)) 299// if (vorbis_encode_init(&vi, /* num_channels */ 1 ,sample_rate, -1, bitrate, -1))
304// if (vorbis_encode_init_vbr(&vi, /* num_channels */ 1 ,sample_rate, quality)) 300 if (vorbis_encode_init_vbr(&vi, /* num_channels */ 1 ,sample_rate, quality))
305// if (vorbis_encode_setup_managed(&vi,1,sample_rate,-1,bitrate,-1) || 301// if (vorbis_encode_setup_managed(&vi,1,sample_rate,-1,bitrate,-1) ||
306// vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE_AVG,NULL) || 302// vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE_AVG,NULL) ||
307// vorbis_encode_setup_init(&vi)) 303// vorbis_encode_setup_init(&vi))
308 { 304 {
309// llwarns << "unable to initialize vorbis codec at quality " << quality << llendl; 305 llwarns << "unable to initialize vorbis codec at quality " << quality << llendl;
310 llwarns << "unable to initialize vorbis codec at bitrate " << bitrate << llendl; 306 // llwarns << "unable to initialize vorbis codec at bitrate " << bitrate << llendl;
311 return(LLVORBISENC_DEST_OPEN_ERR); 307 return(LLVORBISENC_DEST_OPEN_ERR);
312 } 308 }
313 309