1 /*  cdrdao - write audio CD-Rs in disc-at-once mode
2  *
3  *  Copyright (C) 1998-2001  Andreas Mueller <andreas@daneb.de>
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef __CDTEXTITEM_H__
21 #define __CDTEXTITEM_H__
22 
23 #include <iostream>
24 
25 class CdTextItem {
26 public:
27   enum DataType { SBCC, DBCC, BINARY };
28 
29   enum PackType { CDTEXT_TITLE = 0x80,
30 		  CDTEXT_PERFORMER = 0x81,
31 		  CDTEXT_SONGWRITER = 0x82,
32 		  CDTEXT_COMPOSER = 0x83,
33 		  CDTEXT_ARRANGER = 0x84,
34 		  CDTEXT_MESSAGE = 0x85,
35 		  CDTEXT_DISK_ID = 0x86,
36 		  CDTEXT_GENRE = 0x87,
37 		  CDTEXT_TOC_INFO1 = 0x88,
38 		  CDTEXT_TOC_INFO2 = 0x89,
39 		  CDTEXT_RES1 = 0x8a,
40 		  CDTEXT_RES2 = 0x8b,
41 		  CDTEXT_RES3 = 0x8c,
42 		  CDTEXT_RES4 = 0x8d,
43 		  CDTEXT_UPCEAN_ISRC = 0x8e,
44 		  CDTEXT_SIZE_INFO = 0x8f };
45 
46   CdTextItem(PackType packType, int blockNr, const char *data);
47 
48   CdTextItem(PackType packType, int blockNr,
49 	     const unsigned char *data, long len);
50 
51   CdTextItem(int blockNr, unsigned char genreCode1, unsigned char genreCode2,
52 	     const char *description);
53 
54   CdTextItem(const CdTextItem &);
55 
56   ~CdTextItem();
57 
dataType()58   DataType dataType() const { return dataType_; }
59 
packType()60   PackType packType() const { return packType_; }
61 
blockNr()62   int blockNr() const { return blockNr_; }
63 
data()64   const unsigned char *data() const { return data_; }
65 
dataLen()66   long dataLen() const { return dataLen_; }
67 
68   void print(int isTrack, std::ostream &) const;
69 
70   int operator==(const CdTextItem &);
71   int operator!=(const CdTextItem &);
72 
73   static const char *packType2String(int isTrack, int packType);
74 
75   static PackType int2PackType(int);
76   static int isBinaryPack(PackType);
77   static int isTrackPack(PackType);
78 
79 private:
80   friend class CdTextContainer;
81 
82   DataType dataType_;
83   PackType packType_;
84   int blockNr_; // 0 ... 7
85 
86   unsigned char *data_;
87   long dataLen_;
88 
89   CdTextItem *next_;
90 };
91 
92 #endif
93