~ubuntu-branches/ubuntu/utopic/cdrdao/utopic

« back to all changes in this revision

Viewing changes to dao/PlextorReader.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Suffield
  • Date: 2004-06-24 22:33:16 UTC
  • Revision ID: james.westby@ubuntu.com-20040624223316-534onzugaeeyq61j
Tags: upstream-1.1.9
ImportĀ upstreamĀ versionĀ 1.1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  cdrdao - write audio CD-Rs in disc-at-once mode
 
2
 *
 
3
 *  Copyright (C) 1998-2001  Andreas Mueller <mueller@daneb.ping.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 __PLEXTOR_READER_H__
 
21
#define __PLEXTOR_READER_H__
 
22
 
 
23
#include "CdrDriver.h"
 
24
 
 
25
#define OPT_PLEX_USE_PARANOIA   0x0001 // always use paranoia method for DAE
 
26
#define OPT_PLEX_DAE_READ10     0x0002 // use READ10 for DAE
 
27
#define OPT_PLEX_DAE_D4_12      0x0004 // use 12 byte command 0xD4 for DAE
 
28
 
 
29
/*! \def OPT_PLEX_NOSLOW_ON_ERR
 
30
    \brief Don't slow down read speed if any read error encountered
 
31
    
 
32
    By default is activated, so the unit slows down. Passing
 
33
    this option will disable it; unit won't slow down. Driver checks
 
34
    previous status and restores it.
 
35
    Mode page 0x31
 
36
    byte 3 [ x x x x x x x re ] 1 means don't slow down, 0 default
 
37
*/
 
38
#define OPT_PLEX_NOSLOW_ON_ERR    0x0010
 
39
 
 
40
/*! \def OPT_PLEX_TRANSF_BEF_MAX
 
41
    \brief Start to transfer data before max speed reached
 
42
    
 
43
    By default is disabled, so unit reaches max speed before beginning
 
44
    transfer. Passing this options will enable it; unit will transfer
 
45
    data before reaching max speed. Driver checks previous status and
 
46
    restores it.
 
47
    Mode page 0x31
 
48
    byte 3 [ x x x x x x td x ] 1 means don't wait for max speed, 0 default
 
49
*/
 
50
#define OPT_PLEX_TRANSF_BEF_MAX 0x0020
 
51
 
 
52
/*! \def OPT_PLEX_NOSLOW_ON_VIB
 
53
    \brief Don't slowdown to avoid vibrations
 
54
    
 
55
    By default is activated, so unit slows down. Passing this option
 
56
    will disable it; unit won't slow down. Driver checks previous status
 
57
    and restores it.
 
58
    Mode page 0x31
 
59
    byte 3 [ x x x x x sl x x ] 1 means don't slow down, 0 default
 
60
*/
 
61
#define OPT_PLEX_NOSLOW_ON_VIB    0x0040
 
62
 
 
63
class Toc;
 
64
class Track;
 
65
 
 
66
class PlextorReader : public CdrDriver {
 
67
public:
 
68
 
 
69
  PlextorReader(ScsiIf *scsiIf, unsigned long options);
 
70
 
 
71
  /*! 
 
72
   * Its only purpose is to reset Plextor special features to their value
 
73
   * before cdrdao initialization.
 
74
   */
 
75
  ~PlextorReader();
 
76
  static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options);
 
77
 
 
78
  unsigned long getReadCapabilities(const CdToc *, int) const { return 0; }
 
79
 
 
80
  // not used for readers
 
81
  int bigEndianSamples() const { return 0;}
 
82
 
 
83
  int speed(int);
 
84
 
 
85
  int loadUnload(int) const { return 0; }
 
86
 
 
87
  int initDao(const Toc *);
 
88
  int startDao();
 
89
  int finishDao();
 
90
  void abortDao();
 
91
  
 
92
  inline int ReadErrorsSlowDown () {return slow_down_on_read_errors;}
 
