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