Audacity  3.0.3
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 <ODDecodeBlockFile.h>

Inheritance diagram for ODFileDecoder:
[legend]
Collaboration diagram for ODFileDecoder:
[legend]

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 193 of file ODDecodeBlockFile.h.

Constructor & Destructor Documentation

◆ ODFileDecoder()

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 538 of file ODDecodeBlockFile.cpp.

539  : mFName{ fName }
540 {
541  mInited = false;
542 }

◆ ~ODFileDecoder()

ODFileDecoder::~ODFileDecoder ( )
virtual

Definition at line 544 of file ODDecodeBlockFile.cpp.

545 {
546 }

Member Function Documentation

◆ Decode()

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().

Here is the caller graph for this function:

◆ GetFileName()

const wxString& ODFileDecoder::GetFileName ( )
inline

Definition at line 216 of file ODDecodeBlockFile.h.

216 {return mFName;}

References mFName.

◆ Init()

virtual bool ODFileDecoder::Init ( )
inlinevirtual

Definition at line 203 of file ODDecodeBlockFile.h.

203 {return ReadHeader();}

References ReadHeader().

Referenced by ODDecodeTask::DoSomeInternal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsInitialized()

bool ODFileDecoder::IsInitialized ( )

Definition at line 548 of file ODDecodeBlockFile.cpp.

549 {
550  bool ret;
551  mInitedLock.Lock();
552  ret = mInited;
553  mInitedLock.Unlock();
554  return ret;
555 }

References mInited, and mInitedLock.

Referenced by ODDecodeTask::DoSomeInternal().

Here is the caller graph for this function:

◆ MarkInitialized()

void ODFileDecoder::MarkInitialized ( )
protected

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

Definition at line 558 of file ODDecodeBlockFile.cpp.

559 {
560  mInitedLock.Lock();
561  mInited=true;
562  mInitedLock.Unlock();
563 }

References mInited, and mInitedLock.

Referenced by ODFlacDecoder::ReadHeader().

Here is the caller graph for this function:

◆ 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().

Here is the caller graph for this function:

◆ SeekingAllowed()

virtual bool ODFileDecoder::SeekingAllowed ( )
inlinevirtual

Definition at line 205 of file ODDecodeBlockFile.h.

205 {return true;}

Member Data Documentation

◆ mFName

const wxString ODFileDecoder::mFName
protected

Definition at line 227 of file ODDecodeBlockFile.h.

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

◆ mInited

bool ODFileDecoder::mInited
protected

Definition at line 224 of file ODDecodeBlockFile.h.

Referenced by IsInitialized(), and MarkInitialized().

◆ mInitedLock

ODLock ODFileDecoder::mInitedLock
protected

Definition at line 225 of file ODDecodeBlockFile.h.

Referenced by IsInitialized(), and MarkInitialized().

◆ mNumChannels

unsigned int ODFileDecoder::mNumChannels
protected

Definition at line 231 of file ODDecodeBlockFile.h.

◆ mNumSamples

unsigned int ODFileDecoder::mNumSamples
protected

Definition at line 230 of file ODDecodeBlockFile.h.

◆ mSampleRate

unsigned int ODFileDecoder::mSampleRate
protected

Definition at line 229 of file ODDecodeBlockFile.h.


The documentation for this class was generated from the following files:
ODFileDecoder::mInited
bool mInited
Definition: ODDecodeBlockFile.h:224
ODFileDecoder::mInitedLock
ODLock mInitedLock
Definition: ODDecodeBlockFile.h:225
ODFileDecoder::ReadHeader
virtual bool ReadHeader()=0
ODFileDecoder::mFName
const wxString mFName
Definition: ODDecodeBlockFile.h:227