93
  inline int VibrationsSlowDown () {return slow_down_on_vibrations;}
 
94
  inline int WaitMaxSpeed () {return transfer_data_before_max_speed;}
 
95
  /*! \brief Controls wheter drive slows down when a read error occurs
 
96
  
 
97
    Special plextor feature;
 
98
    \param slowdown 0 to disable slowdown, 1 to enable (default)
 
99
    \return 1 on success, -1 on error
 
100
  */
 
101
  int ReadErrorsSlowDown (int slowdown);
 
102
  /*! \brief Controls wheter drive slows down when paused to avoid
 
103
      vibrations
 
104
      
 
105
      Special plextor feature, available on PX-20 and later
 
106
      \param slowdown 0 to disable slowdown, 1 to enable (default)
 
107
      \return 1 on success, -1 on error
 
108
  */
 
109
  int VibrationsSlowDown (int slowdown);
 
110
  /*! \brief Controls wheter drive waits for max speed before transferring data
 
111
  
 
112
      Special plextor feature, available on PX-20 and later
 
113
      \param wait 0 to transfer before maximum speed, 1 to wait (default)
 
114
      \return 1 on success, -1 on error
 
115
  */
 
116
  int WaitMaxSpeed (int wait);
 
117
 
 
118
  DiskInfo *diskInfo();
 
119
 
 
120
  Toc *readDiskToc(int, const char *);
 
121
  Toc *readDisk(int, const char *);
 
122
 
 
123
protected:
 
124
  DiskInfo diskInfo_;
 
125
  /*! \brief Drive model, as index of following 
 
126
      
 
127
      { 1,"CD-ROM PX-4XCH" }, { 2,"CD-ROM PX-4XCS" },
 
128
      { 3,"CD-ROM PX-4XCE" }, { 4,"CD-ROM PX-6X" },
 
129
      { 5,"CD-ROM PX-8X" }, { 6,"CD-ROM PX-12" },
 
130
      { 7,"CD-ROM PX-20" }, { 8,"CD-ROM PX-32" },
 
131
      { 9,"CD-ROM PX-40" }
 
132
  */
 
133
  int model_;
 
134
 
 
135
  CdRawToc *getRawToc(int sessionNr, int *len);
 
136
 
 
137
  int getTrackIndex(long lba, int *trackNr, int *indexNr, 
 
138
                    unsigned char *ctl);
 
139
  int readCatalog(Toc *, long startLba, long endLba);
 
140
  int analyzeTrack(TrackData::Mode, int trackNr, long startLba, long endLba,
 
141
                   Msf *index,
 
142
                   int *indexCnt, long *pregap, char *isrcCode,
 
143
                   unsigned char *ctl);
 
144
  int readIsrc(int trackNr, char *);
 
145
 
 
146
  long readTrackData(TrackData::Mode mode, TrackData::SubChannelMode,
 
147
                     long lba, long len, unsigned char *buf);
 
148
  int readSubChannels(TrackData::SubChannelMode, long lba, long len,
 
149
                      SubChannel ***, Sample *);
 
150
  int readAudioRange(ReadDiskInfo *, int fd, long start, long end,
 
151
                     int startTrack, int endTrack, TrackInfo *trackInfo);
 
152
 
 
153
 
 
154
private:
 
155
  void playAudioBlock(long start, long len);
 
156
  int readSubChannelData(int *trackNr, int *indexNr, long *,
 
157
                         unsigned char *ctl);
 
158
 
 
159
  int readAudioRangePlextor(ReadDiskInfo *, int fd,  long start, long end,
 
160
                            int startTrack, int endTrack, TrackInfo *);
 
161
    /* These can be -1 if not available, 0 or 1 */
 
162
    int slow_down_on_read_errors;
 
163
    int transfer_data_before_max_speed;
 
164
    int slow_down_on_vibrations;
 
165
    /* Original status of plextor special features */
 
166
    unsigned char orig_byte3;
 
167
};
 
168
 
 
169
#endif