mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:23:53 +00:00
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)
|
||||
{ }
|
||||
virtual ~OgreFile() { }
|
||||
|
||||
Ogre::String getName()
|
||||
{ return mStream->getName(); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -60,7 +63,7 @@ void Audiere_Decoder::open(const std::string &fname)
|
|||
{
|
||||
close();
|
||||
|
||||
audiere::FilePtr file(new OgreFile(mResourceMgr.openResource(fname)));
|
||||
mSoundFile = audiere::FilePtr(new OgreFile(mResourceMgr.openResource(fname)));
|
||||
mSoundSource = audiere::OpenSampleSource(file);
|
||||
|
||||
int channels, srate;
|
||||
|
@ -86,9 +89,15 @@ void Audiere_Decoder::open(const std::string &fname)
|
|||
|
||||
void Audiere_Decoder::close()
|
||||
{
|
||||
mSoundFile = NULL;
|
||||
mSoundSource = NULL;
|
||||
}
|
||||
|
||||
std::string Audiere_Decoder::getName()
|
||||
{
|
||||
return mSoundFile->getName();
|
||||
}
|
||||
|
||||
void Audiere_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
||||
{
|
||||
*samplerate = mSampleRate;
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace MWSound
|
|||
{
|
||||
class Audiere_Decoder : public Sound_Decoder
|
||||
{
|
||||
audiere::FilePtr mSoundFile;
|
||||
audiere::SampleSourcePtr mSoundSource;
|
||||
int mSampleRate;
|
||||
SampleType mSampleType;
|
||||
|
|
|
@ -324,6 +324,11 @@ void FFmpeg_Decoder::close()
|
|||
mDataStream.setNull();
|
||||
}
|
||||
|
||||
std::string FFmpeg_Decoder::getName()
|
||||
{
|
||||
return mFormatCtx->filename;
|
||||
}
|
||||
|
||||
void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
||||
{
|
||||
if(mStreams.empty())
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace MWSound
|
|||
virtual void open(const std::string &fname);
|
||||
virtual void close();
|
||||
|
||||
virtual std::string getName();
|
||||
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type);
|
||||
|
||||
virtual size_t read(char *buffer, size_t bytes);
|
||||
|
|
|
@ -155,6 +155,11 @@ void MpgSnd_Decoder::close()
|
|||
mDataStream.setNull();
|
||||
}
|
||||
|
||||
std::string MpgSnd_Decoder::getName()
|
||||
{
|
||||
return mDataStream->getName();
|
||||
}
|
||||
|
||||
void MpgSnd_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
|
||||
{
|
||||
if(!mSndFile && !mMpgFile)
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace MWSound
|
|||
virtual void open(const std::string &fname) = 0;
|
||||
virtual void close() = 0;
|
||||
|
||||
virtual std::string getName() = 0;
|
||||
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0;
|
||||
|
||||
virtual size_t read(char *buffer, size_t bytes) = 0;
|
||||
|
|
Loading…
Reference in a new issue