PageRenderTime 112ms CodeModel.GetById 0ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_VORBISENCODE_H
  27. #define LL_VORBISENCODE_H
  28. const S32 LLVORBISENC_NOERR = 0; // no error
  29. const S32 LLVORBISENC_SOURCE_OPEN_ERR = 1; // error opening source
  30. const S32 LLVORBISENC_DEST_OPEN_ERR = 2; // error opening destination
  31. const S32 LLVORBISENC_WAV_FORMAT_ERR = 3; // not a WAV
  32. const S32 LLVORBISENC_PCM_FORMAT_ERR = 4; // not a PCM
  33. const S32 LLVORBISENC_MONO_ERR = 5; // can't do mono
  34. const S32 LLVORBISENC_STEREO_ERR = 6; // can't do stereo
  35. const S32 LLVORBISENC_MULTICHANNEL_ERR = 7; // can't do stereo
  36. const S32 LLVORBISENC_UNSUPPORTED_SAMPLE_RATE = 8; // unsupported sample rate
  37. const S32 LLVORBISENC_UNSUPPORTED_WORD_SIZE = 9; // unsupported word size
  38. const S32 LLVORBISENC_CLIP_TOO_LONG = 10; // source file is too long
  39. const S32 LLVORBISENC_CHUNK_SIZE_ERR = 11; // chunk size is wrong
  40. const F32 LLVORBIS_CLIP_MAX_TIME = 10.0f;
  41. const U8 LLVORBIS_CLIP_MAX_CHANNELS = 2;
  42. const U32 LLVORBIS_CLIP_SAMPLE_RATE = 44100;
  43. const U32 LLVORBIS_CLIP_MAX_SAMPLES_PER_CHANNEL = (U32)(LLVORBIS_CLIP_MAX_TIME * LLVORBIS_CLIP_SAMPLE_RATE);
  44. const U32 LLVORBIS_CLIP_MAX_SAMPLES = LLVORBIS_CLIP_MAX_SAMPLES_PER_CHANNEL * LLVORBIS_CLIP_MAX_CHANNELS;
  45. const size_t LLVORBIS_CLIP_MAX_SAMPLE_DATA = LLVORBIS_CLIP_MAX_SAMPLES * 2; // 2 = 16-bit
  46. // Treat anything this long as a bad asset. A little fudge factor at the end:
  47. // Make that a lot of fudge factor. We're allowing 30 sec for now - 3x legal upload
  48. const size_t LLVORBIS_CLIP_REJECT_SAMPLES = LLVORBIS_CLIP_MAX_SAMPLES * 3;
  49. const size_t LLVORBIS_CLIP_REJECT_SIZE = LLVORBIS_CLIP_MAX_SAMPLE_DATA * 3;
  50. S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg);
  51. S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname);
  52. #endif