Audacity  2.2.2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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.)

Definition at line 100 of file ODDecodeTask.h.

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.

Definition at line 294 of file ODDecodeTask.cpp.

295  : mFName{ fName }
296 {
297  mInited = false;
298 }
const wxString mFName
Definition: ODDecodeTask.h:134
ODFileDecoder::~ODFileDecoder ( )
virtual

Definition at line 300 of file ODDecodeTask.cpp.

301 {
302 }

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

Definition at line 123 of file ODDecodeTask.h.

References mFName.

123 {return mFName;}
const wxString mFName
Definition: ODDecodeTask.h:134
virtual bool ODFileDecoder::Init ( )
inlinevirtual

Definition at line 110 of file ODDecodeTask.h.

References ReadHeader().

Referenced by ODDecodeTask::DoSomeInternal().

110 {return ReadHeader();}
virtual bool ReadHeader()=0
bool ODFileDecoder::IsInitialized ( )

Definition at line 304 of file ODDecodeTask.cpp.

References mInited, and mInitedLock.

Referenced by ODDecodeTask::DoSomeInternal().

305 {
306  bool ret;
307  mInitedLock.Lock();
308  ret = mInited;
309  mInitedLock.Unlock();
310  return ret;
311 }
ODLock mInitedLock
Definition: ODDecodeTask.h:132
void ODFileDecoder::MarkInitialized ( )
protected

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

Definition at line 314 of file ODDecodeTask.cpp.

References mInited, and mInitedLock.

Referenced by ODFlacDecoder::ReadHeader().

315 {
316  mInitedLock.Lock();
317  mInited=true;
318  mInitedLock.Unlock();
319 }
ODLock mInitedLock
Definition: ODDecodeTask.h:132
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

Definition at line 112 of file ODDecodeTask.h.

112 {return true;}

Member Data Documentation

const wxString ODFileDecoder::mFName
protected

Definition at line 134 of file ODDecodeTask.h.

Referenced by GetFileName(), and ODFlacDecoder::ReadHeader().

bool ODFileDecoder::mInited
protected

Definition at line 131 of file ODDecodeTask.h.

Referenced by IsInitialized(), and MarkInitialized().

ODLock ODFileDecoder::mInitedLock
protected

Definition at line 132 of file ODDecodeTask.h.

Referenced by IsInitialized(), and MarkInitialized().

unsigned int ODFileDecoder::mNumChannels
protected

Definition at line 138 of file ODDecodeTask.h.

unsigned int ODFileDecoder::mNumSamples
protected

Definition at line 137 of file ODDecodeTask.h.

unsigned int ODFileDecoder::mSampleRate
protected

Definition at line 136 of file ODDecodeTask.h.


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