forked from teamnwah/openmw-tes3coop
Add a decoder method to get the "file" name
This commit is contained in:
parent
1fb9eef27b
commit
9c831d3039
6 changed files with 23 additions and 1 deletions
|
@ -53,6 +53,9 @@ public:
|
||||||
: mStream(stream), refs(1)
|
: mStream(stream), refs(1)
|
||||||
{ }
|
{ }
|
||||||
virtual ~OgreFile() { }
|
virtual ~OgreFile() { }
|
||||||
|
|
||||||
|
Ogre::String getName()
|
||||||
|
{ return mStream->getName(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +63,7 @@ void Audiere_Decoder::open(const std::string &fname)
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
|
||||||
audiere::FilePtr file(new OgreFile(mResourceMgr.openResource(fname)));
|
mSoundFile = audiere::FilePtr(new OgreFile(mResourceMgr.openResource(fname)));
|
||||||
mSoundSource = audiere::OpenSampleSource(file);
|
mSoundSource = audiere::OpenSampleSource(file);
|
||||||
|
|
||||||
int channels, srate;
|
int channels, srate;
|
||||||
|
@ -86,9 +89,15 @@ void Audiere_Decoder::open(const std::string &fname)
|
||||||
|
|
||||||
void Audiere_Decoder::close()
|
void Audiere_Decoder::close()
|
||||||
{
|
{
|
||||||
|
mSoundFile = NULL;
|
||||||
mSoundSource = NULL;
|
mSoundSource = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Audiere_Decoder::getName()
|
||||||
|
{
|
||||||
|
return mSoundFile->getName();
|
||||||
|
}
|
||||||
|
|
||||||
void Audiere_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
void Audiere_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
||||||
{
|
{
|
||||||
*samplerate = mSampleRate;
|
*samplerate = mSampleRate;
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
class Audiere_Decoder : public Sound_Decoder
|
class Audiere_Decoder : public Sound_Decoder
|
||||||
{
|
{
|
||||||
|
audiere::FilePtr mSoundFile;
|
||||||
audiere::SampleSourcePtr mSoundSource;
|
audiere::SampleSourcePtr mSoundSource;
|
||||||
int mSampleRate;
|
int mSampleRate;
|
||||||
SampleType mSampleType;
|
SampleType mSampleType;
|
||||||
|
|
|
@ -324,6 +324,11 @@ void FFmpeg_Decoder::close()
|
||||||
mDataStream.setNull();
|
mDataStream.setNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string FFmpeg_Decoder::getName()
|
||||||
|
{
|
||||||
|
return mFormatCtx->filename;
|
||||||
|
}
|
||||||
|
|
||||||
void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
||||||
{
|
{
|
||||||
if(mStreams.empty())
|
if(mStreams.empty())
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace MWSound
|
||||||
virtual void open(const std::string &fname);
|
virtual void open(const std::string &fname);
|
||||||
virtual void close();
|
virtual void close();
|
||||||
|
|
||||||
|
virtual std::string getName();
|
||||||
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type);
|
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type);
|
||||||
|
|
||||||
virtual size_t read(char *buffer, size_t bytes);
|
virtual size_t read(char *buffer, size_t bytes);
|
||||||
|
|
|
@ -155,6 +155,11 @@ void MpgSnd_Decoder::close()
|
||||||
mDataStream.setNull();
|
mDataStream.setNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string MpgSnd_Decoder::getName()
|
||||||
|
{
|
||||||
|
return mDataStream->getName();
|
||||||
|
}
|
||||||
|
|
||||||
void MpgSnd_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
void MpgSnd_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
||||||
{
|
{
|
||||||
if(!mSndFile && !mMpgFile)
|
if(!mSndFile && !mMpgFile)
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace MWSound
|
||||||
virtual void open(const std::string &fname) = 0;
|
virtual void open(const std::string &fname) = 0;
|
||||||
virtual void close() = 0;
|
virtual void close() = 0;
|
||||||
|
|
||||||
|
virtual std::string getName() = 0;
|
||||||
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0;
|
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0;
|
||||||
|
|
||||||
virtual size_t read(char *buffer, size_t bytes) = 0;
|
virtual size_t read(char *buffer, size_t bytes) = 0;
|
||||||
|
|
Loading…
Reference in a new issue