forked from teamnwah/openmw-tes3coop
Handle the wav -> mp3 extension conversion in the sound output backend
This commit is contained in:
parent
f11e3e39a1
commit
15317796bf
3 changed files with 13 additions and 23 deletions
|
@ -238,17 +238,7 @@ size_t FFmpeg_Decoder::MyStream::readAVAudioData(void *data, size_t length)
|
|||
void FFmpeg_Decoder::open(const std::string &fname)
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
mDataStream = mResourceMgr.openResource(fname);
|
||||
}
|
||||
catch(Ogre::Exception &e)
|
||||
{
|
||||
std::string::size_type pos = fname.rfind('.');
|
||||
if(pos == std::string::npos)
|
||||
throw;
|
||||
mDataStream = mResourceMgr.openResource(fname.substr(0, pos)+".mp3");
|
||||
}
|
||||
mDataStream = mResourceMgr.openResource(fname);
|
||||
|
||||
if((mFormatCtx=avformat_alloc_context()) == NULL)
|
||||
fail("Failed to allocate context");
|
||||
|
|
|
@ -81,17 +81,7 @@ off_t MpgSnd_Decoder::ogrempg_lseek(void *user_data, off_t offset, int whence)
|
|||
void MpgSnd_Decoder::open(const std::string &fname)
|
||||
{
|
||||
close();
|
||||
try
|
||||
{
|
||||
mDataStream = mResourceMgr.openResource(fname);
|
||||
}
|
||||
catch(Ogre::Exception &e)
|
||||
{
|
||||
std::string::size_type pos = fname.rfind('.');
|
||||
if(pos == std::string::npos)
|
||||
throw;
|
||||
mDataStream = mResourceMgr.openResource(fname.substr(0, pos)+".mp3");
|
||||
}
|
||||
mDataStream = mResourceMgr.openResource(fname);
|
||||
|
||||
SF_VIRTUAL_IO streamIO = {
|
||||
ogresf_get_filelen, ogresf_seek,
|
||||
|
|
|
@ -465,7 +465,17 @@ ALuint OpenAL_Output::getBuffer(const std::string &fname)
|
|||
int srate;
|
||||
|
||||
DecoderPtr decoder = mManager.getDecoder();
|
||||
decoder->open(fname);
|
||||
try
|
||||
{
|
||||
decoder->open(fname);
|
||||
}
|
||||
catch(Ogre::FileNotFoundException &e)
|
||||
{
|
||||
std::string::size_type pos = fname.rfind('.');
|
||||
if(pos == std::string::npos)
|
||||
throw;
|
||||
decoder->open(fname.substr(0, pos)+".mp3");
|
||||
}
|
||||
|
||||
decoder->getInfo(&srate, &chans, &type);
|
||||
format = getALFormat(chans, type);
|
||||
|
|
Loading…
Reference in a new issue