summaryrefslogtreecommitdiff
path: root/indra/llaudio/llaudiodecodemgr.cpp
diff options
context:
space:
mode:
authorBrad Linden <46733234+brad-linden@users.noreply.github.com>2024-05-06 15:44:19 -0700
committerGitHub <noreply@github.com>2024-05-06 15:44:19 -0700
commit84827a7cb8d4b7a58309f98c7d4df4cfeb173935 (patch)
treeb91494298eab93bbd8dd9b00722b7a30714a1b9c /indra/llaudio/llaudiodecodemgr.cpp
parent76101843c0d390c25a783f212eb1ea75e508ada4 (diff)
parent8b747cee182cd8e95063fa152d9b5d7383cb1c74 (diff)
Merge pull request #1413 from secondlife/gltf-dev-maint-a-merge
Merge Maint A to development
Diffstat (limited to 'indra/llaudio/llaudiodecodemgr.cpp')
-rwxr-xr-xindra/llaudio/llaudiodecodemgr.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index 190c5290cb..4b23b37cc9 100755
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -70,22 +70,22 @@ public:
LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename);
- BOOL initDecode();
- BOOL decodeSection(); // Return TRUE if done.
- BOOL finishDecode();
+ bool initDecode();
+ bool decodeSection(); // Return true if done.
+ bool finishDecode();
void flushBadFile();
void ioComplete(S32 bytes) { mBytesRead = bytes; }
- BOOL isValid() const { return mValid; }
- BOOL isDone() const { return mDone; }
+ bool isValid() const { return mValid; }
+ bool isDone() const { return mDone; }
const LLUUID &getUUID() const { return mUUID; }
protected:
virtual ~LLVorbisDecodeState();
- BOOL mValid;
- BOOL mDone;
+ bool mValid;
+ bool mDone;
LLAtomicS32 mBytesRead;
LLUUID mUUID;
@@ -164,8 +164,8 @@ long cache_tell (void *datasource)
LLVorbisDecodeState::LLVorbisDecodeState(const LLUUID &uuid, const std::string &out_filename)
{
- mDone = FALSE;
- mValid = FALSE;
+ mDone = false;
+ mValid = false;
mBytesRead = -1;
mUUID = uuid;
mInFilep = NULL;
@@ -188,7 +188,7 @@ LLVorbisDecodeState::~LLVorbisDecodeState()
}
-BOOL LLVorbisDecodeState::initDecode()
+bool LLVorbisDecodeState::initDecode()
{
ov_callbacks cache_callbacks;
cache_callbacks.read_func = cache_read;
@@ -204,14 +204,14 @@ BOOL LLVorbisDecodeState::initDecode()
LL_WARNS("AudioEngine") << "unable to open vorbis source vfile for reading" << LL_ENDL;
delete mInFilep;
mInFilep = NULL;
- return FALSE;
+ return false;
}
S32 r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, cache_callbacks);
if(r < 0)
{
LL_WARNS("AudioEngine") << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << mUUID << LL_ENDL;
- return(FALSE);
+ return(false);
}
S32 sample_count = (S32)ov_pcm_total(&mVF, -1);
@@ -260,7 +260,7 @@ BOOL LLVorbisDecodeState::initDecode()
}
delete mInFilep;
mInFilep = NULL;
- return FALSE;
+ return false;
}
try
@@ -273,7 +273,7 @@ BOOL LLVorbisDecodeState::initDecode()
LL_WARNS("AudioEngine") << "Out of memory when trying to alloc buffer: " << size_guess << LL_ENDL;
delete mInFilep;
mInFilep = NULL;
- return FALSE;
+ return false;
}
{
@@ -360,31 +360,31 @@ BOOL LLVorbisDecodeState::initDecode()
// fprintf(stderr,"\nDecoded length: %ld samples\n", (long)ov_pcm_total(&vf,-1));
// fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
//}
- return TRUE;
+ return true;
}
-BOOL LLVorbisDecodeState::decodeSection()
+bool LLVorbisDecodeState::decodeSection()
{
if (!mInFilep)
{
LL_WARNS("AudioEngine") << "No cache file to decode in vorbis!" << LL_ENDL;
- return TRUE;
+ return true;
}
if (mDone)
{
// LL_WARNS("AudioEngine") << "Already done with decode, aborting!" << LL_ENDL;
- return TRUE;
+ return true;
}
char pcmout[4096]; /*Flawfinder: ignore*/
- BOOL eof = FALSE;
+ bool eof = false;
long ret=ov_read(&mVF, pcmout, sizeof(pcmout), 0, 2, 1, &mCurrentSection);
if (ret == 0)
{
/* EOF */
- eof = TRUE;
- mDone = TRUE;
- mValid = TRUE;
+ eof = true;
+ mDone = true;
+ mValid = true;
// LL_INFOS("AudioEngine") << "Vorbis EOF" << LL_ENDL;
}
else if (ret < 0)
@@ -394,10 +394,10 @@ BOOL LLVorbisDecodeState::decodeSection()
LL_WARNS("AudioEngine") << "BAD vorbis decode in decodeSection." << LL_ENDL;
- mValid = FALSE;
- mDone = TRUE;
- // We're done, return TRUE.
- return TRUE;
+ mValid = false;
+ mDone = true;
+ // We're done, return true.
+ return true;
}
else
{
@@ -409,12 +409,12 @@ BOOL LLVorbisDecodeState::decodeSection()
return eof;
}
-BOOL LLVorbisDecodeState::finishDecode()
+bool LLVorbisDecodeState::finishDecode()
{
if (!isValid())
{
LL_WARNS("AudioEngine") << "Bogus vorbis decode state for " << getUUID() << ", aborting!" << LL_ENDL;
- return TRUE; // We've finished
+ return true; // We've finished
}
if (mFileHandle == LLLFSThread::nullHandle())
@@ -487,8 +487,8 @@ BOOL LLVorbisDecodeState::finishDecode()
if (36 == data_length)
{
LL_WARNS("AudioEngine") << "BAD Vorbis decode in finishDecode!" << LL_ENDL;
- mValid = FALSE;
- return TRUE; // we've finished
+ mValid = false;
+ return true; // we've finished
}
mBytesRead = -1;
mFileHandle = LLLFSThread::sLocal->write(mOutFilename, &mWAVBuffer[0], 0, mWAVBuffer.size(),
@@ -502,21 +502,21 @@ BOOL LLVorbisDecodeState::finishDecode()
if (mBytesRead == 0)
{
LL_WARNS("AudioEngine") << "Unable to write file in LLVorbisDecodeState::finishDecode" << LL_ENDL;
- mValid = FALSE;
- return TRUE; // we've finished
+ mValid = false;
+ return true; // we've finished
}
}
else
{
- return FALSE; // not done
+ return false; // not done
}
}
- mDone = TRUE;
+ mDone = true;
LL_DEBUGS("AudioEngine") << "Finished decode for " << getUUID() << LL_ENDL;
- return TRUE;
+ return true;
}
void LLVorbisDecodeState::flushBadFile()
@@ -779,13 +779,13 @@ void LLAudioDecodeMgr::processQueue()
mImpl->processQueue();
}
-BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
+bool LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
{
if (gAudiop && gAudiop->hasDecodedFile(uuid))
{
// Already have a decoded version, don't need to decode it.
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has decoded file already" << LL_ENDL;
- return TRUE;
+ return true;
}
if (gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND))
@@ -793,9 +793,9 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
// Just put it on the decode queue.
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has local asset file already" << LL_ENDL;
mImpl->mDecodeQueue.push_back(uuid);
- return TRUE;
+ return true;
}
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " no file available" << LL_ENDL;
- return FALSE;
+ return false;
}