Audacity  2.2.0
ODFileDecoder Class Referenceabstract

class to decode a particular file (one per file). Saves info such as filename and length (after the header is read.) More...

#include <ODDecodeTask.h>

Inheritance diagram for ODFileDecoder:
ODFlacDecoder

Public Member Functions

 ODFileDecoder (const wxString &fName)
 This should handle unicode converted to UTF-8 on mac/linux, but OD TODO:check on windows. More...
 
virtual ~ODFileDecoder ()
 
virtual bool ReadHeader ()=0
 
virtual bool Init ()
 
virtual bool SeekingAllowed ()
 
virtual int Decode (SampleBuffer &data, sampleFormat &format, sampleCount start, size_t len, unsigned int channel)=0
 
const wxString & GetFileName ()
 
bool IsInitialized ()
 

Protected Member Functions

void MarkInitialized ()
 Derived classes should call this after they have parsed the header. More...
 

Protected Attributes

bool mInited
 
ODLock mInitedLock
 
const wxString mFName
 
unsigned int mSampleRate
 
unsigned int mNumSamples
 
unsigned int mNumChannels
 

Detailed Description

class to decode a particular file (one per file). Saves info such as filename and length (after the header is read.)

Constructor & Destructor Documentation

ODFileDecoder::ODFileDecoder ( const wxString &  fName)

This should handle unicode converted to UTF-8 on mac/linux, but OD TODO:check on windows.

ODFileDecoder::~ODFileDecoder ( )
virtual

Member Function Documentation

virtual int ODFileDecoder::Decode ( SampleBuffer data,
sampleFormat &  format,
sampleCount  start,
size_t  len,
unsigned int  channel 
)
pure virtual

Decodes the samples for this blockfile from the real file into a float buffer. This is file specific, so subclasses must implement this only. the buffer should be created by the ODFileDecoder implementing this method. It should set the format parameter so that the client code can deal with it. This class should call ReadHeader() first, so it knows the length, and can prepare the file object if it needs to. returns negative value for failure, 0 or positive value for success.

Implemented in ODFlacDecoder.

Referenced by ODDecodeBlockFile::WriteODDecodeBlockFile().

const wxString& ODFileDecoder::GetFileName ( )
inline

References mFName.

virtual bool ODFileDecoder::Init ( )
inlinevirtual

References ReadHeader().

Referenced by ODDecodeTask::DoSomeInternal().

bool ODFileDecoder::IsInitialized ( )

References mInited, and mInitedLock.

Referenced by ODDecodeTask::DoSomeInternal().

void ODFileDecoder::MarkInitialized ( )
protected

Derived classes should call this after they have parsed the header.

References mInited, and mInitedLock.

Referenced by ODFlacDecoder::ReadHeader().

virtual bool ODFileDecoder::ReadHeader ( )
pure virtual

Read header. Subclasses must override. Probably should save the info somewhere. Ideally called once per decoding of a file. This complicates the task because

Implemented in ODFlacDecoder.

Referenced by Init().

virtual bool ODFileDecoder::SeekingAllowed ( )
inlinevirtual

Member Data Documentation

const wxString ODFileDecoder::mFName
protected
bool ODFileDecoder::mInited
protected

Referenced by IsInitialized(), and MarkInitialized().

ODLock ODFileDecoder::mInitedLock
protected

Referenced by IsInitialized(), and MarkInitialized().

unsigned int ODFileDecoder::mNumChannels
protected
unsigned int ODFileDecoder::mNumSamples
protected
unsigned int ODFileDecoder::mSampleRate
protected

The documentation for this class was generated from the following files: