00001 /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 00002 00003 /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 00004 Copyright (c) 2006 - 2010 Thomas Schmitt <scdbackup@gmx.net> 00005 Provided under GPL version 2 or later. 00006 00007 This is the official API definition of libburn. 00008 00009 */ 00010 00011 00012 #ifndef LIBBURN_H 00013 #define LIBBURN_H 00014 00015 /* 00016 00017 Applications must use 64 bit off_t. E.g. by defining 00018 #define _LARGEFILE_SOURCE 00019 #define _FILE_OFFSET_BITS 64 00020 or take special precautions to interface with the library by 64 bit integers 00021 where this .h files prescribe off_t. 00022 00023 To prevent 64 bit file i/o in the library would keep the application from 00024 processing tracks of more than 2 GB size. 00025 00026 */ 00027 #include <sys/types.h> 00028 00029 #ifndef DOXYGEN 00030 00031 #if defined(__cplusplus) 00032 #define BURN_BEGIN_DECLS \ 00033 namespace burn { \ 00034 extern "C" { 00035 #define BURN_END_DECLS \ 00036 } \ 00037 } 00038 #else 00039 #define BURN_BEGIN_DECLS 00040 #define BURN_END_DECLS 00041 #endif 00042 00043 BURN_BEGIN_DECLS 00044 00045 #endif 00046 00047 /** References a physical drive in the system */ 00048 struct burn_drive; 00049 00050 /** References a whole disc */ 00051 struct burn_disc; 00052 00053 /** References a single session on a disc */ 00054 struct burn_session; 00055 00056 /** References a single track on a disc */ 00057 struct burn_track; 00058 00059 /* ts A61111 */ 00060 /** References a set of write parameters */ 00061 struct burn_write_opts; 00062 00063 /** Session format for normal audio or data discs */ 00064 #define BURN_CDROM 0 00065 /** Session format for obsolete CD-I discs */ 00066 #define BURN_CDI 0x10 00067 /** Session format for CDROM-XA discs */ 00068 #define BURN_CDXA 0x20 00069 00070 #define BURN_POS_END 100 00071 00072 /** Mask for mode bits */ 00073 #define BURN_MODE_BITS 127 00074 00075 /** Track mode - mode 0 data 00076 0 bytes of user data. it's all 0s. mode 0. get it? HAH 00077 */ 00078 #define BURN_MODE0 (1 << 0) 00079 /** Track mode - mode "raw" - all 2352 bytes supplied by app 00080 FOR DATA TRACKS ONLY! 00081 */ 00082 #define BURN_MODE_RAW (1 << 1) 00083 /** Track mode - mode 1 data 00084 2048 bytes user data, and all the LEC money can buy 00085 */ 00086 #define BURN_MODE1 (1 << 2) 00087 /** Track mode - mode 2 data 00088 defaults to formless, 2336 bytes of user data, unprotected 00089 | with a data form if required. 00090 */ 00091 #define BURN_MODE2 (1 << 3) 00092 /** Track mode modifier - Form 1, | with MODE2 for reasonable results 00093 2048 bytes of user data, 4 bytes of subheader 00094 */ 00095 #define BURN_FORM1 (1 << 4) 00096 /** Track mode modifier - Form 2, | with MODE2 for reasonable results 00097 lots of user data. not much LEC. 00098 */ 00099 #define BURN_FORM2 (1 << 5) 00100 /** Track mode - audio 00101 2352 bytes per sector. may be | with 4ch or preemphasis. 00102 NOT TO BE CONFUSED WITH BURN_MODE_RAW 00103 Audio data must be 44100Hz 16bit stereo with no riff or other header at 00104 beginning. Extra header data will cause pops or clicks. Audio data should 00105 also be in little-endian byte order. Big-endian audio data causes static. 00106 */ 00107 #define BURN_AUDIO (1 << 6) 00108 /** Track mode modifier - 4 channel audio. */ 00109 #define BURN_4CH (1 << 7) 00110 /** Track mode modifier - Digital copy permitted, can be set on any track.*/ 00111 #define BURN_COPY (1 << 8) 00112 /** Track mode modifier - 50/15uS pre-emphasis */ 00113 #define BURN_PREEMPHASIS (1 << 9) 00114 /** Input mode modifier - subcodes present packed 16 */ 00115 #define BURN_SUBCODE_P16 (1 << 10) 00116 /** Input mode modifier - subcodes present packed 96 */ 00117 #define BURN_SUBCODE_P96 (1 << 11) 00118 /** Input mode modifier - subcodes present raw 96 */ 00119 #define BURN_SUBCODE_R96 (1 << 12) 00120 00121 /** Possible disc writing style/modes */ 00122 enum burn_write_types 00123 { 00124 /** Packet writing. 00125 currently unsupported, (for DVD Incremental Streaming use TAO) 00126 */ 00127 BURN_WRITE_PACKET, 00128 00129 /** With CD: Track At Once recording 00130 2s gaps between tracks, no fonky lead-ins 00131 00132 With sequential DVD-R[W]: Incremental Streaming 00133 With DVD+R and BD-R: Track of open size 00134 With DVD-RAM, DVD+RW, BD-RE: Random Writeable (used sequentially) 00135 With overwriteable DVD-RW: Rigid Restricted Overwrite 00136 */ 00137 BURN_WRITE_TAO, 00138 00139 /** With CD: Session At Once 00140 Block type MUST be BURN_BLOCK_SAO 00141 ts A70122: Currently not capable of mixing data and audio tracks. 00142 00143 With sequential DVD-R[W]: Disc-at-once, DAO 00144 Single session, single track, fixed size mandatory, (-dvd-compat) 00145 With other DVD or BD media: same as BURN_WRITE_TAO but may demand 00146 that track size is known in advance. 00147 */ 00148 BURN_WRITE_SAO, 00149 00150 /** With CD: Raw disc at once recording. 00151 all subcodes must be provided by lib or user 00152 only raw block types are supported 00153 With DVD and BD media: not supported. 00154 00155 ts A90901: This had been disabled because its implementation 00156 relied on code from cdrdao which is not understood 00157 currently. 00158 A burn run will abort with "FATAL" error message 00159 if this mode is attempted. 00160 @since 0.7.2 00161 ts A91016: Re-implemented according to ECMA-130 Annex A and B. 00162 Now understood, explained and not stemming from cdrdao. 00163 @since 0.7.4 00164 */ 00165 BURN_WRITE_RAW, 00166 00167 /** In replies this indicates that not any writing will work. 00168 As parameter for inquiries it indicates that no particular write 00169 mode shall is specified. 00170 Do not use for setting a write mode for burning. It will not work. 00171 */ 00172 BURN_WRITE_NONE 00173 }; 00174 00175 /** Data format to send to the drive */ 00176 enum burn_block_types 00177 { 00178 /** sync, headers, edc/ecc provided by lib/user */ 00179 BURN_BLOCK_RAW0 = 1, 00180 /** sync, headers, edc/ecc and p/q subs provided by lib/user */ 00181 BURN_BLOCK_RAW16 = 2, 00182 /** sync, headers, edc/ecc and packed p-w subs provided by lib/user */ 00183 BURN_BLOCK_RAW96P = 4, 00184 /** sync, headers, edc/ecc and raw p-w subs provided by lib/user */ 00185 BURN_BLOCK_RAW96R = 8, 00186 /** only 2048 bytes of user data provided by lib/user */ 00187 BURN_BLOCK_MODE1 = 256, 00188 /** 2336 bytes of user data provided by lib/user */ 00189 BURN_BLOCK_MODE2R = 512, 00190 /** 2048 bytes of user data provided by lib/user 00191 subheader provided in write parameters 00192 are we ever going to support this shit? I vote no. 00193 (supposed to be supported on all drives...) 00194 */ 00195 BURN_BLOCK_MODE2_PATHETIC = 1024, 00196 /** 2048 bytes of data + 8 byte subheader provided by lib/user 00197 hey, this is also dumb 00198 */ 00199 BURN_BLOCK_MODE2_LAME = 2048, 00200 /** 2324 bytes of data provided by lib/user 00201 subheader provided in write parameters 00202 no sir, I don't like it. 00203 */ 00204 BURN_BLOCK_MODE2_OBSCURE = 4096, 00205 /** 2332 bytes of data supplied by lib/user 00206 8 bytes sub header provided in write parameters 00207 this is the second least suck mode2, and is mandatory for 00208 all drives to support. 00209 */ 00210 BURN_BLOCK_MODE2_OK = 8192, 00211 /** SAO block sizes are based on cue sheet, so use this. */ 00212 BURN_BLOCK_SAO = 16384 00213 }; 00214 00215 /** Possible status of the drive in regard to the disc in it. */ 00216 enum burn_disc_status 00217 { 00218 /** The current status is not yet known */ 00219 BURN_DISC_UNREADY, 00220 00221 /** The drive holds a blank disc. It is ready for writing from scratch. 00222 Unused multi-session media: 00223 CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R 00224 Blanked multi-session media (i.e. treated by burn_disc_erase()) 00225 CD-RW, DVD-RW 00226 Overwriteable media with or without valid data 00227 DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE 00228 */ 00229 BURN_DISC_BLANK, 00230 00231 /** There is no disc at all in the drive */ 00232 BURN_DISC_EMPTY, 00233 00234 /** There is an incomplete disc in the drive. It is ready for appending 00235 another session. 00236 Written but not yet closed multi-session media 00237 CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R 00238 */ 00239 BURN_DISC_APPENDABLE, 00240 00241 /** There is a disc with data on it in the drive. It is usable only for 00242 reading. 00243 Written and closed multi-session media 00244 CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R 00245 Read-Only media 00246 CD-ROM, DVD-ROM, BD-ROM 00247 Note that many DVD-ROM drives report any written media 00248 as Read-Only media and not by their real media types. 00249 */ 00250 BURN_DISC_FULL, 00251 00252 /* ts A61007 */ 00253 /* @since 0.2.4 */ 00254 /** The drive was not grabbed when the status was inquired */ 00255 BURN_DISC_UNGRABBED, 00256 00257 /* ts A61020 */ 00258 /* @since 0.2.6 */ 00259 /** The media seems to be unsuitable for reading and for writing */ 00260 BURN_DISC_UNSUITABLE 00261 }; 00262 00263 00264 /** Possible data source return values */ 00265 enum burn_source_status 00266 { 00267 /** The source is ok */ 00268 BURN_SOURCE_OK, 00269 /** The source is at end of file */ 00270 BURN_SOURCE_EOF, 00271 /** The source is unusable */ 00272 BURN_SOURCE_FAILED 00273 }; 00274 00275 00276 /** Possible busy states for a drive */ 00277 enum burn_drive_status 00278 { 00279 /** The drive is not in an operation */ 00280 BURN_DRIVE_IDLE, 00281 /** The library is spawning the processes to handle a pending 00282 operation (A read/write/etc is about to start but hasn't quite 00283 yet) */ 00284 BURN_DRIVE_SPAWNING, 00285 /** The drive is reading data from a disc */ 00286 BURN_DRIVE_READING, 00287 /** The drive is writing data to a disc */ 00288 BURN_DRIVE_WRITING, 00289 /** The drive is writing Lead-In */ 00290 BURN_DRIVE_WRITING_LEADIN, 00291 /** The drive is writing Lead-Out */ 00292 BURN_DRIVE_WRITING_LEADOUT, 00293 /** The drive is erasing a disc */ 00294 BURN_DRIVE_ERASING, 00295 /** The drive is being grabbed */ 00296 BURN_DRIVE_GRABBING, 00297 00298 /* ts A61102 */ 00299 /* @since 0.2.6 */ 00300 /** The drive gets written zeroes before the track payload data */ 00301 BURN_DRIVE_WRITING_PREGAP, 00302 /** The drive is told to close a track (TAO only) */ 00303 BURN_DRIVE_CLOSING_TRACK, 00304 /** The drive is told to close a session (TAO only) */ 00305 BURN_DRIVE_CLOSING_SESSION, 00306 00307 /* ts A61223 */ 00308 /* @since 0.3.0 */ 00309 /** The drive is formatting media */ 00310 BURN_DRIVE_FORMATTING, 00311 00312 /* ts A70822 */ 00313 /* @since 0.4.0 */ 00314 /** The drive is busy in synchronous read (if you see this then it 00315 has been interrupted) */ 00316 BURN_DRIVE_READING_SYNC, 00317 /** The drive is busy in synchronous write (if you see this then it 00318 has been interrupted) */ 00319 BURN_DRIVE_WRITING_SYNC 00320 00321 }; 00322 00323 00324 /** Information about a track on a disc - this is from the q sub channel of the 00325 lead-in area of a disc. The documentation here is very terse. 00326 See a document such as mmc3 for proper information. 00327 00328 CAUTION : This structure is prone to future extension ! 00329 00330 Do not restrict your application to unsigned char with any counter like 00331 "session", "point", "pmin", ... 00332 Do not rely on the current size of a burn_toc_entry. 00333 00334 ts A70201 : DVD extension, see below 00335 */ 00336 struct burn_toc_entry 00337 { 00338 /** Session the track is in */ 00339 unsigned char session; 00340 /** Type of data. for this struct to be valid, it must be 1 */ 00341 unsigned char adr; 00342 /** Type of data in the track */ 00343 unsigned char control; 00344 /** Zero. Always. Really. */ 00345 unsigned char tno; 00346 /** Track number or special information */ 00347 unsigned char point; 00348 unsigned char min; 00349 unsigned char sec; 00350 unsigned char frame; 00351 unsigned char zero; 00352 /** Track start time minutes for normal tracks */ 00353 unsigned char pmin; 00354 /** Track start time seconds for normal tracks */ 00355 unsigned char psec; 00356 /** Track start time frames for normal tracks */ 00357 unsigned char pframe; 00358 00359 /* Indicates whether extension data are valid and eventually override 00360 older elements in this structure: 00361 bit0= DVD extension is valid @since 0.3.2 00362 @since 0.5.2 : DVD extensions are made valid for CD too 00363 */ 00364 unsigned char extensions_valid; 00365 00366 /* ts A70201 : DVD extension. extensions_valid:bit0 00367 If invalid the members are guaranteed to be 0. */ 00368 /* @since 0.3.2 */ 00369 /* Tracks and session numbers are 16 bit. Here are the high bytes. */ 00370 unsigned char session_msb; 00371 unsigned char point_msb; 00372 /* pmin, psec, and pframe may be too small if DVD extension is valid */ 00373 int start_lba; 00374 /* min, sec, and frame may be too small if DVD extension is valid */ 00375 int track_blocks; 00376 00377 /* ts A90909 : LRA extension. extensions_valid:bit1 */ 00378 /* @since 0.7.2 */ 00379 /* MMC-5 6.27.3.18 : The Last Recorded Address is valid for DVD-R, 00380 DVD-R DL when LJRS = 00b, DVD-RW, HD DVD-R, and BD-R. 00381 This would mean profiles: 0x11, 0x15, 0x13, 0x14, 0x51, 0x41, 0x42 00382 */ 00383 int last_recorded_address; 00384 }; 00385 00386 00387 /** Data source interface for tracks. 00388 This allows to use arbitrary program code as provider of track input data. 00389 00390 Objects compliant to this interface are either provided by the application 00391 or by API calls of libburn: burn_fd_source_new() , burn_file_source_new(), 00392 and burn_fifo_source_new(). 00393 00394 The API calls allow to use any file object as data source. Consider to feed 00395 an eventual custom data stream asynchronously into a pipe(2) and to let 00396 libburn handle the rest. 00397 In this case the following rule applies: 00398 Call burn_source_free() exactly once for every source obtained from 00399 libburn API. You MUST NOT otherwise use or manipulate its components. 00400 00401 In general, burn_source objects can be freed as soon as they are attached 00402 to track objects. The track objects will keep them alive and dispose them 00403 when they are no longer needed. With a fifo burn_source it makes sense to 00404 keep the own reference for inquiring its state while burning is in 00405 progress. 00406 00407 --- 00408 00409 The following description of burn_source applies only to application 00410 implemented burn_source objects. You need not to know it for API provided 00411 ones. 00412 00413 If you really implement an own passive data producer by this interface, 00414 then beware: it can do anything and it can spoil everything. 00415 00416 In this case the functions (*read), (*get_size), (*set_size), (*free_data) 00417 MUST be implemented by the application and attached to the object at 00418 creation time. 00419 Function (*read_sub) is allowed to be NULL or it MUST be implemented and 00420 attached. 00421 00422 burn_source.refcount MUST be handled properly: If not exactly as many 00423 references are freed as have been obtained, then either memory leaks or 00424 corrupted memory are the consequence. 00425 All objects which are referred to by *data must be kept existent until 00426 (*free_data) is called via burn_source_free() by the last referer. 00427 */ 00428 struct burn_source { 00429 00430 /** Reference count for the data source. MUST be 1 when a new source 00431 is created and thus the first reference is handed out. Increment 00432 it to take more references for yourself. Use burn_source_free() 00433 to destroy your references to it. */ 00434 int refcount; 00435 00436 00437 /** Read data from the source. Semantics like with read(2), but MUST 00438 either deliver the full buffer as defined by size or MUST deliver 00439 EOF (return 0) or failure (return -1) at this call or at the 00440 next following call. I.e. the only incomplete buffer may be the 00441 last one from that source. 00442 libburn will read a single sector by each call to (*read). 00443 The size of a sector depends on BURN_MODE_*. The known range is 00444 2048 to 2352. 00445 00446 If this call is reading from a pipe then it will learn 00447 about the end of data only when that pipe gets closed on the 00448 feeder side. So if the track size is not fixed or if the pipe 00449 delivers less than the predicted amount or if the size is not 00450 block aligned, then burning will halt until the input process 00451 closes the pipe. 00452 00453 IMPORTANT: 00454 If this function pointer is NULL, then the struct burn_source is of 00455 version >= 1 and the job of .(*read)() is done by .(*read_xt)(). 00456 See below, member .version. 00457 */ 00458 int (*read)(struct burn_source *, unsigned char *buffer, int size); 00459 00460 00461 /** Read subchannel data from the source (NULL if lib generated) 00462 WARNING: This is an obscure feature with CD raw write modes. 00463 Unless you checked the libburn code for correctness in that aspect 00464 you should not rely on raw writing with own subchannels. 00465 ADVICE: Set this pointer to NULL. 00466 */ 00467 int (*read_sub)(struct burn_source *, unsigned char *buffer, int size); 00468 00469 00470 /** Get the size of the source's data. Return 0 means unpredictable 00471 size. If application provided (*get_size) allows return 0, then 00472 the application MUST provide a fully functional (*set_size). 00473 */ 00474 off_t (*get_size)(struct burn_source *); 00475 00476 00477 /* ts A70125 : BROKE BINARY BACKWARD COMPATIBILITY AT libburn-0.3.1. */ 00478 /* @since 0.3.2 */ 00479 /** Program the reply of (*get_size) to a fixed value. It is advised 00480 to implement this by a attribute off_t fixed_size; in *data . 00481 The read() function does not have to take into respect this fake 00482 setting. It is rather a note of libburn to itself. Eventually 00483 necessary truncation or padding is done in libburn. Truncation 00484 is usually considered a misburn. Padding is considered ok. 00485 00486 libburn is supposed to work even if (*get_size) ignores the 00487 setting by (*set_size). But your application will not be able to 00488 enforce fixed track sizes by burn_track_set_size() and possibly 00489 even padding might be left out. 00490 */ 00491 int (*set_size)(struct burn_source *source, off_t size); 00492 00493 00494 /** Clean up the source specific data. This function will be called 00495 once by burn_source_free() when the last referer disposes the 00496 source. 00497 */ 00498 void (*free_data)(struct burn_source *); 00499 00500 00501 /** Next source, for when a source runs dry and padding is disabled 00502 WARNING: This is an obscure feature. Set to NULL at creation and 00503 from then on leave untouched and uninterpreted. 00504 */ 00505 struct burn_source *next; 00506 00507 00508 /** Source specific data. Here the various source classes express their 00509 specific properties and the instance objects store their individual 00510 management data. 00511 E.g. data could point to a struct like this: 00512 struct app_burn_source 00513 { 00514 struct my_app *app_handle; 00515 ... other individual source parameters ... 00516 off_t fixed_size; 00517 }; 00518 00519 Function (*free_data) has to be prepared to clean up and free 00520 the struct. 00521 */ 00522 void *data; 00523 00524 00525 /* ts A71222 : Supposed to be binary backwards compatible extension. */ 00526 /* @since 0.4.2 */ 00527 /** Valid only if above member .(*read)() is NULL. This indicates a 00528 version of struct burn_source younger than 0. 00529 From then on, member .version tells which further members exist 00530 in the memory layout of struct burn_source. libburn will only touch 00531 those announced extensions. 00532 00533 Versions: 00534 0 has .(*read)() != NULL, not even .version is present. 00535 1 has .version, .(*read_xt)(), .(*cancel)() 00536 */ 00537 int version; 00538 00539 /** This substitutes for (*read)() in versions above 0. */ 00540 int (*read_xt)(struct burn_source *, unsigned char *buffer, int size); 00541 00542 /** Informs the burn_source that the consumer of data prematurely 00543 ended reading. This call may or may not be issued by libburn 00544 before (*free_data)() is called. 00545 */ 00546 int (*cancel)(struct burn_source *source); 00547 }; 00548 00549 00550 /** Information on a drive in the system */ 00551 struct burn_drive_info 00552 { 00553 /** Name of the vendor of the drive */ 00554 char vendor[9]; 00555 /** Name of the drive */ 00556 char product[17]; 00557 /** Revision of the drive */ 00558 char revision[5]; 00559 00560 /** Invalid: Was: "Location of the drive in the filesystem." */ 00561 /** This string has no meaning any more. Once it stored the persistent 00562 drive address. Now always use function burn_drive_d_get_adr() to 00563 inquire a persistent address. ^^^^^^ ALWAYS ^^^^^^^^ */ 00564 char location[17]; 00565 00566 /** Can the drive read DVD-RAM discs */ 00567 unsigned int read_dvdram:1; 00568 /** Can the drive read DVD-R discs */ 00569 unsigned int read_dvdr:1; 00570 /** Can the drive read DVD-ROM discs */ 00571 unsigned int read_dvdrom:1; 00572 /** Can the drive read CD-R discs */ 00573 unsigned int read_cdr:1; 00574 /** Can the drive read CD-RW discs */ 00575 unsigned int read_cdrw:1; 00576 00577 /** Can the drive write DVD-RAM discs */ 00578 unsigned int write_dvdram:1; 00579 /** Can the drive write DVD-R discs */ 00580 unsigned int write_dvdr:1; 00581 /** Can the drive write CD-R discs */ 00582 unsigned int write_cdr:1; 00583 /** Can the drive write CD-RW discs */ 00584 unsigned int write_cdrw:1; 00585 00586 /** Can the drive simulate a write */ 00587 unsigned int write_simulate:1; 00588 00589 /** Can the drive report C2 errors */ 00590 unsigned int c2_errors:1; 00591 00592 /** The size of the drive's buffer (in kilobytes) */ 00593 int buffer_size; 00594 /** 00595 * The supported block types in tao mode. 00596 * They should be tested with the desired block type. 00597 * See also burn_block_types. 00598 */ 00599 int tao_block_types; 00600 /** 00601 * The supported block types in sao mode. 00602 * They should be tested with the desired block type. 00603 * See also burn_block_types. 00604 */ 00605 int sao_block_types; 00606 /** 00607 * The supported block types in raw mode. 00608 * They should be tested with the desired block type. 00609 * See also burn_block_types. 00610 */ 00611 int raw_block_types; 00612 /** 00613 * The supported block types in packet mode. 00614 * They should be tested with the desired block type. 00615 * See also burn_block_types. 00616 */ 00617 int packet_block_types; 00618 00619 /** The value by which this drive can be indexed when using functions 00620 in the library. This is the value to pass to all libbburn functions 00621 that operate on a drive. */ 00622 struct burn_drive *drive; 00623 }; 00624 00625 00626 /** Operation progress report. All values are 0 based indices. 00627 * */ 00628 struct burn_progress { 00629 /** The total number of sessions */ 00630 int sessions; 00631 /** Current session.*/ 00632 int session; 00633 /** The total number of tracks */ 00634 int tracks; 00635 /** Current track. */ 00636 int track; 00637 /** The total number of indices */ 00638 int indices; 00639 /** Curent index. */ 00640 int index; 00641 /** The starting logical block address */ 00642 int start_sector; 00643 /** On write: The number of sectors. 00644 On blank: 0x10000 as upper limit for relative progress steps */ 00645 int sectors; 00646 /** On write: The current sector being processed. 00647 On blank: Relative progress steps 0 to 0x10000 */ 00648 int sector; 00649 00650 /* ts A61023 */ 00651 /* @since 0.2.6 */ 00652 /** The capacity of the drive buffer */ 00653 unsigned buffer_capacity; 00654 /** The free space in the drive buffer (might be slightly outdated) */ 00655 unsigned buffer_available; 00656 00657 /* ts A61119 */ 00658 /* @since 0.2.6 */ 00659 /** The number of bytes sent to the drive buffer */ 00660 off_t buffered_bytes; 00661 /** The minimum number of bytes stored in buffer during write. 00662 (Caution: Before surely one buffer size of bytes was processed, 00663 this value is 0xffffffff.) 00664 */ 00665 unsigned buffer_min_fill; 00666 }; 00667 00668 00669 /* ts A61226 */ 00670 /* @since 0.3.0 */ 00671 /** Description of a speed capability as reported by the drive in conjunction 00672 with eventually loaded media. There can be more than one such object per 00673 drive. So they are chained via .next and .prev , where NULL marks the end 00674 of the chain. This list is set up by burn_drive_scan() and gets updated 00675 by burn_drive_grab(). 00676 A copy may be obtained by burn_drive_get_speedlist() and disposed by 00677 burn_drive_free_speedlist(). 00678 For technical background info see SCSI specs MMC and SPC: 00679 mode page 2Ah (from SPC 5Ah MODE SENSE) , mmc3r10g.pdf , 6.3.11 Table 364 00680 ACh GET PERFORMANCE, Type 03h , mmc5r03c.pdf , 6.8.5.3 Table 312 00681 */ 00682 struct burn_speed_descriptor { 00683 00684 /** Where this info comes from : 00685 0 = misc , 1 = mode page 2Ah , 2 = ACh GET PERFORMANCE */ 00686 int source; 00687 00688 /** The media type that was current at the time of report 00689 -2 = state unknown, -1 = no media was loaded , else see 00690 burn_disc_get_profile() */ 00691 int profile_loaded; 00692 char profile_name[80]; 00693 00694 /** The attributed capacity of appropriate media in logical block units 00695 i.e. 2352 raw bytes or 2048 data bytes. -1 = capacity unknown. */ 00696 int end_lba; 00697 00698 /** Speed is given in 1000 bytes/s , 0 = invalid. The numbers 00699 are supposed to be usable with burn_drive_set_speed() */ 00700 int write_speed; 00701 int read_speed; 00702 00703 /** Expert info from ACh GET PERFORMANCE and/or mode page 2Ah. 00704 Expect values other than 0 or 1 to get a meaning in future.*/ 00705 /* Rotational control: 0 = CLV/default , 1 = CAV */ 00706 int wrc; 00707 /* 1 = drive promises reported performance over full media */ 00708 int exact; 00709 /* 1 = suitable for mixture of read and write */ 00710 int mrw; 00711 00712 /** List chaining. Use .next until NULL to iterate over the list */ 00713 struct burn_speed_descriptor *prev; 00714 struct burn_speed_descriptor *next; 00715 }; 00716 00717 00718 /** Initialize the library. 00719 This must be called before using any other functions in the library. It 00720 may be called more than once with no effect. 00721 It is possible to 'restart' the library by shutting it down and 00722 re-initializing it. Once this was necessary if you follow the older and 00723 more general way of accessing a drive via burn_drive_scan() and 00724 burn_drive_grab(). See burn_drive_scan_and_grab() with its strong 00725 urges and its explanations. 00726 @return Nonzero if the library was able to initialize; zero if 00727 initialization failed. 00728 */ 00729 int burn_initialize(void); 00730 00731 /** Shutdown the library. 00732 This should be called before exiting your application. Make sure that all 00733 drives you have grabbed are released <i>before</i> calling this. 00734 */ 00735 void burn_finish(void); 00736 00737 00738 /* ts A61002 */ 00739 /** Abort any running drive operation and eventually call burn_finish(). 00740 00741 You MUST shut down the busy drives if an aborting event occurs during a 00742 burn run. For that you may call this function either from your own signal 00743 handling code or indirectly by activating the built-in signal handling: 00744 burn_set_signal_handling("my_app_name : ", NULL, 0); 00745 Else you may eventually call burn_drive_cancel() on the active drives and 00746 wait for them to assume state BURN_DRIVE_IDLE. 00747 @param patience Maximum number of seconds to wait for drives to 00748 finish. 00749 @since 0.7.8 : 00750 If this is -1, then only the cancel operations will 00751 be performed and no burn_finish() will happen. 00752 @param pacifier_func If not NULL: a function to produce appeasing messages. 00753 See burn_abort_pacifier() for an example. 00754 @param handle Opaque handle to be used with pacifier_func 00755 @return 1 ok, all went well 00756 0 had to leave a drive in unclean state 00757 <0 severe error, do no use libburn again 00758 @since 0.2.6 00759 */ 00760 int burn_abort(int patience, 00761 int (*pacifier_func)(void *handle, int patience, int elapsed), 00762 void *handle); 00763 00764 /** A pacifier function suitable for burn_abort. 00765 @param handle If not NULL, a pointer to a text suitable for printf("%s") 00766 @param patience Maximum number of seconds to wait 00767 @param elapsed Elapsed number of seconds 00768 */ 00769 int burn_abort_pacifier(void *handle, int patience, int elapsed); 00770 00771 00772 /** ts A61006 : This is for development only. Not suitable for applications. 00773 Set the verbosity level of the library. The default value is 0, which means 00774 that nothing is output on stderr. The more you increase this, the more 00775 debug output should be displayed on stderr for you. 00776 @param level The verbosity level desired. 0 for nothing, higher positive 00777 values for more information output. 00778 */ 00779 void burn_set_verbosity(int level); 00780 00781 /* ts A91111 */ 00782 /** Enable resp. disable logging of SCSI commands (currently GNU/Linux only). 00783 This call can be made at any time - even before burn_initialize(). 00784 It is in effect for all active drives and currently not very thread 00785 safe for multiple drives. 00786 @param flag Bitfield for control purposes. The default is 0. 00787 bit0= log to file /tmp/libburn_sg_command_log 00788 bit1= log to stderr 00789 bit2= flush output after each line 00790 @since 0.7.4 00791 */ 00792 void burn_set_scsi_logging(int flag); 00793 00794 /* ts A60813 */ 00795 /** Set parameters for behavior on opening device files. To be called early 00796 after burn_initialize() and before any bus scan. But not mandatory at all. 00797 Parameter value 1 enables a feature, 0 disables. 00798 Default is (1,0,0). Have a good reason before you change it. 00799 @param exclusive 00800 0 = no attempt to make drive access exclusive. 00801 1 = Try to open only devices which are not marked as busy 00802 and try to mark them busy if opened sucessfully. (O_EXCL 00803 on GNU/Linux , flock(LOCK_EX) on FreeBSD.) 00804 2 = in case of a SCSI device, also try to open exclusively 00805 the matching /dev/sr, /dev/scd and /dev/st . 00806 One may select a device SCSI file family by adding 00807 0 = default family 00808 4 = /dev/sr%d 00809 8 = /dev/scd%d 00810 16 = /dev/sg%d 00811 Do not use other values ! 00812 Add 32 to demand on GNU/Linux an exclusive lock by 00813 fcntl(,F_SETLK,) after open() has succeeded. 00814 @param blocking Try to wait for drives which do not open immediately but 00815 also do not return an error as well. (O_NONBLOCK) 00816 This might stall indefinitely with /dev/hdX hard disks. 00817 @param abort_on_busy Unconditionally abort process when a non blocking 00818 exclusive opening attempt indicates a busy drive. 00819 Use this only after thorough tests with your app. 00820 @since 0.2.2 00821 */ 00822 void burn_preset_device_open(int exclusive, int blocking, int abort_on_busy); 00823 00824 00825 /* ts A70223 */ 00826 /** Allows the use of media types which are implemented in libburn but not yet 00827 tested. The list of those untested profiles is subject to change. 00828 Currently it contains: 0x15 "DVD-R/DL sequential recording", 00829 If you really test such media, then please report the outcome on 00830 libburn-hackers@pykix.org 00831 If ever then this call should be done soon after burn_initialize() before 00832 any drive scanning. 00833 @param yes 1=allow all implemented profiles, 0=only tested media (default) 00834 @since 0.3.4 00835 */ 00836 void burn_allow_untested_profiles(int yes); 00837 00838 00839 /* ts A60823 */ 00840 /** Aquire a drive with known persistent address. 00841 00842 This is the sysadmin friendly way to open one drive and to leave all 00843 others untouched. It bundles the following API calls to form a 00844 non-obtrusive way to use libburn: 00845 burn_drive_add_whitelist() , burn_drive_scan() , burn_drive_grab() 00846 You are *strongly urged* to use this call whenever you know the drive 00847 address in advance. 00848 00849 If not, then you have to use directly above calls. In that case, you are 00850 *strongly urged* to drop any unintended drive which will be exclusively 00851 occupied and not closed by burn_drive_scan(). 00852 This can be done by shutting down the library including a call to 00853 burn_finish(). You may later start a new libburn session and should then 00854 use the function described here with an address obtained after 00855 burn_drive_scan() via burn_drive_d_get_adr(drive_infos[driveno].drive,adr). 00856 Another way is to drop the unwanted drives by burn_drive_info_forget(). 00857 00858 Operating on multiple drives: 00859 00860 Different than with burn_drive_scan() it is allowed to call 00861 burn_drive_scan_and_grab() without giving up any other scanned drives. So 00862 this call can be used to get a collection of more than one aquired drives. 00863 The attempt to aquire the same drive twice will fail, though. 00864 00865 Pseudo-drives: 00866 00867 burn_drive_scan_and_grab() is able to aquire virtual drives which will 00868 accept options much like a MMC burner drive. Many of those options will not 00869 cause any effect, though. The address of a pseudo-drive begins with 00870 prefix "stdio:" followed by a path. 00871 Examples: "stdio:/tmp/pseudo_drive" , "stdio:/dev/null" , "stdio:-" 00872 00873 If the path is empty, the result is a null-drive = drive role 0. 00874 It pretends to have loaded no media and supports no reading or writing. 00875 00876 If the path leads to an existing regular file, or to a not yet existing 00877 file, or to an existing block device, then the result is a random access 00878 stdio-drive capable of reading and writing = drive role 2. 00879 00880 If the path leads to an existing file of any type other than directory, 00881 then the result is a sequential write-only stdio-drive = drive role 3. 00882 00883 The special address form "stdio:/dev/fd/{number}" is interpreted literally 00884 as reference to open file descriptor {number}. This address form coincides 00885 with real files on some systems, but it is in fact hardcoded in libburn. 00886 Special address "stdio:-" means stdout = "stdio:/dev/fd/1". 00887 The role of such a drive is determined by the file type obtained via 00888 fstat({number}). 00889 00890 Roles 2 and 3 perform all their eventual data transfer activities on a file 00891 via standard i/o functions open(2), lseek(2), read(2), write(2), close(2). 00892 The media profile is reported as 0xffff. Write space information from those 00893 media is not necessarily realistic. 00894 00895 The capabilities of role 2 resemble DVD-RAM but it can simulate writing. 00896 If the path does not exist in the filesystem yet, it is attempted to create 00897 it as a regular file as soon as write operations are started. 00898 00899 The capabilities of role 3 resemble a blank DVD-R. Nevertheless each 00900 burn_disc_write() run may only write a single track. 00901 00902 One may distinguish pseudo-drives from MMC drives by call 00903 burn_drive_get_drive_role(). 00904 00905 @param drive_infos On success returns a one element array with the drive 00906 (cdrom/burner). Thus use with driveno 0 only. On failure 00907 the array has no valid elements at all. 00908 The returned array should be freed via burn_drive_info_free() 00909 when it is no longer needed. 00910 This is a result from call burn_drive_scan(). See there. 00911 Use with driveno 0 only. 00912 @param adr The persistent address of the desired drive. Either once 00913 obtained by burn_drive_d_get_adr() or composed skillfully by 00914 application resp. its user. E.g. "/dev/sr0". 00915 Consider to preprocess it by burn_drive_convert_fs_adr(). 00916 @param load Nonzero to make the drive attempt to load a disc (close its 00917 tray door, etc). 00918 @return 1 = success , 0 = drive not found , -1 = other error 00919 @since 0.2.2 00920 */ 00921 int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], 00922 char* adr, int load); 00923 00924 00925 /* ts A51221 */ 00926 /* @since 0.2.2 */ 00927 /** Maximum number of particularly permissible drive addresses */ 00928 #define BURN_DRIVE_WHITELIST_LEN 255 00929 00930 /** Add a device to the list of permissible drives. As soon as some entry is in 00931 the whitelist all non-listed drives are banned from scanning. 00932 @return 1 success, <=0 failure 00933 @since 0.2.2 00934 */ 00935 int burn_drive_add_whitelist(char *device_address); 00936 00937 /** Remove all drives from whitelist. This enables all possible drives. */ 00938 void burn_drive_clear_whitelist(void); 00939 00940 00941 /** Scan for drives. This function MUST be called until it returns nonzero. 00942 In case of re-scanning: 00943 All pointers to struct burn_drive and all struct burn_drive_info arrays 00944 are invalidated by using this function. Do NOT store drive pointers across 00945 calls to this function ! 00946 To avoid invalid pointers one MUST free all burn_drive_info arrays 00947 by burn_drive_info_free() before calling burn_drive_scan() a second time. 00948 If there are drives left, then burn_drive_scan() will refuse to work. 00949 00950 After this call all drives depicted by the returned array are subject 00951 to eventual (O_EXCL) locking. See burn_preset_device_open(). This state 00952 ends either with burn_drive_info_forget() or with burn_drive_release(). 00953 It is unfriendly to other processes on the system to hold drives locked 00954 which one does not definitely plan to use soon. 00955 @param drive_infos Returns an array of drive info items (cdroms/burners). 00956 The returned array must be freed by burn_drive_info_free() 00957 before burn_finish(), and also before calling this function 00958 burn_drive_scan() again. 00959 @param n_drives Returns the number of drive items in drive_infos. 00960 @return 0 while scanning is not complete 00961 >0 when it is finished sucessfully, 00962 <0 when finished but failed. 00963 */ 00964 int burn_drive_scan(struct burn_drive_info *drive_infos[], 00965 unsigned int *n_drives); 00966 00967 /* ts A60904 : ticket 62, contribution by elmom */ 00968 /** Release memory about a single drive and any exclusive lock on it. 00969 Become unable to inquire or grab it. Expect FATAL consequences if you try. 00970 @param drive_info pointer to a single element out of the array 00971 obtained from burn_drive_scan() : &(drive_infos[driveno]) 00972 @param force controls degree of permissible drive usage at the moment this 00973 function is called, and the amount of automatically provided 00974 drive shutdown : 00975 0= drive must be ungrabbed and BURN_DRIVE_IDLE 00976 1= try to release drive resp. accept BURN_DRIVE_GRABBING 00977 Use these two only. Further values are to be defined. 00978 @return 1 on success, 2 if drive was already forgotten, 00979 0 if not permissible, <0 on other failures, 00980 @since 0.2.2 00981 */ 00982 int burn_drive_info_forget(struct burn_drive_info *drive_info, int force); 00983 00984 00985 /** When no longer needed, free a whole burn_drive_info array which was 00986 returned by burn_drive_scan(). 00987 For freeing single drive array elements use burn_drive_info_forget(). 00988 */ 00989 void burn_drive_info_free(struct burn_drive_info drive_infos[]); 00990 00991 00992 /* ts A60823 */ 00993 /* @since 0.2.2 */ 00994 /** Maximum length+1 to expect with a persistent drive address string */ 00995 #define BURN_DRIVE_ADR_LEN 1024 00996 00997 /* ts A70906 */ 00998 /** Inquire the persistent address of the given drive. 00999 @param drive The drive to inquire. 01000 @param adr An application provided array of at least BURN_DRIVE_ADR_LEN 01001 characters size. The persistent address gets copied to it. 01002 @return >0 success , <=0 error (due to libburn internal problem) 01003 @since 0.4.0 01004 */ 01005 int burn_drive_d_get_adr(struct burn_drive *drive, char adr[]); 01006 01007 /* A60823 */ 01008 /** Inquire the persistent address of a drive via a given drive_info object. 01009 (Note: This is a legacy call.) 01010 @param drive_info The drive to inquire.Usually some &(drive_infos[driveno]) 01011 @param adr An application provided array of at least BURN_DRIVE_ADR_LEN 01012 characters size. The persistent address gets copied to it. 01013 @return >0 success , <=0 error (due to libburn internal problem) 01014 @since 0.2.6 01015 */ 01016 int burn_drive_get_adr(struct burn_drive_info *drive_info, char adr[]); 01017 01018 01019 /* ts A60922 ticket 33 */ 01020 /** Evaluate whether the given address would be a possible persistent drive 01021 address of libburn. 01022 @return 1 means yes, 0 means no 01023 @since 0.2.6 01024 */ 01025 int burn_drive_is_enumerable_adr(char *adr); 01026 01027 /* ts A60922 ticket 33 */ 01028 /** Try to convert a given existing filesystem address into a persistent drive 01029 address. This succeeds with symbolic links or if a hint about the drive's 01030 system address can be read from the filesystem object and a matching drive 01031 is found. 01032 @param path The address of an existing file system object 01033 @param adr An application provided array of at least BURN_DRIVE_ADR_LEN 01034 characters size. The persistent address gets copied to it. 01035 @return 1 = success , 0 = failure , -1 = severe error 01036 @since 0.2.6 01037 */ 01038 int burn_drive_convert_fs_adr(char *path, char adr[]); 01039 01040 /* ts A60923 */ 01041 /** Try to convert a given SCSI address of bus,host,channel,target,lun into 01042 a persistent drive address. If a SCSI address component parameter is < 0 01043 then it is not decisive and the first enumerated address which matches 01044 the >= 0 parameters is taken as result. 01045 Note: bus and (host,channel) are supposed to be redundant. 01046 @param bus_no "Bus Number" (something like a virtual controller) 01047 @param host_no "Host Number" (something like half a virtual controller) 01048 @param channel_no "Channel Number" (other half of "Host Number") 01049 @param target_no "Target Number" or "SCSI Id" (a device) 01050 @param lun_no "Logical Unit Number" (a sub device) 01051 @param adr An application provided array of at least BURN_DRIVE_ADR_LEN 01052 characters size. The persistent address gets copied to it. 01053 @return 1 = success , 0 = failure , -1 = severe error 01054 @since 0.2.6 01055 */ 01056 int burn_drive_convert_scsi_adr(int bus_no, int host_no, int channel_no, 01057 int target_no, int lun_no, char adr[]); 01058 01059 /* ts A60923 - A61005 */ 01060 /** Try to obtain bus,host,channel,target,lun from path. If there is an SCSI 01061 address at all, then this call should succeed with a persistent 01062 drive address obtained via burn_drive_d_get_adr(). It is also supposed to 01063 succeed with any device file of a (possibly emulated) SCSI device. 01064 @return 1 = success , 0 = failure , -1 = severe error 01065 @since 0.2.6 01066 */ 01067 int burn_drive_obtain_scsi_adr(char *path, int *bus_no, int *host_no, 01068 int *channel_no, int *target_no, int *lun_no); 01069 01070 /** Grab a drive. This must be done before the drive can be used (for reading, 01071 writing, etc). 01072 @param drive The drive to grab. This is found in a returned 01073 burn_drive_info struct. 01074 @param load Nonzero to make the drive attempt to load a disc (close its 01075 tray door, etc). 01076 @return 1 if it was possible to grab the drive, else 0 01077 */ 01078 int burn_drive_grab(struct burn_drive *drive, int load); 01079 01080 /* ts B00114 */ 01081 /* Probe available CD write modes and block types. In earlier versions this 01082 was done unconditionally on drive examination or aquiration. But it is 01083 lengthy and obtrusive, up to spoiling burn runs on the examined drives. 01084 So now this probing is omitted by default. All drives which announce to be 01085 capable of CD or DVD writing, get blindly attributed the capability for 01086 SAO and TAO. Applications which are interested in RAW modes or want to 01087 rely on the traditional write mode information, may use this call. 01088 @param drive_info drive object to be inquired 01089 @return >0 indicates success, <=0 means failure 01090 @since 0.7.6 01091 */ 01092 int burn_drive_probe_cd_write_modes(struct burn_drive_info *drive_info); 01093 01094 /* ts A90824 */ 01095 /** Calm down or alert a drive. Some drives stay alert after reading for 01096 quite some time. This saves time with the startup for the next read 01097 operation but also causes noise and consumes extra energy. It makes 01098 sense to calm down the drive if no read operation is expected for the 01099 next few seconds. The drive will get alert automatically if operations 01100 are required. 01101 @param d The drive to influence. 01102 @param flag Bitfield for control purposes 01103 bit0= become alert (else start snoozing) 01104 This is not mandatory to allow further drive operations 01105 @return 1= success , 0= drive role not suitable for calming 01106 @since 0.7.0 01107 */ 01108 int burn_drive_snooze(struct burn_drive *d, int flag); 01109 01110 01111 /** Release a drive. This should not be done until the drive is no longer 01112 busy (see burn_drive_get_status). 01113 @param drive The drive to release. 01114 @param eject Nonzero to make the drive eject the disc in it. 01115 */ 01116 void burn_drive_release(struct burn_drive *drive, int eject); 01117 01118 01119 /* ts A70918 */ 01120 /** Like burn_drive_release() but keeping the drive tray closed and its 01121 eject button disabled. This physically locked drive state will last until 01122 the drive is grabbed again and released via burn_drive_release(). 01123 Programs like eject, cdrecord, growisofs will break that ban too. 01124 @param d The drive to release and leave locked. 01125 @param flag Bitfield for control purposes (unused yet, submit 0) 01126 @return 1 means success, <=0 means failure 01127 @since 0.4.0 01128 */ 01129 int burn_drive_leave_locked(struct burn_drive *d, int flag); 01130 01131 01132 /** Returns what kind of disc a drive is holding. This function may need to be 01133 called more than once to get a proper status from it. See burn_disc_status 01134 for details. 01135 @param drive The drive to query for a disc. 01136 @return The status of the drive, or what kind of disc is in it. 01137 Note: BURN_DISC_UNGRABBED indicates wrong API usage 01138 */ 01139 enum burn_disc_status burn_disc_get_status(struct burn_drive *drive); 01140 01141 01142 /* ts A61020 */ 01143 /** WARNING: This revives an old bug-like behavior that might be dangerous. 01144 Sets the drive status to BURN_DISC_BLANK if it is BURN_DISC_UNREADY 01145 or BURN_DISC_UNSUITABLE. Thus marking media as writable which actually 01146 failed to declare themselves either blank or (partially) filled. 01147 @return 1 drive status has been set , 0 = unsuitable drive status 01148 @since 0.2.6 01149 */ 01150 int burn_disc_pretend_blank(struct burn_drive *drive); 01151 01152 01153 /* ts A61106 */ 01154 /** WARNING: This overrides the safety measures against unsuitable media. 01155 Sets the drive status to BURN_DISC_FULL if it is BURN_DISC_UNREADY 01156 or BURN_DISC_UNSUITABLE. Thus marking media as blankable which actually 01157 failed to declare themselves either blank or (partially) filled. 01158 @since 0.2.6 01159 */ 01160 int burn_disc_pretend_full(struct burn_drive *drive); 01161 01162 01163 /* ts A61021 */ 01164 /** Reads ATIP information from inserted media. To be obtained via 01165 burn_drive_get_write_speed(), burn_drive_get_min_write_speed(), 01166 burn_drive_get_start_end_lba(). The drive must be grabbed for this call. 01167 @param drive The drive to query. 01168 @return 1=sucess, 0=no valid ATIP info read, -1 severe error 01169 @since 0.2.6 01170 */ 01171 int burn_disc_read_atip(struct burn_drive *drive); 01172 01173 01174 /* ts A61020 */ 01175 /** Returns start and end lba of the media which is currently inserted 01176 in the given drive. The drive has to be grabbed to have hope for reply. 01177 Shortcomming (not a feature): unless burn_disc_read_atip() was called 01178 only blank media will return valid info. 01179 @param drive The drive to query. 01180 @param start_lba Returns the start lba value 01181 @param end_lba Returns the end lba value 01182 @param flag Bitfield for control purposes (unused yet, submit 0) 01183 @return 1 if lba values are valid , 0 if invalid 01184 @since 0.2.6 01185 */ 01186 int burn_drive_get_start_end_lba(struct burn_drive *drive, 01187 int *start_lba, int *end_lba, int flag); 01188 01189 01190 /* ts A90902 */ 01191 /** Guess the manufacturer name of CD media from the ATIP addresses of lead-in 01192 and lead-out. (Currently only lead-in is interpreted. Lead-out may in 01193 future be used to identify the media type in more detail.) 01194 The parameters of this call should be obtained by burn_disc_read_atip(d), 01195 burn_drive_get_start_end_lba(d, &start_lba, &end_lba, 0), 01196 burn_lba_to_msf(start_lba, &m_li, &s_li, &f_li) and 01197 burn_lba_to_msf(end_lba, &m_lo, &s_lo, &f_lo). 01198 @param m_li "minute" part of ATIP lead-in resp. start_lba 01199 @param s_li "second" of lead-in resp. start_lba 01200 @param f_li "frame" of lead-in 01201 @param m_lo "minute" part of ATIP lead-out 01202 @param s_lo "second" of lead-out 01203 @param f_lo "frame" of lead-out 01204 @param flag Bitfield for control purposes, 01205 bit0= append a text "(aka ...)" to reply if other brands or 01206 vendor names are known. 01207 @return Printable text or NULL on memory shortage. 01208 Dispose by free() when no longer needed. 01209 @since 0.7.2 01210 */ 01211 char *burn_guess_cd_manufacturer(int m_li, int s_li, int f_li, 01212 int m_lo, int s_lo, int f_lo, int flag); 01213 01214 /* ts A90909 */ 01215 /** Retrieve some media information which is mainly specific to CD. For other 01216 media only the bits in reply parameter valid are supposed to be meaningful. 01217 @param d The drive to query. 01218 @param disc_type A string saying either "CD-DA or CD-ROM", or "CD-I", 01219 or ""CD-ROM XA", or "undefined". 01220 @param disc_id A 32 bit number read from the media. (Meaning unclear yet) 01221 @param bar_code 8 hex digits from a barcode on media read by the drive 01222 (if the drive has a bar code reader built in). 01223 @param app_code The Host Application Code which must be set in the Write 01224 Parameters Page if the media is not unrestricted (URU==0). 01225 @param valid Replies bits which indicate the validity of other reply 01226 parameters or the state of certain CD info bits: 01227 bit0= disc_type is valid 01228 bit1= disc_id is valid 01229 bit2= bar_code is valid 01230 bit3= disc_app_code is valid 01231 bit4= Disc is unrestricted (URU bit, 51h READ DISC INFO) 01232 This seems to be broken with my drives. The bit is 01233 0 and the validity bit for disc_app_code is 0 too. 01234 bit5= Disc is nominally erasable (Erasable bit) 01235 This will be set with overwriteable media which 01236 libburn normally considers to be unerasable blank. 01237 @since 0.7.2 01238 */ 01239 int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80], 01240 unsigned int *disc_id, char bar_code[9], int *app_code, 01241 int *valid); 01242 01243 01244 /* ts A61110 */ 01245 /** Read start lba and Next Writeable Address of a track from media. 01246 Usually a track lba is obtained from the result of burn_track_get_entry(). 01247 This call retrieves an updated lba, eventual nwa, and can address the 01248 invisible track to come. 01249 The drive must be grabbed for this call. One may not issue this call 01250 during ongoing burn_disc_write() or burn_disc_erase(). 01251 @param d The drive to query. 01252 @param o If not NULL: write parameters to be set on drive before query 01253 @param trackno 0=next track to come, >0 number of existing track 01254 @param lba return value: start lba 01255 @param nwa return value: Next Writeable Address 01256 @return 1=nwa is valid , 0=nwa is not valid , -1=error 01257 @since 0.2.6 01258 */ 01259 int burn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o, 01260 int trackno, int *lba, int *nwa); 01261 01262 /* ts A70131 */ 01263 /** Read start lba of the first track in the last complete session. 01264 This is the first parameter of mkisofs option -C. The second parameter 01265 is nwa as obtained by burn_disc_track_lba_nwa() with trackno 0. 01266 @param d The drive to query. 01267 @param start_lba returns the start address of that track 01268 @return <= 0 : failure, 1 = ok 01269 @since 0.3.2 01270 */ 01271 int burn_disc_get_msc1(struct burn_drive *d, int *start_lba); 01272 01273 01274 /* ts A70213 */ 01275 /** Return the best possible estimation of the currently available capacity of 01276 the media. This might depend on particular write option settings. For 01277 inquiring the space with such a set of options, the drive has to be 01278 grabbed and BURN_DRIVE_IDLE. If not, then one will only get a canned value 01279 from the most recent automatic inquiry (e.g. during last drive grabbing). 01280 An eventual start address from burn_write_opts_set_start_byte() will be 01281 subtracted from the obtained capacity estimation. Negative results get 01282 defaulted to 0. 01283 @param d The drive to query. 01284 @param o If not NULL: write parameters to be set on drive before query 01285 @return number of most probably available free bytes 01286 @since 0.3.4 01287 */ 01288 off_t burn_disc_available_space(struct burn_drive *d, 01289 struct burn_write_opts *o); 01290 01291 01292 /* ts A61202 */ 01293 /** Tells the MMC Profile identifier of the loaded media. The drive must be 01294 grabbed in order to get a non-zero result. 01295 libburn currently writes only to profiles 01296 0x09 "CD-R", 0x0a "CD-RW", 01297 0x11 "DVD-R sequential recording", 0x12 "DVD-RAM", 01298 0x13 "DVD-RW restricted overwrite", 0x14 "DVD-RW sequential recording", 01299 0x1a "DVD+RW", 0x1b "DVD+R", 01300 0x2b "DVD+R/DL", 01301 0x41 "BD-R sequential recording", 0x43 "BD-RE", 01302 0xffff "stdio file" 01303 Note: 0xffff is not a MMC profile but a libburn invention. 01304 If enabled by burn_allow_untested_profiles() it also writes to profiles 01305 0x15 "DVD-R/DL sequential recording", 01306 Read-only are the profiles 01307 0x08 "CD-ROM", 0x10 "DVD-ROM", 01308 0x40 "BD-ROM", 01309 For now read-only is BD-R profile (testers wanted) 01310 0x42 "BD-R random recording" 01311 @param d The drive where the media is inserted. 01312 @param pno Profile Number. See also mmc5r03c.pdf, table 89 01313 @param name Profile Name (see above list, unknown profiles have empty name) 01314 @return 1 profile is valid, 0 no profile info available 01315 @since 0.3.0 01316 */ 01317 int burn_disc_get_profile(struct burn_drive *d, int *pno, char name[80]); 01318 01319 01320 /* ts A90903 : API */ 01321 /** Obtain product id and standards defined media codes. 01322 The product id is a printable string which is supposed to be the same 01323 for identical media but should vary with non-identical media. Some media 01324 do not allow to obtain such an id at all. 01325 The pair (profile_number, product_id) should be the best id to identify 01326 media with identical product specifications. 01327 The reply parameters media_code1 and media_code2 can be used with 01328 burn_guess_manufacturer() 01329 The reply parameters have to be disposed by free() when no longer needed. 01330 @param d The drive where the media is inserted. 01331 @param product_id Reply: Printable text depicting manufacturer and 01332 eventually media id. 01333 @param media_code1 Reply: The eventual manufacturer identification as read 01334 from DVD/BD media or a text "XXmYYsZZf" from CD media 01335 ATIP lead-in. 01336 @param media_code2 The eventual media id as read from DVD+/BD media or a 01337 text "XXmYYsZZf" from CD ATIP lead-out. 01338 @param book_type Book type text for DVD and BD. 01339 Caution: is NULL with CD, even if return value says ok. 01340 @param flag Bitfield for control purposes 01341 bit0= do not escape " _/" (not suitable for 01342 burn_guess_manufacturer()) 01343 @return 1= ok, product_id and media codes are valid, 01344 0= no product id_available, reply parameters are NULL 01345 <0= error 01346 @since 0.7.2 01347 */ 01348 int burn_disc_get_media_id(struct burn_drive *d, 01349 char **product_id, char **media_code1, char **media_code2, 01350 char **book_type, int flag); 01351 01352 01353 /* ts A90904 */ 01354 /** Guess the name of a manufacturer by profile number, manufacturer code 01355 and media code. The profile number can be obtained by 01356 burn_disc_get_profile(), the other two parameters can be obtained as 01357 media_code1 and media_code2 by burn_get_media_product_id(). 01358 @param profile_no Profile number (submit -1 if not known) 01359 @param manuf_code Manufacturer code from media (e.g. "RICOHJPN") 01360 @param media_code Media ID code from media (e.g. "W11") 01361 @param flag Bitfield for control purposes, submit 0 01362 @return Printable text or NULL on memory shortage. 01363 If the text begins with "Unknown " then no item of the 01364 manufacturer list matched the codes. 01365 Dispose by free() when no longer needed. 01366 @since 0.7.2 01367 */ 01368 char *burn_guess_manufacturer(int profile_no, 01369 char *manuf_code, char *media_code, int flag); 01370 01371 01372 /** Tells whether a disc can be erased or not 01373 @param d The drive to inquire. 01374 @return Non-zero means erasable 01375 */ 01376 int burn_disc_erasable(struct burn_drive *d); 01377 01378 /** Returns the progress and status of a drive. 01379 @param drive The drive to query busy state for. 01380 @param p Returns the progress of the operation, NULL if you don't care 01381 @return the current status of the drive. See also burn_drive_status. 01382 */ 01383 enum burn_drive_status burn_drive_get_status(struct burn_drive *drive, 01384 struct burn_progress *p); 01385 01386 /** Creates a write_opts struct for burning to the specified drive. 01387 The returned object must later be freed with burn_write_opts_free(). 01388 @param drive The drive to write with 01389 @return The write_opts, NULL on error 01390 */ 01391 struct burn_write_opts *burn_write_opts_new(struct burn_drive *drive); 01392 01393 01394 /* ts A70901 */ 01395 /** Inquires the drive associated with a burn_write_opts object. 01396 @param opts object to inquire 01397 @return pointer to drive 01398 @since 0.4.0 01399 */ 01400 struct burn_drive *burn_write_opts_get_drive(struct burn_write_opts *opts); 01401 01402 01403 /** Frees a write_opts struct created with burn_write_opts_new 01404 @param opts write_opts to free 01405 */ 01406 void burn_write_opts_free(struct burn_write_opts *opts); 01407 01408 /** Creates a read_opts struct for reading from the specified drive 01409 must be freed with burn_read_opts_free 01410 @param drive The drive to read from 01411 @return The read_opts 01412 */ 01413 struct burn_read_opts *burn_read_opts_new(struct burn_drive *drive); 01414 01415 /** Frees a read_opts struct created with burn_read_opts_new 01416 @param opts write_opts to free 01417 */ 01418 void burn_read_opts_free(struct burn_read_opts *opts); 01419 01420 /** Erase a disc in the drive. The drive must be grabbed successfully BEFORE 01421 calling this functions. Always ensure that the drive reports a status of 01422 BURN_DISC_FULL before calling this function. An erase operation is not 01423 cancellable, as control of the operation is passed wholly to the drive and 01424 there is no way to interrupt it safely. 01425 @param drive The drive with which to erase a disc. 01426 @param fast Nonzero to do a fast erase, where only the disc's headers are 01427 erased; zero to erase the entire disc. 01428 With DVD-RW, fast blanking yields media capable only of DAO. 01429 */ 01430 void burn_disc_erase(struct burn_drive *drive, int fast); 01431 01432 01433 /* ts A70101 - A70417 */ 01434 /** Format media for use with libburn. This currently applies to DVD-RW 01435 in state "Sequential Recording" (profile 0014h) which get formatted to 01436 state "Restricted Overwrite" (profile 0013h). DVD+RW can be "de-iced" 01437 by setting bit2 of flag. DVD-RAM and BD-RE may get formatted initially 01438 or re-formatted to adjust their Defect Managment. 01439 This function usually returns while the drive is still in the process 01440 of formatting. The formatting is done, when burn_drive_get_status() 01441 returns BURN_DRIVE_IDLE. This may be immediately after return or may 01442 need several thousand seconds to occur. 01443 @param drive The drive with the disc to format. 01444 @param size The size in bytes to be used with the format command. It should 01445 be divisible by 32*1024. The effect of this parameter may 01446 depend on the media profile and on parameter flag. 01447 @param flag Bitfield for control purposes: 01448 bit0= after formatting, write the given number of zero-bytes 01449 to the media and eventually perform preliminary closing. 01450 bit1+2: size mode 01451 0 = use parameter size as far as it makes sense 01452 1 = insist in size 0 even if there is a better default known 01453 (on DVD-RAM or BD-R identical to size mode 0, 01454 i.e. they never get formatted with payload size 0) 01455 2 = without bit7: format to maximum available size 01456 with bit7 : take size from indexed format descriptor 01457 3 = without bit7: format to default size 01458 with bit7 : take size from indexed format descriptor 01459 bit3= -reserved- 01460 bit4= enforce re-format of (partly) formatted media 01461 bit5= try to disable eventual defect management 01462 bit6= try to avoid lengthy media certification 01463 bit7, bit8 to bit15 = 01464 bit7 enables MMC expert application mode (else libburn 01465 tries to choose a suitable format type): 01466 If it is set then bit8 to bit15 contain the index of 01467 the format to use. See burn_disc_get_formats(), 01468 burn_disc_get_format_descr(). 01469 Acceptable types are: 0x00, 0x01, 0x10, 0x11, 0x13, 01470 0x15, 0x26, 0x30, 0x31, 0x32. 01471 If bit7 is set, then bit4 is set automatically. 01472 bit16= enable POW on blank BD-R 01473 @since 0.3.0 01474 */ 01475 void burn_disc_format(struct burn_drive *drive, off_t size, int flag); 01476 01477 01478 /* ts A70112 */ 01479 /* @since 0.3.0 */ 01480 /** Possible formatting status values */ 01481 #define BURN_FORMAT_IS_UNFORMATTED 1 01482 #define BURN_FORMAT_IS_FORMATTED 2 01483 #define BURN_FORMAT_IS_UNKNOWN 3 01484 01485 /* ts A70112 */ 01486 /** Inquire the formatting status, the associated sizes and the number of 01487 available formats. The info is media specific and stems from MMC command 01488 23h READ FORMAT CAPACITY. See mmc5r03c.pdf 6.24 for background details. 01489 Media type can be determined via burn_disc_get_profile(). 01490 @param drive The drive with the disc to format. 01491 @param status The current formatting status of the inserted media. 01492 See BURN_FORMAT_IS_* macros. Note: "unknown" is the 01493 legal status for quick formatted, yet unwritten DVD-RW. 01494 @param size The size in bytes associated with status. 01495 unformatted: the maximum achievable size of the media 01496 formatted: the currently formatted capacity 01497 unknown: maximum capacity of drive or of media 01498 @param bl_sas Additional info "Block Length/Spare Area Size". 01499 Expected to be constantly 2048 for non-BD media. 01500 @param num_formats The number of available formats. To be used with 01501 burn_disc_get_format_descr() to obtain such a format 01502 and eventually with burn_disc_format() to select one. 01503 @return 1 reply is valid , <=0 failure 01504 @since 0.3.0 01505 */ 01506 int burn_disc_get_formats(struct burn_drive *drive, int *status, off_t *size, 01507 unsigned *bl_sas, int *num_formats); 01508 01509 /* ts A70112 */ 01510 /** Inquire parameters of an available media format. 01511 @param drive The drive with the disc to format. 01512 @param index The index of the format item. Beginning with 0 up to reply 01513 parameter from burn_disc_get_formats() : num_formats - 1 01514 @param type The format type. See mmc5r03c.pdf, 6.5, 04h FORMAT UNIT. 01515 0x00=full, 0x10=CD-RW/DVD-RW full, 0x11=CD-RW/DVD-RW grow, 01516 0x15=DVD-RW quick, 0x13=DVD-RW quick grow, 01517 0x26=DVD+RW background, 0x30=BD-RE with spare areas, 01518 0x31=BD-RE without spare areas 01519 @param size The maximum size in bytes achievable with this format. 01520 @param tdp Type Dependent Parameter. See mmc5r03c.pdf. 01521 @return 1 reply is valid , <=0 failure 01522 @since 0.3.0 01523 */ 01524 int burn_disc_get_format_descr(struct burn_drive *drive, int index, 01525 int *type, off_t *size, unsigned *tdp); 01526 01527 01528 01529 /* ts A61109 : this was and is defunct */ 01530 /** Read a disc from the drive and write it to an fd pair. The drive must be 01531 grabbed successfully BEFORE calling this function. Always ensure that the 01532 drive reports a status of BURN_DISC_FULL before calling this function. 01533 @param drive The drive from which to read a disc. 01534 @param o The options for the read operation. 01535 */ 01536 void burn_disc_read(struct burn_drive *drive, const struct burn_read_opts *o); 01537 01538 01539 01540 /* ts A70222 */ 01541 /* @since 0.3.4 */ 01542 /** The length of a rejection reasons string for burn_precheck_write() and 01543 burn_write_opts_auto_write_type() . 01544 */ 01545 #define BURN_REASONS_LEN 4096 01546 01547 01548 /* ts A70219 */ 01549 /** Examines a completed setup for burn_disc_write() whether it is permissible 01550 with drive and media. This function is called by burn_disc_write() but 01551 an application might be interested in this check in advance. 01552 @param o The options for the writing operation. 01553 @param disc The descrition of the disc to be created 01554 @param reasons Eventually returns a list of rejection reason statements 01555 @param silent 1= do not issue error messages , 0= report problems 01556 @return 1 ok, -1= no recordable media detected, 0= other failure 01557 @since 0.3.4 01558 */ 01559 int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc, 01560 char reasons[BURN_REASONS_LEN], int silent); 01561 01562 01563 /** Write a disc in the drive. The drive must be grabbed successfully before 01564 calling this function. Always ensure that the drive reports a status of 01565 BURN_DISC_BLANK ot BURN_DISC_APPENDABLE before calling this function. 01566 Note: write_type BURN_WRITE_SAO is currently not capable of writing a mix 01567 of data and audio tracks. You must use BURN_WRITE_TAO for such sessions. 01568 To be set by burn_write_opts_set_write_type(). 01569 Note: This function is not suitable for overwriting data in the middle of 01570 a valid data area because it is allowed to append trailing data. 01571 For exact random access overwriting use burn_random_access_write(). 01572 @param o The options for the writing operation. 01573 @param disc The struct burn_disc * that described the disc to be created 01574 */ 01575 void burn_disc_write(struct burn_write_opts *o, struct burn_disc *disc); 01576 01577 01578 /* ts A90227 */ 01579 /** Control stream recording during the write run and eventually set the start 01580 LBA for stream recording. 01581 Stream recording is set from struct burn_write_opts when the write run 01582 gets started. See burn_write_opts_set_stream_recording(). 01583 The call described here can be used later to override this setting and 01584 to program automatic switching at a given LBA. It also affects subsequent 01585 calls to burn_random_access_write(). 01586 @param drive The drive which performs the write operation. 01587 @param recmode -1= disable stream recording 01588 0= leave setting as is 01589 1= enable stream recording 01590 @param start The LBA where actual stream recording shall start. 01591 (0 means unconditional stream recording) 01592 @param flag Bitfield for control purposes (unused yet, submit 0). 01593 @return 1=success , <=0 failure 01594 @since 0.6.4 01595 */ 01596 int burn_drive_set_stream_recording(struct burn_drive *drive, int recmode, 01597 int start, int flag); 01598 01599 /** Cancel an operation on a drive. 01600 This will only work when the drive's busy state is BURN_DRIVE_READING or 01601 BURN_DRIVE_WRITING. 01602 @param drive The drive on which to cancel the current operation. 01603 */ 01604 void burn_drive_cancel(struct burn_drive *drive); 01605 01606 01607 /* ts A61223 */ 01608 /** Inquire whether the most recent asynchronous media job was successful. 01609 This applies to burn_disc_erase(), burn_disc_format(), burn_disc_write(). 01610 Reasons for non-success may be: rejection of burn parameters, abort due to 01611 fatal errors during write, blank or format, a call to burn_drive_cancel() 01612 by the application thread. 01613 @param d The drive to inquire. 01614 @return 1=burn seems to have went well, 0=burn failed 01615 @since 0.2.6 01616 */ 01617 int burn_drive_wrote_well(struct burn_drive *d); 01618 01619 01620 /** Convert a minute-second-frame (MSF) value to sector count 01621 @param m Minute component 01622 @param s Second component 01623 @param f Frame component 01624 @return The sector count 01625 */ 01626 int burn_msf_to_sectors(int m, int s, int f); 01627 01628 /** Convert a sector count to minute-second-frame (MSF) 01629 @param sectors The sector count 01630 @param m Returns the minute component 01631 @param s Returns the second component 01632 @param f Returns the frame component 01633 */ 01634 void burn_sectors_to_msf(int sectors, int *m, int *s, int *f); 01635 01636 /** Convert a minute-second-frame (MSF) value to an lba 01637 @param m Minute component 01638 @param s Second component 01639 @param f Frame component 01640 @return The lba 01641 */ 01642 int burn_msf_to_lba(int m, int s, int f); 01643 01644 /** Convert an lba to minute-second-frame (MSF) 01645 @param lba The lba 01646 @param m Returns the minute component 01647 @param s Returns the second component 01648 @param f Returns the frame component 01649 */ 01650 void burn_lba_to_msf(int lba, int *m, int *s, int *f); 01651 01652 /** Create a new disc 01653 @return Pointer to a burn_disc object or NULL on failure. 01654 */ 01655 struct burn_disc *burn_disc_create(void); 01656 01657 /** Delete disc and decrease the reference count on all its sessions 01658 @param d The disc to be freed 01659 */ 01660 void burn_disc_free(struct burn_disc *d); 01661 01662 /** Create a new session 01663 @return Pointer to a burn_session object or NULL on failure. 01664 */ 01665 struct burn_session *burn_session_create(void); 01666 01667 /** Free a session (and decrease reference count on all tracks inside) 01668 @param s Session to be freed 01669 */ 01670 void burn_session_free(struct burn_session *s); 01671 01672 /** Add a session to a disc at a specific position, increasing the 01673 sessions's reference count. 01674 @param d Disc to add the session to 01675 @param s Session to add to the disc 01676 @param pos position to add at (BURN_POS_END is "at the end") 01677 @return 0 for failure, 1 for success 01678 */ 01679 int burn_disc_add_session(struct burn_disc *d, struct burn_session *s, 01680 unsigned int pos); 01681 01682 /** Remove a session from a disc 01683 @param d Disc to remove session from 01684 @param s Session pointer to find and remove 01685 */ 01686 int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s); 01687 01688 01689 /** Create a track (for TAO recording, or to put in a session) */ 01690 struct burn_track *burn_track_create(void); 01691 01692 /** Free a track 01693 @param t Track to free 01694 */ 01695 void burn_track_free(struct burn_track *t); 01696 01697 /** Add a track to a session at specified position 01698 @param s Session to add to 01699 @param t Track to insert in session 01700 @param pos position to add at (BURN_POS_END is "at the end") 01701 @return 0 for failure, 1 for success 01702 */ 01703 int burn_session_add_track(struct burn_session *s, struct burn_track *t, 01704 unsigned int pos); 01705 01706 /** Remove a track from a session 01707 @param s Session to remove track from 01708 @param t Track pointer to find and remove 01709 @return 0 for failure, 1 for success 01710 */ 01711 int burn_session_remove_track(struct burn_session *s, struct burn_track *t); 01712 01713 01714 /** Define the data in a track 01715 @param t the track to define 01716 @param offset The lib will write this many 0s before start of data 01717 @param tail The number of extra 0s to write after data 01718 @param pad 1 means the lib should pad the last sector with 0s if the 01719 track isn't exactly sector sized. (otherwise the lib will 01720 begin reading from the next track) 01721 @param mode data format (bitfield) 01722 */ 01723 void burn_track_define_data(struct burn_track *t, int offset, int tail, 01724 int pad, int mode); 01725 01726 01727 /* ts A61024 */ 01728 /** Define whether a track shall swap bytes of its input stream. 01729 @param t The track to change 01730 @param swap_source_bytes 0=do not swap, 1=swap byte pairs 01731 @return 1=success , 0=unacceptable value 01732 @since 0.2.6 01733 */ 01734 int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes); 01735 01736 01737 /* ts A90910 */ 01738 /** Activates CD XA compatibility modes. 01739 libburn currently writes data only in CD mode 1. Some programs insist in 01740 sending data with additional management bytes. These bytes have to be 01741 stripped in order to make the input suitable for BURN_MODE1. 01742 @param t The track to manipulate 01743 @param value 0= no conversion 01744 1= strip 8 byte sector headers of CD-ROM XA mode 2 form 1 01745 see MMC-5 4.2.3.8.5.3 Block Format for Mode 2 form 1 Data 01746 all other values are reserved 01747 @return 1=success , 0=unacceptable value 01748 @since 0.7.2 01749 */ 01750 int burn_track_set_cdxa_conv(struct burn_track *t, int value); 01751 01752 01753 /** Set the ISRC details for a track 01754 @param t The track to change 01755 @param country the 2 char country code. Each character must be 01756 only numbers or letters. 01757 @param owner 3 char owner code. Each character must be only numbers 01758 or letters. 01759 @param year 2 digit year. A number in 0-99 (Yep, not Y2K friendly). 01760 @param serial 5 digit serial number. A number in 0-99999. 01761 */ 01762 void burn_track_set_isrc(struct burn_track *t, char *country, char *owner, 01763 unsigned char year, unsigned int serial); 01764 01765 /** Disable ISRC parameters for a track 01766 @param t The track to change 01767 */ 01768 void burn_track_clear_isrc(struct burn_track *t); 01769 01770 /** Hide the first track in the "pre gap" of the disc 01771 @param s session to change 01772 @param onoff 1 to enable hiding, 0 to disable 01773 */ 01774 void burn_session_hide_first_track(struct burn_session *s, int onoff); 01775 01776 /** Get the drive's disc struct - free when done 01777 @param d drive to query 01778 @return the disc struct or NULL on failure 01779 */ 01780 struct burn_disc *burn_drive_get_disc(struct burn_drive *d); 01781 01782 /** Set the track's data source 01783 @param t The track to set the data source for 01784 @param s The data source to use for the contents of the track 01785 @return An error code stating if the source is ready for use for 01786 writing the track, or if an error occured 01787 01788 */ 01789 enum burn_source_status burn_track_set_source(struct burn_track *t, 01790 struct burn_source *s); 01791 01792 01793 /* ts A70218 */ 01794 /** Set a default track size to be used only if the track turns out to be of 01795 unpredictable length and if the effective write type demands a fixed size. 01796 This can be useful to enable write types CD SAO or DVD DAO together with 01797 a track source like stdin. If the track source delivers fewer bytes than 01798 announced then the track will be padded up with zeros. 01799 @param t The track to change 01800 @param size The size to set 01801 @return 0=failure 1=sucess 01802 @since 0.3.4 01803 */ 01804 int burn_track_set_default_size(struct burn_track *t, off_t size); 01805 01806 /** Free a burn_source (decrease its refcount and maybe free it) 01807 @param s Source to free 01808 */ 01809 void burn_source_free(struct burn_source *s); 01810 01811 /** Creates a data source for an image file (and maybe subcode file) 01812 @param path The file address for the main channel payload. 01813 @param subpath Eventual address for subchannel data. Only used in exotic 01814 raw write modes. Submit NULL for normal tasks. 01815 @return Pointer to a burn_source object, NULL indicates failure 01816 */ 01817 struct burn_source *burn_file_source_new(const char *path, 01818 const char *subpath); 01819 01820 01821 /* ts A91122 : An interface to open(O_DIRECT) or similar OS tricks. */ 01822 01823 /** Opens a file with eventual acceleration preparations which may depend 01824 on the operating system and on compile time options of libburn. 01825 You may use this call instead of open(2) for opening file descriptors 01826 which shall be handed to burn_fd_source_new(). 01827 This should only be done for tracks with BURN_BLOCK_MODE1 (2048 bytes 01828 per block). 01829 01830 If you use this call then you MUST allocate the buffers which you use 01831 with read(2) by call burn_os_alloc_buffer(). Read sizes MUST be a multiple 01832 of a safe buffer amount. Else you risk that track data get altered during 01833 transmission. 01834 burn_disk_write() will allocate a suitable read/write buffer for its own 01835 operations. A fifo created by burn_fifo_source_new() will allocate 01836 suitable memory for its buffer if called with flag bit0 and a multiple 01837 of a safe buffer amount. 01838 @param path The file address to open 01839 @param open_flags The flags as of man 2 open. Normally just O_RDONLY. 01840 @param flag Bitfield for control purposes (unused yet, submit 0). 01841 @return A file descriptor as of open(2). Finally to be disposed 01842 by close(2). 01843 -1 indicates failure. 01844 @since 0.7.4 01845 */ 01846 int burn_os_open_track_src(char *path, int open_flags, int flag); 01847 01848 /** Allocate a memory area that is suitable for reading with a file descriptor 01849 opened by burn_os_open_track_src(). 01850 @param amount Number of bytes to allocate. This should be a multiple 01851 of the operating system's i/o block size. 32 KB is 01852 guaranteed by libburn to be safe. 01853 @param flag Bitfield for control purposes (unused yet, submit 0). 01854 @return The address of the allocated memory, or NULL on failure. 01855 A non-NULL return value has finally to be disposed via 01856 burn_os_free_buffer(). 01857 @since 0.7.4 01858 */ 01859 void *burn_os_alloc_buffer(size_t amount, int flag); 01860 01861 /** Dispose a memory area which was obtained by burn_os_alloc_buffer(), 01862 @param buffer Memory address to be freed. 01863 @param amount The number of bytes which was allocated at that 01864 address. 01865 @param flag Bitfield for control purposes (unused yet, submit 0). 01866 @return 1 success , <=0 failure 01867 @since 0.7.4 01868 */ 01869 int burn_os_free_buffer(void *buffer, size_t amount, int flag); 01870 01871 01872 /** Creates a data source for an image file (a track) from an open 01873 readable filedescriptor, an eventually open readable subcodes file 01874 descriptor and eventually a fixed size in bytes. 01875 @param datafd The source of data. 01876 @param subfd The eventual source of subchannel data. Only used in exotic 01877 raw write modes. Submit -1 for normal tasks. 01878 @param size The eventual fixed size of eventually both fds. 01879 If this value is 0, the size will be determined from datafd. 01880 @return Pointer to a burn_source object, NULL indicates failure 01881 */ 01882 struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size); 01883 01884 01885 /* ts A70930 */ 01886 /** Creates a fifo which acts as proxy for an already existing data source. 01887 The fifo provides a ring buffer which shall smoothen the data stream 01888 between burn_source and writer thread. Each fifo serves only for one 01889 data source and gets attached to one track as its only data source 01890 by burn_track_set_source(). 01891 A fifo starts its life in "standby" mode with no buffer space allocated. 01892 As soon as its track requires bytes, the fifo establishes a worker thread 01893 and allocates its buffer. After input has ended and all buffer content is 01894 consumed, the buffer space gets freed and the worker thread ends. 01895 This happens asynchronously. So expect two buffers and worker threads to 01896 exist for a short time between tracks. Be modest in your size demands if 01897 multiple tracks are to be expected. 01898 @param inp The burn_source for which the fifo shall act as proxy. 01899 It can be disposed by burn_source_free() immediately 01900 after this call. 01901 @param chunksize The size in bytes of a chunk. 01902 Use 2048 for sources suitable for BURN_BLOCK_MODE1, 01903 2352 for sources which deliver for BURN_BLOCK_AUDIO, 01904 2056 for sources which shall get treated by 01905 burn_track_set_cdxa_conv(track, 1). 01906 Some variations of burn_source might work only with 01907 a particular chunksize. E.g. libisofs demands 2048. 01908 @param chunks The number of chunks to be allocated in ring buffer. 01909 This value must be >= 2. 01910 @param flag Bitfield for control purposes: 01911 bit0= The read method of inp is capable of delivering 01912 arbitrary amounts of data per call. Not only one 01913 sector. 01914 Suitable for inp from burn_file_source_new() 01915 and burn_fd_source_new() if not the fd has 01916 exotic limitations on read size. 01917 You MUST use this on inp which uses an fd opened 01918 with burn_os_open_track_src(). 01919 Better do not use with other inp types. 01920 @since 0.7.4 01921 @return A pointer to the newly created burn_source. 01922 Later both burn_sources, inp and the returned fifo, have 01923 to be disposed by calling burn_source_free() for each. 01924 inp can be freed immediately, the returned fifo may be 01925 kept as handle for burn_fifo_inquire_status(). 01926 @since 0.4.0 01927 */ 01928 struct burn_source *burn_fifo_source_new(struct burn_source *inp, 01929 int chunksize, int chunks, int flag); 01930 01931 /* ts A71003 */ 01932 /** Inquires state and fill parameters of a fifo burn_source which was created 01933 by burn_fifo_source_new() . Do not use with other burn_source variants. 01934 @param fifo The fifo object to inquire 01935 @param size The total size of the fifo 01936 @param free_bytes The current free capacity of the fifo 01937 @param status_text Returns a pointer to a constant text, see below 01938 @return <0 reply invalid, >=0 fifo status code: 01939 bit0+1=input status, bit2=consumption status, i.e: 01940 0="standby" : data processing not started yet 01941 1="active" : input and consumption are active 01942 2="ending" : input has ended without error 01943 3="failing" : input had error and ended, 01944 4="unused" : ( consumption has ended before processing start ) 01945 5="abandoned" : consumption has ended prematurely 01946 6="ended" : consumption has ended without input error 01947 7="aborted" : consumption has ended after input error 01948 @since 0.4.0 01949 */ 01950 int burn_fifo_inquire_status(struct burn_source *fifo, int *size, 01951 int *free_bytes, char **status_text); 01952 01953 /* ts A91125 */ 01954 /** Inquire various counters which reflect the fifo operation. 01955 @param fifo The fifo object to inquire 01956 @param total_min_fill The minimum number of bytes in the fifo. Beginning 01957 from the moment when fifo consumption is enabled. 01958 @param interval_min_fill The minimum byte number beginning from the moment 01959 when fifo consumption is enabled or from the 01960 most recent moment when burn_fifo_next_interval() 01961 was called. 01962 @param put_counter The number of data transactions into the fifo. 01963 @param get_counter The number of data transactions out of the fifo. 01964 @param empty_counter The number of times the fifo was empty. 01965 @param full_counter The number of times the fifo was full. 01966 @since 0.7.4 01967 */ 01968 void burn_fifo_get_statistics(struct burn_source *fifo, 01969 int *total_min_fill, int *interval_min_fill, 01970 int *put_counter, int *get_counter, 01971 int *empty_counter, int *full_counter); 01972 01973 /* ts A91125 */ 01974 /** Inquire the fifo minimum fill counter for intervals and reset that counter. 01975 @param fifo The fifo object to inquire 01976 @param interval_min_fill The minimum number of bytes in the fifo. Beginning 01977 from the moment when fifo consumption is enabled 01978 or from the most recent moment when 01979 burn_fifo_next_interval() was called. 01980 @since 0.7.4 01981 */ 01982 void burn_fifo_next_interval(struct burn_source *fifo, int *interval_min_fill); 01983 01984 /* ts A80713 */ 01985 /** Obtain a preview of the first input data of a fifo which was created 01986 by burn_fifo_source_new(). The data will later be delivered normally to 01987 the consumer track of the fifo. 01988 bufsize may not be larger than the fifo size (chunk_size * chunks) - 32k. 01989 This call will succeed only if data consumption by the track has not 01990 started yet, i.e. best before the call to burn_disc_write(). 01991 It will start the worker thread of the fifo with the expectable side 01992 effects on the external data source. Then it waits either until enough 01993 data have arrived or until it becomes clear that this will not happen. 01994 The call may be repeated with increased bufsize. It will always yield 01995 the bytes beginning from the first one in the fifo. 01996 @param fifo The fifo object to inquire resp. start 01997 @param buf Pointer to memory of at least bufsize bytes where to 01998 deliver the peeked data. 01999 @param bufsize Number of bytes to peek from the start of the fifo data 02000 @param flag Bitfield for control purposes (unused yet, submit 0). 02001 @return <0 on severe error, 0 if not enough data, 1 if bufsize bytes read 02002 @since 0.5.0 02003 */ 02004 int burn_fifo_peek_data(struct burn_source *fifo, char *buf, int bufsize, 02005 int flag); 02006 02007 /* ts A91125 */ 02008 /** Start the fifo worker thread and wait either until the requested number 02009 of bytes have arrived or until it becomes clear that this will not happen. 02010 Filling will go on asynchronously after burn_fifo_fill() returned. 02011 This call and burn_fifo_peek_data() do not disturb each other. 02012 @param fifo The fifo object to start 02013 @param fill Number of bytes desired. Expect to get return 1 if 02014 at least fifo size - 32k were read. 02015 @param flag Bitfield for control purposes. 02016 bit0= fill fifo to maximum size 02017 @return <0 on severe error, 0 if not enough data, 02018 1 if desired amount or fifo full 02019 @since 0.7.4 02020 */ 02021 int burn_fifo_fill(struct burn_source *fifo, int fill, int flag); 02022 02023 02024 /* ts A70328 */ 02025 /** Sets a fixed track size after the data source object has already been 02026 created. 02027 @param t The track to operate on 02028 @param size the number of bytes to use as track size 02029 @return <=0 indicates failure , >0 success 02030 @since 0.3.6 02031 */ 02032 int burn_track_set_size(struct burn_track *t, off_t size); 02033 02034 02035 /** Tells how long a track will be on disc 02036 >>> NOTE: Not reliable with tracks of undefined length 02037 */ 02038 int burn_track_get_sectors(struct burn_track *); 02039 02040 02041 /* ts A61101 */ 02042 /** Tells how many source bytes have been read and how many data bytes have 02043 been written by the track during burn. 02044 @param t The track to inquire 02045 @param read_bytes Number of bytes read from the track source 02046 @param written_bytes Number of bytes written to track 02047 @since 0.2.6 02048 */ 02049 int burn_track_get_counters(struct burn_track *t, 02050 off_t *read_bytes, off_t *written_bytes); 02051 02052 02053 /** Sets drive read and write speed 02054 Note: "k" is 1000, not 1024. 1xCD = 176.4 k/s, 1xDVD = 1385 k/s. 02055 Fractional speeds should be rounded up. Like 4xCD = 706. 02056 @param d The drive to set speed for 02057 @param read Read speed in k/s (0 is max, -1 is min). 02058 @param write Write speed in k/s (0 is max, -1 is min). 02059 */ 02060 void burn_drive_set_speed(struct burn_drive *d, int read, int write); 02061 02062 02063 /* ts A70711 */ 02064 /** Controls the behavior with writing when the drive buffer is suspected to 02065 be full. To check and wait for enough free buffer space before writing 02066 will move the task of waiting from the operating system's device driver 02067 to libburn. While writing is going on and waiting is enabled, any write 02068 operation will be checked whether it will fill the drive buffer up to 02069 more than max_percent. If so, then waiting will happen until the buffer 02070 fill is predicted with at most min_percent. 02071 Thus: if min_percent < max_percent then transfer rate will oscillate. 02072 This may allow the driver to operate on other devices, e.g. a disk from 02073 which to read the input for writing. On the other hand, this checking might 02074 reduce maximum throughput to the drive or even get misled by faulty buffer 02075 fill replies from the drive. 02076 If a setting parameter is < 0, then this setting will stay unchanged 02077 by the call. 02078 Known burner or media specific pitfalls: 02079 To have max_percent larger than the burner's best reported buffer fill has 02080 the same effect as min_percent==max_percent. Some burners do not report 02081 their full buffer with all media types. Some are not suitable because 02082 they report their buffer fill with delay. 02083 @param d The drive to control 02084 @param enable 0= disable , 1= enable waiting , (-1 = do not change setting) 02085 @param min_usec Shortest possible sleeping period (given in micro seconds) 02086 @param max_usec Longest possible sleeping period (given in micro seconds) 02087 @param timeout_sec If a single write has to wait longer than this number 02088 of seconds, then waiting gets disabled and mindless 02089 writing starts. A value of 0 disables this timeout. 02090 @param min_percent Minimum of desired buffer oscillation: 25 to 100 02091 @param max_percent Maximum of desired buffer oscillation: 25 to 100 02092 @return 1=success , 0=failure 02093 @since 0.3.8 02094 */ 02095 int burn_drive_set_buffer_waiting(struct burn_drive *d, int enable, 02096 int min_usec, int max_usec, int timeout_sec, 02097 int min_percent, int max_percent); 02098 02099 02100 /* these are for my debugging, they will disappear */ 02101 void burn_structure_print_disc(struct burn_disc *d); 02102 void burn_structure_print_session(struct burn_session *s); 02103 void burn_structure_print_track(struct burn_track *t); 02104 02105 /** Sets the write type for the write_opts struct. 02106 Note: write_type BURN_WRITE_SAO is currently not capable of writing a mix 02107 of data and audio tracks. You must use BURN_WRITE_TAO for such sessions. 02108 @param opts The write opts to change 02109 @param write_type The write type to use 02110 @param block_type The block type to use 02111 @return Returns 1 on success and 0 on failure. 02112 */ 02113 int burn_write_opts_set_write_type(struct burn_write_opts *opts, 02114 enum burn_write_types write_type, 02115 int block_type); 02116 02117 02118 /* ts A70207 */ 02119 /** As an alternative to burn_write_opts_set_write_type() this function tries 02120 to find a suitable write type and block type for a given write job 02121 described by opts and disc. To be used after all other setups have been 02122 made, i.e. immediately before burn_disc_write(). 02123 @param opts The nearly complete write opts to change 02124 @param disc The already composed session and track model 02125 @param reasons This text string collects reasons for decision resp. failure 02126 @param flag Bitfield for control purposes: 02127 bit0= do not choose type but check the one that is already set 02128 bit1= do not issue error messages via burn_msgs queue 02129 (is automatically set with bit0) 02130 @return Chosen write type. BURN_WRITE_NONE on failure. 02131 @since 0.3.2 02132 */ 02133 enum burn_write_types burn_write_opts_auto_write_type( 02134 struct burn_write_opts *opts, struct burn_disc *disc, 02135 char reasons[BURN_REASONS_LEN], int flag); 02136 02137 02138 /** Supplies toc entries for writing - not normally required for cd mastering 02139 @param opts The write opts to change 02140 @param count The number of entries 02141 @param toc_entries 02142 */ 02143 void burn_write_opts_set_toc_entries(struct burn_write_opts *opts, 02144 int count, 02145 struct burn_toc_entry *toc_entries); 02146 02147 /** Sets the session format for a disc 02148 @param opts The write opts to change 02149 @param format The session format to set 02150 */ 02151 void burn_write_opts_set_format(struct burn_write_opts *opts, int format); 02152 02153 /** Sets the simulate value for the write_opts struct . 02154 This corresponds to the Test Write bit in MMC mode page 05h. Several media 02155 types do not support this. See struct burn_multi_caps.might_simulate for 02156 actual availability of this feature. 02157 If the media is suitable, the drive will perform burn_write_disc() as a 02158 simulation instead of effective write operations. This means that the 02159 media content and burn_disc_get_status() stay unchanged. 02160 Note: With stdio-drives, the target file gets eventually created, opened, 02161 lseeked, and closed, but not written. So there are effects on it. 02162 Warning: Call burn_random_access_write() will never do simulation because 02163 it does not get any burn_write_opts. 02164 @param opts The write opts to change 02165 @param sim Non-zero enables simulation, 0 enables real writing 02166 @return Returns 1 on success and 0 on failure. 02167 */ 02168 int burn_write_opts_set_simulate(struct burn_write_opts *opts, int sim); 02169 02170 /** Controls buffer underrun prevention 02171 @param opts The write opts to change 02172 @param underrun_proof if non-zero, buffer underrun protection is enabled 02173 @return Returns 1 on success and 0 on failure. 02174 */ 02175 int burn_write_opts_set_underrun_proof(struct burn_write_opts *opts, 02176 int underrun_proof); 02177 02178 /** Sets whether to use opc or not with the write_opts struct 02179 @param opts The write opts to change 02180 @param opc If non-zero, optical power calibration will be performed at 02181 start of burn 02182 02183 */ 02184 void burn_write_opts_set_perform_opc(struct burn_write_opts *opts, int opc); 02185 02186 void burn_write_opts_set_has_mediacatalog(struct burn_write_opts *opts, int has_mediacatalog); 02187 02188 void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts, unsigned char mediacatalog[13]); 02189 02190 02191 /* ts A61106 */ 02192 /** Sets the multi flag which eventually marks the emerging session as not 02193 being the last one and thus creating a BURN_DISC_APPENDABLE media. 02194 @param opts The option object to be manipulated 02195 @param multi 1=media will be appendable, 0=media will be closed (default) 02196 @since 0.2.6 02197 */ 02198 void burn_write_opts_set_multi(struct burn_write_opts *opts, int multi); 02199 02200 02201 /* ts A61222 */ 02202 /** Sets a start address for writing to media and write modes which allow to 02203 choose this address at all (for now: DVD+RW, DVD-RAM, formatted DVD-RW). 02204 now). The address is given in bytes. If it is not -1 then a write run 02205 will fail if choice of start address is not supported or if the block 02206 alignment of the address is not suitable for media and write mode. 02207 Alignment to 32 kB blocks is supposed to be safe with DVD media. 02208 Call burn_disc_get_multi_caps() can obtain the necessary media info. See 02209 resulting struct burn_multi_caps elements .start_adr , .start_alignment , 02210 .start_range_low , .start_range_high . 02211 @param opts The write opts to change 02212 @param value The address in bytes (-1 = start at default address) 02213 @since 0.3.0 02214 */ 02215 void burn_write_opts_set_start_byte(struct burn_write_opts *opts, off_t value); 02216 02217 02218 /* ts A70213 */ 02219 /** Caution: still immature and likely to change. Problems arose with 02220 sequential DVD-RW on one drive. 02221 02222 Controls whether the whole available space of the media shall be filled up 02223 by the last track of the last session. 02224 @param opts The write opts to change 02225 @param fill_up_media If 1 : fill up by last track, if 0 = do not fill up 02226 @since 0.3.4 02227 */ 02228 void burn_write_opts_set_fillup(struct burn_write_opts *opts, 02229 int fill_up_media); 02230 02231 02232 /* ts A70303 */ 02233 /** Eventually makes libburn ignore the failure of some conformance checks: 02234 - the check whether CD write+block type is supported by the drive 02235 - the check whether the media profile supports simulated burning 02236 @param opts The write opts to change 02237 @param use_force 1=ignore above checks, 0=refuse work on failed check 02238 @since 0.3.4 02239 */ 02240 void burn_write_opts_set_force(struct burn_write_opts *opts, int use_force); 02241 02242 02243 /* ts A80412 */ 02244 /** Eventually makes use of the more modern write command AAh WRITE12 and 02245 sets the Streaming bit. With DVD-RAM and BD this can override the 02246 traditional slowdown to half nominal speed. But if it speeds up writing 02247 then it also disables error management and correction. Weigh your 02248 priorities. This affects the write operations of burn_disc_write() 02249 and subsequent calls of burn_random_access_write(). 02250 @param opts The write opts to change 02251 @param value 0=use 2Ah WRITE10, 1=use AAh WRITE12 with Streaming bit 02252 @since 0.6.4: 02253 >=16 use WRITE12 but not before the LBA given by value 02254 @since 0.4.6 02255 */ 02256 void burn_write_opts_set_stream_recording(struct burn_write_opts *opts, 02257 int value); 02258 02259 /* ts A91115 */ 02260 /** Overrides the write chunk size for DVD and BD media which is normally 02261 determined according to media type and setting of stream recording. 02262 A chunk size of 64 KB may improve throughput with bus systems which show 02263 latency problems. 02264 @param opts The write opts to change 02265 @param obs Number of bytes which shall be sent by a single write command. 02266 0 means automatic size, 32768 and 65336 are the only other 02267 accepted sizes for now. 02268 @since 0.7.4 02269 */ 02270 void burn_write_opts_set_dvd_obs(struct burn_write_opts *opts, int obs); 02271 02272 /* ts A91115 */ 02273 /** Sets the rythm by which stdio pseudo drives force their output data to 02274 be consumed by the receiving storage device. This forcing keeps the memory 02275 from being clogged with lots of pending data for slow devices. 02276 @param opts The write opts to change 02277 @param rythm Number of 2KB output blocks after which fsync(2) is 02278 performed. -1 means no fsync(), 0 means default, 02279 elsewise the value must be >= 32. 02280 Default is currently 8192 = 16 MB. 02281 @since 0.7.4 02282 */ 02283 void burn_write_opts_set_stdio_fsync(struct burn_write_opts *opts, int rythm); 02284 02285 02286 /** Sets whether to read in raw mode or not 02287 @param opts The read opts to change 02288 @param raw_mode If non-zero, reading will be done in raw mode, so that everything in the data tracks on the 02289 disc is read, including headers. 02290 */ 02291 void burn_read_opts_set_raw(struct burn_read_opts *opts, int raw_mode); 02292 02293 /** Sets whether to report c2 errors or not 02294 @param opts The read opts to change 02295 @param c2errors If non-zero, report c2 errors. 02296 */ 02297 void burn_read_opts_set_c2errors(struct burn_read_opts *opts, int c2errors); 02298 02299 /** Sets whether to read subcodes from audio tracks or not 02300 @param opts The read opts to change 02301 @param subcodes_audio If non-zero, read subcodes from audio tracks on the disc. 02302 */ 02303 void burn_read_opts_read_subcodes_audio(struct burn_read_opts *opts, 02304 int subcodes_audio); 02305 02306 /** Sets whether to read subcodes from data tracks or not 02307 @param opts The read opts to change 02308 @param subcodes_data If non-zero, read subcodes from data tracks on the disc. 02309 */ 02310 void burn_read_opts_read_subcodes_data(struct burn_read_opts *opts, 02311 int subcodes_data); 02312 02313 /** Sets whether to recover errors if possible 02314 @param opts The read opts to change 02315 @param hardware_error_recovery If non-zero, attempt to recover errors if possible. 02316 */ 02317 void burn_read_opts_set_hardware_error_recovery(struct burn_read_opts *opts, 02318 int hardware_error_recovery); 02319 02320 /** Sets whether to report recovered errors or not 02321 @param opts The read opts to change 02322 @param report_recovered_errors If non-zero, recovered errors will be reported. 02323 */ 02324 void burn_read_opts_report_recovered_errors(struct burn_read_opts *opts, 02325 int report_recovered_errors); 02326 02327 /** Sets whether blocks with unrecoverable errors should be read or not 02328 @param opts The read opts to change 02329 @param transfer_damaged_blocks If non-zero, blocks with unrecoverable errors will still be read. 02330 */ 02331 void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts, 02332 int transfer_damaged_blocks); 02333 02334 /** Sets the number of retries to attempt when trying to correct an error 02335 @param opts The read opts to change 02336 @param hardware_error_retries The number of retries to attempt when correcting an error. 02337 */ 02338 void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts, 02339 unsigned char hardware_error_retries); 02340 02341 02342 /* ts A90815 */ 02343 /** Gets the list of profile codes supported by the drive. 02344 Profiles depict the feature sets which constitute media types. For 02345 known profile codes and names see burn_disc_get_profile(). 02346 @param d is the drive to query 02347 @param num_profiles returns the number of supported profiles 02348 @param profiles returns the profile codes 02349 @param is_current returns the status of the corresponding profile code: 02350 1= current, i.e. the matching media is loaded 02351 0= not current, i.e. the matching media is not loaded 02352 @return always 1 for now 02353 @since 0.7.0 02354 */ 02355 int burn_drive_get_all_profiles(struct burn_drive *d, int *num_profiles, 02356 int profiles[64], char is_current[64]); 02357 02358 02359 /* ts A90815 */ 02360 /** Obtains the profile name associated with a profile code. 02361 @param profile_code the profile code to be translated 02362 @param name returns the profile name (e.g. "DVD+RW") 02363 @return 1= known profile code , 0= unknown profile code 02364 @since 0.7.0 02365 */ 02366 int burn_obtain_profile_name(int profile_code, char name[80]); 02367 02368 02369 /** Gets the maximum write speed for a drive and eventually loaded media. 02370 The return value might change by the media type of already loaded media, 02371 again by call burn_drive_grab() and again by call burn_disc_read_atip(). 02372 @param d Drive to query 02373 @return Maximum write speed in K/s 02374 */ 02375 int burn_drive_get_write_speed(struct burn_drive *d); 02376 02377 02378 /* ts A61021 */ 02379 /** Gets the minimum write speed for a drive and eventually loaded media. 02380 The return value might change by the media type of already loaded media, 02381 again by call burn_drive_grab() and again by call burn_disc_read_atip(). 02382 @param d Drive to query 02383 @return Minimum write speed in K/s 02384 @since 0.2.6 02385 */ 02386 int burn_drive_get_min_write_speed(struct burn_drive *d); 02387 02388 02389 /** Gets the maximum read speed for a drive 02390 @param d Drive to query 02391 @return Maximum read speed in K/s 02392 */ 02393 int burn_drive_get_read_speed(struct burn_drive *d); 02394 02395 02396 /* ts A61226 */ 02397 /** Obtain a copy of the current speed descriptor list. The drive's list gets 02398 updated on various occasions such as burn_drive_grab() but the copy 02399 obtained here stays untouched. It has to be disposed via 02400 burn_drive_free_speedlist() when it is not longer needed. Speeds 02401 may appear several times in the list. The list content depends much on 02402 drive and media type. It seems that .source == 1 applies mostly to CD media 02403 whereas .source == 2 applies to any media. 02404 @param d Drive to query 02405 @param speed_list The copy. If empty, *speed_list gets returned as NULL. 02406 @return 1=success , 0=list empty , <0 severe error 02407 @since 0.3.0 02408 */ 02409 int burn_drive_get_speedlist(struct burn_drive *d, 02410 struct burn_speed_descriptor **speed_list); 02411 02412 /* ts A70713 */ 02413 /** Look up the fastest speed descriptor which is not faster than the given 02414 speed_goal. If it is 0, then the fastest one is chosen among the 02415 descriptors with the highest end_lba. If it is -1 then the slowest speed 02416 descriptor is chosen regardless of end_lba. Parameter flag decides whether 02417 the speed goal means write speed or read speed. 02418 @param d Drive to query 02419 @param speed_goal Upper limit for speed, 02420 0=search for maximum speed , -1 search for minimum speed 02421 @param best_descr Result of the search, NULL if no match 02422 @param flag Bitfield for control purposes 02423 bit0= look for best read speed rather than write speed 02424 bit1= look for any source type (else look for source==2 first 02425 and for any other source type only with CD media) 02426 @return >0 indicates a valid best_descr, 0 = no valid best_descr 02427 @since 0.3.8 02428 */ 02429 int burn_drive_get_best_speed(struct burn_drive *d, int speed_goal, 02430 struct burn_speed_descriptor **best_descr, int flag); 02431 02432 02433 /* ts A61226 */ 02434 /** Dispose a speed descriptor list copy which was obtained by 02435 burn_drive_get_speedlist(). 02436 @param speed_list The list copy. *speed_list gets set to NULL. 02437 @return 1=list disposed , 0= *speedlist was already NULL 02438 @since 0.3.0 02439 */ 02440 int burn_drive_free_speedlist(struct burn_speed_descriptor **speed_list); 02441 02442 02443 /* ts A70203 */ 02444 /* @since 0.3.2 */ 02445 /** The reply structure for burn_disc_get_multi_caps() 02446 */ 02447 struct burn_multi_caps { 02448 02449 /* Multi-session capability allows to keep the media appendable after 02450 writing a session. It also guarantees that the drive will be able 02451 to predict and use the appropriate Next Writeable Address to place 02452 the next session on the media without overwriting the existing ones. 02453 It does not guarantee that the selected write type is able to do 02454 an appending session after the next session. (E.g. CD SAO is capable 02455 of multi-session by keeping a disc appendable. But .might_do_sao 02456 will be 0 afterwards, when checking the appendable media.) 02457 1= media may be kept appendable by burn_write_opts_set_multi(o,1) 02458 0= media will not be appendable 02459 */ 02460 int multi_session; 02461 02462 /* Multi-track capability allows to write more than one track source 02463 during a single session. The written tracks can later be found in 02464 libburn's TOC model with their start addresses and sizes. 02465 1= multiple tracks per session are allowed 02466 0= only one track per session allowed 02467 */ 02468 int multi_track; 02469 02470 /* Start-address capability allows to set a non-zero address with 02471 burn_write_opts_set_start_byte(). Eventually this has to respect 02472 .start_alignment and .start_range_low, .start_range_high in this 02473 structure. 02474 1= non-zero start address is allowed 02475 0= only start address 0 is allowed (to depict the drive's own idea 02476 about the appropriate write start) 02477 */ 02478 int start_adr; 02479 02480 /** The alignment for start addresses. 02481 ( start_address % start_alignment ) must be 0. 02482 */ 02483 off_t start_alignment; 02484 02485 /** The lowest permissible start address. 02486 */ 02487 off_t start_range_low; 02488 02489 /** The highest addressable start address. 02490 */ 02491 off_t start_range_high; 02492 02493 /** Potential availability of write modes 02494 4= needs no size prediction, not to be chosen automatically 02495 3= needs size prediction, not to be chosen automatically 02496 2= available, no size prediction necessary 02497 1= available, needs exact size prediction 02498 0= not available 02499 With CD media (profiles 0x09 and 0x0a) check also the elements 02500 *_block_types of the according write mode. 02501 */ 02502 int might_do_tao; 02503 int might_do_sao; 02504 int might_do_raw; 02505 02506 /** Generally advised write mode. 02507 Not necessarily the one chosen by burn_write_opts_auto_write_type() 02508 because the burn_disc structure might impose particular demands. 02509 */ 02510 enum burn_write_types advised_write_mode; 02511 02512 /** Write mode as given by parameter wt of burn_disc_get_multi_caps(). 02513 */ 02514 enum burn_write_types selected_write_mode; 02515 02516 /** Profile number which was current when the reply was generated */ 02517 int current_profile; 02518 02519 /** Wether the current profile indicates CD media. 1=yes, 0=no */ 02520 int current_is_cd_profile; 02521 02522 /* ts A70528 */ 02523 /* @since 0.3.8 */ 02524 /** Wether the current profile is able to perform simulated write */ 02525 int might_simulate; 02526 }; 02527 02528 /** Allocates a struct burn_multi_caps (see above) and fills it with values 02529 which are appropriate for the drive and the loaded media. The drive 02530 must be grabbed for this call. The returned structure has to be disposed 02531 via burn_disc_free_multi_caps() when no longer needed. 02532 @param d The drive to inquire 02533 @param wt With BURN_WRITE_NONE the best capabilities of all write modes 02534 get returned. If set to a write mode like BURN_WRITE_SAO the 02535 capabilities with that particular mode are returned and the 02536 return value is 0 if the desired mode is not possible. 02537 @param caps returns the info structure 02538 @param flag Bitfield for control purposes (unused yet, submit 0) 02539 @return < 0 : error , 0 : writing seems impossible , 1 : writing possible 02540 @since 0.3.2 02541 */ 02542 int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt, 02543 struct burn_multi_caps **caps, int flag); 02544 02545 /** Removes from memory a multi session info structure which was returned by 02546 burn_disc_get_multi_caps(). The pointer *caps gets set to NULL. 02547 @param caps the info structure to dispose (note: pointer to pointer) 02548 @return 0 : *caps was already NULL, 1 : memory object was disposed 02549 @since 0.3.2 02550 */ 02551 int burn_disc_free_multi_caps(struct burn_multi_caps **caps); 02552 02553 02554 /** Gets a copy of the toc_entry structure associated with a track 02555 @param t Track to get the entry from 02556 @param entry Struct for the library to fill out 02557 */ 02558 void burn_track_get_entry(struct burn_track *t, struct burn_toc_entry *entry); 02559 02560 /** Gets a copy of the toc_entry structure associated with a session's lead out 02561 @param s Session to get the entry from 02562 @param entry Struct for the library to fill out 02563 */ 02564 void burn_session_get_leadout_entry(struct burn_session *s, 02565 struct burn_toc_entry *entry); 02566 02567 /** Gets an array of all the sessions for the disc 02568 THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A SESSION 02569 @param d Disc to get session array for 02570 @param num Returns the number of sessions in the array 02571 @return array of sessions 02572 */ 02573 struct burn_session **burn_disc_get_sessions(struct burn_disc *d, 02574 int *num); 02575 02576 int burn_disc_get_sectors(struct burn_disc *d); 02577 02578 /** Gets an array of all the tracks for a session 02579 THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A TRACK 02580 @param s session to get track array for 02581 @param num Returns the number of tracks in the array 02582 @return array of tracks 02583 */ 02584 struct burn_track **burn_session_get_tracks(struct burn_session *s, 02585 int *num); 02586 02587 int burn_session_get_sectors(struct burn_session *s); 02588 02589 /** Gets the mode of a track 02590 @param track the track to query 02591 @return the track's mode 02592 */ 02593 int burn_track_get_mode(struct burn_track *track); 02594 02595 /** Returns whether the first track of a session is hidden in the pregap 02596 @param session the session to query 02597 @return non-zero means the first track is hidden 02598 */ 02599 int burn_session_get_hidefirst(struct burn_session *session); 02600 02601 /** Returns the library's version in its parts. 02602 This is the runtime counterpart of the three build time macros 02603 burn_header_version_* below. 02604 @param major The major version number 02605 @param minor The minor version number 02606 @param micro The micro version number 02607 */ 02608 void burn_version(int *major, int *minor, int *micro); 02609 02610 02611 /* ts A80129 */ 02612 /* @since 0.4.4 */ 02613 /** These three release version numbers tell the revision of this header file 02614 and of the API it describes. They are memorized by applications at build 02615 time. 02616 Immediately after burn_initialize() an application should do this check: 02617 burn_version(&major, &minor, µ); 02618 if(major > burn_header_version_major 02619 || (major == burn_header_version_major 02620 && (minor > burn_header_version_minor 02621 || (minor == burn_header_version_minor 02622 && micro >= burn_header_version_micro)))) { 02623 ... Young enough. Go on with program run .... 02624 } else { 02625 ... Too old. Do not use this libburn version ... 02626 } 02627 02628 */ 02629 #define burn_header_version_major 0 02630 #define burn_header_version_minor 8 02631 #define burn_header_version_micro 0 02632 /** Note: 02633 Above version numbers are also recorded in configure.ac because libtool 02634 wants them as parameters at build time. 02635 For the library compatibility check, BURN_*_VERSION in configure.ac 02636 are not decisive. Only the three numbers above do matter. 02637 */ 02638 /** Usage discussion: 02639 02640 Some developers of the libburnia project have differing 02641 opinions how to ensure the compatibility of libaries 02642 and applications. 02643 02644 It is about whether to use at compile time and at runtime 02645 the version numbers isoburn_header_version_* provided here. 02646 Thomas Schmitt advises to use them. 02647 Vreixo Formoso advises to use other means. 02648 02649 At compile time: 02650 02651 Vreixo Formoso advises to leave proper version matching 02652 to properly programmed checks in the the application's 02653 build system, which will eventually refuse compilation. 02654 02655 Thomas Schmitt advises to use the macros defined here 02656 for comparison with the application's requirements of 02657 library revisions and to eventually break compilation. 02658 02659 Both advises are combinable. I.e. be master of your 02660 build system and have #if checks in the source code 02661 of your application, nevertheless. 02662 02663 At runtime (via *_is_compatible()): 02664 02665 Vreixo Formoso advises to compare the application's 02666 requirements of library revisions with the runtime 02667 library. This is to allow runtime libraries which are 02668 young enough for the application but too old for 02669 the lib*.h files seen at compile time. 02670 02671 Thomas Schmitt advises to compare the header 02672 revisions defined here with the runtime library. 02673 This is to enforce a strictly monotonous chain 02674 of revisions from app to header to library, 02675 at the cost of excluding some older libraries. 02676 02677 These two advises are mutually exclusive. 02678 02679 */ 02680 02681 /* ts A91226 */ 02682 /** Obtain the id string of the SCSI transport interface. 02683 This interface may be a system specific adapter module of libburn or 02684 an adapter to a supporting library like libcdio. 02685 @flag Bitfield for control puposes, submit 0 for now 02686 @return A pointer to the id string. Do not alter the string content. 02687 @since 0.7.6 02688 */ 02689 char *burn_scsi_transport_id(int flag); 02690 02691 /* ts A60924 : ticket 74 */ 02692 /** Control queueing and stderr printing of messages from libburn. 02693 Severity may be one of "NEVER", "ABORT", "FATAL", "FAILURE", "SORRY", 02694 "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG", "ALL". 02695 @param queue_severity Gives the minimum limit for messages to be queued. 02696 Default: "NEVER". If you queue messages then you 02697 must consume them by burn_msgs_obtain(). 02698 @param print_severity Does the same for messages to be printed directly 02699 to stderr. Default: "FATAL". 02700 @param print_id A text prefix to be printed before the message. 02701 @return >0 for success, <=0 for error 02702 @since 0.2.6 02703 */ 02704 int burn_msgs_set_severities(char *queue_severity, 02705 char *print_severity, char *print_id); 02706 02707 /* ts A60924 : ticket 74 */ 02708 /* @since 0.2.6 */ 02709 #define BURN_MSGS_MESSAGE_LEN 4096 02710 02711 /** Obtain the oldest pending libburn message from the queue which has at 02712 least the given minimum_severity. This message and any older message of 02713 lower severity will get discarded from the queue and is then lost forever. 02714 @param minimum_severity may be one of "NEVER", "ABORT", "FATAL", 02715 "FAILURE", "SORRY", "WARNING", "HINT", "NOTE", "UPDATE", 02716 "DEBUG", "ALL". 02717 To call with minimum_severity "NEVER" will discard the 02718 whole queue. 02719 @param error_code Will become a unique error code as liste in 02720 libburn/libdax_msgs.h 02721 @param msg_text Must provide at least BURN_MSGS_MESSAGE_LEN bytes. 02722 @param os_errno Will become the eventual errno related to the message 02723 @param severity Will become the severity related to the message and 02724 should provide at least 80 bytes. 02725 @return 1 if a matching item was found, 0 if not, <0 for severe errors 02726 @since 0.2.6 02727 */ 02728 int burn_msgs_obtain(char *minimum_severity, 02729 int *error_code, char msg_text[], int *os_errno, 02730 char severity[]); 02731 02732 02733 /* ts A70922 */ 02734 /** Submit a message to the libburn queueing system. It will be queued or 02735 printed as if it was generated by libburn itself. 02736 @param error_code The unique error code of your message. 02737 Submit 0 if you do not have reserved error codes within 02738 the libburnia project. 02739 @param msg_text Not more than BURN_MSGS_MESSAGE_LEN characters of 02740 message text. 02741 @param os_errno Eventual errno related to the message. Submit 0 if 02742 the message is not related to a operating system error. 02743 @param severity One of "ABORT", "FATAL", "FAILURE", "SORRY", "WARNING", 02744 "HINT", "NOTE", "UPDATE", "DEBUG". Defaults to "FATAL". 02745 @param d An eventual drive to which the message shall be related. 02746 Submit NULL if the message is not specific to a 02747 particular drive object. 02748 @return 1 if message was delivered, <=0 if failure 02749 @since 0.4.0 02750 */ 02751 int burn_msgs_submit(int error_code, char msg_text[], int os_errno, 02752 char severity[], struct burn_drive *d); 02753 02754 02755 /* ts A71016 */ 02756 /** Convert a severity name into a severity number, which gives the severity 02757 rank of the name. 02758 @param severity_name A name as with burn_msgs_submit(), e.g. "SORRY". 02759 @param severity_number The rank number: the higher, the more severe. 02760 @param flag Bitfield for control purposes (unused yet, submit 0) 02761 @return >0 success, <=0 failure 02762 @since 0.4.0 02763 */ 02764 int burn_text_to_sev(char *severity_name, int *severity_number, int flag); 02765 02766 02767 /* ts A80202 */ 02768 /** Convert a severity number into a severity name 02769 @since 0.4.4 02770 @param severity_number The rank number: the higher, the more severe. 02771 @param severity_name A name as with burn_msgs_submit(), e.g. "SORRY". 02772 @param flag Bitfield for control purposes (unused yet, submit 0) 02773 @since 0.4.4 02774 */ 02775 int burn_sev_to_text(int severity_number, char **severity_name, int flag); 02776 02777 02778 02779 /* ts A70915 */ 02780 /** Replace the messenger object handle of libburn by a compatible handle 02781 obtained from a related library. 02782 See also: libisofs, API function iso_get_messenger(). 02783 @param messenger The foreign but compatible message handle. 02784 @return 1 : success, <=0 : failure 02785 @since 0.4.0 02786 */ 02787 int burn_set_messenger(void *messenger); 02788 02789 02790 /* ts A61002 */ 02791 /* @since 0.2.6 */ 02792 /** The prototype of a handler function suitable for burn_set_signal_handling() 02793 Such a function has to return -2 if it does not want the process to 02794 exit with value 1. 02795 */ 02796 typedef int (*burn_abort_handler_t)(void *handle, int signum, int flag); 02797 02798 /** Control built-in signal handling. Either by setting an own handler or 02799 by activating the built-in signal handler. 02800 02801 A function parameter handle of NULL activates the built-in abort handler. 02802 Depending on mode it may cancel all drive operations, wait for all drives 02803 to become idle, exit(1). It may also prepare function 02804 burn_drive_get_status() for waiting and performing exit(1). 02805 If parameter handle may be NULL or a text that shall be used as prefix for 02806 pacifier messages of burn_abort_pacifier(). Other than with an application 02807 provided handler, the prefix char array does not have to be kept existing 02808 until the eventual signal event. 02809 Before version 0.7.8 only action 0 was available. I.e. the built-in handler 02810 waited for the drives to become idle and then performed exit(1) directly. 02811 But during burn_disc_write() onto real CD or DVD, FreeBSD 8.0 pauses the 02812 other threads until the signal handler returns. 02813 The new actions try to avoid this deadlock. It is advised to use action 3 02814 at least during burn_disc_write(), burn_disc_rease(), burn_disc_format(): 02815 burn_set_signal_handling(text, NULL, 0x30); 02816 and to call burn_is_aborting(0) when the drive is BURN_DRIVE_IDLE. 02817 If burn_is_aborting(0) returns 1, then call burn_abort() and exit(1). 02818 02819 @param handle Opaque handle eventually pointing to an application 02820 provided memory object 02821 @param handler A function to be called on signals. It will get handle as 02822 argument. flag will be 0. 02823 It should finally call burn_abort(). See there. 02824 @param mode : bit0 - bit3: 02825 Receiving signals: 02826 0 Call handler(handle, signum, 0) on nearly all signals 02827 1 Enable system default reaction on all signals 02828 2 Try to ignore nearly all signals 02829 10 like mode 2 but handle SIGABRT like with mode 0 02830 bit4 - bit7: With handler == NULL : 02831 Action of built-in handler. "control thread" is the one 02832 which called burn_set_signal_handling(). 02833 All actions activate receive mode 2 to ignore further 02834 signals. 02835 0 Same as 1 (for pre-0.7.8 backward compatibility) 02836 @since 0.7.8 02837 1 Catch the control thread in abort handler, call 02838 burn_abort(>0) and finally exit(1). 02839 Does not always work with FreeBSD. 02840 2 Call burn_abort(-1) and return from handler. When the 02841 control thread calls burn_drive_get_status(), then do 02842 burn_abort(>0) instead, and finally exit(1). 02843 Does not always work with FreeBSD. 02844 3 Call burn_abort(-1), return from handler. It is duty of 02845 the application to detect a pending abort condition 02846 by calling burn_is_aborting() and to wait for all 02847 drives to become idle. E.g. by calling burn_abort(>0). 02848 4 Like 3, but without calling burn_abort(-1). Only the 02849 indicator of burn_is_aborting() gets set. 02850 @since 0.2.6 02851 */ 02852 void burn_set_signal_handling(void *handle, burn_abort_handler_t handler, 02853 int mode); 02854 02855 02856 /* ts B00304 */ 02857 /* Inquire whether the built-in abort handler was triggered by a signal. 02858 This has to be done to detect pending abort handling if signal handling 02859 was set to the built-in handler and action was set to 2 or 3. 02860 @param flag Bitfield for control purposes (unused yet, submit 0) 02861 @return 0 = no abort was triggered 02862 >0 = action that was triggered (action 0 is reported as 1) 02863 @since 0.7.8 02864 */ 02865 int burn_is_aborting(int flag); 02866 02867 02868 /* ts A70811 */ 02869 /** Write data in random access mode. 02870 The drive must be grabbed successfully before calling this function which 02871 circumvents usual libburn session processing and rather writes data without 02872 preparations or finalizing. This will work only with overwriteable media 02873 which are also suitable for burn_write_opts_set_start_byte(). The same 02874 address alignment restrictions as with this function apply. I.e. for DVD 02875 it is best to align to 32 KiB blocks (= 16 LBA units). The amount of data 02876 to be written is subject to the same media dependent alignment rules. 02877 Again, 32 KiB is most safe. 02878 Call burn_disc_get_multi_caps() can obtain the necessary media info. See 02879 resulting struct burn_multi_caps elements .start_adr , .start_alignment , 02880 .start_range_low , .start_range_high . 02881 Other than burn_disc_write() this is a synchronous call which returns 02882 only after the write transaction has ended (sucessfully or not). So it is 02883 wise not to transfer giant amounts of data in a single call. 02884 Important: Data have to fit into the already formatted area of the media. 02885 @param d The drive to which to write 02886 @param byte_address The start address of the write in byte 02887 (1 LBA unit = 2048 bytes) (do respect media alignment) 02888 @param data The bytes to be written 02889 @param data_count The number of those bytes (do respect media alignment) 02890 data_count == 0 is permitted (e.g. to flush the 02891 drive buffer without further data transfer). 02892 @param flag Bitfield for control purposes: 02893 bit0 = flush the drive buffer after eventual writing 02894 @return 1=sucessful , <=0 : number of transfered bytes * -1 02895 @since 0.4.0 02896 */ 02897 int burn_random_access_write(struct burn_drive *d, off_t byte_address, 02898 char *data, off_t data_count, int flag); 02899 02900 02901 /* ts A81215 */ 02902 /** Inquire the maximum amount of readable data. 02903 It is supposed that all LBAs in the range from 0 to media_read_acpacity-1 02904 can be read via burn_read_data() although some of them may never have been 02905 recorded. If tracks are recognizable then it is better to only read 02906 LBAs which are part of some track. 02907 @param d The drive from which to read 02908 @param capacity Will return the result if valid 02909 @param flag Bitfield for control purposes: Unused yet, submit 0. 02910 @return 1=sucessful , <=0 an error occured 02911 @since 0.6.0 02912 */ 02913 int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag); 02914 02915 02916 /* ts A70812 */ 02917 /** Read data in random access mode. 02918 The drive must be grabbed successfully before calling this function. 02919 With all currently supported drives and media the byte_address has to 02920 be aligned to 2048 bytes. Only data tracks with 2048 bytes per sector 02921 can be read this way. I.e. not CD-audio, not CD-video-stream ... 02922 This is a synchronous call which returns only after the full read job 02923 has ended (sucessfully or not). So it is wise not to read giant amounts 02924 of data in a single call. 02925 @param d The drive from which to read 02926 @param byte_address The start address of the read in byte (aligned to 2048) 02927 @param data A memory buffer capable of taking data_size bytes 02928 @param data_size The amount of data to be read. This does not have to 02929 be aligned to any block size. 02930 @param data_count The amount of data actually read (interesting on error) 02931 @param flag Bitfield for control purposes: 02932 bit0= - reserved - 02933 bit1= do not submit error message if read error 02934 bit2= on error do not try to read a second time 02935 with single block steps. @since 0.5.2 02936 @return 1=sucessful , <=0 an error occured 02937 @since 0.4.0 02938 */ 02939 int burn_read_data(struct burn_drive *d, off_t byte_address, 02940 char data[], off_t data_size, off_t *data_count, int flag); 02941 02942 02943 /* A70904 */ 02944 /** Inquire whether the drive object is a real MMC drive or a pseudo-drive 02945 created by a stdio: address. 02946 @param d The drive to inquire 02947 @return 0= null-drive 02948 1= real MMC drive 02949 2= stdio-drive, random access, read-write 02950 3= stdio-drive, sequential, write-only 02951 @since 0.4.0 02952 */ 02953 int burn_drive_get_drive_role(struct burn_drive *d); 02954 02955 02956 /* ts A70923 */ 02957 /** Find out whether a given address string would lead to the given drive 02958 object. This should be done in advance for track source addresses 02959 with parameter drive_role set to 2. 02960 Although a real MMC drive should hardly exist as two drive objects at 02961 the same time, this can easily happen with stdio-drives. So if more than 02962 one drive is used by the application, then this gesture is advised: 02963 burn_drive_d_get_adr(d2, adr2); 02964 if (burn_drive_equals_adr(d1, adr2, burn_drive_get_drive_role(d2))) 02965 ... Both drive objects point to the same storage facility ... 02966 02967 @param d1 Existing drive object 02968 @param adr2 Address string to be tested. Prefix "stdio:" overrides 02969 parameter drive_role2 by either 0 or 2 as appropriate. 02970 The string must be shorter than BURN_DRIVE_ADR_LEN. 02971 @param drive_role2 Role as burn_drive_get_drive_role() would attribute 02972 to adr2 if it was a drive. Use value 2 for checking track 02973 sources resp. pseudo-drive addresses without "stdio:". 02974 Use 1 for checking drive addresses including those with 02975 prefix "stdio:". 02976 @return 1= adr2 leads to d1 , 0= adr2 seems not to lead to d1, 02977 -1 = adr2 is bad 02978 @since 0.4.0 02979 */ 02980 int burn_drive_equals_adr(struct burn_drive *d1, char *adr2, int drive_role2); 02981 02982 02983 #ifndef DOXYGEN 02984 02985 BURN_END_DECLS 02986 02987 #endif 02988 02989 02990 /* ts A91205 */ 02991 /* The following experiments may be interesting in future: 02992 */ 02993 02994 /* Perform OPC explicitely. 02995 # define Libburn_pioneer_dvr_216d_with_opC 1 02996 */ 02997 02998 /* Load mode page 5 and modify it rather than composing from scratch. 02999 # define Libburn_pioneer_dvr_216d_load_mode5 1 03000 */ 03001 03002 /* Inquire drive events and react by reading configuration or starting unit. 03003 # define Libburn_pioneer_dvr_216d_get_evenT 1 03004 */ 03005 03006 /* ts A91112 */ 03007 /* Do not probe CD modes but declare only data and audio modes supported. 03008 For other modes resp. real probing one has to call 03009 burn_drive_probe_cd_write_modes(). 03010 03011 */ 03012 #define Libburn_dummy_probe_write_modeS 1 03013 03014 03015 #endif /*LIBBURN_H*/