-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCDInfo.h
259 lines (205 loc) · 7.77 KB
/
CDInfo.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
/*
** CDex - Open Source Digital Audio CD Extractor
**
** Copyright (C) 2006 - 2007 Georgy Berdyshev
** Copyright (C) 1999 - 2007 Albert L. Faber
**
** http://cdexos.sourceforge.net/
** http://sourceforge.net/projects/cdexos
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CDINFO_INCLUDED
#define CDINFO_INCLUDED
#define TRACKSPERSEC 75
#define CB_CDDASECTORSIZE 2352
#include "config.h"
#include "TagData.h"
#pragma pack(push,1)
enum CDTEXT_PACK_TYPE
{
CDT_TRACK_TITLE =0x80, // Title of Album name(ID2=00h) or Track Titles (ID2=01h...63h)
CDT_PERFORMER =0x81, // Name(s) of the performer(s) (in ASCII)
CDT_SONGWRITER =0x82, // Name(s) of the songwriter(s) (in ASCII)
CDT_COMPOSER =0x83, // Name(s) of the composer(s) (in ASCII)
CDT_ARRANGER =0x84, // Name(s) of the arranger(s) (in ASCII)
CDT_MESSAGE =0x85, // Message(s) from content provider and/or artist (in ASCII)
CDT_DISC_ID =0x86, // Disc Identification information
CDT_GENRE =0x87, // Genre Identification and Genre information
CDT_TOC_INFO =0x88, // Table of Content information
CDT_SEC_TOC_INFO=0x89, // Second Table of Content information
CDT_RESERVED_1 =0x8A, // Reserved
CDT_RESERVED_2 =0x8B, // Reserved
CDT_RESERVED_3 =0x8C, // Reserved
CDT_RESERVED_4 =0x8D, // Reserved for content provider only
CDT_UPC_EAN =0x8E, // UPC/EAN code of the album and ISRC code of each track
CDT_SIZE_BLOCK =0x8F // Size information of the Block
};
typedef struct CDTEXTPACK_TAG
{
BYTE packType;
BYTE trackNumber;
BYTE sequenceNumber;
BYTE characterPosition:4; // character position
BYTE block :3; // block number 0..7
BYTE bDBC :1; // double byte character
BYTE data[12];
BYTE crc0;
BYTE crc1;
} CDTEXTPACK;
#pragma pack(pop)
class PlayList:public CObject
{
private:
CUString m_strFileName;
CUString m_strOutDir;
CUString m_strPlayListDir;
CUString m_strFileDir;
public:
PlayList( const CUString& strPlayListFileName );
void AddEntry( CUString Entry );
void AddM3UEntry( CUString Entry );
void AddPLSEntry( CUString Entry );
private:
CUString MakeEntry( const CUString& strListName,
const CUString& strEntry );
};
class CCDTrackInfo: public CObject
{
//private:
public:
BYTE m_reserved1;
BYTE m_btFlags;
BYTE m_btTrack;
BYTE m_reserved2;
DWORD m_dwStartSector;
CUString m_strTrackName;
CUString m_strExtTrackName;
CUString m_strISRC;
int m_nCDDBType;
DWORD m_dwGap;
public:
CCDTrackInfo();
DWORD GetStartSector() const {return m_dwStartSector;}
BYTE GetFlags() const {return m_btFlags;}
BYTE GetTrack() const {return m_btTrack;}
CUString GetTrackName() const {return m_strTrackName;}
CUString GetExtTrackName() const {return m_strExtTrackName;}
CUString GetISRC() const {return m_strISRC;}
DWORD GetGap() const {return m_dwGap;}
void SetTrack(BYTE btTrack) {m_btTrack=btTrack;}
void SetTrackName(const CUString& strValue) {m_strTrackName=strValue;}
void SetExtTrackName(const CUString& strValue){m_strExtTrackName=strValue;}
void SetStartSector(DWORD dwStartSector) {m_dwStartSector=dwStartSector;}
void SetISRC(const CUString& strValue) {m_strISRC=strValue;}
void SetGap(DWORD value) {m_dwGap = value;}
private:
};
class CDInfo: public CObject
{
private:
INT m_nNumTracks;
CCDTrackInfo m_TrackInfo[MAXTRK];
CUString m_strArtist;
CUString m_strTitle;
CUString m_strExtTitle;
DWORD m_dwVolID;
DWORD m_dwDiscID;
CUString m_strYear;
CUString m_strGenre;
DWORD m_dwTotalSecs;
INT m_nRevision;
CUString m_strSubmission;
CUString m_strVolID;
CUString m_strCDDBCat;
CUString m_strMCDI;
CUString m_strMCN;
RAW_TOC_TYPE m_btaRawToc;
vector<CTagData> m_vTagData;
public:
// CONSTRUCTORS
CDInfo();
// DESTRUCTOR
~CDInfo();
CUString GetCDDBCat();
void SetCDDBCat( const CUString& strCDDBCat );
INT GetNumTracks() const {return m_nNumTracks;}
VOID SetNumTracks(WORD wValue) {m_nNumTracks=wValue;}
void DumpToc(LPBYTE pbtBuffer,int nSize);
LONG GetEndSector(int p_track);
LONG GetStartSector(int p_track);
CUString GetTrackDuration(int nTrack);
CUString GetStartTime(int nTrack);
DWORD GetSize(int nTrack);
BOOL IsAudioTrack(int p_track);
DWORD CalculateDiscID();
WORD GetTrack(int iTrackIndex) const {return m_TrackInfo[iTrackIndex].GetTrack();}
void SetTrack(int iTrackIndex, BYTE btTrack) { m_TrackInfo[iTrackIndex].SetTrack(btTrack);}
DWORD GetGap(int iTrackIndex) const {return m_TrackInfo[iTrackIndex].GetGap();}
void SetGap(int iTrackIndex, DWORD value ) { m_TrackInfo[iTrackIndex].SetGap(value);}
CUString GetTrackName(int iTrackIndex) const {return m_TrackInfo[iTrackIndex].GetTrackName();}
void SetTrackName( const CUString& strValue, int iTrackIndex);
CUString GetISRC(int iTrackIndex) const {return m_TrackInfo[iTrackIndex].GetISRC();}
CUString GetExtTrackName(int iExtTrackIndex) const {return m_TrackInfo[iExtTrackIndex].GetExtTrackName();}
void SetExtTrackName( const CUString& strValue,int iExtTrackIndex );
CUString GetArtist() const {return m_strArtist;}
void SetArtist( const CUString& strValue );
CUString GetTitle() const {return m_strTitle;}
void SetTitle( const CUString& strValue);
CUString GetExtTitle() const {return m_strExtTitle;}
void SetExtTitle( const CUString& strValue ) {m_strExtTitle=strValue;}
CUString GetYear() const {return m_strYear;}
void SetYear(CUString strValue) { m_strYear = strValue; }
CUString GetGenre() const {return m_strGenre;}
void SetGenre(CUString strValue);
int GetRevision() const {return m_nRevision;}
void SetRevision(int nValue) {m_nRevision=nValue;}
CUString GetSubmission() const {return m_strSubmission;}
void SetSubmission(CUString strValue) {m_strSubmission=strValue;}
void SetStartSector( int p_track, DWORD dwOffset);
void SetTotalSecs( DWORD dwSecs) {m_dwTotalSecs=dwSecs;}
int FirstTrack();
void ReadCDInfo();
void SaveCDInfo();
DWORD GetDiscID() const {return m_dwDiscID;}
void SetDiscID(DWORD dwID) {m_dwDiscID=dwID;}
DWORD GetVolID() const {return m_dwVolID;}
CUString GetMCDI() const {
CUString strTmp;
strTmp = m_strMCDI;
return strTmp; }
CUString GetMCN() const { return m_strMCN; };
BYTE* GetRawToc() const { return (BYTE*)m_btaRawToc; }
void SetRawToc( BYTE* btaRawToc ) { memcpy( m_btaRawToc, btaRawToc, sizeof( RAW_TOC_TYPE ) ); }
BOOL IsLastAudioTrack( int p_track );
LONG GetSaveEndSector(int p_track);
void Init();
BOOL ReadCDPlayerIni();
BOOL ReadCDText();
void SaveCDPlayerIni();
BOOL ReadLocalCDDB( );
BOOL ReadRemoteCDDB( CWnd* pWnd, volatile BOOL& bAbort );
BOOL SubmitRemoteCDDB( CWnd* pWnd, volatile BOOL& bAbort );
BOOL ReadRemoteCDDBBatch( CWnd* pWnd, volatile BOOL& bAbort );
DWORD GetTotalSecs() const {return m_dwTotalSecs;}
CDEX_ERR ReadToc();
BOOL ReadFromWinampDB();
CDEX_ERR ReadUpcAndISRC();
private:
BOOL ReadWinampDBString( CFile& cFile, CUString& strRead );
};
UINT ReadRemoteCDDBThreadFunc( void* pParam, CWnd* pWnd, volatile BOOL& bAbort );
UINT SubmitRemoteCDDBThreadFunc( void* pParam, CWnd* pWnd, volatile BOOL& bAbort );
UINT BatchRemoteCDDBThreadFunc( void* pParam, CWnd* pWnd, volatile BOOL& bAbort );
#endif