PageRenderTime 23ms CodeModel.GetById 17ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llaudio/llvorbisencode.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 59 lines | 25 code | 7 blank | 27 comment | 0 complexity | a772a5fb087d7a5aa669c1e7056f3b5d MD5 | raw file
 1/** 
 2 * @file vorbisencode.h
 3 * @brief Vorbis encoding routine routine for Indra.
 4 *
 5 * $LicenseInfo:firstyear=2000&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#ifndef LL_VORBISENCODE_H
28#define LL_VORBISENCODE_H
29
30const S32 LLVORBISENC_NOERR                        = 0; // no error
31const S32 LLVORBISENC_SOURCE_OPEN_ERR              = 1; // error opening source
32const S32 LLVORBISENC_DEST_OPEN_ERR                = 2; // error opening destination
33const S32 LLVORBISENC_WAV_FORMAT_ERR               = 3; // not a WAV
34const S32 LLVORBISENC_PCM_FORMAT_ERR               = 4; // not a PCM
35const S32 LLVORBISENC_MONO_ERR                     = 5; // can't do mono
36const S32 LLVORBISENC_STEREO_ERR                   = 6; // can't do stereo
37const S32 LLVORBISENC_MULTICHANNEL_ERR             = 7; // can't do stereo
38const S32 LLVORBISENC_UNSUPPORTED_SAMPLE_RATE      = 8; // unsupported sample rate
39const S32 LLVORBISENC_UNSUPPORTED_WORD_SIZE        = 9; // unsupported word size
40const S32 LLVORBISENC_CLIP_TOO_LONG                = 10; // source file is too long
41const S32 LLVORBISENC_CHUNK_SIZE_ERR               = 11; // chunk size is wrong
42
43const F32 LLVORBIS_CLIP_MAX_TIME                               = 10.0f;
44const U8  LLVORBIS_CLIP_MAX_CHANNELS                   = 2;
45const U32 LLVORBIS_CLIP_SAMPLE_RATE                            = 44100;
46const U32 LLVORBIS_CLIP_MAX_SAMPLES_PER_CHANNEL        = (U32)(LLVORBIS_CLIP_MAX_TIME * LLVORBIS_CLIP_SAMPLE_RATE);
47const U32 LLVORBIS_CLIP_MAX_SAMPLES                            = LLVORBIS_CLIP_MAX_SAMPLES_PER_CHANNEL * LLVORBIS_CLIP_MAX_CHANNELS;
48const size_t LLVORBIS_CLIP_MAX_SAMPLE_DATA             = LLVORBIS_CLIP_MAX_SAMPLES * 2; // 2 = 16-bit
49 
50// Treat anything this long as a bad asset. A little fudge factor at the end:
51// Make that a lot of fudge factor. We're allowing 30 sec for now - 3x legal upload
52const size_t LLVORBIS_CLIP_REJECT_SAMPLES              = LLVORBIS_CLIP_MAX_SAMPLES * 3;
53const size_t LLVORBIS_CLIP_REJECT_SIZE                 = LLVORBIS_CLIP_MAX_SAMPLE_DATA * 3;
54
55S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg);
56S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname);
57
58#endif
59