Bringing ChocolateCaste-0.7 into the main branch.
[AROS-Contrib.git] / FryingPan / Optical / Disc_Generic.h
blob14300ec44bd98017dddf8d63388d21e3195e12ed
1 /*
2 * FryingPan - Amiga CD/DVD Recording Software (User Interface and supporting Libraries only)
3 * Copyright (C) 2001-2011 Tomasz Wiszkowski Tomasz.Wiszkowski at gmail.com
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1
8 * of the License, or (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 Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __DISC_GENERIC_H
21 #define __DISC_GENERIC_H
23 #include "Drive.h"
24 #include "Disc_Item.h"
25 #include "OptDisc.h"
26 #include <Generic/Vector.h>
27 #include <Generic/VectorT.h>
28 #include "IOptItem.h"
30 using namespace GenNS;
32 struct cmd_Read;
33 struct cmd_Write;
35 class Disc
37 private:
39 int64 lSeqSector; // sequential recording - sector number of current track
40 int64 lSeqLastSector; // sequential recording - last sector to be written for current track
41 const IOptItem *pSeqStructure; // disc structure
42 const IOptItem *pSeqCurrentTrack; // current track;
43 cmd_Read *pRead;
44 cmd_Write *pWrite;
46 bool tryReadTrackInfo(void);
47 bool tryReadTOC(void);
48 bool tryPrimitiveTOC(void);
50 unsigned short read_speed;
51 unsigned short write_speed;
52 DiscWriteMethod write_method;
53 unsigned char refresh_period;
54 cmd_ReadDiscInfo *pReadDiscInfo;
55 bool bNeedUpdate;
57 VectorT<DiscSpeed> readSpeeds;
58 VectorT<DiscSpeed> writeSpeeds;
60 OptDisc *optcontent;
62 int16 laySessions;
63 int16 layTracks;
64 int16 layFirstTrack;
65 int16 layFirstSession;
66 int64 layCurrentBlock;
69 protected:
70 DEFINE_DEBUG;
71 DriveIO *dio;
72 Drive *drive;
73 DiscInfo *pDiscInfo;
76 void RequestUpdate();
77 void SetRefreshPeriod(UBYTE fiftieths);
78 int WritePadData(const IOptItem *pDI, int32 len);
79 int WriteDisc(int lBlock, unsigned short lLength, unsigned short lSectorSize, APTR pBuffer);
80 virtual void ReadSpeeds();
82 public:
84 Disc(Drive*);
85 virtual ~Disc(void);
88 //=======================//
89 // now the methods... //
90 //=======================//
92 virtual bool AllowMultiSessionLayout() = 0;
93 virtual bool AllowMultiTrackLayout() = 0;
94 virtual int SessionGapSize() = 0;
95 virtual int TrackGapSize() = 0;
96 virtual int LayoutAdjustment() = 0;
97 virtual bool IsCD() = 0;
98 virtual bool IsDVD() = 0;
99 virtual bool IsFormatted() = 0;
100 virtual bool IsWritable() = 0;
101 virtual bool IsErasable() = 0;
102 virtual bool IsFormatable() = 0;
103 virtual bool IsOverwritable() = 0;
104 virtual int EraseDisc(int) = 0;
105 virtual int FormatDisc(int) = 0;
106 virtual int StructureDisc() = 0;
107 virtual int DiscType() = 0;
108 virtual int DiscSubType() = 0;
109 virtual int CheckItemData(const IOptItem*);
110 virtual int BeginTrackWrite(const IOptItem*) = 0; // for writing
111 virtual int EndTrackWrite(const IOptItem*) = 0;
112 virtual void FillDiscSpeed(DiscSpeed&) = 0;
114 virtual const char *DiscVendor();
116 virtual int WriteData(const IOptItem*);
118 virtual const uint8 GetRefreshPeriod(void);
120 virtual void Init(void); // OUGHT TO BE INHERITED EVERYWHERE!
122 virtual int RandomRead(const IOptItem*, int32, int32, void*);
123 virtual int RandomWrite(const IOptItem*, int32, int32, void*);
124 virtual int SequentialWrite(APTR pMem, ULONG lBlocks);
125 virtual int CloseDisc(int lType, int lTrackNo);
127 virtual int LayoutTracks(const IOptItem*);
128 virtual int UploadLayout(const IOptItem*);
129 virtual const IOptItem *GetNextWritableTrack(const IOptItem*);
131 virtual int GetNumTracks(void);
132 virtual int GetNumSessions(void);
134 virtual const IOptItem *GetContents();
136 virtual const IOptItem *FindSession(int lSessNum);
137 virtual const IOptItem *FindTrack(int lTrackNum);
139 virtual int SetWriteSpeed(uint16);
140 virtual int SetReadSpeed(uint16);
141 virtual uint16 GetWriteSpeed();
142 virtual uint16 GetReadSpeed();
143 virtual bool RequiresUpdate();
145 virtual const DiscSpeed *GetReadSpeeds();
146 virtual const DiscSpeed *GetWriteSpeeds();
148 virtual int SetWriteMethod(DiscWriteMethod);
149 virtual DiscWriteMethod GetWriteMethod();
150 virtual int OnChangeWriteMethod();
152 virtual int16 GetOperationProgress();
153 virtual uint32 GetDiscSize();
155 virtual uint32 Calibrate();
156 virtual uint32 WaitOpComplete();
159 #endif