svcore  1.9
MP3FileReader Class Reference

#include <MP3FileReader.h>

Inheritance diagram for MP3FileReader:
Collaboration diagram for MP3FileReader:

List of all members.

Classes

struct  DecoderData
class  DecodeThread

Public Types

enum  DecodeMode { DecodeAtOnce, DecodeThreaded }
enum  CacheMode { CacheInTemporaryFile, CacheInMemory }
typedef std::map< QString,
QString > 
TagMap

Public Slots

void cancelled ()

Signals

void progress (int)
void frameCountChanged ()

Public Member Functions

 MP3FileReader (FileSource source, DecodeMode decodeMode, CacheMode cacheMode, int targetRate=0, bool normalised=false, ProgressReporter *reporter=0)
virtual ~MP3FileReader ()
virtual QString getError () const
virtual QString getLocation () const
 Return the location of the audio data in the reader (as passed in to the FileSource constructor, for example).
virtual QString getTitle () const
 Return the title of the work in the audio file, if known.
virtual QString getMaker () const
 Return the "maker" of the work in the audio file, if known.
virtual TagMap getTags () const
virtual int getDecodeCompletion () const
virtual bool isUpdating () const
virtual void getInterleavedFrames (int start, int count, SampleBlock &frames) const
 Return interleaved samples for count frames from index start.
virtual int getNativeRate () const
virtual bool isQuicklySeekable () const
 Intermediate cache means all CodedAudioFileReaders are quickly seekable.
bool isOK () const
int getFrameCount () const
int getChannelCount () const
int getSampleRate () const
virtual void getDeInterleavedFrames (int start, int count, std::vector< SampleBlock > &frames) const
 Return de-interleaved samples for count frames from index start.

Static Public Member Functions

static void getSupportedExtensions (std::set< QString > &extensions)
static bool supportsExtension (QString ext)
static bool supportsContentType (QString type)
static bool supports (FileSource &source)

Protected Member Functions

bool decode (void *mm, int sz)
enum mad_flow accept (struct mad_header const *, struct mad_pcm *)
void loadTags ()
QString loadTag (void *vtag, const char *name)
void initialiseDecodeCache ()
void addSamplesToDecodeCache (float **samples, int nframes)
void addSamplesToDecodeCache (float *samplesInterleaved, int nframes)
void addSamplesToDecodeCache (const SampleBlock &interleaved)
void finishDecodeCache ()
bool isDecodeCacheInitialised () const
void startSerialised (QString id)
void endSerialised ()

Static Protected Member Functions

static enum mad_flow input (void *, struct mad_stream *)
static enum mad_flow output (void *, struct mad_header const *, struct mad_pcm *)
static enum mad_flow error (void *, struct mad_stream *, struct mad_frame *)

Protected Attributes

FileSource m_source
QString m_path
QString m_error
QString m_title
QString m_maker
TagMap m_tags
int m_fileSize
double m_bitrateNum
int m_bitrateDenom
int m_completion
bool m_done
unsigned char * m_filebuffer
float ** m_samplebuffer
int m_samplebuffersize
ProgressReporterm_reporter
bool m_cancelled
DecodeThreadm_decodeThread
QMutex m_cacheMutex
CacheMode m_cacheMode
SampleBlock m_data
QReadWriteLock m_dataLock
bool m_initialised
Serialiserm_serialiser
int m_fileRate
QString m_cacheFileName
SNDFILE * m_cacheFileWritePtr
WavFileReaderm_cacheFileReader
float * m_cacheWriteBuffer
int m_cacheWriteBufferIndex
int m_cacheWriteBufferSize
Resamplerm_resampler
float * m_resampleBuffer
int m_fileFrameCount
bool m_normalised
float m_max
float m_gain
int m_frameCount
int m_channelCount
int m_sampleRate

Detailed Description

Definition at line 30 of file MP3FileReader.h.


Member Typedef Documentation

typedef std::map<QString, QString> AudioFileReader::TagMap [inherited]

Definition at line 65 of file AudioFileReader.h.


Member Enumeration Documentation

Enumerator:
DecodeAtOnce 
DecodeThreaded 

Definition at line 35 of file MP3FileReader.h.

Enumerator:
CacheInTemporaryFile 
CacheInMemory 

