MythTV  master
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CdDecoder Class Reference

#include <cddecoder.h>

Inheritance diagram for CdDecoder:
Inheritance graph
[legend]
Collaboration diagram for CdDecoder:
Collaboration graph
[legend]

Public Member Functions

 CdDecoder (const QString &file, DecoderFactory *d, AudioOutput *o)
 
 ~CdDecoder () override
 
bool initialize () override
 
void seek (double pos) override
 
void stop () override
 
MusicMetadatagetMetadata (void)
 
MusicMetadatagetMetadata (int track)
 
int getNumTracks ()
 
int getNumCDAudioTracks ()
 
void setDevice (const QString &dev)
 
void setCDSpeed (int speed)
 
- Public Member Functions inherited from Decoder
 ~Decoder () override
 
DecoderFactoryfactory () const
 
AudioOutputoutput ()
 
void setOutput (AudioOutput *o)
 
void setURL (const QString &url)
 
virtual void lock (void)
 
virtual void unlock (void)
 
virtual bool tryLock (void)
 
QWaitCondition * cond ()
 
QString getURL (void) const
 
- Public Member Functions inherited from MThread
 MThread (const QString &objectName)
 Standard constructor. More...
 
 MThread (const QString &objectName, QRunnable *runnable)
 Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More...
 
virtual ~MThread ()
 
 MThread (const MThread &)=delete
 
MThreadoperator= (const MThread &)=delete
 
void RunProlog (void)
 Sets up a thread, call this if you reimplement run(). More...
 
void RunEpilog (void)
 Cleans up a thread's resources, call this if you reimplement run(). More...
 
QThread * qthread (void)
 Returns the thread, this will always return the same pointer no matter how often you restart the thread. More...
 
void setObjectName (const QString &name)
 
QString objectName (void) const
 
void setPriority (QThread::Priority priority)
 
QThread::Priority priority (void) const
 
bool isFinished (void) const
 
bool isRunning (void) const
 
void setStackSize (uint stackSize)
 
uint stackSize (void) const
 
void exit (int retcode=0)
 Use this to exit from the thread if you are using a Qt event loop. More...
 
void start (QThread::Priority p=QThread::InheritPriority)
 Tell MThread to start running the thread in the near future. More...
 
void terminate (void)
 Kill a thread unsafely. More...
 
void quit (void)
 calls exit(0) More...
 
bool wait (std::chrono::milliseconds time=std::chrono::milliseconds::max())
 Wait for the MThread to exit, with a maximum timeout. More...
 
- Public Member Functions inherited from MythObservable
 MythObservable ()
 
virtual ~MythObservable ()
 
void addListener (QObject *listener)
 Add a listener to the observable. More...
 
void removeListener (QObject *listener)
 Remove a listener to the observable. More...
 
void dispatch (const MythEvent &event)
 Dispatch an event to all listeners. More...
 
bool hasListeners (void)
 

Private Member Functions

 Q_DECLARE_TR_FUNCTIONS (CdDecoder)
 
void run () override
 Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead. More...
 
void writeBlock ()
 
void deinit ()
 

Static Private Member Functions

static QRecursiveMutex & getCdioMutex ()
 

Private Attributes

volatile bool m_inited {false}
 
volatile bool m_userStop {false}
 
QString m_deviceName
 
DecoderEvent::Type m_stat {DecoderEvent::kError}
 
char * m_outputBuf {nullptr}
 
std::size_t m_outputAt {0}
 
std::size_t m_bks {0}
 
std::size_t m_bksFrames {0}
 
std::size_t m_decodeBytes {0}
 
bool m_finish {false}
 
long m_freq {0}
 
long m_bitrate {0}
 
int m_chan {0}
 
double m_seekTime {-1.0}
 
int m_setTrackNum {-1}
 
int m_trackNum {0}
 

Additional Inherited Members

- Static Public Member Functions inherited from Decoder
static QStringList all ()
 
static bool supports (const QString &source)
 
static void registerFactory (DecoderFactory *fact)
 
static Decodercreate (const QString &source, AudioOutput *output, bool deletable=false)
 
- Static Public Member Functions inherited from MThread
static void ThreadSetup (const QString &name)
 This is to be called on startup in those few threads that haven't been ported to MThread. More...
 
static void ThreadCleanup (void)
 This is to be called on exit in those few threads that haven't been ported to MThread. More...
 
static void Cleanup (void)
 This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More...
 
static void GetAllThreadNames (QStringList &list)
 
static void GetAllRunningThreadNames (QStringList &list)
 
- Protected Member Functions inherited from Decoder
 Decoder (DecoderFactory *d, AudioOutput *o)
 
QMutex * getMutex (void)
 
void error (const QString &e)
 
- Protected Member Functions inherited from MThread
int exec (void)
 Enters the qt event loop. call exit or quit to exit thread. More...
 
- Static Protected Member Functions inherited from MThread
static void setTerminationEnabled (bool enabled=true)
 
static void usleep (std::chrono::microseconds time)
 
template<typename R , typename P >
static std::enable_if_t< std::chrono::treat_as_floating_point< R >::value, void > usleep (std::chrono::duration< R, P > time)
 
- Protected Attributes inherited from Decoder
QString m_url
 
- Protected Attributes inherited from MThread
MThreadInternalm_thread {nullptr}
 
QRunnable * m_runnable {nullptr}
 
bool m_prologExecuted {true}
 
bool m_epilogExecuted {true}
 
- Protected Attributes inherited from MythObservable
QMutex * m_lock {nullptr}
 
QSet< QObject * > m_listeners
 

Detailed Description

