/
cddecoder.h
95 lines (72 loc) · 2.1 KB
/
cddecoder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef CDDECODER_H_
#define CDDECODER_H_
#include "decoder.h"
#include <mythconfig.h>
#if CONFIG_DARWIN
#include <vector>
using std::vector;
#endif
#ifdef HAVE_CDIO
# include <cdio/cdda.h>
# include <cdio/paranoia.h>
#endif
class MusicMetadata;
class CdDecoder : public Decoder
{
public:
CdDecoder(const QString &file, DecoderFactory *, AudioOutput *);
virtual ~CdDecoder();
// Decoder implementation
virtual bool initialize();
virtual void seek(double);
virtual void stop();
// Decoder overrides
virtual MusicMetadata *getMetadata(void);
virtual void commitMetadata(MusicMetadata *mdata);
// The following need to allocate a new MusicMetadata object each time,
// because their callers free the returned value
// TODO check this is still true
MusicMetadata *getMetadata(int track);
MusicMetadata *getLastMetadata();
#if CONFIG_DARWIN
double lengthInSeconds();
#endif
int getNumTracks();
int getNumCDAudioTracks();
void setDevice(const QString &dev);
void setCDSpeed(int speed);
private:
void run();
void writeBlock();
void deinit();
volatile bool m_inited;
volatile bool m_user_stop;
QString m_devicename;
#if CONFIG_DARWIN
void lookupCDDB(const QString &hexID, uint tracks);
uint32_t m_diskID; ///< For CDDB1/FreeDB lookup
uint m_firstTrack, ///< First AUDIO track
m_lastTrack, ///< Last AUDIO track
m_leadout; ///< End of last track
double m_lengthInSecs;
vector<int> m_tracks; ///< Start block offset of each track
#endif
static QMutex& getCdioMutex();
DecoderEvent::Type m_stat;
char *m_output_buf;
std::size_t m_output_at;
std::size_t m_bks, m_bksFrames, m_decodeBytes;
bool m_finish;
long m_freq, m_bitrate;
int m_chan;
double m_seekTime;
int m_settracknum;
int m_tracknum;
#ifdef HAVE_CDIO
CdIo_t *m_cdio;
cdrom_drive_t *m_device;
cdrom_paranoia_t *m_paranoia;
lsn_t m_start, m_end, m_curpos;
#endif
};
#endif