Definition at line 36 of file CodedAudioFileReader.h.


Constructor & Destructor Documentation

Definition at line 149 of file MP3FileReader.cpp.

References m_cancelled, and m_decodeThread.


Member Function Documentation

virtual QString MP3FileReader::getError ( ) const [inline, virtual]

Reimplemented from AudioFileReader.

Definition at line 48 of file MP3FileReader.h.

References m_error.

virtual QString MP3FileReader::getLocation ( ) const [inline, virtual]

Return the location of the audio data in the reader (as passed in to the FileSource constructor, for example).

Reimplemented from AudioFileReader.

Definition at line 50 of file MP3FileReader.h.

References FileSource::getLocation(), and m_source.

virtual QString MP3FileReader::getTitle ( ) const [inline, virtual]

Return the title of the work in the audio file, if known.

This may be implemented by subclasses that support file tagging. This is not the same thing as the file name.

Reimplemented from AudioFileReader.

Definition at line 51 of file MP3FileReader.h.

References m_title.

virtual QString MP3FileReader::getMaker ( ) const [inline, virtual]

Return the "maker" of the work in the audio file, if known.

This could represent almost anything (band, composer, conductor, artist etc).

Reimplemented from AudioFileReader.

Definition at line 52 of file MP3FileReader.h.

References m_maker.

virtual TagMap MP3FileReader::getTags ( ) const [inline, virtual]

Reimplemented from AudioFileReader.

Definition at line 53 of file MP3FileReader.h.

References m_tags.

void MP3FileReader::getSupportedExtensions ( std::set< QString > &  extensions) [static]
bool MP3FileReader::supportsExtension ( QString  ext) [static]

Definition at line 451 of file MP3FileReader.cpp.

References getSupportedExtensions().

Referenced by supports().

bool MP3FileReader::supportsContentType ( QString  type) [static]

Definition at line 459 of file MP3FileReader.cpp.

Referenced by supports().

virtual int MP3FileReader::getDecodeCompletion ( ) const [inline, virtual]

Reimplemented from AudioFileReader.

Definition at line 60 of file MP3FileReader.h.

References m_completion.

virtual bool MP3FileReader::isUpdating ( ) const [inline, virtual]

Reimplemented from AudioFileReader.

Definition at line 62 of file MP3FileReader.h.

References m_decodeThread.

void MP3FileReader::cancelled ( ) [slot]

Definition at line 159 of file MP3FileReader.cpp.

References m_cancelled.

Referenced by MP3FileReader().

enum mad_flow MP3FileReader::input ( void *  dp,
struct mad_stream *  stream 
) [static, protected]

Definition at line 312 of file MP3FileReader.cpp.

References MP3FileReader::DecoderData::length, and MP3FileReader::DecoderData::start.

Referenced by decode().

enum mad_flow MP3FileReader::output ( void *  dp,
struct mad_header const *  header,
struct mad_pcm *  pcm 
) [static, protected]

Definition at line 339 of file MP3FileReader.cpp.

References accept(), and MP3FileReader::DecoderData::reader.

Referenced by decode().

enum mad_flow MP3FileReader::error ( void *  ,
struct mad_stream *  ,
struct mad_frame *   
) [static, protected]

Definition at line 431 of file MP3FileReader.cpp.

Referenced by decode().

void MP3FileReader::loadTags ( ) [protected]

Definition at line 165 of file MP3FileReader.cpp.

References loadTag(), m_maker, m_path, m_tags, m_title, and SVDEBUG.

Referenced by MP3FileReader().

QString MP3FileReader::loadTag ( void *  vtag,
const char *  name 
) [protected]

Definition at line 211 of file MP3FileReader.cpp.

References SVDEBUG.

Referenced by loadTags().

void CodedAudioFileReader::getInterleavedFrames ( int  start,
int  count,
SampleBlock frames 
) const [virtual, inherited]

Return interleaved samples for count frames from index start.

The resulting sample block will contain count * getChannelCount() samples (or fewer if end of file is reached).

The subclass implementations of this function must be thread-safe -- that is, safe to call from multiple threads with different arguments on the same object at the same time.

Implements AudioFileReader.

Definition at line 409 of file CodedAudioFileReader.cpp.