Definition at line 24 of file cddecoder.h.

Constructor & Destructor Documentation

◆ CdDecoder()

CdDecoder::CdDecoder ( const QString &  file,
DecoderFactory d,
AudioOutput o 
)

Definition at line 91 of file cddecoder.cpp.

◆ ~CdDecoder()

CdDecoder::~CdDecoder ( )
override

Definition at line 98 of file cddecoder.cpp.

Member Function Documentation

◆ Q_DECLARE_TR_FUNCTIONS()

CdDecoder::Q_DECLARE_TR_FUNCTIONS ( CdDecoder  )
private

◆ initialize()

bool CdDecoder::initialize ( )
overridevirtual

Implements Decoder.

Definition at line 146 of file cddecoder.cpp.

◆ seek()

void CdDecoder::seek ( double  pos)
overridevirtual

Implements Decoder.

Definition at line 260 of file cddecoder.cpp.

◆ stop()

void CdDecoder::stop ( )
overridevirtual

Implements Decoder.

Definition at line 115 of file cddecoder.cpp.

◆ getMetadata() [1/2]

MusicMetadata * CdDecoder::getMetadata ( void  )

Definition at line 499 of file cddecoder.cpp.

Referenced by getMetadata(), and Ripper::ScanFinished().

◆ getMetadata() [2/2]

MusicMetadata * CdDecoder::getMetadata ( int  track)

Definition at line 488 of file cddecoder.cpp.

◆ getNumTracks()

int CdDecoder::getNumTracks ( )

Definition at line 446 of file cddecoder.cpp.

Referenced by Ripper::ScanFinished().

◆ getNumCDAudioTracks()

int CdDecoder::getNumCDAudioTracks ( )

Definition at line 464 of file cddecoder.cpp.

Referenced by getMetadata().

◆ setDevice()

void CdDecoder::setDevice ( const QString &  dev)

Definition at line 104 of file cddecoder.cpp.

Referenced by MusicPlayer::decoderHandlerReady(), and Ripper::scanCD().

◆ setCDSpeed()

void CdDecoder::setCDSpeed ( int  speed)

Definition at line 428 of file cddecoder.cpp.

Referenced by deinit(), and initialize().

◆ run()

void CdDecoder::run ( )
overrideprivatevirtual

Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.

Note
If you override this method you must call RunProlog before you do any work and RunEpilog before you exit the run method.

Reimplemented from MThread.

Definition at line 292 of file cddecoder.cpp.

◆ writeBlock()

void CdDecoder::writeBlock ( )
private

Definition at line 121 of file cddecoder.cpp.

Referenced by run().

◆ deinit()

void CdDecoder::deinit ( )
private

Definition at line 268 of file cddecoder.cpp.

Referenced by run(), and ~CdDecoder().

◆ getCdioMutex()

QRecursiveMutex & CdDecoder::getCdioMutex ( )
staticprivate

Member Data Documentation

◆ m_inited

volatile bool CdDecoder::m_inited {false}
private

Definition at line 56 of file cddecoder.h.

Referenced by deinit(), initialize(), run(), and ~CdDecoder().

◆ m_userStop

volatile bool CdDecoder::m_userStop {false}
private

Definition at line 57 of file cddecoder.h.

Referenced by deinit(), initialize(), run(), and stop().

◆ m_deviceName

QString CdDecoder::m_deviceName
private

◆ m_stat

DecoderEvent::Type CdDecoder::m_stat {DecoderEvent::kError}
private

Definition at line 63 of file cddecoder.h.

Referenced by deinit(), initialize(), and run().

◆ m_outputBuf

char* CdDecoder::m_outputBuf {nullptr}
private

Definition at line 64 of file cddecoder.h.

Referenced by deinit(), initialize(), run(), and writeBlock().

◆ m_outputAt

std::size_t CdDecoder::m_outputAt {0}
private

Definition at line 65 of file cddecoder.h.

Referenced by initialize(), run(), and writeBlock().

◆ m_bks

std::size_t CdDecoder::m_bks {0}
private

Definition at line 67 of file cddecoder.h.

Referenced by initialize(), run(), and writeBlock().

◆ m_bksFrames

std::size_t CdDecoder::m_bksFrames {0}
private

Definition at line 68 of file cddecoder.h.

Referenced by initialize(), and writeBlock().

◆ m_decodeBytes

std::size_t CdDecoder::m_decodeBytes {0}
private

Definition at line 69 of file cddecoder.h.

Referenced by initialize(), and run().

◆ m_finish

bool CdDecoder::m_finish {false}
private

Definition at line 70 of file cddecoder.h.

Referenced by deinit(), initialize(), and run().

◆ m_freq

long CdDecoder::m_freq {0}
private

Definition at line 71 of file cddecoder.h.

Referenced by deinit(), and initialize().

◆ m_bitrate

long CdDecoder::m_bitrate {0}
private

Definition at line 72 of file cddecoder.h.

Referenced by deinit(), and initialize().

◆ m_chan

int CdDecoder::m_chan {0}
private

Definition at line 73 of file cddecoder.h.

Referenced by deinit(), and initialize().

◆ m_seekTime

double CdDecoder::m_seekTime {-1.0}
private

Definition at line 74 of file cddecoder.h.

Referenced by initialize(), run(), seek(), and writeBlock().

◆ m_setTrackNum

int CdDecoder::m_setTrackNum {-1}
private

Definition at line 76 of file cddecoder.h.

Referenced by getMetadata().

◆ m_trackNum

int CdDecoder::m_trackNum {0}
private

Definition at line 77 of file cddecoder.h.

Referenced by initialize().


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