MythTV master
cddecoder.h
Go to the documentation of this file.
1#ifndef CDDECODER_H_
2#define CDDECODER_H_
3
4#include "decoder.h"
5
6#include "config.h"
7
8#ifdef HAVE_CDIO
9# if __has_include(<cdio/paranoia/cdda.h>)
10# include <cdio/paranoia/cdda.h>
11# include <cdio/paranoia/paranoia.h>
12# else
13# include <cdio/cdda.h>
14# include <cdio/paranoia.h>
15# endif
16#endif
17
18#ifdef HAVE_MUSICBRAINZ
19 #include "musicbrainz.h"
20#endif // HAVE_MUSICBRAINZ
21
22class MusicMetadata;
23
24class CdDecoder : public Decoder
25{
27
28 public:
29 CdDecoder(const QString &file, DecoderFactory *d, AudioOutput *o);
30 ~CdDecoder() override;
31
32 // Decoder implementation
33 bool initialize() override; // Decoder
34 void seek(double pos) override; // Decoder
35 void stop() override; // Decoder
36
38
39 // The following need to allocate a new MusicMetadata object each time,
40 // because their callers free the returned value
41 // TODO check this is still true
42 MusicMetadata *getMetadata(int track);
43
44 int getNumTracks();
46
47 void setDevice(const QString &dev);
48 void setCDSpeed(int speed);
49
50 private:
51 void run() override; // MThread
52
53 void writeBlock();
54 void deinit();
55
56 volatile bool m_inited {false};
57 volatile bool m_userStop {false};
58
59 QString m_deviceName;
60
61 static QRecursiveMutex& getCdioMutex();
62
63 DecoderEvent::Type m_stat {DecoderEvent::kError};
64 char *m_outputBuf {nullptr};
65 std::size_t m_outputAt {0};
66
67 std::size_t m_bks {0};
68 std::size_t m_bksFrames {0};
69 std::size_t m_decodeBytes {0};
70 bool m_finish {false};
71 long m_freq {0};
72 long m_bitrate {0};
73 int m_chan {0};
74 double m_seekTime {-1.0};
75
76 int m_setTrackNum {-1};
77 int m_trackNum {0};
78
79#ifdef HAVE_CDIO
80 CdIo_t *m_cdio {nullptr};
81 cdrom_drive_t *m_device {nullptr};
82 cdrom_paranoia_t *m_paranoia {nullptr};
83 lsn_t m_start {CDIO_INVALID_LSN};
84 lsn_t m_end {CDIO_INVALID_LSN};
85 lsn_t m_curPos {CDIO_INVALID_LSN};
86#endif
87
88#ifdef HAVE_MUSICBRAINZ
89 static MusicBrainz & getMusicBrainz();
90#endif // HAVE_MUSICBRAINZ
91
92};
93
94#endif
95
char * m_outputBuf
Definition: cddecoder.h:64
int m_chan
Definition: cddecoder.h:73
int m_setTrackNum
Definition: cddecoder.h:76
volatile bool m_userStop
Definition: cddecoder.h:57
void setDevice(const QString &dev)
Definition: cddecoder.cpp:104
CdDecoder(const QString &file, DecoderFactory *d, AudioOutput *o)
Definition: cddecoder.cpp:91
void setCDSpeed(int speed)
Definition: cddecoder.cpp:428
bool initialize() override
Definition: cddecoder.cpp:146
long m_freq
Definition: cddecoder.h:71
void stop() override
Definition: cddecoder.cpp:115
void seek(double pos) override
Definition: cddecoder.cpp:260
long m_bitrate
Definition: cddecoder.h:72
std::size_t m_bksFrames
Definition: cddecoder.h:68
std::size_t m_bks
Definition: cddecoder.h:67
MusicMetadata * getMetadata(void)
Definition: cddecoder.cpp:499
QString m_deviceName
Definition: cddecoder.h:59
~CdDecoder() override
Definition: cddecoder.cpp:98
bool m_finish
Definition: cddecoder.h:70
void run() override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: cddecoder.cpp:292
std::size_t m_decodeBytes
Definition: cddecoder.h:69
void deinit()
Definition: cddecoder.cpp:268
static QRecursiveMutex & getCdioMutex()
Definition: cddecoder.cpp:139
std::size_t m_outputAt
Definition: cddecoder.h:65
int getNumTracks()
Definition: cddecoder.cpp:446
volatile bool m_inited
Definition: cddecoder.h:56
int getNumCDAudioTracks()
Definition: cddecoder.cpp:464
void writeBlock()
Definition: cddecoder.cpp:121
double m_seekTime
Definition: cddecoder.h:74
Q_DECLARE_TR_FUNCTIONS(CdDecoder)
DecoderEvent::Type m_stat
Definition: cddecoder.h:63
int m_trackNum
Definition: cddecoder.h:77
static const Type kError
Definition: decoder.h:48
static const iso6937table * d