References CodedAudioFileReader::CacheInMemory, CodedAudioFileReader::CacheInTemporaryFile, WavFileReader::getInterleavedFrames(), AudioFileReader::isOK(), CodedAudioFileReader::m_cacheFileReader, CodedAudioFileReader::m_cacheMode, AudioFileReader::m_channelCount, CodedAudioFileReader::m_data, CodedAudioFileReader::m_dataLock, CodedAudioFileReader::m_gain, CodedAudioFileReader::m_initialised, CodedAudioFileReader::m_normalised, and SVDEBUG.

virtual int CodedAudioFileReader::getNativeRate ( ) const [inline, virtual, inherited]

Reimplemented from AudioFileReader.

Definition at line 44 of file CodedAudioFileReader.h.

References CodedAudioFileReader::m_fileRate.

virtual bool CodedAudioFileReader::isQuicklySeekable ( ) const [inline, virtual, inherited]

Intermediate cache means all CodedAudioFileReaders are quickly seekable.

Implements AudioFileReader.

Definition at line 47 of file CodedAudioFileReader.h.

void AudioFileReader::getDeInterleavedFrames ( int  start,
int  count,
std::vector< SampleBlock > &  frames 
) const [virtual, inherited]

Return de-interleaved samples for count frames from index start.

Implemented in this class (it calls getInterleavedFrames and de-interleaves). The resulting vector will contain getChannelCount() sample blocks of count samples each (or fewer if end of file is reached).

Definition at line 19 of file AudioFileReader.cpp.

References AudioFileReader::getChannelCount(), and AudioFileReader::getInterleavedFrames().

void AudioFileReader::frameCountChanged ( ) [signal, inherited]

Member Data Documentation

Definition at line 70 of file MP3FileReader.h.

Referenced by getLocation().

QString MP3FileReader::m_path [protected]

Definition at line 71 of file MP3FileReader.h.

Referenced by loadTags(), MP3FileReader(), and MP3FileReader::DecodeThread::run().

QString MP3FileReader::m_error [protected]

Definition at line 72 of file MP3FileReader.h.

Referenced by getError(), MP3FileReader(), and MP3FileReader::DecodeThread::run().

QString MP3FileReader::m_title [protected]

Definition at line 73 of file MP3FileReader.h.

Referenced by getTitle(), and loadTags().

QString MP3FileReader::m_maker [protected]

Definition at line 74 of file MP3FileReader.h.

Referenced by getMaker(), and loadTags().

Definition at line 75 of file MP3FileReader.h.

Referenced by getTags(), and loadTags().

int MP3FileReader::m_fileSize [protected]

Definition at line 76 of file MP3FileReader.h.

Referenced by accept(), MP3FileReader(), and MP3FileReader::DecodeThread::run().

double MP3FileReader::m_bitrateNum [protected]

Definition at line 77 of file MP3FileReader.h.

Referenced by accept(), and MP3FileReader().

Definition at line 78 of file MP3FileReader.h.

Referenced by accept(), and MP3FileReader().

bool MP3FileReader::m_done [protected]

Definition at line 80 of file MP3FileReader.h.

Referenced by decode(), MP3FileReader(), and MP3FileReader::DecodeThread::run().

unsigned char* MP3FileReader::m_filebuffer [protected]

Definition at line 82 of file MP3FileReader.h.

Referenced by MP3FileReader(), and MP3FileReader::DecodeThread::run().

float** MP3FileReader::m_samplebuffer [protected]

Definition at line 83 of file MP3FileReader.h.

Referenced by accept(), MP3FileReader(), and MP3FileReader::DecodeThread::run().

Definition at line 84 of file MP3FileReader.h.

Referenced by accept(), and MP3FileReader().

Definition at line 86 of file MP3FileReader.h.

Referenced by accept(), and MP3FileReader().

bool MP3FileReader::m_cancelled [protected]

Definition at line 87 of file MP3FileReader.h.

Referenced by accept(), cancelled(), MP3FileReader(), and ~MP3FileReader().

Definition at line 113 of file MP3FileReader.h.

Referenced by isUpdating(), MP3FileReader(), and ~MP3FileReader().

QReadWriteLock CodedAudioFileReader::m_dataLock [mutable, protected, inherited]
float CodedAudioFileReader::m_max [protected, inherited]

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