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