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
|
#ifndef _SVC_BURNER_H
#define _SVC_BURNER_H
#include <bfc/dispatch.h>
#include <bfc/depend.h>
#include <bfc/string/string.h>
#include <api/service/services.h>
namespace MediaRecorder {
class Session : public Dispatchable {
protected:
Session() {} // protect constructor
public:
int getSessionType() { return _call(GETSESSIONTYPE,0); }
enum {
Session_REDBOOK, Session_DATA, Session_ISO
};
int closeSession() { return _call(CLOSESESSION,0); }
int getNumEntries() { return _call(GETNUMENTRIES,0); }
const char *enumEntry(int n) { return _call(ENUMENTRY,(const char *)NULL,n); }
int getTotalBytes() { return _call(GETTOTALBYTES,0); }
int getTotalTime() { return _call(GETTOTALTIME,0); }
enum {
GETSESSIONTYPE=10,
CLOSESESSION=20,
GETNUMENTRIES=30,
ENUMENTRY=40,
GETTOTALBYTES=50,
GETTOTALTIME=60,
};
};
// this represents one session on the cd
// normal audio cds have 1 redbook session, mixed mode has 2 (or more), with
// 1 audio followed by 1 or more data
class SessionI : public Session {
public:
virtual int getSessionType()=0;
virtual int closeSession()=0;
virtual int getNumEntries()=0;
virtual const char *enumEntry(int n)=0;
virtual int getTotalBytes()=0; //total space used in bytes
virtual int getTotalTime()=0; //total time used in ms
protected:
RECVS_DISPATCH;
};
class RedbookSession : public SessionI {
public:
virtual ~RedbookSession() { m_tracks.deleteAll(); }
int getSessionType() { return Session_REDBOOK; }
int closeSession() { return 1; }
void addEntry(const char *file) { m_tracks.addItem(new String(file)); }
int getNumEntries() { return m_tracks.getNumItems(); }
void removeEntry(int n) { m_tracks.deleteItem(n); }
void clearEntries() { m_tracks.deleteAll(); }
const char *enumEntry(int n);
int getTotalBytes();
int getTotalTime();
protected:
PtrList<String> m_tracks;
};
// this is the physical device
class Device : public Dispatchable {
protected:
Device() {} // protect constructor
public:
static const GUID *depend_getClassGuid() {
// {23F48039-455D-4348-86D5-0A82754678FC}
static const GUID ret =
{ 0x23f48039, 0x455d, 0x4348, { 0x86, 0xd5, 0xa, 0x82, 0x75, 0x46, 0x78, 0xfc } };
return &ret;
}
api_dependent *getDependencyPtr() { return _call(GETDEPENDENCYPTR,(api_dependent *)NULL); }
const char *getDeviceName() { return _call(GETDEVICENAME,(const char *)NULL); }
const char *getDeviceType() { return _call(GETDEVICETYPE,(const char *)NULL); }
const char *getDeviceDescription() { return _call(GETDEVICEDESCRIPTION,(const char *)NULL); }
int enumDeviceSpeeds(int n) { return _call(ENUMDEVICESPEEDS,0,n); }
int getMediaSize() { return _call(GETMEDIASIZE,0); }
int getMediaFree() { return _call(GETMEDIAFREE,0); }
void clearSessions() { _voidcall(CLEARSESSIONS); }
int addSession(Session *session) { return _call(ADDSESSION,0,session); }
Session *getSession(int num) { return _call(GETSESSION,(Session *)NULL,num); }
int setRecordSpeed(int kbps) { return _call(SETRECORDSPEED,0,kbps); }
int setTest(int testmode) { return _call(SETTEST,0,testmode); }
int setCloseDisc(int closedisc) { return _call(SETCLOSEDISC,0,closedisc); }
int canBurnNow() { return _call(CANBURNNOW,0); }
int canCancel() { return _call(CANCANCEL,0); }
int begin() { return _call(BEGIN,0); }
int end() { return _call(END,0); }
int cancel() { return _call(CANCEL,0); }
int getStatus() { return _call(GETSTATUS,0); }
enum {
Status_IDLE, Status_PREPARING, Status_BURNING, Status_DONE,
};
int getProgress() { return _call(GETPROGRESS,0); }
const char *getStatusText() { return _call(GETSTATUSTEXT,(const char *)NULL); }
const char *getLastError() { return _call(GETLASTERROR,(const char *)NULL); }
enum {
Event_PREPAREBEGIN=100,
Event_MEDIATRANSCODED=200, // params is item #
Event_PREPAREEND=300,
Event_BURNBEGIN=400,
Event_ENTRYCOMPLETE=500, // param is the position in bytes
Event_SESSIONCOMPLETE=600,
Event_BURNEND=700,
Event_ERROR=800,
Event_MEDIACHANGE=900, // user put in a different disc
};
enum {
GETDEPENDENCYPTR=10,
GETDEVICENAME=20,
GETDEVICETYPE=30,
GETDEVICEDESCRIPTION=40,
ENUMDEVICESPEEDS=50,
GETMEDIASIZE=60,
GETMEDIAFREE=70,
CLEARSESSIONS=80,
ADDSESSION=90,
GETSESSION=100,
SETRECORDSPEED=110,
SETTEST=120,
SETCLOSEDISC=130,
CANBURNNOW=140,
CANCANCEL=150,
BEGIN=160,
END=170,
CANCEL=180,
GETSTATUS=190,
GETPROGRESS=200,
GETSTATUSTEXT=210,
GETLASTERROR=220,
};
};
class DeviceI : public Device {
public:
virtual api_dependent *getDependencyPtr()=0; // for events
virtual const char *getDeviceName()=0; // internal device name
virtual const char *getDeviceType()=0; // "CD-R", "CD-RW", "DVD-R" etc
virtual const char *getDeviceDescription()=0; // user readable string
virtual int enumDeviceSpeeds(int n)=0; // in kb/s
virtual int getMediaSize()=0; // total space in bytes
virtual int getMediaFree()=0; // free space in bytes
virtual void clearSessions()=0;
virtual int addSession(Session *session)=0;
virtual Session *getSession(int num)=0;
virtual int setRecordSpeed(int kbps)=0; //kbps==0 means max speed
virtual int setTest(int testmode)=0; // if true, don't really burn
virtual int setCloseDisc(int closedisc)=0; // if true, close entire disc at end
virtual int canBurnNow()=0; // return 1 if everything's ready
virtual int canCancel()=0; // return 1 if we can cancel (during burning)
virtual int begin()=0;
virtual int end()=0;
virtual int cancel()=0;
virtual int getStatus()=0;
virtual int getProgress()=0; // # of bytes written
virtual const char *getStatusText()=0; // like "xx% complete" or something
virtual const char *getLastError()=0;
protected:
RECVS_DISPATCH;
};
}; // end namespace MediaRecorder
//don't override this one
class NOVTABLE svc_mediaRecorder : public Dispatchable {
protected:
svc_mediaRecorder() {} // protect constructor
public:
static FOURCC getServiceType() { return WaSvc::MEDIARECORDER; }
int isSessionSupported(MediaRecorder::Session *session) { return _call(ISSESSIONSUPPORTED,0,session); }
int isMediaSupported(const char *medianame) { return _call(ISMEDIASUPPORTED,0,medianame); }
int getNumDevices() { return _call(GETNUMDEVICES,0); }
MediaRecorder::Device *enumDevice(int n) { return _call(ENUMDEVICE,(MediaRecorder::Device*)NULL,n); }
void refreshDevices() { _voidcall(REFRESHDEVICES); }
enum {
ISSESSIONSUPPORTED=10,
ISMEDIASUPPORTED=20,
GETNUMDEVICES=30,
ENUMDEVICE=40,
REFRESHDEVICES=50,
};
};
// this should be implemented by a given burning lib
class NOVTABLE svc_mediaRecorderI : public svc_mediaRecorder {
public:
static FOURCC getServiceType() { return WaSvc::MEDIARECORDER; }
virtual int isSessionSupported(MediaRecorder::Session *session)=0;
virtual int isMediaSupported(const char *medianame)=0;// "CD-R", "DVD-R", etc.
virtual int getNumDevices()=0;
virtual MediaRecorder::Device *enumDevice(int n)=0;
virtual void refreshDevices()=0;
protected:
RECVS_DISPATCH;
};
#endif
|