00001 /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ 00002 00003 /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens 00004 Copyright (c) 2006 - 2013 Thomas Schmitt <scdbackup@gmx.net> 00005 Provided under GPL version 2 or later. 00006 00007 This is the official API definition of libburn. 00008 00009 */ 00010 /* Important: If you add a public API function then add its name to file 00011 libburn/libburn.ver 00012 */ 00013 00014 00015 #ifndef LIBBURN_H 00016 #define LIBBURN_H 00017 00018 /* 00019 00020 Applications must use 64 bit off_t. E.g. by defining 00021 #define _LARGEFILE_SOURCE 00022 #define _FILE_OFFSET_BITS 64 00023 or take special precautions to interface with the library by 64 bit integers 00024 where this .h files prescribe off_t. 00025 00026 To prevent 64 bit file i/o in the library would keep the application from 00027 processing tracks of more than 2 GB size. 00028 00029 */ 00030 #include <sys/types.h> 00031 00032 #ifndef DOXYGEN 00033 00034 #if defined(__cplusplus) 00035 #define BURN_BEGIN_DECLS \ 00036 namespace burn { \ 00037 extern "C" { 00038 #define BURN_END_DECLS \ 00039 } \ 00040 } 00041 #else 00042 #define BURN_BEGIN_DECLS 00043 #define BURN_END_DECLS 00044 #endif 00045 00046 BURN_BEGIN_DECLS 00047 00048 #endif 00049 00050 /** References a physical drive in the system */ 00051 struct burn_drive; 00052 00053 /** References a whole disc */ 00054 struct burn_disc; 00055 00056 /** References a single session on a disc */ 00057 struct burn_session; 00058 00059 /** References a single track on a disc */ 00060 struct burn_track; 00061 00062 /* ts A61111 */ 00063 /** References a set of write parameters */ 00064 struct burn_write_opts; 00065 00066 /** Session format for normal audio or data discs */ 00067 #define BURN_CDROM 0 00068 /** Session format for obsolete CD-I discs */ 00069 #define BURN_CDI 0x10 00070 /** Session format for CDROM-XA discs */ 00071 #define BURN_CDXA 0x20 00072 00073 #define BURN_POS_END 100 00074 00075 /** Mask for mode bits */ 00076 #define BURN_MODE_BITS 127 00077 00078 /** Track mode - mode 0 data 00079 0 bytes of user data. it's all 0s. mode 0. get it? HAH 00080 */ 00081 #define BURN_MODE0 (1 << 0) 00082 /** Track mode - mode "raw" - all 2352 bytes supplied by app 00083 FOR DATA TRACKS ONLY! 00084 */ 00085 #define BURN_MODE_RAW (1 << 1) 00086 /** Track mode - mode 1 data 00087 2048 bytes user data, and all the LEC money can buy 00088 */ 00089 #define BURN_MODE1 (1 << 2) 00090 /** Track mode - mode 2 data 00091 defaults to formless, 2336 bytes of user data, unprotected 00092 | with a data form if required. 00093 */ 00094 #define BURN_MODE2 (1 << 3) 00095 /** Track mode modifier - Form 1, | with MODE2 for reasonable results 00096 2048 bytes of user data, 4 bytes of subheader 00097 */ 00098 #define BURN_FORM1 (1 << 4) 00099 /** Track mode modifier - Form 2, | with MODE2 for reasonable results 00100 lots of user data. not much LEC. 00101 */ 00102 #define BURN_FORM2 (1 << 5) 00103 /** Track mode - audio 00104 2352 bytes per sector. may be | with 4ch or preemphasis. 00105 NOT TO BE CONFUSED WITH BURN_MODE_RAW 00106 Audio data must be 44100Hz 16bit stereo with no riff or other header at 00107 beginning. Extra header data will cause pops or clicks. Audio data should 00108 also be in little-endian byte order. Big-endian audio data causes static. 00109 */ 00110 #define BURN_AUDIO (1 << 6) 00111 /** Track mode modifier - 4 channel audio. */ 00112 #define BURN_4CH (1 << 7) 00113 /** Track mode modifier - Digital copy permitted, can be set on any track.*/ 00114 #define BURN_COPY (1 << 8) 00115 /** Track mode modifier - 50/15uS pre-emphasis */ 00116 #define BURN_PREEMPHASIS (1 << 9) 00117 /** Input mode modifier - subcodes present packed 16 */ 00118 #define BURN_SUBCODE_P16 (1 << 10) 00119 /** Input mode modifier - subcodes present packed 96 */ 00120 #define BURN_SUBCODE_P96 (1 << 11) 00121 /** Input mode modifier - subcodes present raw 96 */ 00122 #define BURN_SUBCODE_R96 (1 << 12) 00123 00124 /* ts B11230 */ 00125 /** Track mode modifier - Serial Copy Management System, SAO only 00126 If this is set and BURN_COPY is not set, then copying the emerging 00127 track will be forbidden. 00128 @since 1.2.0 00129 */ 00130 #define BURN_SCMS (1 << 13) 00131 00132 00133 /** Possible disc writing style/modes */ 00134 enum burn_write_types 00135 { 00136 /** Packet writing. 00137 currently unsupported, (for DVD Incremental Streaming use TAO) 00138 */ 00139 BURN_WRITE_PACKET, 00140 00141 /** With CD: Track At Once recording 00142 2s gaps between tracks, no fonky lead-ins 00143 00144 With sequential DVD-R[W]: Incremental Streaming 00145 With DVD+R and BD-R: Track of open size 00146 With DVD-RAM, DVD+RW, BD-RE: Random Writeable (used sequentially) 00147 With overwriteable DVD-RW: Rigid Restricted Overwrite 00148 */ 00149 BURN_WRITE_TAO, 00150 00151 /** With CD: Session At Once 00152 Block type MUST be BURN_BLOCK_SAO 00153 ts A70122: Currently not capable of mixing data and audio tracks. 00154 00155 With sequential DVD-R[W]: Disc-at-once, DAO 00156 Single session, single track, fixed size mandatory, (-dvd-compat) 00157 With other DVD or BD media: same as BURN_WRITE_TAO but may demand 00158 that track size is known in advance. 00159 */ 00160 BURN_WRITE_SAO, 00161 00162 /** With CD: Raw disc at once recording. 00163 all subcodes must be provided by lib or user 00164 only raw block types are supported 00165 With DVD and BD media: not supported. 00166 00167 ts A90901: This had been disabled because its implementation 00168 relied on code from cdrdao which is not understood 00169 currently. 00170 A burn run will abort with "FATAL" error message 00171 if this mode is attempted. 00172 @since 0.7.2 00173 ts A91016: Re-implemented according to ECMA-130 Annex A and B. 00174 Now understood, explained and not stemming from cdrdao. 00175 @since 0.7.4 00176 */ 00177 BURN_WRITE_RAW, 00178 00179 /** In replies this indicates that not any writing will work. 00180 As parameter for inquiries it indicates that no particular write 00181 mode shall is specified. 00182 Do not use for setting a write mode for burning. It will not work. 00183 */ 00184 BURN_WRITE_NONE 00185 }; 00186 00187 /** Data format to send to the drive */ 00188 enum burn_block_types 00189 { 00190 /** sync, headers, edc/ecc provided by lib/user */ 00191 BURN_BLOCK_RAW0 = 1, 00192 /** sync, headers, edc/ecc and p/q subs provided by lib/user */ 00193 BURN_BLOCK_RAW16 = 2, 00194 /** sync, headers, edc/ecc and packed p-w subs provided by lib/user */ 00195 BURN_BLOCK_RAW96P = 4, 00196 /** sync, headers, edc/ecc and raw p-w subs provided by lib/user */ 00197 BURN_BLOCK_RAW96R = 8, 00198 /** only 2048 bytes of user data provided by lib/user */ 00199 BURN_BLOCK_MODE1 = 256, 00200 /** 2336 bytes of user data provided by lib/user */ 00201 BURN_BLOCK_MODE2R = 512, 00202 /** 2048 bytes of user data provided by lib/user 00203 subheader provided in write parameters 00204 are we ever going to support this shit? I vote no. 00205 (supposed to be supported on all drives...) 00206 */ 00207 BURN_BLOCK_MODE2_PATHETIC = 1024, 00208 /** 2048 bytes of data + 8 byte subheader provided by lib/user 00209 hey, this is also dumb 00210 */ 00211 BURN_BLOCK_MODE2_LAME = 2048, 00212 /** 2324 bytes of data provided by lib/user 00213 subheader provided in write parameters 00214 no sir, I don't like it. 00215 */ 00216 BURN_BLOCK_MODE2_OBSCURE = 4096, 00217 /** 2332 bytes of data supplied by lib/user 00218 8 bytes sub header provided in write parameters 00219 this is the second least suck mode2, and is mandatory for 00220 all drives to support. 00221 */ 00222 BURN_BLOCK_MODE2_OK = 8192, 00223 /** SAO block sizes are based on cue sheet, so use this. */ 00224 BURN_BLOCK_SAO = 16384 00225 }; 00226 00227 /** Possible status of the drive in regard to the disc in it. */ 00228 enum burn_disc_status 00229 { 00230 /** The current status is not yet known */ 00231 BURN_DISC_UNREADY, 00232 00233 /** The drive holds a blank disc. It is ready for writing from scratch. 00234 Unused multi-session media: 00235 CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R 00236 Blanked multi-session media (i.e. treated by burn_disc_erase()) 00237 CD-RW, DVD-RW 00238 Overwriteable media with or without valid data 00239 DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE 00240 */ 00241 BURN_DISC_BLANK, 00242 00243 /** There is no disc at all in the drive */ 00244 BURN_DISC_EMPTY, 00245 00246 /** There is an incomplete disc in the drive. It is ready for appending 00247 another session. 00248 Written but not yet closed multi-session media 00249 CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R 00250 */ 00251 BURN_DISC_APPENDABLE, 00252 00253 /** There is a disc with data on it in the drive. It is usable only for 00254 reading. 00255 Written and closed multi-session media 00256 CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R 00257 Read-Only media 00258 CD-ROM, DVD-ROM, BD-ROM 00259 Note that many DVD-ROM drives report any written media 00260 as Read-Only media and not by their real media types. 00261 */ 00262 BURN_DISC_FULL, 00263 00264 /* ts A61007 */ 00265 /* @since 0.2.4 */ 00266 /** The drive was not grabbed when the status was inquired */ 00267 BURN_DISC_UNGRABBED, 00268 00269 /* ts A61020 */ 00270 /* @since 0.2.6 */ 00271 /** The media seems to be unsuitable for reading and for writing */ 00272 BURN_DISC_UNSUITABLE 00273 }; 00274 00275 00276 /** Possible data source return values */ 00277 enum burn_source_status 00278 { 00279 /** The source is ok */ 00280 BURN_SOURCE_OK, 00281 /** The source is at end of file */ 00282 BURN_SOURCE_EOF, 00283 /** The source is unusable */ 00284 BURN_SOURCE_FAILED 00285 }; 00286 00287 00288 /** Possible busy states for a drive */ 00289 enum burn_drive_status 00290 { 00291 /** The drive is not in an operation */ 00292 BURN_DRIVE_IDLE, 00293 /** The library is spawning the processes to handle a pending 00294 operation (A read/write/etc is about to start but hasn't quite 00295 yet) */ 00296 BURN_DRIVE_SPAWNING, 00297 /** The drive is reading data from a disc */ 00298 BURN_DRIVE_READING, 00299 /** The drive is writing data to a disc */ 00300 BURN_DRIVE_WRITING, 00301 /** The drive is writing Lead-In */ 00302 BURN_DRIVE_WRITING_LEADIN, 00303 /** The drive is writing Lead-Out */ 00304 BURN_DRIVE_WRITING_LEADOUT, 00305 /** The drive is erasing a disc */ 00306 BURN_DRIVE_ERASING, 00307 /** The drive is being grabbed */ 00308 BURN_DRIVE_GRABBING, 00309 00310 /* ts A61102 */ 00311 /* @since 0.2.6 */ 00312 /** The drive gets written zeroes before the track payload data */ 00313 BURN_DRIVE_WRITING_PREGAP, 00314 /** The drive is told to close a track (TAO only) */ 00315 BURN_DRIVE_CLOSING_TRACK, 00316 /** The drive is told to close a session (TAO only) */ 00317 BURN_DRIVE_CLOSING_SESSION, 00318 00319 /* ts A61223 */ 00320 /* @since 0.3.0 */ 00321 /** The drive is formatting media */ 00322 BURN_DRIVE_FORMATTING, 00323 00324 /* ts A70822 */ 00325 /* @since 0.4.0 */ 00326 /** The drive is busy in synchronous read (if you see this then it 00327 has been interrupted) */ 00328 BURN_DRIVE_READING_SYNC, 00329 /** The drive is busy in synchronous write (if you see this then it 00330 has been interrupted) */ 00331 BURN_DRIVE_WRITING_SYNC 00332 00333 }; 00334 00335 00336 /** Information about a track on a disc - this is from the q sub channel of the 00337 lead-in area of a disc. The documentation here is very terse. 00338 See a document such as mmc3 for proper information. 00339 00340 CAUTION : This structure is prone to future extension ! 00341 00342 Do not restrict your application to unsigned char with any counter like 00343 "session", "point", "pmin", ... 00344 Do not rely on the current size of a burn_toc_entry. 00345 00346 */ 00347 struct burn_toc_entry 00348 { 00349 /** Session the track is in */ 00350 unsigned char session; 00351 /** Type of data. for this struct to be valid, it must be 1 */ 00352 unsigned char adr; 00353 /** Type of data in the track */ 00354 unsigned char control; 00355 /** Zero. Always. Really. */ 00356 unsigned char tno; 00357 /** Track number or special information */ 00358 unsigned char point; 00359 unsigned char min; 00360 unsigned char sec; 00361 unsigned char frame; 00362 unsigned char zero; 00363 /** Track start time minutes for normal tracks */ 00364 unsigned char pmin; 00365 /** Track start time seconds for normal tracks */ 00366 unsigned char psec; 00367 /** Track start time frames for normal tracks */ 00368 unsigned char pframe; 00369 00370 /* Indicates whether extension data are valid and eventually override 00371 older elements in this structure: 00372 bit0= DVD extension is valid @since 0.3.2 00373 @since 0.5.2 : DVD extensions are made valid for CD too 00374 bit1= LRA extension is valid @since 0.7.2 00375 bit2= Track status bits extension is valid @since 1.2.8 00376 */ 00377 unsigned char extensions_valid; 00378 00379 /* ts A70201 : DVD extension. extensions_valid:bit0 00380 If invalid the members are guaranteed to be 0. */ 00381 /* @since 0.3.2 */ 00382 /* Tracks and session numbers are 16 bit. Here are the high bytes. */ 00383 unsigned char session_msb; 00384 unsigned char point_msb; 00385 /* pmin, psec, and pframe may be too small if DVD extension is valid */ 00386 int start_lba; 00387 /* min, sec, and frame may be too small if DVD extension is valid */ 00388 int track_blocks; 00389 00390 /* ts A90909 : LRA extension. extensions_valid:bit1 */ 00391 /* @since 0.7.2 */ 00392 /* MMC-5 6.27.3.18 : The Last Recorded Address is valid for DVD-R, 00393 DVD-R DL when LJRS = 00b, DVD-RW, HD DVD-R, and BD-R. 00394 This would mean profiles: 0x11, 0x15, 0x13, 0x14, 0x51, 0x41, 0x42 00395 */ 00396 int last_recorded_address; 00397 00398 /* ts B30112 : Track status bits extension. extensions_valid:bit2 */ 00399 /* @since 1.2.8 */ 00400 /* Names as of READ TRACK INFORMATION, MMC-5 6.27.3 : 00401 bit0 - bit3 = Track Mode 00402 bit4 = Copy 00403 bit5 = Damage 00404 bit6 - bit7 = LJRS 00405 bit8 - bit11 = Data Mode 00406 bit12 = FP 00407 bit13 = Packet/Inc 00408 bit14 = Blank 00409 bit15 = RT 00410 bit16 = NWA_V 00411 bit17 = LRA_V 00412 */ 00413 int track_status_bits; 00414 00415 }; 00416 00417 00418 /** Data source interface for tracks. 00419 This allows to use arbitrary program code as provider of track input data. 00420 00421 Objects compliant to this interface are either provided by the application 00422 or by API calls of libburn: burn_fd_source_new() , burn_file_source_new(), 00423 and burn_fifo_source_new(). 00424 00425 The API calls allow to use any file object as data source. Consider to feed 00426 an eventual custom data stream asynchronously into a pipe(2) and to let 00427 libburn handle the rest. 00428 In this case the following rule applies: 00429 Call burn_source_free() exactly once for every source obtained from 00430 libburn API. You MUST NOT otherwise use or manipulate its components. 00431 00432 In general, burn_source objects can be freed as soon as they are attached 00433 to track objects. The track objects will keep them alive and dispose them 00434 when they are no longer needed. With a fifo burn_source it makes sense to 00435 keep the own reference for inquiring its state while burning is in 00436 progress. 00437 00438 --- 00439 00440 The following description of burn_source applies only to application 00441 implemented burn_source objects. You need not to know it for API provided 00442 ones. 00443 00444 If you really implement an own passive data producer by this interface, 00445 then beware: it can do anything and it can spoil everything. 00446 00447 In this case the functions (*read), (*get_size), (*set_size), (*free_data) 00448 MUST be implemented by the application and attached to the object at 00449 creation time. 00450 Function (*read_sub) is allowed to be NULL or it MUST be implemented and 00451 attached. 00452 00453 burn_source.refcount MUST be handled properly: If not exactly as many 00454 references are freed as have been obtained, then either memory leaks or 00455 corrupted memory are the consequence. 00456 All objects which are referred to by *data must be kept existent until 00457 (*free_data) is called via burn_source_free() by the last referer. 00458 */ 00459 struct burn_source { 00460 00461 /** Reference count for the data source. MUST be 1 when a new source 00462 is created and thus the first reference is handed out. Increment 00463 it to take more references for yourself. Use burn_source_free() 00464 to destroy your references to it. */ 00465 int refcount; 00466 00467 00468 /** Read data from the source. Semantics like with read(2), but MUST 00469 either deliver the full buffer as defined by size or MUST deliver 00470 EOF (return 0) or failure (return -1) at this call or at the 00471 next following call. I.e. the only incomplete buffer may be the 00472 last one from that source. 00473 libburn will read a single sector by each call to (*read). 00474 The size of a sector depends on BURN_MODE_*. The known range is 00475 2048 to 2352. 00476 00477 If this call is reading from a pipe then it will learn 00478 about the end of data only when that pipe gets closed on the 00479 feeder side. So if the track size is not fixed or if the pipe 00480 delivers less than the predicted amount or if the size is not 00481 block aligned, then burning will halt until the input process 00482 closes the pipe. 00483 00484 IMPORTANT: 00485 If this function pointer is NULL, then the struct burn_source is of 00486 version >= 1 and the job of .(*read)() is done by .(*read_xt)(). 00487 See below, member .version. 00488 */ 00489 int (*read)(struct burn_source *, unsigned char *buffer, int size); 00490 00491 00492 /** Read subchannel data from the source (NULL if lib generated) 00493 WARNING: This is an obscure feature with CD raw write modes. 00494 Unless you checked the libburn code for correctness in that aspect 00495 you should not rely on raw writing with own subchannels. 00496 ADVICE: Set this pointer to NULL. 00497 */ 00498 int (*read_sub)(struct burn_source *, unsigned char *buffer, int size); 00499 00500 00501 /** Get the size of the source's data. Return 0 means unpredictable 00502 size. If application provided (*get_size) allows return 0, then 00503 the application MUST provide a fully functional (*set_size). 00504 */ 00505 off_t (*get_size)(struct burn_source *); 00506 00507 00508 /* ts A70125 : BROKE BINARY BACKWARD COMPATIBILITY AT libburn-0.3.1. */ 00509 /* @since 0.3.2 */ 00510 /** Program the reply of (*get_size) to a fixed value. It is advised 00511 to implement this by a attribute off_t fixed_size; in *data . 00512 The read() function does not have to take into respect this fake 00513 setting. It is rather a note of libburn to itself. Eventually 00514 necessary truncation or padding is done in libburn. Truncation 00515 is usually considered a misburn. Padding is considered ok. 00516 00517 libburn is supposed to work even if (*get_size) ignores the 00518 setting by (*set_size). But your application will not be able to 00519 enforce fixed track sizes by burn_track_set_size() and possibly 00520 even padding might be left out. 00521 */ 00522 int (*set_size)(struct burn_source *source, off_t size); 00523 00524 00525 /** Clean up the source specific data. This function will be called 00526 once by burn_source_free() when the last referer disposes the 00527 source. 00528 */ 00529 void (*free_data)(struct burn_source *); 00530 00531 00532 /** Next source, for when a source runs dry and padding is disabled 00533 WARNING: This is an obscure feature. Set to NULL at creation and 00534 from then on leave untouched and uninterpreted. 00535 */ 00536 struct burn_source *next; 00537 00538 00539 /** Source specific data. Here the various source classes express their 00540 specific properties and the instance objects store their individual 00541 management data. 00542 E.g. data could point to a struct like this: 00543 struct app_burn_source 00544 { 00545 struct my_app *app_handle; 00546 ... other individual source parameters ... 00547 off_t fixed_size; 00548 }; 00549 00550 Function (*free_data) has to be prepared to clean up and free 00551 the struct. 00552 */ 00553 void *data; 00554 00555 00556 /* ts A71222 : Supposed to be binary backwards compatible extension. */ 00557 /* @since 0.4.2 */ 00558 /** Valid only if above member .(*read)() is NULL. This indicates a 00559 version of struct burn_source younger than 0. 00560 From then on, member .version tells which further members exist 00561 in the memory layout of struct burn_source. libburn will only touch 00562 those announced extensions. 00563 00564 Versions: 00565 0 has .(*read)() != NULL, not even .version is present. 00566 1 has .version, .(*read_xt)(), .(*cancel)() 00567 */ 00568 int version; 00569 00570 /** This substitutes for (*read)() in versions above 0. */ 00571 int (*read_xt)(struct burn_source *, unsigned char *buffer, int size); 00572 00573 /** Informs the burn_source that the consumer of data prematurely 00574 ended reading. This call may or may not be issued by libburn 00575 before (*free_data)() is called. 00576 */ 00577 int (*cancel)(struct burn_source *source); 00578 }; 00579 00580 00581 /** Information on a drive in the system */ 00582 struct burn_drive_info 00583 { 00584 /** Name of the vendor of the drive */ 00585 char vendor[9]; 00586 /** Name of the drive */ 00587 char product[17]; 00588 /** Revision of the drive */ 00589 char revision[5]; 00590 00591 /** Invalid: Was: "Location of the drive in the filesystem." */ 00592 /** This string has no meaning any more. Once it stored the drive 00593 device file address. Now always use function burn_drive_d_get_adr() 00594 to inquire a device file address. ^^^^^ ALWAYS ^^^^^^^*/ 00595 char location[17]; 00596 00597 /** Can the drive read DVD-RAM discs */ 00598 unsigned int read_dvdram:1; 00599 /** Can the drive read DVD-R discs */ 00600 unsigned int read_dvdr:1; 00601 /** Can the drive read DVD-ROM discs */ 00602 unsigned int read_dvdrom:1; 00603 /** Can the drive read CD-R discs */ 00604 unsigned int read_cdr:1; 00605 /** Can the drive read CD-RW discs */ 00606 unsigned int read_cdrw:1; 00607 00608 /** Can the drive write DVD-RAM discs */ 00609 unsigned int write_dvdram:1; 00610 /** Can the drive write DVD-R discs */ 00611 unsigned int write_dvdr:1; 00612 /** Can the drive write CD-R discs */ 00613 unsigned int write_cdr:1; 00614 /** Can the drive write CD-RW discs */ 00615 unsigned int write_cdrw:1; 00616 00617 /** Can the drive simulate a write */ 00618 unsigned int write_simulate:1; 00619 00620 /** Can the drive report C2 errors */ 00621 unsigned int c2_errors:1; 00622 00623 /** The size of the drive's buffer (in kilobytes) */ 00624 int buffer_size; 00625 /** 00626 * The supported block types in tao mode. 00627 * They should be tested with the desired block type. 00628 * See also burn_block_types. 00629 */ 00630 int tao_block_types; 00631 /** 00632 * The supported block types in sao mode. 00633 * They should be tested with the desired block type. 00634 * See also burn_block_types. 00635 */ 00636 int sao_block_types; 00637 /** 00638 * The supported block types in raw mode. 00639 * They should be tested with the desired block type. 00640 * See also burn_block_types. 00641 */ 00642 int raw_block_types; 00643 /** 00644 * The supported block types in packet mode. 00645 * They should be tested with the desired block type. 00646 * See also burn_block_types. 00647 */ 00648 int packet_block_types; 00649 00650 /** The value by which this drive can be indexed when using functions 00651 in the library. This is the value to pass to all libbburn functions 00652 that operate on a drive. */ 00653 struct burn_drive *drive; 00654 }; 00655 00656 00657 /** Operation progress report. All values are 0 based indices. 00658 * */ 00659 struct burn_progress { 00660 /** The total number of sessions */ 00661 int sessions; 00662 /** Current session.*/ 00663 int session; 00664 /** The total number of tracks */ 00665 int tracks; 00666 /** Current track. */ 00667 int track; 00668 /** The total number of indices */ 00669 int indices; 00670 /** Curent index. */ 00671 int index; 00672 /** The starting logical block address */ 00673 int start_sector; 00674 /** On write: The number of sectors. 00675 On blank: 0x10000 as upper limit for relative progress steps */ 00676 int sectors; 00677 /** On write: The current sector being processed. 00678 On blank: Relative progress steps 0 to 0x10000 */ 00679 int sector; 00680 00681 /* ts A61023 */ 00682 /* @since 0.2.6 */ 00683 /** The capacity of the drive buffer */ 00684 unsigned buffer_capacity; 00685 /** The free space in the drive buffer (might be slightly outdated) */ 00686 unsigned buffer_available; 00687 00688 /* ts A61119 */ 00689 /* @since 0.2.6 */ 00690 /** The number of bytes sent to the drive buffer */ 00691 off_t buffered_bytes; 00692 /** The minimum number of bytes stored in buffer during write. 00693 (Caution: Before surely one buffer size of bytes was processed, 00694 this value is 0xffffffff.) 00695 */ 00696 unsigned buffer_min_fill; 00697 }; 00698 00699 00700 /* ts A61226 */ 00701 /* @since 0.3.0 */ 00702 /** Description of a speed capability as reported by the drive in conjunction 00703 with eventually loaded media. There can be more than one such object per 00704 drive. So they are chained via .next and .prev , where NULL marks the end 00705 of the chain. This list is set up by burn_drive_scan() and gets updated 00706 by burn_drive_grab(). 00707 A copy may be obtained by burn_drive_get_speedlist() and disposed by 00708 burn_drive_free_speedlist(). 00709 For technical background info see SCSI specs MMC and SPC: 00710 mode page 2Ah (from SPC 5Ah MODE SENSE) , mmc3r10g.pdf , 6.3.11 Table 364 00711 ACh GET PERFORMANCE, Type 03h , mmc5r03c.pdf , 6.8.5.3 Table 312 00712 */ 00713 struct burn_speed_descriptor { 00714 00715 /** Where this info comes from : 00716 0 = misc , 1 = mode page 2Ah , 2 = ACh GET PERFORMANCE */ 00717 int source; 00718 00719 /** The media type that was current at the time of report 00720 -2 = state unknown, -1 = no media was loaded , else see 00721 burn_disc_get_profile() */ 00722 int profile_loaded; 00723 char profile_name[80]; 00724 00725 /** The attributed capacity of appropriate media in logical block units 00726 i.e. 2352 raw bytes or 2048 data bytes. -1 = capacity unknown. */ 00727 int end_lba; 00728 00729 /** Speed is given in 1000 bytes/s , 0 = invalid. The numbers 00730 are supposed to be usable with burn_drive_set_speed() */ 00731 int write_speed; 00732 int read_speed; 00733 00734 /** Expert info from ACh GET PERFORMANCE and/or mode page 2Ah. 00735 Expect values other than 0 or 1 to get a meaning in future.*/ 00736 /* Rotational control: 0 = CLV/default , 1 = CAV */ 00737 int wrc; 00738 /* 1 = drive promises reported performance over full media */ 00739 int exact; 00740 /* 1 = suitable for mixture of read and write */ 00741 int mrw; 00742 00743 /** List chaining. Use .next until NULL to iterate over the list */ 00744 struct burn_speed_descriptor *prev; 00745 struct burn_speed_descriptor *next; 00746 }; 00747 00748 00749 /** Initialize the library. 00750 This must be called before using any other functions in the library. It 00751 may be called more than once with no effect. 00752 It is possible to 'restart' the library by shutting it down and 00753 re-initializing it. Once this was necessary if you follow the older and 00754 more general way of accessing a drive via burn_drive_scan() and 00755 burn_drive_grab(). See burn_drive_scan_and_grab() with its strong 00756 urges and its explanations. 00757 @return Nonzero if the library was able to initialize; zero if 00758 initialization failed. 00759 */ 00760 int burn_initialize(void); 00761 00762 /** Shutdown the library. 00763 This should be called before exiting your application. Make sure that all 00764 drives you have grabbed are released <i>before</i> calling this. 00765 */ 00766 void burn_finish(void); 00767 00768 00769 /* ts A61002 */ 00770 /** Abort any running drive operation and eventually call burn_finish(). 00771 00772 You MUST shut down the busy drives if an aborting event occurs during a 00773 burn run. For that you may call this function either from your own signal 00774 handling code or indirectly by activating the built-in signal handling: 00775 burn_set_signal_handling("my_app_name : ", NULL, 0); 00776 Else you may eventually call burn_drive_cancel() on the active drives and 00777 wait for them to assume state BURN_DRIVE_IDLE. 00778 @param patience Maximum number of seconds to wait for drives to 00779 finish. 00780 @since 0.7.8 : 00781 If this is -1, then only the cancel operations will 00782 be performed and no burn_finish() will happen. 00783 @param pacifier_func If not NULL: a function to produce appeasing messages. 00784 See burn_abort_pacifier() for an example. 00785 @param handle Opaque handle to be used with pacifier_func 00786 @return 1 ok, all went well 00787 0 had to leave a drive in unclean state 00788 <0 severe error, do no use libburn again 00789 @since 0.2.6 00790 */ 00791 int burn_abort(int patience, 00792 int (*pacifier_func)(void *handle, int patience, int elapsed), 00793 void *handle); 00794 00795 /** A pacifier function suitable for burn_abort. 00796 @param handle If not NULL, a pointer to a text suitable for printf("%s") 00797 @param patience Maximum number of seconds to wait 00798 @param elapsed Elapsed number of seconds 00799 */ 00800 int burn_abort_pacifier(void *handle, int patience, int elapsed); 00801 00802 00803 /** ts A61006 : This is for development only. Not suitable for applications. 00804 Set the verbosity level of the library. The default value is 0, which means 00805 that nothing is output on stderr. The more you increase this, the more 00806 debug output should be displayed on stderr for you. 00807 @param level The verbosity level desired. 0 for nothing, higher positive 00808 values for more information output. 00809 */ 00810 void burn_set_verbosity(int level); 00811 00812 /* ts A91111 */ 00813 /** Enable resp. disable logging of SCSI commands. 00814 This call can be made at any time - even before burn_initialize(). 00815 It is in effect for all active drives and currently not very thread 00816 safe for multiple drives. 00817 @param flag Bitfield for control purposes. The default is 0. 00818 bit0= log to file /tmp/libburn_sg_command_log 00819 bit1= log to stderr 00820 bit2= flush output after each line 00821 @since 0.7.4 00822 */ 00823 void burn_set_scsi_logging(int flag); 00824 00825 /* ts A60813 */ 00826 /** Set parameters for behavior on opening device files. To be called early 00827 after burn_initialize() and before any bus scan. But not mandatory at all. 00828 Parameter value 1 enables a feature, 0 disables. 00829 Default is (1,0,0). Have a good reason before you change it. 00830 @param exclusive 00831 0 = no attempt to make drive access exclusive. 00832 1 = Try to open only devices which are not marked as busy 00833 and try to mark them busy if opened sucessfully. (O_EXCL 00834 on GNU/Linux , flock(LOCK_EX) on FreeBSD.) 00835 2 = in case of a SCSI device, also try to open exclusively 00836 the matching /dev/sr, /dev/scd and /dev/st . 00837 One may select a device SCSI file family by adding 00838 0 = default family 00839 4 = /dev/sr%d 00840 8 = /dev/scd%d 00841 16 = /dev/sg%d 00842 Do not use other values ! 00843 Add 32 to demand on GNU/Linux an exclusive lock by 00844 fcntl(,F_SETLK,) after open() has succeeded. 00845 @param blocking Try to wait for drives which do not open immediately but 00846 also do not return an error as well. (O_NONBLOCK) 00847 This might stall indefinitely with /dev/hdX hard disks. 00848 @param abort_on_busy Unconditionally abort process when a non blocking 00849 exclusive opening attempt indicates a busy drive. 00850 Use this only after thorough tests with your app. 00851 @since 0.2.2 00852 */ 00853 void burn_preset_device_open(int exclusive, int blocking, int abort_on_busy); 00854 00855 00856 /* ts A70223 */ 00857 /** Allows the use of media types which are implemented in libburn but not yet 00858 tested. The list of those untested profiles is subject to change. 00859 - Currently no media types are under test reservation - 00860 If you really test such media, then please report the outcome on 00861 libburn-hackers@pykix.org 00862 If ever then this call should be done soon after burn_initialize() before 00863 any drive scanning. 00864 @param yes 1=allow all implemented profiles, 0=only tested media (default) 00865 @since 0.3.4 00866 */ 00867 void burn_allow_untested_profiles(int yes); 00868 00869 00870 /* ts A60823 */ 00871 /** Aquire a drive with known device file address. 00872 00873 This is the sysadmin friendly way to open one drive and to leave all 00874 others untouched. It bundles the following API calls to form a 00875 non-obtrusive way to use libburn: 00876 burn_drive_add_whitelist() , burn_drive_scan() , burn_drive_grab() 00877 You are *strongly urged* to use this call whenever you know the drive 00878 address in advance. 00879 00880 If not, then you have to use directly above calls. In that case, you are 00881 *strongly urged* to drop any unintended drive which will be exclusively 00882 occupied and not closed by burn_drive_scan(). 00883 This can be done by shutting down the library including a call to 00884 burn_finish(). You may later start a new libburn session and should then 00885 use the function described here with an address obtained after 00886 burn_drive_scan() via burn_drive_d_get_adr(drive_infos[driveno].drive,adr). 00887 Another way is to drop the unwanted drives by burn_drive_info_forget(). 00888 00889 Operating on multiple drives: 00890 00891 Different than with burn_drive_scan() it is allowed to call 00892 burn_drive_scan_and_grab() without giving up any other scanned drives. So 00893 this call can be used to get a collection of more than one aquired drives. 00894 The attempt to aquire the same drive twice will fail, though. 00895 00896 Pseudo-drives: 00897 00898 burn_drive_scan_and_grab() is able to aquire virtual drives which will 00899 accept options much like a MMC burner drive. Many of those options will not 00900 cause any effect, though. The address of a pseudo-drive begins with 00901 prefix "stdio:" followed by a path. 00902 Examples: "stdio:/tmp/pseudo_drive" , "stdio:/dev/null" , "stdio:-" 00903 00904 If the path is empty, the result is a null-drive = drive role 0. 00905 It pretends to have loaded no media and supports no reading or writing. 00906 00907 If the path leads to an existing regular file, or to a not yet existing 00908 file, or to an existing block device, then the result is a random access 00909 stdio-drive capable of reading and writing = drive role 2. 00910 00911 If the path leads to an existing file of any type other than directory, 00912 then the result is a sequential write-only stdio-drive = drive role 3. 00913 00914 The special address form "stdio:/dev/fd/{number}" is interpreted literally 00915 as reference to open file descriptor {number}. This address form coincides 00916 with real files on some systems, but it is in fact hardcoded in libburn. 00917 Special address "stdio:-" means stdout = "stdio:/dev/fd/1". 00918 The role of such a drive is determined by the file type obtained via 00919 fstat({number}). 00920 00921 Roles 2 and 3 perform all their eventual data transfer activities on a file 00922 via standard i/o functions open(2), lseek(2), read(2), write(2), close(2). 00923 The media profile is reported as 0xffff. Write space information from those 00924 media is not necessarily realistic. 00925 00926 The capabilities of role 2 resemble DVD-RAM but it can simulate writing. 00927 If the path does not exist in the filesystem yet, it is attempted to create 00928 it as a regular file as soon as write operations are started. 00929 00930 The capabilities of role 3 resemble a blank DVD-R. Nevertheless each 00931 burn_disc_write() run may only write a single track. 00932 00933 One may distinguish pseudo-drives from MMC drives by call 00934 burn_drive_get_drive_role(). 00935 00936 @param drive_infos On success returns a one element array with the drive 00937 (cdrom/burner). Thus use with driveno 0 only. On failure 00938 the array has no valid elements at all. 00939 The returned array should be freed via burn_drive_info_free() 00940 when it is no longer needed. 00941 This is a result from call burn_drive_scan(). See there. 00942 Use with driveno 0 only. 00943 @param adr The device file address of the desired drive. Either once 00944 obtained by burn_drive_d_get_adr() or composed skillfully by 00945 application resp. its user. E.g. "/dev/sr0". 00946 Consider to preprocess it by burn_drive_convert_fs_adr(). 00947 @param load Nonzero to make the drive attempt to load a disc (close its 00948 tray door, etc). 00949 @return 1 = success , 0 = drive not found , -1 = other error 00950 @since 0.2.2 00951 */ 00952 int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], 00953 char* adr, int load); 00954 00955 00956 /* ts A51221 */ 00957 /* @since 0.2.2 */ 00958 /** Maximum number of particularly permissible drive addresses */ 00959 #define BURN_DRIVE_WHITELIST_LEN 255 00960 00961 /** Add a device to the list of permissible drives. As soon as some entry is in 00962 the whitelist all non-listed drives are banned from scanning. 00963 @return 1 success, <=0 failure 00964 @since 0.2.2 00965 */ 00966 int burn_drive_add_whitelist(char *device_address); 00967 00968 /** Remove all drives from whitelist. This enables all possible drives. */ 00969 void burn_drive_clear_whitelist(void); 00970 00971 00972 /** Scan for drives. This function MUST be called until it returns nonzero. 00973 In case of re-scanning: 00974 All pointers to struct burn_drive and all struct burn_drive_info arrays 00975 are invalidated by using this function. Do NOT store drive pointers across 00976 calls to this function ! 00977 To avoid invalid pointers one MUST free all burn_drive_info arrays 00978 by burn_drive_info_free() before calling burn_drive_scan() a second time. 00979 If there are drives left, then burn_drive_scan() will refuse to work. 00980 00981 After this call all drives depicted by the returned array are subject 00982 to eventual (O_EXCL) locking. See burn_preset_device_open(). This state 00983 ends either with burn_drive_info_forget() or with burn_drive_release(). 00984 It is unfriendly to other processes on the system to hold drives locked 00985 which one does not definitely plan to use soon. 00986 @param drive_infos Returns an array of drive info items (cdroms/burners). 00987 The returned array must be freed by burn_drive_info_free() 00988 before burn_finish(), and also before calling this function 00989 burn_drive_scan() again. 00990 @param n_drives Returns the number of drive items in drive_infos. 00991 @return 0 while scanning is not complete 00992 >0 when it is finished sucessfully, 00993 <0 when finished but failed. 00994 */ 00995 int burn_drive_scan(struct burn_drive_info *drive_infos[], 00996 unsigned int *n_drives); 00997 00998 /* ts A60904 : ticket 62, contribution by elmom */ 00999 /** Release memory about a single drive and any exclusive lock on it. 01000 Become unable to inquire or grab it. Expect FATAL consequences if you try. 01001 @param drive_info pointer to a single element out of the array 01002 obtained from burn_drive_scan() : &(drive_infos[driveno]) 01003 @param force controls degree of permissible drive usage at the moment this 01004 function is called, and the amount of automatically provided 01005 drive shutdown : 01006 0= drive must be ungrabbed and BURN_DRIVE_IDLE 01007 1= try to release drive resp. accept BURN_DRIVE_GRABBING 01008 Use these two only. Further values are to be defined. 01009 @return 1 on success, 2 if drive was already forgotten, 01010 0 if not permissible, <0 on other failures, 01011 @since 0.2.2 01012 */ 01013 int burn_drive_info_forget(struct burn_drive_info *drive_info, int force); 01014 01015 01016 /** When no longer needed, free a whole burn_drive_info array which was 01017 returned by burn_drive_scan(). 01018 For freeing single drive array elements use burn_drive_info_forget(). 01019 */ 01020 void burn_drive_info_free(struct burn_drive_info drive_infos[]); 01021 01022 01023 /* ts A60823 */ 01024 /* @since 0.2.2 */ 01025 /** Maximum length+1 to expect with a drive device file address string */ 01026 #define BURN_DRIVE_ADR_LEN 1024 01027 01028 /* ts A70906 */ 01029 /** Inquire the device file address of the given drive. 01030 @param drive The drive to inquire. 01031 @param adr An application provided array of at least BURN_DRIVE_ADR_LEN 01032 characters size. The device file address gets copied to it. 01033 @return >0 success , <=0 error (due to libburn internal problem) 01034 @since 0.4.0 01035 */ 01036 int burn_drive_d_get_adr(struct burn_drive *drive, char adr[]); 01037 01038 /* A60823 */ 01039 /** Inquire the device file address of a drive via a given drive_info object. 01040 (Note: This is a legacy call.) 01041 @param drive_info The drive to inquire.Usually some &(drive_infos[driveno]) 01042 @param adr An application provided array of at least BURN_DRIVE_ADR_LEN 01043 characters size. The device file address gets copied to it. 01044 @return >0 success , <=0 error (due to libburn internal problem) 01045 @since 0.2.6 01046 */ 01047 int burn_drive_get_adr(struct burn_drive_info *drive_info, char adr[]); 01048 01049 01050 /* ts A60922 ticket 33 */ 01051 /** Evaluate whether the given address would be a drive device file address 01052 which could be listed by a run of burn_drive_scan(). No check is made 01053 whether a device file with this address exists or whether it leads 01054 to a usable MMC drive. 01055 @return 1 means yes, 0 means no 01056 @since 0.2.6 01057 */ 01058 int burn_drive_is_enumerable_adr(char *adr); 01059 01060 /* ts A60922 ticket 33 */ 01061 /** Try to convert a given existing filesystem address into a drive device file 01062 address. This succeeds with symbolic links or if a hint about the drive's 01063 system address can be read from the filesystem object and a matching drive 01064 is found. 01065 @param path The address of an existing file system object 01066 @param adr An application provided array of at least BURN_DRIVE_ADR_LEN 01067 characters size. The device file address gets copied to it. 01068 @return 1 = success , 0 = failure , -1 = severe error 01069 @since 0.2.6 01070 */ 01071 int burn_drive_convert_fs_adr(char *path, char adr[]); 01072 01073 /* ts A60923 */ 01074 /** Try to convert a given SCSI address of bus,host,channel,target,lun into 01075 a drive device file address. If a SCSI address component parameter is < 0 01076 then it is not decisive and the first enumerated address which matches 01077 the >= 0 parameters is taken as result. 01078 Note: bus and (host,channel) are supposed to be redundant. 01079 @param bus_no "Bus Number" (something like a virtual controller) 01080 @param host_no "Host Number" (something like half a virtual controller) 01081 @param channel_no "Channel Number" (other half of "Host Number") 01082 @param target_no "Target Number" or "SCSI Id" (a device) 01083 @param lun_no "Logical Unit Number" (a sub device) 01084 @param adr An application provided array of at least BURN_DRIVE_ADR_LEN 01085 characters size. The device file address gets copied to it. 01086 @return 1 = success , 0 = failure , -1 = severe error 01087 @since 0.2.6 01088 */ 01089 int burn_drive_convert_scsi_adr(int bus_no, int host_no, int channel_no, 01090 int target_no, int lun_no, char adr[]); 01091 01092 /* ts B10728 */ 01093 /** Try to convert a given drive device file address into the address of a 01094 symbolic link that points to this drive address. 01095 Modern GNU/Linux systems may shuffle drive addresses from boot to boot. 01096 The udev daemon is supposed to create links which always point to the 01097 same drive, regardless of its system address. 01098 This call tries to find such links. 01099 @param dev_adr Should contain a drive address as returned by 01100 burn_drive_scan(). 01101 @param link_adr An application provided array of at least 01102 BURN_DRIVE_ADR_LEN characters size. The found link 01103 address gets copied to it. 01104 @param dir_adr The address of the directory where to look for links. 01105 Normally: "/dev" 01106 @param templ An array of pointers to name templates, which 01107 links have to match. A symbolic link in dir_adr matches 01108 a name template if it begins by that text. E.g. 01109 link address "/dev/dvdrw1" matches template "dvdrw". 01110 If templ is NULL, then the default array gets used: 01111 {"dvdrw", "cdrw", "dvd", "cdrom", "cd"} 01112 If several links would match, then a link will win, 01113 which matches the template with the lowest array index. 01114 Among these candidates, the one with the lowest strcmp() 01115 rank will be chosen as link_adr. 01116 @param num_templ Number of array elements in templ. 01117 @param flag Bitfield for control purposes. Unused yet. Submit 0. 01118 @return <0 severe error, 0 failed to search, 2 nothing found 01119 1 success, link_adr is valid 01120 @since 1.1.4 01121 */ 01122 int burn_lookup_device_link(char *dev_adr, char link_adr[], 01123 char *dir_adr, char **templ, int num_templ, int flag); 01124 01125 /* ts A60923 - A61005 */ 01126 /** Try to obtain bus,host,channel,target,lun from path. If there is an SCSI 01127 address at all, then this call should succeed with a drive device file 01128 address obtained via burn_drive_d_get_adr(). It is also supposed to 01129 succeed with any device file of a (possibly emulated) SCSI device. 01130 @return 1 = success , 0 = failure , -1 = severe error 01131 @since 0.2.6 01132 */ 01133 int burn_drive_obtain_scsi_adr(char *path, int *bus_no, int *host_no, 01134 int *channel_no, int *target_no, int *lun_no); 01135 01136 /** Grab a drive. This must be done before the drive can be used (for reading, 01137 writing, etc). 01138 @param drive The drive to grab. This is found in a returned 01139 burn_drive_info struct. 01140 @param load Nonzero to make the drive attempt to load a disc (close its 01141 tray door, etc). 01142 @return 1 if it was possible to grab the drive, else 0 01143 */ 01144 int burn_drive_grab(struct burn_drive *drive, int load); 01145 01146 /* ts B00114 */ 01147 /* Probe available CD write modes and block types. In earlier versions this 01148 was done unconditionally on drive examination or aquiration. But it is 01149 lengthy and obtrusive, up to spoiling burn runs on the examined drives. 01150 So now this probing is omitted by default. All drives which announce to be 01151 capable of CD or DVD writing, get blindly attributed the capability for 01152 SAO and TAO. Applications which are interested in RAW modes or want to 01153 rely on the traditional write mode information, may use this call. 01154 @param drive_info drive object to be inquired 01155 @return >0 indicates success, <=0 means failure 01156 @since 0.7.6 01157 */ 01158 int burn_drive_probe_cd_write_modes(struct burn_drive_info *drive_info); 01159 01160 /* ts A90824 */ 01161 /** Calm down or alert a drive. Some drives stay alert after reading for 01162 quite some time. This saves time with the startup for the next read 01163 operation but also causes noise and consumes extra energy. It makes 01164 sense to calm down the drive if no read operation is expected for the 01165 next few seconds. The drive will get alert automatically if operations 01166 are required. 01167 @param d The drive to influence. 01168 @param flag Bitfield for control purposes 01169 bit0= become alert (else start snoozing) 01170 This is not mandatory to allow further drive operations 01171 @return 1= success , 0= drive role not suitable for calming 01172 @since 0.7.0 01173 */ 01174 int burn_drive_snooze(struct burn_drive *d, int flag); 01175 01176 01177 /** Re-assess drive and media status. This should be done after a drive 01178 underwent a status change and shall be further used without intermediate 01179 burn_drive_release(), burn_drive_grab(). E.g. after blanking or burning. 01180 @param drive The already grabbed drive to re-assess. 01181 @param flag Unused yet. Submit 0. 01182 @return 1 success , <= 0 could not determine drive and media state 01183 @since 1.1.8 01184 */ 01185 int burn_drive_re_assess(struct burn_drive *d, int flag); 01186 01187 01188 /** Release a drive. This should not be done until the drive is no longer 01189 busy (see burn_drive_get_status). 01190 @param drive The drive to release. 01191 @param eject Nonzero to make the drive eject the disc in it. 01192 */ 01193 void burn_drive_release(struct burn_drive *drive, int eject); 01194 01195 01196 /* ts A70918 */ 01197 /** Like burn_drive_release() but keeping the drive tray closed and its 01198 eject button disabled. This physically locked drive state will last until 01199 the drive is grabbed again and released via burn_drive_release(). 01200 Programs like eject, cdrecord, growisofs will break that ban too. 01201 @param d The drive to release and leave locked. 01202 @param flag Bitfield for control purposes (unused yet, submit 0) 01203 @return 1 means success, <=0 means failure 01204 @since 0.4.0 01205 */ 01206 int burn_drive_leave_locked(struct burn_drive *d, int flag); 01207 01208 01209 /** Returns what kind of disc a drive is holding. This function may need to be 01210 called more than once to get a proper status from it. See burn_disc_status 01211 for details. 01212 @param drive The drive to query for a disc. 01213 @return The status of the drive, or what kind of disc is in it. 01214 Note: BURN_DISC_UNGRABBED indicates wrong API usage 01215 */ 01216 enum burn_disc_status burn_disc_get_status(struct burn_drive *drive); 01217 01218 01219 /* ts A61020 */ 01220 /** WARNING: This revives an old bug-like behavior that might be dangerous. 01221 Sets the drive status to BURN_DISC_BLANK if it is BURN_DISC_UNREADY 01222 or BURN_DISC_UNSUITABLE. Thus marking media as writable which actually 01223 failed to declare themselves either blank or (partially) filled. 01224 @return 1 drive status has been set , 0 = unsuitable drive status 01225 @since 0.2.6 01226 */ 01227 int burn_disc_pretend_blank(struct burn_drive *drive); 01228 01229 01230 /* ts A61106 */ 01231 /** WARNING: This overrides the safety measures against unsuitable media. 01232 Sets the drive status to BURN_DISC_FULL if it is BURN_DISC_UNREADY 01233 or BURN_DISC_UNSUITABLE. Thus marking media as blankable which actually 01234 failed to declare themselves either blank or (partially) filled. 01235 @since 0.2.6 01236 */ 01237 int burn_disc_pretend_full(struct burn_drive *drive); 01238 01239 01240 /* ts A61021 */ 01241 /** Reads ATIP information from inserted media. To be obtained via 01242 burn_drive_get_write_speed(), burn_drive_get_min_write_speed(), 01243 burn_drive_get_start_end_lba(). The drive must be grabbed for this call. 01244 @param drive The drive to query. 01245 @return 1=sucess, 0=no valid ATIP info read, -1 severe error 01246 @since 0.2.6 01247 */ 01248 int burn_disc_read_atip(struct burn_drive *drive); 01249 01250 01251 /* ts A61020 */ 01252 /** Returns start and end lba of the media which is currently inserted 01253 in the given drive. The drive has to be grabbed to have hope for reply. 01254 Shortcomming (not a feature): unless burn_disc_read_atip() was called 01255 only blank media will return valid info. 01256 @param drive The drive to query. 01257 @param start_lba Returns the start lba value 01258 @param end_lba Returns the end lba value 01259 @param flag Bitfield for control purposes (unused yet, submit 0) 01260 @return 1 if lba values are valid , 0 if invalid 01261 @since 0.2.6 01262 */ 01263 int burn_drive_get_start_end_lba(struct burn_drive *drive, 01264 int *start_lba, int *end_lba, int flag); 01265 01266 01267 /* ts A90902 */ 01268 /** Guess the manufacturer name of CD media from the ATIP addresses of lead-in 01269 and lead-out. (Currently only lead-in is interpreted. Lead-out may in 01270 future be used to identify the media type in more detail.) 01271 The parameters of this call should be obtained by burn_disc_read_atip(d), 01272 burn_drive_get_start_end_lba(d, &start_lba, &end_lba, 0), 01273 burn_lba_to_msf(start_lba, &m_li, &s_li, &f_li) and 01274 burn_lba_to_msf(end_lba, &m_lo, &s_lo, &f_lo). 01275 @param m_li "minute" part of ATIP lead-in resp. start_lba 01276 @param s_li "second" of lead-in resp. start_lba 01277 @param f_li "frame" of lead-in 01278 @param m_lo "minute" part of ATIP lead-out 01279 @param s_lo "second" of lead-out 01280 @param f_lo "frame" of lead-out 01281 @param flag Bitfield for control purposes, 01282 bit0= append a text "(aka ...)" to reply if other brands or 01283 vendor names are known. 01284 @return Printable text or NULL on memory shortage. 01285 Dispose by free() when no longer needed. 01286 @since 0.7.2 01287 */ 01288 char *burn_guess_cd_manufacturer(int m_li, int s_li, int f_li, 01289 int m_lo, int s_lo, int f_lo, int flag); 01290 01291 /* ts A90909 */ 01292 /** Retrieve some media information which is mainly specific to CD. For other 01293 media only the bits in reply parameter valid are supposed to be meaningful. 01294 @param d The drive to query. 01295 @param disc_type A string saying either "CD-DA or CD-ROM", or "CD-I", 01296 or ""CD-ROM XA", or "undefined". 01297 @param disc_id A 32 bit number read from the media. (Meaning unclear yet) 01298 @param bar_code 8 hex digits from a barcode on media read by the drive 01299 (if the drive has a bar code reader built in). 01300 @param app_code The Host Application Code which must be set in the Write 01301 Parameters Page if the media is not unrestricted (URU==0). 01302 @param valid Replies bits which indicate the validity of other reply 01303 parameters or the state of certain CD info bits: 01304 bit0= disc_type is valid 01305 bit1= disc_id is valid 01306 bit2= bar_code is valid 01307 bit3= disc_app_code is valid 01308 bit4= Disc is unrestricted (URU bit, 51h READ DISC INFO) 01309 This seems to be broken with my drives. The bit is 01310 0 and the validity bit for disc_app_code is 0 too. 01311 bit5= Disc is nominally erasable (Erasable bit) 01312 This will be set with overwriteable media which 01313 libburn normally considers to be unerasable blank. 01314 @return 1 success, <= 0 an error occured 01315 @since 0.7.2 01316 */ 01317 int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80], 01318 unsigned int *disc_id, char bar_code[9], int *app_code, 01319 int *valid); 01320 01321 /* ts B11201 */ 01322 /** Read the array of CD-TEXT packs from the Lead-in of an audio CD. 01323 Each pack consists of 18 bytes, of which 4 are header. 12 bytes are pieces 01324 of 0-terminated texts or binary data. 2 bytes hold a CRC. 01325 For a description of the format of the array, see file doc/cdtext.txt. 01326 @param d The drive to query. 01327 @param text_packs Will point to an allocated memory buffer with CD-TEXT. 01328 It will only contain text packs, and not be prepended 01329 by the TOC header of four bytes, which gets stored with 01330 file cdtext.dat by cdrecord -vv -toc. (The first two of 01331 these bytes are supposed to hold the number of CD-TEXT 01332 bytes + 2. The other two bytes are supposed to be 0.) 01333 Dispose this buffer by free(), when no longer needed. 01334 @param num_packs Will tell the number of text packs, i.e. the number of 01335 bytes in text_packs divided by 18. 01336 @param flag Bitfield for control purposes, 01337 Unused yet. Submit 0. 01338 @return 1 success, 0= no CD-TEXT found, < 0 an error occured 01339 @since 1.2.0 01340 */ 01341 int burn_disc_get_leadin_text(struct burn_drive *d, 01342 unsigned char **text_packs, int *num_packs, 01343 int flag); 01344 01345 /* ts B00924 */ 01346 /** Read the current usage of the eventual BD Spare Area. This area gets 01347 reserved on BD media during formatting. During writing it is used to 01348 host replacements of blocks which failed the checkread immediately after 01349 writing. 01350 This call applies only to recordable BD media. I.e. profiles 0x41 to 0x43. 01351 @param d The drive to query. 01352 @param alloc_blocks Returns the number of blocks reserved as Spare Area 01353 @param free_blocks Returns the number of yet unused blocks in that area 01354 @param flag Bitfield for control purposes (unused yet, submit 0) 01355 @return 1 = reply prarameters are valid, 01356 <=0 = reply is invalid (e.g. because no BD profile) 01357 @since 0.8.8 01358 */ 01359 int burn_disc_get_bd_spare_info(struct burn_drive *d, 01360 int *alloc_blocks, int *free_blocks, int flag); 01361 01362 /* ts B10801 */ 01363 /** Retrieve some media information which is mainly specific to media of 01364 the DVD-R family: DVD-R , DVD-RW , DVD-R DL , HD DVD-R 01365 Currently the information cannot be retrieved from other media types. 01366 @param d The drive to query. 01367 @param disk_category returns DVD Book to which the media complies 01368 @param book_name returns a pointer to the book name of disk_category. 01369 This memory is static. Do not alter or free it ! 01370 @param part_version returns the Media Version in the DVD Book 01371 @param num_layers returns the number of media layers 01372 @param num_blocks returns the number of blocks between pysical start 01373 and physical end of the media 01374 @param flag Bitfield for control purposes (unused yet, submit 0) 01375 @return 1 = reply prarameters are valid, 01376 <=0 = reply is invalid (e.g. because no DVD-R) 01377 @since 1.1.4 01378 */ 01379 int burn_disc_get_phys_format_info(struct burn_drive *d, int *disk_category, 01380 char **book_name, int *part_version, int *num_layers, 01381 int *num_blocks, int flag); 01382 01383 /* ts A61110 */ 01384 /** Read start lba and Next Writeable Address of a track from media. 01385 Usually a track lba is obtained from the result of burn_track_get_entry(). 01386 This call retrieves an updated lba, eventual nwa, and can address the 01387 invisible track to come. 01388 The drive must be grabbed for this call. One may not issue this call 01389 during ongoing burn_disc_write() or burn_disc_erase(). 01390 @param d The drive to query. 01391 @param o If not NULL: write parameters to be set on drive before query 01392 @param trackno 0=next track to come, >0 number of existing track 01393 The first existing track on a CD may have a number higher 01394 than 1. Use burn_session_get_start_tno() to inquire this 01395 start number. 01396 @param lba return value: start lba 01397 @param nwa return value: Next Writeable Address 01398 @return 1=nwa is valid , 0=nwa is not valid , -1=error 01399 @since 0.2.6 01400 */ 01401 int burn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o, 01402 int trackno, int *lba, int *nwa); 01403 01404 /* ts B10525 */ 01405 /** Tells whether a previous attempt to determine the Next Writeable Address 01406 of the upcomming track reveiled that the READ TRACK INFORMATION Damage Bit 01407 is set for this track, resp. that no valid writable address is available. 01408 See MMC-5 6.27.3.7 Damage Bit, 6.27.3.11 NWA_V (NWA valid) 01409 @param d The drive to query. 01410 @param flag Bitfield for control purposes (unused yet, submit 0) 01411 @return 0= Looks ok: Damage Bit is not set, NWA_V is set 01412 1= Damaged and theoretically writable (NWA_V is set) 01413 2= Not writable: NWA_V is not set 01414 3= Damaged and not writable (NWA_V is not set), 01415 @since 1.1.0 01416 */ 01417 int burn_disc_next_track_is_damaged(struct burn_drive *d, int flag); 01418 01419 /* ts B10527 */ 01420 /** Try to close the last track and session of media which have bit0 set in 01421 the return value of call burn_disc_next_track_is_damaged(). 01422 Whether it helps depends much on the reason why the media is reported 01423 as damaged by the drive. 01424 This call works only for profiles 0x09 CD-R, 0x0a CD-RW, 0x11 DVD-R, 01425 0x14 DVD-RW sequential, 0x1b DVD+R, 0x2b DVD+R DL, 0x41 BD-R sequential. 01426 Note: After writing it is advised to give up the drive and to grab it again 01427 in order to learn about its view on the new media state. 01428 @param o Write options created by burn_write_opts_new() and 01429 manipulated by burn_write_opts_set_multi(). 01430 burn_write_opts_set_write_type() should be set to 01431 BURN_WRITE_TAO, burn_write_opts_set_simulate() should be 01432 set to 0. 01433 @param flag Bitfield for control purposes 01434 bit0= force close, even if no damage was seen 01435 @return <=0 media not marked as damaged, or media type not suitable, 01436 or closing attempted but failed 01437 1= attempt finished without error indication 01438 @since 1.1.0 01439 */ 01440 int burn_disc_close_damaged(struct burn_write_opts *o, int flag); 01441 01442 01443 /* ts A70131 */ 01444 /** Read start lba of the first track in the last complete session. 01445 This is the first parameter of mkisofs option -C. The second parameter 01446 is nwa as obtained by burn_disc_track_lba_nwa() with trackno 0. 01447 @param d The drive to query. 01448 @param start_lba returns the start address of that track 01449 @return <= 0 : failure, 1 = ok 01450 @since 0.3.2 01451 */ 01452 int burn_disc_get_msc1(struct burn_drive *d, int *start_lba); 01453 01454 01455 /* ts A70213 */ 01456 /** Return the best possible estimation of the currently available capacity of 01457 the media. This might depend on particular write option settings. For 01458 inquiring the space with such a set of options, the drive has to be 01459 grabbed and BURN_DRIVE_IDLE. If not, then one will only get a canned value 01460 from the most recent automatic inquiry (e.g. during last drive grabbing). 01461 An eventual start address from burn_write_opts_set_start_byte() will be 01462 subtracted from the obtained capacity estimation. Negative results get 01463 defaulted to 0. 01464 If the drive is actually a file in a large filesystem or a large block 01465 device, then the capacity is curbed to a maximum of 0x7ffffff0 blocks 01466 = 4 TB - 32 KB. 01467 @param d The drive to query. 01468 @param o If not NULL: write parameters to be set on drive before query 01469 @return number of most probably available free bytes 01470 @since 0.3.4 01471 */ 01472 off_t burn_disc_available_space(struct burn_drive *d, 01473 struct burn_write_opts *o); 01474 01475 /* ts A61202 */ 01476 /** Tells the MMC Profile identifier of the loaded media. The drive must be 01477 grabbed in order to get a non-zero result. 01478 libburn currently writes only to profiles 01479 0x09 "CD-R" 01480 0x0a "CD-RW" 01481 0x11 "DVD-R sequential recording" 01482 0x12 "DVD-RAM" 01483 0x13 "DVD-RW restricted overwrite" 01484 0x14 "DVD-RW sequential recording", 01485 0x15 "DVD-R/DL sequential recording", 01486 0x1a "DVD+RW" 01487 0x1b "DVD+R", 01488 0x2b "DVD+R/DL", 01489 0x41 "BD-R sequential recording", 01490 0x43 "BD-RE", 01491 0xffff "stdio file" 01492 Note: 0xffff is not a MMC profile but a libburn invention. 01493 Read-only are the profiles 01494 0x08 "CD-ROM", 01495 0x10 "DVD-ROM", 01496 0x40 "BD-ROM", 01497 Read-only for now is this BD-R profile (testers wanted) 01498 0x42 "BD-R random recording" 01499 Empty drives are supposed to report 01500 0x00 "" 01501 @param d The drive where the media is inserted. 01502 @param pno Profile Number. See also mmc5r03c.pdf, table 89 01503 @param name Profile Name (see above list, unknown profiles have empty name) 01504 @return 1 profile is valid, 0 no profile info available 01505 @since 0.3.0 01506 */ 01507 int burn_disc_get_profile(struct burn_drive *d, int *pno, char name[80]); 01508 01509 01510 /* ts A90903 : API */ 01511 /** Obtain product id and standards defined media codes. 01512 The product id is a printable string which is supposed to be the same 01513 for identical media but should vary with non-identical media. Some media 01514 do not allow to obtain such an id at all. 01515 The pair (profile_number, product_id) should be the best id to identify 01516 media with identical product specifications. 01517 The reply parameters media_code1 and media_code2 can be used with 01518 burn_guess_manufacturer() 01519 The reply parameters have to be disposed by free() when no longer needed. 01520 @param d The drive where the media is inserted. 01521 @param product_id Reply: Printable text depicting manufacturer and 01522 eventually media id. 01523 @param media_code1 Reply: The eventual manufacturer identification as read 01524 from DVD/BD media or a text "XXmYYsZZf" from CD media 01525 ATIP lead-in. 01526 @param media_code2 The eventual media id as read from DVD+/BD media or a 01527 text "XXmYYsZZf" from CD ATIP lead-out. 01528 @param book_type Book type text for DVD and BD. 01529 Caution: is NULL with CD, even if return value says ok. 01530 @param flag Bitfield for control purposes 01531 bit0= do not escape " _/" (not suitable for 01532 burn_guess_manufacturer()) 01533 @return 1= ok, product_id and media codes are valid, 01534 0= no product id_available, reply parameters are NULL 01535 <0= error 01536 @since 0.7.2 01537 */ 01538 int burn_disc_get_media_id(struct burn_drive *d, 01539 char **product_id, char **media_code1, char **media_code2, 01540 char **book_type, int flag); 01541 01542 01543 /* ts A90904 */ 01544 /** Guess the name of a manufacturer by profile number, manufacturer code 01545 and media code. The profile number can be obtained by 01546 burn_disc_get_profile(), the other two parameters can be obtained as 01547 media_code1 and media_code2 by burn_get_media_product_id(). 01548 @param profile_no Profile number (submit -1 if not known) 01549 @param manuf_code Manufacturer code from media (e.g. "RICOHJPN") 01550 @param media_code Media ID code from media (e.g. "W11") 01551 @param flag Bitfield for control purposes, submit 0 01552 @return Printable text or NULL on memory shortage. 01553 If the text begins with "Unknown " then no item of the 01554 manufacturer list matched the codes. 01555 Dispose by free() when no longer needed. 01556 @since 0.7.2 01557 */ 01558 char *burn_guess_manufacturer(int profile_no, 01559 char *manuf_code, char *media_code, int flag); 01560 01561 01562 /** Tells whether a disc can be erased or not 01563 @param d The drive to inquire. 01564 @return Non-zero means erasable 01565 */ 01566 int burn_disc_erasable(struct burn_drive *d); 01567 01568 /** Returns the progress and status of a drive. 01569 @param drive The drive to query busy state for. 01570 @param p Returns the progress of the operation, NULL if you don't care 01571 @return the current status of the drive. See also burn_drive_status. 01572 */ 01573 enum burn_drive_status burn_drive_get_status(struct burn_drive *drive, 01574 struct burn_progress *p); 01575 01576 /** Creates a write_opts struct for burning to the specified drive. 01577 The returned object must later be freed with burn_write_opts_free(). 01578 @param drive The drive to write with 01579 @return The write_opts, NULL on error 01580 */ 01581 struct burn_write_opts *burn_write_opts_new(struct burn_drive *drive); 01582 01583 01584 /* ts A70901 */ 01585 /** Inquires the drive associated with a burn_write_opts object. 01586 @param opts object to inquire 01587 @return pointer to drive 01588 @since 0.4.0 01589 */ 01590 struct burn_drive *burn_write_opts_get_drive(struct burn_write_opts *opts); 01591 01592 01593 /** Frees a write_opts struct created with burn_write_opts_new 01594 @param opts write_opts to free 01595 */ 01596 void burn_write_opts_free(struct burn_write_opts *opts); 01597 01598 /** Creates a read_opts struct for reading from the specified drive 01599 must be freed with burn_read_opts_free 01600 @param drive The drive to read from 01601 @return The read_opts 01602 */ 01603 struct burn_read_opts *burn_read_opts_new(struct burn_drive *drive); 01604 01605 /** Frees a read_opts struct created with burn_read_opts_new 01606 @param opts write_opts to free 01607 */ 01608 void burn_read_opts_free(struct burn_read_opts *opts); 01609 01610 /** Erase a disc in the drive. The drive must be grabbed successfully BEFORE 01611 calling this functions. Always ensure that the drive reports a status of 01612 BURN_DISC_FULL before calling this function. An erase operation is not 01613 cancellable, as control of the operation is passed wholly to the drive and 01614 there is no way to interrupt it safely. 01615 @param drive The drive with which to erase a disc. 01616 Only drive roles 1 (MMC) and 5 (stdio random write-only) 01617 support erasing. 01618 @param fast Nonzero to do a fast erase, where only the disc's headers are 01619 erased; zero to erase the entire disc. 01620 With DVD-RW, fast blanking yields media capable only of DAO. 01621 */ 01622 void burn_disc_erase(struct burn_drive *drive, int fast); 01623 01624 01625 /* ts A70101 - A70417 */ 01626 /** Format media for use with libburn. This currently applies to DVD-RW 01627 in state "Sequential Recording" (profile 0014h) which get formatted to 01628 state "Restricted Overwrite" (profile 0013h). DVD+RW can be "de-iced" 01629 by setting bit2 of flag. DVD-RAM and BD-RE may get formatted initially 01630 or re-formatted to adjust their Defect Managment. 01631 This function usually returns while the drive is still in the process 01632 of formatting. The formatting is done, when burn_drive_get_status() 01633 returns BURN_DRIVE_IDLE. This may be immediately after return or may 01634 need several thousand seconds to occur. 01635 @param drive The drive with the disc to format. 01636 @param size The size in bytes to be used with the format command. It should 01637 be divisible by 32*1024. The effect of this parameter may 01638 depend on the media profile and on parameter flag. 01639 @param flag Bitfield for control purposes: 01640 bit0= after formatting, write the given number of zero-bytes 01641 to the media and eventually perform preliminary closing. 01642 bit1+2: size mode 01643 0 = use parameter size as far as it makes sense 01644 1 = insist in size 0 even if there is a better default known 01645 (on DVD-RAM or BD-R identical to size mode 0, 01646 i.e. they never get formatted with payload size 0) 01647 2 = without bit7: format to maximum available size 01648 with bit7 : take size from indexed format descriptor 01649 3 = without bit7: format to default size 01650 with bit7 : take size from indexed format descriptor 01651 bit3= -reserved- 01652 bit4= enforce re-format of (partly) formatted media 01653 bit5= try to disable eventual defect management 01654 bit6= try to avoid lengthy media certification 01655 bit7, bit8 to bit15 = 01656 bit7 enables MMC expert application mode (else libburn 01657 tries to choose a suitable format type): 01658 If it is set then bit8 to bit15 contain the index of 01659 the format to use. See burn_disc_get_formats(), 01660 burn_disc_get_format_descr(). 01661 Acceptable types are: 0x00, 0x01, 0x10, 0x11, 0x13, 01662 0x15, 0x26, 0x30, 0x31, 0x32. 01663 If bit7 is set, then bit4 is set automatically. 01664 bit16= enable POW on blank BD-R 01665 @since 0.3.0 01666 */ 01667 void burn_disc_format(struct burn_drive *drive, off_t size, int flag); 01668 01669 01670 /* ts A70112 */ 01671 /* @since 0.3.0 */ 01672 /** Possible formatting status values */ 01673 #define BURN_FORMAT_IS_UNFORMATTED 1 01674 #define BURN_FORMAT_IS_FORMATTED 2 01675 #define BURN_FORMAT_IS_UNKNOWN 3 01676 01677 /* ts A70112 */ 01678 /** Inquire the formatting status, the associated sizes and the number of 01679 available formats. The info is media specific and stems from MMC command 01680 23h READ FORMAT CAPACITY. See mmc5r03c.pdf 6.24 for background details. 01681 Media type can be determined via burn_disc_get_profile(). 01682 @param drive The drive with the disc to format. 01683 @param status The current formatting status of the inserted media. 01684 See BURN_FORMAT_IS_* macros. Note: "unknown" is the 01685 legal status for quick formatted, yet unwritten DVD-RW. 01686 @param size The size in bytes associated with status. 01687 unformatted: the maximum achievable size of the media 01688 formatted: the currently formatted capacity 01689 unknown: maximum capacity of drive or of media 01690 @param bl_sas Additional info "Block Length/Spare Area Size". 01691 Expected to be constantly 2048 for non-BD media. 01692 @param num_formats The number of available formats. To be used with 01693 burn_disc_get_format_descr() to obtain such a format 01694 and eventually with burn_disc_format() to select one. 01695 @return 1 reply is valid , <=0 failure 01696 @since 0.3.0 01697 */ 01698 int burn_disc_get_formats(struct burn_drive *drive, int *status, off_t *size, 01699 unsigned *bl_sas, int *num_formats); 01700 01701 /* ts A70112 */ 01702 /** Inquire parameters of an available media format. 01703 @param drive The drive with the disc to format. 01704 @param index The index of the format item. Beginning with 0 up to reply 01705 parameter from burn_disc_get_formats() : num_formats - 1 01706 @param type The format type. See mmc5r03c.pdf, 6.5, 04h FORMAT UNIT. 01707 0x00=full, 0x10=CD-RW/DVD-RW full, 0x11=CD-RW/DVD-RW grow, 01708 0x15=DVD-RW quick, 0x13=DVD-RW quick grow, 01709 0x26=DVD+RW background, 0x30=BD-RE with spare areas, 01710 0x31=BD-RE without spare areas 01711 @param size The maximum size in bytes achievable with this format. 01712 @param tdp Type Dependent Parameter. See mmc5r03c.pdf. 01713 @return 1 reply is valid , <=0 failure 01714 @since 0.3.0 01715 */ 01716 int burn_disc_get_format_descr(struct burn_drive *drive, int index, 01717 int *type, off_t *size, unsigned *tdp); 01718 01719 01720 01721 /* ts A61109 : this was and is defunct */ 01722 /** Read a disc from the drive and write it to an fd pair. The drive must be 01723 grabbed successfully BEFORE calling this function. Always ensure that the 01724 drive reports a status of BURN_DISC_FULL before calling this function. 01725 @param drive The drive from which to read a disc. 01726 @param o The options for the read operation. 01727 */ 01728 void burn_disc_read(struct burn_drive *drive, const struct burn_read_opts *o); 01729 01730 01731 01732 /* ts A70222 */ 01733 /* @since 0.3.4 */ 01734 /** The length of a rejection reasons string for burn_precheck_write() and 01735 burn_write_opts_auto_write_type() . 01736 */ 01737 #define BURN_REASONS_LEN 4096 01738 01739 01740 /* ts A70219 */ 01741 /** Examines a completed setup for burn_disc_write() whether it is permissible 01742 with drive and media. This function is called by burn_disc_write() but 01743 an application might be interested in this check in advance. 01744 @param o The options for the writing operation. 01745 @param disc The descrition of the disc to be created 01746 @param reasons Eventually returns a list of rejection reason statements 01747 @param silent 1= do not issue error messages , 0= report problems 01748 @return 1 ok, -1= no recordable media detected, 0= other failure 01749 @since 0.3.4 01750 */ 01751 int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc, 01752 char reasons[BURN_REASONS_LEN], int silent); 01753 01754 01755 /** Write a disc in the drive. The drive must be grabbed successfully before 01756 calling this function. Always ensure that the drive reports a status of 01757 BURN_DISC_BLANK ot BURN_DISC_APPENDABLE before calling this function. 01758 Note: write_type BURN_WRITE_SAO is currently not capable of writing a mix 01759 of data and audio tracks. You must use BURN_WRITE_TAO for such sessions. 01760 To be set by burn_write_opts_set_write_type(). 01761 Note: This function is not suitable for overwriting data in the middle of 01762 a valid data area because it is allowed to append trailing data. 01763 For exact random access overwriting use burn_random_access_write(). 01764 Note: After writing it is advised to give up the drive and to grab it again 01765 in order to learn about its view on the new media state. 01766 Note: Before mounting the written media it might be necessary to eject 01767 and reload in order to allow the operating system to notice the new 01768 media state. 01769 @param o The options for the writing operation. 01770 @param disc The struct burn_disc * that described the disc to be created 01771 */ 01772 void burn_disc_write(struct burn_write_opts *o, struct burn_disc *disc); 01773 01774 01775 /* ts A90227 */ 01776 /** Control stream recording during the write run and eventually set the start 01777 LBA for stream recording. 01778 Stream recording is set from struct burn_write_opts when the write run 01779 gets started. See burn_write_opts_set_stream_recording(). 01780 The call described here can be used later to override this setting and 01781 to program automatic switching at a given LBA. It also affects subsequent 01782 calls to burn_random_access_write(). 01783 @param drive The drive which performs the write operation. 01784 @param recmode -1= disable stream recording 01785 0= leave setting as is 01786 1= enable stream recording 01787 @param start The LBA where actual stream recording shall start. 01788 (0 means unconditional stream recording) 01789 @param flag Bitfield for control purposes (unused yet, submit 0). 01790 @return 1=success , <=0 failure 01791 @since 0.6.4 01792 */ 01793 int burn_drive_set_stream_recording(struct burn_drive *drive, int recmode, 01794 int start, int flag); 01795 01796 /** Cancel an operation on a drive. 01797 This will only work when the drive's busy state is BURN_DRIVE_READING or 01798 BURN_DRIVE_WRITING. 01799 @param drive The drive on which to cancel the current operation. 01800 */ 01801 void burn_drive_cancel(struct burn_drive *drive); 01802 01803 01804 /* ts A61223 */ 01805 /** Inquire whether the most recent asynchronous media job was successful. 01806 This applies to burn_disc_erase(), burn_disc_format(), burn_disc_write(). 01807 Reasons for non-success may be: rejection of burn parameters, abort due to 01808 fatal errors during write, blank or format, a call to burn_drive_cancel() 01809 by the application thread. 01810 @param d The drive to inquire. 01811 @return 1=burn seems to have went well, 0=burn failed 01812 @since 0.2.6 01813 */ 01814 int burn_drive_wrote_well(struct burn_drive *d); 01815 01816 01817 /** Convert a minute-second-frame (MSF) value to sector count 01818 @param m Minute component 01819 @param s Second component 01820 @param f Frame component 01821 @return The sector count 01822 */ 01823 int burn_msf_to_sectors(int m, int s, int f); 01824 01825 /** Convert a sector count to minute-second-frame (MSF) 01826 @param sectors The sector count 01827 @param m Returns the minute component 01828 @param s Returns the second component 01829 @param f Returns the frame component 01830 */ 01831 void burn_sectors_to_msf(int sectors, int *m, int *s, int *f); 01832 01833 /** Convert a minute-second-frame (MSF) value to an lba 01834 @param m Minute component 01835 @param s Second component 01836 @param f Frame component 01837 @return The lba 01838 */ 01839 int burn_msf_to_lba(int m, int s, int f); 01840 01841 /** Convert an lba to minute-second-frame (MSF) 01842 @param lba The lba 01843 @param m Returns the minute component 01844 @param s Returns the second component 01845 @param f Returns the frame component 01846 */ 01847 void burn_lba_to_msf(int lba, int *m, int *s, int *f); 01848 01849 /** Create a new disc 01850 @return Pointer to a burn_disc object or NULL on failure. 01851 */ 01852 struct burn_disc *burn_disc_create(void); 01853 01854 /** Delete disc and decrease the reference count on all its sessions 01855 @param d The disc to be freed 01856 */ 01857 void burn_disc_free(struct burn_disc *d); 01858 01859 /** Create a new session 01860 @return Pointer to a burn_session object or NULL on failure. 01861 */ 01862 struct burn_session *burn_session_create(void); 01863 01864 /** Free a session (and decrease reference count on all tracks inside) 01865 @param s Session to be freed 01866 */ 01867 void burn_session_free(struct burn_session *s); 01868 01869 /** Add a session to a disc at a specific position, increasing the 01870 sessions's reference count. 01871 @param d Disc to add the session to 01872 @param s Session to add to the disc 01873 @param pos position to add at (BURN_POS_END is "at the end") 01874 @return 0 for failure, 1 for success 01875 */ 01876 int burn_disc_add_session(struct burn_disc *d, struct burn_session *s, 01877 unsigned int pos); 01878 01879 /** Remove a session from a disc 01880 @param d Disc to remove session from 01881 @param s Session pointer to find and remove 01882 */ 01883 int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s); 01884 01885 01886 /* ts B11219 */ 01887 /** Read a CDRWIN cue sheet file and equip the session object by tracks and 01888 CD-TEXT according to the content of the file. 01889 For a description of CDRWIN file format see 01890 http://digitalx.org/cue-sheet/syntax/ 01891 Fully supported commands are: 01892 CATALOG , CDTEXTFILE , FLAGS , INDEX , ISRC , PERFORMER , 01893 POSTGAP , PREGAP , REM , SONGWRITER , TITLE 01894 Further supported commands introduced by cdrecord (usage like PERFORMER): 01895 ARRANGER , COMPOSER , MESSAGE 01896 Partly supported commands are: 01897 FILE which supports only types BINARY , MOTOROLA , WAVE 01898 TRACK which supports only datatypes AUDIO , MODE1/2048 01899 Unsupported types of FILE or TRACK lead to failure of the call. 01900 libburn does not yet support mixing of AUDIO and MODE1/2048. So this call 01901 will fail if such a mix is found. 01902 CD-TEXT information is allowed only if all tracks are of datatype AUDIO. 01903 Empty lines and lines which start by '#' are ignored. 01904 @param session Session where to attach tracks. It must not yet have 01905 tracks or else this call will fail. 01906 @param path Filesystem address of the CDRWIN cue sheet file. 01907 Normally with suffix .cue 01908 @param fifo_size Number of bytes in fifo. This will be rounded up by 01909 the block size of the track mode. <= 0 means no fifo. 01910 @param fifo Returns a reference to the burn_source object that 01911 was installed as fifo between FILE and the track 01912 burn sources. One may use this to inquire the fifo 01913 state. Dispose it by burn_source_free() when no longer 01914 needed. It is permissible to pass this parameter to 01915 libburn as NULL, in order to immediately drop ownership 01916 on the fifo. 01917 @param text_packs Returns pre-formatted CD-TEXT packs resulting from 01918 cue sheet command CDTEXTFILE. To be used with call 01919 burn_write_opts_set_leadin_text(). 01920 It is permissible to pass this parameter to libburn 01921 as NULL, in order to disable CDTEXTFILE. 01922 @param num_packs Returns the number of 18 byte records in text_packs. 01923 @param flag Bitfield for control purposes. 01924 bit0= Do not attach CD-TEXT information to session and 01925 tracks. Do not load text_packs. 01926 bit1= Do not use media catalog string of session or ISRC 01927 strings of tracks for writing to Q sub-channel. 01928 @return > 0 indicates success, <= 0 indicates failure 01929 @since 1.2.0 01930 */ 01931 int burn_session_by_cue_file(struct burn_session *session, 01932 char *path, int fifo_size, struct burn_source **fifo, 01933 unsigned char **text_packs, int *num_packs, int flag); 01934 01935 01936 /** Create a track */ 01937 struct burn_track *burn_track_create(void); 01938 01939 /** Free a track 01940 @param t Track to free 01941 */ 01942 void burn_track_free(struct burn_track *t); 01943 01944 /** Add a track to a session at specified position 01945 @param s Session to add to 01946 @param t Track to insert in session 01947 @param pos position to add at (BURN_POS_END is "at the end") 01948 @return 0 for failure, 1 for success 01949 */ 01950 int burn_session_add_track(struct burn_session *s, struct burn_track *t, 01951 unsigned int pos); 01952 01953 /** Remove a track from a session 01954 @param s Session to remove track from 01955 @param t Track pointer to find and remove 01956 @return 0 for failure, 1 for success 01957 */ 01958 int burn_session_remove_track(struct burn_session *s, struct burn_track *t); 01959 01960 01961 /* ts B20107 */ 01962 /** Set the number which shall be written as CD track number with the first 01963 track of the session. The following tracks will then get written with 01964 consecutive CD track numbers. The resulting number of the last track 01965 must not exceed 99. The lowest possible start number is 1, which is also 01966 the default. This setting applies only to CD SAO writing. 01967 @param session The session to be manipulated 01968 @param tno A number between 1 and 99 01969 @param flag Bitfield for control purposes. Unused yet. Submit 0. 01970 @return > 0 indicates success, <= 0 indicates failure 01971 @since 1.2.0 01972 */ 01973 int burn_session_set_start_tno(struct burn_session *session, int tno, 01974 int flag); 01975 01976 /* ts B20108 */ 01977 /** Inquire the CD track start number, as set by default or by 01978 burn_session_set_start_tno(). 01979 @param session The session to be inquired 01980 @return > 0 is the currently set CD track start number 01981 <= 0 indicates failure 01982 @since 1.2.0 01983 */ 01984 int burn_session_get_start_tno(struct burn_session *session, int flag); 01985 01986 01987 01988 /* ts B11206 */ 01989 /** Set the Character Codes, the Copyright bytes, and the Language Codes 01990 for CD-TEXT blocks 0 to 7. They will be used in the block summaries 01991 of text packs which get generated from text or binary data submitted 01992 by burn_session_set_cdtext() and burn_track_set_cdtext(). 01993 Character Code value can be 01994 0x00 = ISO-8859-1 01995 0x01 = 7 bit ASCII 01996 0x80 = MS-JIS (japanesei Kanji, double byte characters) 01997 Copyright byte value can be 01998 0x00 = not copyrighted 01999 0x03 = copyrighted 02000 Language Code value will typically be 0x09 = English or 0x69 = Japanese. 02001 See below macros BURN_CDTEXT_LANGUAGES_0X00 and BURN_CDTEXT_LANGUAGES_0X45, 02002 but be aware that many of these codes have never been seen on CD, and that 02003 many of them do not have a character representation among the above 02004 Character Codes. 02005 Default is 0x09 = English for block 0 and 0x00 = Unknown for block 1 to 7. 02006 Copyright and Character Code are 0x00 for all blocks by default. 02007 See also file doc/cdtext.txt, "Format of a CD-TEXT packs array", 02008 "Pack type 0x8f". 02009 02010 Parameter value -1 leaves the current setting of the session parameter 02011 unchanged. 02012 @param s Session where to change settings 02013 @param char_codes Character Codes for block 0 to 7 02014 @param copyrights Copyright bytes for block 0 to 7 02015 @param languages Language Codes for block 0 to 7 02016 @param flag Bitfiled for control purposes. Unused yet. Submit 0. 02017 @return <=0 failure, > 0 success 02018 @since 1.2.0 02019 */ 02020 int burn_session_set_cdtext_par(struct burn_session *s, 02021 int char_codes[8], int copyrights[8], 02022 int languages[8], int flag); 02023 02024 /** This is the first list of languages sorted by their Language codes, 02025 which start at 0x00. They stem from from EBU Tech 3264, appendix 3. 02026 E.g. language 0x00 is "Unknown", 0x08 is "German", 0x10 is "Frisian", 02027 0x18 is "Latvian", 0x20 is "Polish", 0x28 is "Swedish", 0x2b is "Wallon". 02028 See also file doc/cdtext.txt. 02029 @since 1.2.0 02030 */ 02031 #define BURN_CDTEXT_LANGUAGES_0X00 \ 02032 "Unknown", "Albanian", "Breton", "Catalan", \ 02033 "Croatian", "Welsh", "Czech", "Danish", \ 02034 "German", "English", "Spanish", "Esperanto", \ 02035 "Estonian", "Basque", "Faroese", "French", \ 02036 "Frisian", "Irish", "Gaelic", "Galician", \ 02037 "Icelandic", "Italian", "Lappish", "Latin", \ 02038 "Latvian", "Luxembourgian", "Lithuanian", "Hungarian", \ 02039 "Maltese", "Dutch", "Norwegian", "Occitan", \ 02040 "Polish", "Portuguese", "Romanian", "Romansh", \ 02041 "Serbian", "Slovak", "Slovenian", "Finnish", \ 02042 "Swedish", "Turkish", "Flemish", "Wallon" 02043 02044 /** This is the second list of languages sorted by their Language codes, 02045 which start at 0x45. They stem from from EBU Tech 3264, appendix 3. 02046 E.g. language 0x45 is "Zulu", 0x50 is "Sranan Tongo", 0x58 is "Pushtu", 02047 0x60 is "Moldavian", 0x68 is "Kannada", 0x70 is "Greek", 0x78 is "Bengali", 02048 0x7f is "Amharic". 02049 See also file doc/cdtext.txt. 02050 @since 1.2.0 02051 */ 02052 #define BURN_CDTEXT_LANGUAGES_0X45 \ 02053 "Zulu", "Vietnamese", "Uzbek", \ 02054 "Urdu", "Ukrainian", "Thai", "Telugu", \ 02055 "Tatar", "Tamil", "Tadzhik", "Swahili", \ 02056 "Sranan Tongo", "Somali", "Sinhalese", "Shona", \ 02057 "Serbo-croat", "Ruthenian", "Russian", "Quechua", \ 02058 "Pushtu", "Punjabi", "Persian", "Papamiento", \ 02059 "Oriya", "Nepali", "Ndebele", "Marathi", \ 02060 "Moldavian", "Malaysian", "Malagasay", "Macedonian", \ 02061 "Laotian", "Korean", "Khmer", "Kazakh", \ 02062 "Kannada", "Japanese", "Indonesian", "Hindi", \ 02063 "Hebrew", "Hausa", "Gurani", "Gujurati", \ 02064 "Greek", "Georgian", "Fulani", "Dari", \ 02065 "Churash", "Chinese", "Burmese", "Bulgarian", \ 02066 "Bengali", "Bielorussian", "Bambora", "Azerbaijani", \ 02067 "Assamese", "Armenian", "Arabic", "Amharic" 02068 02069 /* This is the list of empty languages names between 0x30 and 0x44. 02070 Together the three macros fill an array of 128 char pointers. 02071 static char *languages[] = { 02072 BURN_CDTEXT_LANGUAGES_0X00, 02073 BURN_CDTEXT_FILLER, 02074 BURN_CDTEXT_LANGUAGES_0X45 02075 }; 02076 */ 02077 #define BURN_CDTEXT_FILLER \ 02078 "", "", "", "", \ 02079 "", "", "", "", \ 02080 "", "", "", "", \ 02081 "", "", "", "", \ 02082 "", "", "", "", \ 02083 "", "", "", "", \ 02084 "" 02085 02086 /* ts B11206 */ 02087 /** Obtain the current settings as of burn_session_set_cdtext_par() resp. 02088 by default. 02089 @param s Session which to inquire 02090 @param char_codes Will return Character Codes for block 0 to 7 02091 @param copyrights Will return Copyright bytes for block 0 to 7 02092 @param languages Will return Language Codes for block 0 to 7 02093 @param flag Bitfiled for control purposes. Unused yet. Submit 0. 02094 @return <=0 failure, reply invalid, > 0 success, reply valid 02095 @since 1.2.0 02096 */ 02097 int burn_session_get_cdtext_par(struct burn_session *s, 02098 int char_codes[8], int copyrights[8], 02099 int block_languages[8], int flag); 02100 02101 02102 /* ts B11206 */ 02103 /** Attach text or binary data as CD-TEXT attributes to a session. 02104 They can be used to generate CD-TEXT packs by burn_cdtext_from_session() 02105 or to write CD-TEXT packs into the lead-in of a CD SAO session. 02106 The latter happens only if no array of CD-TEXT packs is attached to 02107 the write options by burn_write_opts_set_leadin_text(). 02108 For details of the CD-TEXT format and of the payload content, see file 02109 doc/cdtext.txt . 02110 @param s Session where to attach CD-TEXT attribute 02111 @param block Number of the language block in which the attribute 02112 shall appear. Possible values: 0 to 7. 02113 @param pack_type Pack type number. 0x80 to 0x8e. Used if pack_type_name 02114 is NULL or empty text. Else submit 0 and a name. 02115 Pack type 0x8f is generated automatically and may not 02116 be set by applications. 02117 @param pack_type_name The pack type by name. Defined names are: 02118 0x80 = "TITLE" 0x81 = "PERFORMER" 02119 0x82 = "SONGWRITER" 0x83 = "COMPOSER" 02120 0x84 = "ARRANGER" 0x85 = "MESSAGE" 02121 0x86 = "DISCID" 0x87 = "GENRE" 02122 0x88 = "TOC" 0x89 = "TOC2" 02123 0x8d = "CLOSED" 0x8e = "UPC_ISRC" 02124 Names are recognized uppercase and lowercase. 02125 @param payload Text or binary bytes. The data will be copied to 02126 session-internal memory. 02127 Pack types 0x80 to 0x85 contain 0-terminated cleartext 02128 encoded according to the block's Character Code. 02129 If double byte characters are used, then two 0-bytes 02130 terminate the cleartext. 02131 Pack type 0x86 is 0-terminated ASCII cleartext. 02132 Pack type 0x87 consists of two byte big-endian 02133 Genre code (see below BURN_CDTEXT_GENRE_LIST), and 02134 0-terminated ASCII cleartext of genre description. 02135 Pack type 0x88 mirrors the session table-of-content. 02136 Pack type 0x89 is not understood yet. 02137 Pack types 0x8a to 0x8c are reserved. 02138 Pack type 0x8d contains ISO-8859-1 cleartext which is 02139 not to be shown by commercial audio CD players. 02140 Pack type 0x8e is ASCII cleartext with UPC/EAN code. 02141 @pram length Number of bytes in payload. Including terminating 02142 0-bytes. 02143 @param flag Bitfield for control purposes. 02144 bit0= payload contains double byte characters 02145 (with character code 0x80 MS-JIS japanese Kanji) 02146 @return > 0 indicates success , <= 0 is failure 02147 @since 1.2.0 02148 */ 02149 int burn_session_set_cdtext(struct burn_session *s, int block, 02150 int pack_type, char *pack_type_name, 02151 unsigned char *payload, int length, int flag); 02152 02153 02154 /** This is the list of Genres sorted by their Genre codes. 02155 E.g. genre code 0x0000 is "No Used", 0x0008 is "Dance, 0x0010 is "Musical", 02156 0x0018 is "Rhythm & Blues", 0x001b is "World Music". 02157 See also file doc/cdtext.txt. 02158 @since 1.2.0 02159 */ 02160 #define BURN_CDTEXT_GENRE_LIST \ 02161 "Not Used", "Not Defined", "Adult Contemporary", "Alternative Rock", \ 02162 "Childrens Music", "Classical", "Contemporary Christian", "Country", \ 02163 "Dance", "Easy Listening", "Erotic", "Folk", \ 02164 "Gospel", "Hip Hop", "Jazz", "Latin", \ 02165 "Musical", "New Age", "Opera", "Operetta", \ 02166 "Pop Music", "Rap", "Reggae", "Rock Music", \ 02167 "Rhythm & Blues", "Sound Effects", "Spoken Word", "World Music" 02168 02169 /* The number of genre names in BURN_CDTEXT_GENRE_LIST. 02170 */ 02171 #define BURN_CDTEXT_NUM_GENRES 28 02172 02173 02174 /* ts B11206 */ 02175 /** Obtain a CD-TEXT attribute that was set by burn_session_set_cdtext() 02176 @param s Session to inquire 02177 @param block Number of the language block to inquire. 02178 @param pack_type Pack type number to inquire. Used if pack_type_name 02179 is NULL or empty text. Else submit 0 and a name. 02180 Pack type 0x8f is generated automatically and may not 02181 be inquire in advance. Use burn_cdtext_from_session() 02182 to generate all packs including type 0x8f packs. 02183 @param pack_type_name The pack type by name. 02184 See above burn_session_set_cdtext(). 02185 @param payload Will return a pointer to text or binary bytes. 02186 Not a copy of data. Do not free() this address. 02187 If no text attribute is attached for pack type and 02188 block, then payload is returned as NULL. The return 02189 value will not indicate error in this case. 02190 @pram length Will return the number of bytes pointed to by payload. 02191 Including terminating 0-bytes. 02192 @param flag Bitfield for control purposes. Unused yet. Submit 0. 02193 @return 1 single byte char, 2 double byte char, <=0 error 02194 @since 1.2.0 02195 */ 02196 int burn_session_get_cdtext(struct burn_session *s, int block, 02197 int pack_type, char *pack_type_name, 02198 unsigned char **payload, int *length, int flag); 02199 02200 02201 /* ts B11215 */ 02202 /** Read a Sony CD-TEXT Input Sheet Version 0.7T file and attach its text 02203 attributes to the given session and its tracks for the given CD-TEXT 02204 block number. This overrides previous settings made by 02205 burn_session_set_cdtext(), burn_track_set_cdtext(), burn_track_set_isrc(), 02206 burn_session_set_start_tno(). It can later be overridden by said function 02207 calls. 02208 The media catalog number from purpose specifier "UPC / EAN" gets into 02209 effect only if burn_write_opts_set_has_mediacatalog() is set to 0. 02210 The format of a v07t sheet file is documented in doc/cdtext.txt. 02211 @param s Session where to attach CD-TEXT attributes 02212 @param path Local filesystem address of the sheet file which 02213 shall be read and interpreted. 02214 @param block Number of the language block in which the attributes 02215 shall appear. Possible values: 0 to 7. 02216 @param flag Bitfield for control purposes. 02217 bit1= Do not use media catalog string of session or ISRC 02218 strings of tracks for writing to Q sub-channel. 02219 @return > 0 indicates success , <= 0 is failure 02220 @since 1.2.0 02221 */ 02222 int burn_session_input_sheet_v07t(struct burn_session *session, 02223 char *path, int block, int flag); 02224 02225 02226 /* ts B11210 */ 02227 /** Produce an array of CD-TEXT packs that could be submitted to 02228 burn_write_opts_set_leadin_text() or stored as *.cdt file. 02229 For a description of the format of the array, see file doc/cdtext.txt. 02230 The input data stem from burn_session_set_cdtext_par(), 02231 burn_session_set_cdtext(), and burn_track_set_cdtext(). 02232 @param s Session from which to produce CD-TEXT packs. 02233 @param text_packs Will return the buffer with the CD-TEXT packs. 02234 Dispose by free() when no longer needed. 02235 @param num_packs Will return the number of 18 byte text packs. 02236 @param flag Bitfield for control purposes. 02237 bit0= do not return generated CD-TEXT packs, 02238 but check whether production would work and 02239 indicate the number of packs by the call return 02240 value. This happens also if 02241 (text_packs == NULL || num_packs == NULL). 02242 @return Without flag bit0: > 0 is success, <= 0 failure 02243 With flag bit0: > 0 is number of packs, 02244 0 means no packs will be generated, 02245 < 0 means failure 02246 @since 1.2.0 02247 */ 02248 int burn_cdtext_from_session(struct burn_session *s, 02249 unsigned char **text_packs, int *num_packs, 02250 int flag); 02251 02252 02253 /* ts B11206 */ 02254 /** Remove all CD-TEXT attributes of the given block from the session. 02255 They were attached by burn_session_set_cdtext(). 02256 @param s Session where to remove the CD-TEXT attribute 02257 @param block Number of the language block in which the attribute 02258 shall appear. Possible values: 0 to 7. 02259 -1 causes text packs of all blocks to be removed. 02260 @return > 0 is success, <= 0 failure 02261 @since 1.2.0 02262 */ 02263 int burn_session_dispose_cdtext(struct burn_session *s, int block); 02264 02265 02266 /* ts B11221*/ 02267 /** Read an array of CD-TEXT packs from a file. This array should be suitable 02268 for burn_write_opts_set_leadin_text(). 02269 The function tolerates and removes 4-byte headers as produced by 02270 cdrecord -vv -toc, if this header tells the correct number of bytes which 02271 matches the file size. If no 4-byte header is present, then the function 02272 tolerates and removes a trailing 0-byte as of Sony specs. 02273 @param path Filesystem address of the CD-TEXT pack file. 02274 Normally with suffix .cdt or .dat 02275 @param text_packs Will return the buffer with the CD-TEXT packs. 02276 Dispose by free() when no longer needed. 02277 @param num_packs Will return the number of 18 byte text packs. 02278 @param flag Bitfield for control purposes. Unused yet.Submit 0. 02279 @return 0 is success, <= 0 failure 02280 @since 1.2.0 02281 */ 02282 int burn_cdtext_from_packfile(char *path, unsigned char **text_packs, 02283 int *num_packs, int flag); 02284 02285 02286 /** Define the data in a track 02287 @param t the track to define 02288 @param offset The lib will write this many 0s before start of data 02289 @param tail The number of extra 0s to write after data 02290 @param pad 1 means the lib should pad the last sector with 0s if the 02291 track isn't exactly sector sized. (otherwise the lib will 02292 begin reading from the next track) 02293 @param mode data format (bitfield) 02294 */ 02295 void burn_track_define_data(struct burn_track *t, int offset, int tail, 02296 int pad, int mode); 02297 02298 02299 /* ts B11206 */ 02300 /** Attach text or binary data as CD-TEXT attributes to a track. 02301 The payload will be used to generate CD-TEXT packs by 02302 burn_cdtext_from_session() or to write CD-TEXT packs into the lead-in 02303 of a CD SAO session. This happens if the CD-TEXT attribute of the session 02304 gets generated, which has the same block number and pack type. In this 02305 case, each track should have such a CD-TEXT attribute, too. 02306 See burn_session_set_cdtext(). 02307 Be cautious not to exceed the maximum number of 253 payload packs per 02308 language block. Use burn_cdtext_from_session() to learn whether a valid 02309 array of CD-TEXT packs can be generated from your attributes. 02310 @param t Track where to attach CD-TEXT attribute. 02311 @param block Number of the language block in which the attribute 02312 shall appear. Possible values: 0 to 7. 02313 @param pack_type Pack type number. 0x80 to 0x85 or 0x8e. Used if 02314 pack_type_name is NULL or empty text. Else submit 0 02315 and a name. 02316 @param pack_type_name The pack type by name. Applicable names are: 02317 0x80 = "TITLE" 0x81 = "PERFORMER" 02318 0x82 = "SONGWRITER" 0x83 = "COMPOSER" 02319 0x84 = "ARRANGER" 0x85 = "MESSAGE" 02320 0x8e = "UPC_ISRC" 02321 @param payload 0-terminated cleartext. If double byte characters 02322 are used, then two 0-bytes terminate the cleartext. 02323 @pram length Number of bytes in payload. Including terminating 02324 0-bytes. 02325 @param flag Bitfield for control purposes. 02326 bit0= payload contains double byte characters 02327 (with character code 0x80 MS-JIS japanese Kanji) 02328 @return > 0 indicates success , <= 0 is failure 02329 @since 1.2.0 02330 */ 02331 int burn_track_set_cdtext(struct burn_track *t, int block, 02332 int pack_type, char *pack_type_name, 02333 unsigned char *payload, int length, int flag); 02334 02335 /* ts B11206 */ 02336 /** Obtain a CD-TEXT attribute that was set by burn_track_set_cdtext(). 02337 @param t Track to inquire 02338 @param block Number of the language block to inquire. 02339 @param pack_type Pack type number to inquire. Used if pack_type_name 02340 is NULL or empty text. Else submit 0 and a name. 02341 @param pack_type_name The pack type by name. 02342 See above burn_track_set_cdtext(). 02343 @param payload Will return a pointer to text bytes. 02344 Not a copy of data. Do not free() this address. 02345 If no text attribute is attached for pack type and 02346 block, then payload is returned as NULL. The return 02347 value will not indicate error in this case. 02348 @pram length Will return the number of bytes pointed to by payload. 02349 Including terminating 0-bytes. 02350 @param flag Bitfield for control purposes. Unused yet. Submit 0. 02351 @return 1=single byte char , 2= double byte char , <=0 error 02352 @since 1.2.0 02353 */ 02354 int burn_track_get_cdtext(struct burn_track *t, int block, 02355 int pack_type, char *pack_type_name, 02356 unsigned char **payload, int *length, int flag); 02357 02358 /* ts B11206 */ 02359 /** Remove all CD-TEXT attributes of the given block from the track. 02360 They were attached by burn_track_set_cdtext(). 02361 @param t Track where to remove the CD-TEXT attribute. 02362 @param block Number of the language block in which the attribute 02363 shall appear. Possible values: 0 to 7. 02364 -1 causes text packs of all blocks to be removed. 02365 @return > 0 is success, <= 0 failure 02366 @since 1.2.0 02367 */ 02368 int burn_track_dispose_cdtext(struct burn_track *t, int block); 02369 02370 02371 /* ts A90910 */ 02372 /** Activates CD XA compatibility modes. 02373 libburn currently writes data only in CD mode 1. Some programs insist in 02374 sending data with additional management bytes. These bytes have to be 02375 stripped in order to make the input suitable for BURN_MODE1. 02376 @param t The track to manipulate 02377 @param value 0= no conversion 02378 1= strip 8 byte sector headers of CD-ROM XA mode 2 form 1 02379 see MMC-5 4.2.3.8.5.3 Block Format for Mode 2 form 1 Data 02380 all other values are reserved 02381 @return 1=success , 0=unacceptable value 02382 @since 0.7.2 02383 */ 02384 int burn_track_set_cdxa_conv(struct burn_track *t, int value); 02385 02386 02387 /** Set the ISRC details for a track. When writing to CD media, ISRC will get 02388 written into the Q sub-channel. 02389 @param t The track to change 02390 @param country the 2 char country code. Each character must be 02391 only numbers or letters. 02392 @param owner 3 char owner code. Each character must be only numbers 02393 or letters. 02394 @param year 2 digit year. A number in 0-99 (Yep, not Y2K friendly). 02395 @param serial 5 digit serial number. A number in 0-99999. 02396 */ 02397 void burn_track_set_isrc(struct burn_track *t, char *country, char *owner, 02398 unsigned char year, unsigned int serial); 02399 02400 /* ts B11226 */ 02401 /** Set the composed ISRC string for a track. This is an alternative to 02402 burn_track_set_isrc(). 02403 @param t The track to be manipulated 02404 @param isrc 12 characters which are composed from ISRC details. 02405 Format is CCOOOYYSSSSS, terminated by a 0-byte: 02406 Country, Owner, Year(decimal digits), Serial(decimal digits). 02407 @param flag Bitfield for control purposes. Unused yet. Submit 0. 02408 @return > 0 indicates success, <= 0 means failure 02409 @since 1.2.0 02410 */ 02411 int burn_track_set_isrc_string(struct burn_track *t, char isrc[13], int flag); 02412 02413 /** Disable ISRC parameters for a track 02414 @param t The track to change 02415 */ 02416 void burn_track_clear_isrc(struct burn_track *t); 02417 02418 02419 /* ts B20103 */ 02420 /** Define an index start address within a track. The index numbers inside a 02421 track have to form sequence starting at 0 or 1 with no gaps up to the 02422 highest number used. They affect only writing of CD SAO sessions. 02423 The first index start address of a track must be 0. 02424 Blocks between index 0 and index 1 are considered to be located before the 02425 track start as of the table-of-content. 02426 @param t The track to be manipulated 02427 @param index_number A number between 0 and 99 02428 @param relative_lba The start address relative to the start of the 02429 burn_source of the track. It will get mapped to the 02430 appropriate absolute block address. 02431 @param flag Bitfield for control purposes. Unused yet. Submit 0. 02432 @return > 0 indicates success, <= 0 means failure 02433 @since 1.2.0 02434 */ 02435 int burn_track_set_index(struct burn_track *t, int index_number, 02436 unsigned int relative_lba, int flag); 02437 02438 /* ts B20103 */ 02439 /** Remove all index start addresses and reset to the default indexing of 02440 CD SAO sessions. This means index 0 of track 1 reaches from LBA -150 02441 to LBA -1. Index 1 of track 1 reaches from LBA 0 to track end. Index 1 02442 of track 2 follows immediately. The same happens for all further tracks 02443 after the end of their predecessor. 02444 @param t The track to be manipulated 02445 @param flag Bitfield for control purposes. Unused yet. Submit 0. 02446 @return > 0 indicates success, <= 0 means failure 02447 @since 1.2.0 02448 */ 02449 int burn_track_clear_indice(struct burn_track *t, int flag); 02450 02451 02452 /* ts B20110 */ 02453 /** Define whether a pre-gap shall be written before the track and how many 02454 sectors this pre-gap shall have. A pre-gap is written in the range of track 02455 index 0 and contains zeros resp. silence. No bytes from the track source 02456 will be read for writing the pre-gap. 02457 This setting affects only CD SAO write runs. 02458 The first track automatically gets a pre-gap of at least 150 sectors. Its 02459 size may be enlarged by this call. Further pre-gaps are demanded by MMC 02460 for tracks which follow tracks of a different mode. (But Mode mixing in 02461 CD SAO sessions is currently not supported by libburn.) 02462 @param t The track to change 02463 @param size Number of sectors in the pre-gap. 02464 -1 disables pre-gap, except for the first track. 02465 libburn allows 0, but MMC does not propose this. 02466 @param flag Bitfield for control purposes. Unused yet. Submit 0. 02467 @return > 0 indicates success, <= 0 means failure 02468 @since 1.2.0 02469 */ 02470 int burn_track_set_pregap_size(struct burn_track *t, int size, int flag); 02471 02472 /* ts B20111 */ 02473 /** Define whether a post-gap shall be written at the end of the track and 02474 how many sectors this gap shall have. A post-gap occupies the range of 02475 an additional index of the track. It contains zeros. No bytes from the 02476 track source will be read for writing the post-gap. 02477 This setting affects only CD SAO write runs. 02478 MMC prescribes to add a post-gap to a data track which is followed by 02479 a non-data track. (But libburn does not yet support mixed mode CD SAO 02480 sessions.) 02481 @param t The track to change 02482 @param size Number of sectors in the post-gap. 02483 -1 disables post-gap. 02484 libburn allows 0, but MMC does not propose this. 02485 @param flag Bitfield for control purposes. Unused yet. Submit 0. 02486 @return > 0 indicates success, <= 0 means failure 02487 @since 1.2.0 02488 */ 02489 int burn_track_set_postgap_size(struct burn_track *t, int size, int flag); 02490 02491 02492 /* ts A61024 */ 02493 /** Define whether a track shall swap bytes of its input stream. 02494 @param t The track to change 02495 @param swap_source_bytes 0=do not swap, 1=swap byte pairs 02496 @return 1=success , 0=unacceptable value 02497 @since 0.2.6 02498 */ 02499 int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes); 02500 02501 02502 /** Hide the first track in the "pre gap" of the disc 02503 @param s session to change 02504 @param onoff 1 to enable hiding, 0 to disable 02505 */ 02506 void burn_session_hide_first_track(struct burn_session *s, int onoff); 02507 02508 /** Get the drive's disc struct - free when done 02509 @param d drive to query 02510 @return the disc struct or NULL on failure 02511 */ 02512 struct burn_disc *burn_drive_get_disc(struct burn_drive *d); 02513 02514 /** Set the track's data source 02515 @param t The track to set the data source for 02516 @param s The data source to use for the contents of the track 02517 @return An error code stating if the source is ready for use for 02518 writing the track, or if an error occured 02519 02520 */ 02521 enum burn_source_status burn_track_set_source(struct burn_track *t, 02522 struct burn_source *s); 02523 02524 02525 /* ts A70218 */ 02526 /** Set a default track size to be used only if the track turns out to be of 02527 unpredictable length and if the effective write type demands a fixed size. 02528 This can be useful to enable write types CD SAO or DVD DAO together with 02529 a track source like stdin. If the track source delivers fewer bytes than 02530 announced then the track will be padded up with zeros. 02531 @param t The track to change 02532 @param size The size to set 02533 @return 0=failure 1=sucess 02534 @since 0.3.4 02535 */ 02536 int burn_track_set_default_size(struct burn_track *t, off_t size); 02537 02538 /** Free a burn_source (decrease its refcount and maybe free it) 02539 @param s Source to free 02540 */ 02541 void burn_source_free(struct burn_source *s); 02542 02543 /** Creates a data source for an image file (and maybe subcode file) 02544 @param path The file address for the main channel payload. 02545 @param subpath Eventual address for subchannel data. Only used in exotic 02546 raw write modes. Submit NULL for normal tasks. 02547 @return Pointer to a burn_source object, NULL indicates failure 02548 */ 02549 struct burn_source *burn_file_source_new(const char *path, 02550 const char *subpath); 02551 02552 02553 /* ts A91122 : An interface to open(O_DIRECT) or similar OS tricks. */ 02554 02555 /** Opens a file with eventual acceleration preparations which may depend 02556 on the operating system and on compile time options of libburn. 02557 You may use this call instead of open(2) for opening file descriptors 02558 which shall be handed to burn_fd_source_new(). 02559 This should only be done for tracks with BURN_BLOCK_MODE1 (2048 bytes 02560 per block). 02561 02562 If you use this call then you MUST allocate the buffers which you use 02563 with read(2) by call burn_os_alloc_buffer(). Read sizes MUST be a multiple 02564 of a safe buffer amount. Else you risk that track data get altered during 02565 transmission. 02566 burn_disk_write() will allocate a suitable read/write buffer for its own 02567 operations. A fifo created by burn_fifo_source_new() will allocate 02568 suitable memory for its buffer if called with flag bit0 and a multiple 02569 of a safe buffer amount. 02570 @param path The file address to open 02571 @param open_flags The flags as of man 2 open. Normally just O_RDONLY. 02572 @param flag Bitfield for control purposes (unused yet, submit 0). 02573 @return A file descriptor as of open(2). Finally to be disposed 02574 by close(2). 02575 -1 indicates failure. 02576 @since 0.7.4 02577 */ 02578 int burn_os_open_track_src(char *path, int open_flags, int flag); 02579 02580 /** Allocate a memory area that is suitable for reading with a file descriptor 02581 opened by burn_os_open_track_src(). 02582 @param amount Number of bytes to allocate. This should be a multiple 02583 of the operating system's i/o block size. 32 KB is 02584 guaranteed by libburn to be safe. 02585 @param flag Bitfield for control purposes (unused yet, submit 0). 02586 @return The address of the allocated memory, or NULL on failure. 02587 A non-NULL return value has finally to be disposed via 02588 burn_os_free_buffer(). 02589 @since 0.7.4 02590 */ 02591 void *burn_os_alloc_buffer(size_t amount, int flag); 02592 02593 /** Dispose a memory area which was obtained by burn_os_alloc_buffer(), 02594 @param buffer Memory address to be freed. 02595 @param amount The number of bytes which was allocated at that 02596 address. 02597 @param flag Bitfield for control purposes (unused yet, submit 0). 02598 @return 1 success , <=0 failure 02599 @since 0.7.4 02600 */ 02601 int burn_os_free_buffer(void *buffer, size_t amount, int flag); 02602 02603 02604 /** Creates a data source for an image file (a track) from an open 02605 readable filedescriptor, an eventually open readable subcodes file 02606 descriptor and eventually a fixed size in bytes. 02607 @param datafd The source of data. 02608 @param subfd The eventual source of subchannel data. Only used in exotic 02609 raw write modes. Submit -1 for normal tasks. 02610 @param size The eventual fixed size of eventually both fds. 02611 If this value is 0, the size will be determined from datafd. 02612 @return Pointer to a burn_source object, NULL indicates failure 02613 */ 02614 struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size); 02615 02616 02617 /* ts B00922 */ 02618 /** Creates an offset source which shall provide a byte interval of a stream 02619 to its consumer. It is supposed to be chain-linked with other offset 02620 sources which serve neighboring consumers. The chronological sequence 02621 of consumers and the sequence of offset sources must match. The intervals 02622 of the sources must not overlap. 02623 02624 A chain of these burn_source objects may be used to feed multiple tracks 02625 from one single stream of input bytes. 02626 Each of the offset sources will skip the bytes up to its start address and 02627 provide the prescribed number of bytes to the track. Skipping takes into 02628 respect the bytes which have been processed by eventual predecessors in the 02629 chain. 02630 Important: It is not allowed to free an offset source before its successor 02631 has ended its work. Best is to keep them all until all tracks 02632 are done. 02633 02634 @param inp The burn_source object from which to read stream data. 02635 E.g. created by burn_file_source_new(). 02636 @param prev The eventual offset source object which shall read data from 02637 inp before the new offset source will begin its own work. 02638 This must either be a result of burn_offst_source_new() or 02639 it must be NULL. 02640 @param start The byte address where to start reading bytes for the 02641 consumer. inp bytes may get skipped to reach this address. 02642 @param size The number of bytes to be delivered to the consumer. 02643 If size is <= 0 then it may be set later by a call of method 02644 set_size(). If it is >= 0, then it can only be changed if 02645 flag bit0 was set with burn_offst_source_new(). 02646 @param flag Bitfield for control purposes 02647 bit0 = Prevent set_size() from overriding interval sizes > 0. 02648 If such a size is already set, then the new one will 02649 only affect the reply of get_size(). 02650 See also above struct burn_source. 02651 @since 1.2.0 02652 @return Pointer to a burn_source object, later to be freed by 02653 burn_source_free(). NULL indicates failure. 02654 @since 0.8.8 02655 */ 02656 struct burn_source *burn_offst_source_new( 02657 struct burn_source *inp, struct burn_source *prev, 02658 off_t start, off_t size, int flag); 02659 02660 /* ts A70930 */ 02661 /** Creates a fifo which acts as proxy for an already existing data source. 02662 The fifo provides a ring buffer which shall smoothen the data stream 02663 between burn_source and writer thread. Each fifo serves only for one 02664 data source. It may be attached to one track as its only data source 02665 by burn_track_set_source(), or it may be used as input for other burn 02666 sources. 02667 A fifo starts its life in "standby" mode with no buffer space allocated. 02668 As soon as its consumer requires bytes, the fifo establishes a worker 02669 thread and allocates its buffer. After input has ended and all buffer 02670 content is consumed, the buffer space gets freed and the worker thread 02671 ends. This happens asynchronously. So expect two buffers and worker threads 02672 to exist for a short time between tracks. Be modest in your size demands if 02673 multiple tracks are to be expected. 02674 @param inp The burn_source for which the fifo shall act as proxy. 02675 It can be disposed by burn_source_free() immediately 02676 after this call. 02677 @param chunksize The size in bytes of a chunk. 02678 Use 2048 for sources suitable for BURN_BLOCK_MODE1, 02679 2352 for sources which deliver for BURN_BLOCK_AUDIO, 02680 2056 for sources which shall get treated by 02681 burn_track_set_cdxa_conv(track, 1). 02682 Some variations of burn_source might work only with 02683 a particular chunksize. E.g. libisofs demands 2048. 02684 @param chunks The number of chunks to be allocated in ring buffer. 02685 This value must be >= 2. 02686 @param flag Bitfield for control purposes: 02687 bit0= The read method of inp is capable of delivering 02688 arbitrary amounts of data per call. Not only one 02689 sector. 02690 Suitable for inp from burn_file_source_new() 02691 and burn_fd_source_new() if not the fd has 02692 exotic limitations on read size. 02693 You MUST use this on inp which uses an fd opened 02694 with burn_os_open_track_src(). 02695 Better do not use with other inp types. 02696 @since 0.7.4 02697 @return A pointer to the newly created burn_source. 02698 Later both burn_sources, inp and the returned fifo, have 02699 to be disposed by calling burn_source_free() for each. 02700 inp can be freed immediately, the returned fifo may be 02701 kept as handle for burn_fifo_inquire_status(). 02702 @since 0.4.0 02703 */ 02704 struct burn_source *burn_fifo_source_new(struct burn_source *inp, 02705 int chunksize, int chunks, int flag); 02706 02707 /* ts A71003 */ 02708 /** Inquires state and fill parameters of a fifo burn_source which was created 02709 by burn_fifo_source_new() . Do not use with other burn_source variants. 02710 @param fifo The fifo object to inquire 02711 @param size The total size of the fifo 02712 @param free_bytes The current free capacity of the fifo 02713 @param status_text Returns a pointer to a constant text, see below 02714 @return <0 reply invalid, >=0 fifo status code: 02715 bit0+1=input status, bit2=consumption status, i.e: 02716 0="standby" : data processing not started yet 02717 1="active" : input and consumption are active 02718 2="ending" : input has ended without error 02719 3="failing" : input had error and ended, 02720 4="unused" : ( consumption has ended before processing start ) 02721 5="abandoned" : consumption has ended prematurely 02722 6="ended" : consumption has ended without input error 02723 7="aborted" : consumption has ended after input error 02724 @since 0.4.0 02725 */ 02726 int burn_fifo_inquire_status(struct burn_source *fifo, int *size, 02727 int *free_bytes, char **status_text); 02728 02729 /* ts A91125 */ 02730 /** Inquire various counters which reflect the fifo operation. 02731 @param fifo The fifo object to inquire 02732 @param total_min_fill The minimum number of bytes in the fifo. Beginning 02733 from the moment when fifo consumption is enabled. 02734 @param interval_min_fill The minimum byte number beginning from the moment 02735 when fifo consumption is enabled or from the 02736 most recent moment when burn_fifo_next_interval() 02737 was called. 02738 @param put_counter The number of data transactions into the fifo. 02739 @param get_counter The number of data transactions out of the fifo. 02740 @param empty_counter The number of times the fifo was empty. 02741 @param full_counter The number of times the fifo was full. 02742 @since 0.7.4 02743 */ 02744 void burn_fifo_get_statistics(struct burn_source *fifo, 02745 int *total_min_fill, int *interval_min_fill, 02746 int *put_counter, int *get_counter, 02747 int *empty_counter, int *full_counter); 02748 02749 /* ts A91125 */ 02750 /** Inquire the fifo minimum fill counter for intervals and reset that counter. 02751 @param fifo The fifo object to inquire 02752 @param interval_min_fill The minimum number of bytes in the fifo. Beginning 02753 from the moment when fifo consumption is enabled 02754 or from the most recent moment when 02755 burn_fifo_next_interval() was called. 02756 @since 0.7.4 02757 */ 02758 void burn_fifo_next_interval(struct burn_source *fifo, int *interval_min_fill); 02759 02760 /* ts A80713 */ 02761 /** Obtain a preview of the first input data of a fifo which was created 02762 by burn_fifo_source_new(). The data will later be delivered normally to 02763 the consumer track of the fifo. 02764 bufsize may not be larger than the fifo size (chunk_size * chunks) - 32k. 02765 This call will succeed only if data consumption by the track has not 02766 started yet, i.e. best before the call to burn_disc_write(). 02767 It will start the worker thread of the fifo with the expectable side 02768 effects on the external data source. Then it waits either until enough 02769 data have arrived or until it becomes clear that this will not happen. 02770 The call may be repeated with increased bufsize. It will always yield 02771 the bytes beginning from the first one in the fifo. 02772 @param fifo The fifo object to inquire resp. start 02773 @param buf Pointer to memory of at least bufsize bytes where to 02774 deliver the peeked data. 02775 @param bufsize Number of bytes to peek from the start of the fifo data 02776 @param flag Bitfield for control purposes (unused yet, submit 0). 02777 @return <0 on severe error, 0 if not enough data, 1 if bufsize bytes read 02778 @since 0.5.0 02779 */ 02780 int burn_fifo_peek_data(struct burn_source *fifo, char *buf, int bufsize, 02781 int flag); 02782 02783 /* ts A91125 */ 02784 /** Start the fifo worker thread and wait either until the requested number 02785 of bytes have arrived or until it becomes clear that this will not happen. 02786 Filling will go on asynchronously after burn_fifo_fill() returned. 02787 This call and burn_fifo_peek_data() do not disturb each other. 02788 @param fifo The fifo object to start 02789 @param fill Number of bytes desired. Expect to get return 1 if 02790 at least fifo size - 32k were read. 02791 @param flag Bitfield for control purposes. 02792 bit0= fill fifo to maximum size 02793 @return <0 on severe error, 0 if not enough data, 02794 1 if desired amount or fifo full 02795 @since 0.7.4 02796 */ 02797 int burn_fifo_fill(struct burn_source *fifo, int fill, int flag); 02798 02799 02800 /* ts A70328 */ 02801 /** Sets a fixed track size after the data source object has already been 02802 created. 02803 @param t The track to operate on 02804 @param size the number of bytes to use as track size 02805 @return <=0 indicates failure , >0 success 02806 @since 0.3.6 02807 */ 02808 int burn_track_set_size(struct burn_track *t, off_t size); 02809 02810 02811 /** Tells how many sectors a track will have on disc, resp. already has on 02812 disc. This includes offset, payload, tail, and post-gap, but not pre-gap. 02813 The result is NOT RELIABLE with tracks of undefined length 02814 */ 02815 int burn_track_get_sectors(struct burn_track *); 02816 02817 02818 /* ts A61101 */ 02819 /** Tells how many source bytes have been read and how many data bytes have 02820 been written by the track during burn. 02821 @param t The track to inquire 02822 @param read_bytes Number of bytes read from the track source 02823 @param written_bytes Number of bytes written to track 02824 @since 0.2.6 02825 */ 02826 int burn_track_get_counters(struct burn_track *t, 02827 off_t *read_bytes, off_t *written_bytes); 02828 02829 02830 /** Sets drive read and write speed 02831 Note: "k" is 1000, not 1024. 1xCD = 176.4 k/s, 1xDVD = 1385 k/s. 02832 Fractional speeds should be rounded up. Like 4xCD = 706. 02833 @param d The drive to set speed for 02834 @param read Read speed in k/s (0 is max, -1 is min). 02835 @param write Write speed in k/s (0 is max, -1 is min). 02836 */ 02837 void burn_drive_set_speed(struct burn_drive *d, int read, int write); 02838 02839 02840 /* ts A70711 */ 02841 /** Controls the behavior with writing when the drive buffer is suspected to 02842 be full. To check and wait for enough free buffer space before writing 02843 will move the task of waiting from the operating system's device driver 02844 to libburn. While writing is going on and waiting is enabled, any write 02845 operation will be checked whether it will fill the drive buffer up to 02846 more than max_percent. If so, then waiting will happen until the buffer 02847 fill is predicted with at most min_percent. 02848 Thus: if min_percent < max_percent then transfer rate will oscillate. 02849 This may allow the driver to operate on other devices, e.g. a disk from 02850 which to read the input for writing. On the other hand, this checking might 02851 reduce maximum throughput to the drive or even get misled by faulty buffer 02852 fill replies from the drive. 02853 If a setting parameter is < 0, then this setting will stay unchanged 02854 by the call. 02855 Known burner or media specific pitfalls: 02856 To have max_percent larger than the burner's best reported buffer fill has 02857 the same effect as min_percent==max_percent. Some burners do not report 02858 their full buffer with all media types. Some are not suitable because 02859 they report their buffer fill with delay. 02860 @param d The drive to control 02861 @param enable 0= disable , 1= enable waiting , (-1 = do not change setting) 02862 @param min_usec Shortest possible sleeping period (given in micro seconds) 02863 @param max_usec Longest possible sleeping period (given in micro seconds) 02864 @param timeout_sec If a single write has to wait longer than this number 02865 of seconds, then waiting gets disabled and mindless 02866 writing starts. A value of 0 disables this timeout. 02867 @param min_percent Minimum of desired buffer oscillation: 25 to 100 02868 @param max_percent Maximum of desired buffer oscillation: 25 to 100 02869 @return 1=success , 0=failure 02870 @since 0.3.8 02871 */ 02872 int burn_drive_set_buffer_waiting(struct burn_drive *d, int enable, 02873 int min_usec, int max_usec, int timeout_sec, 02874 int min_percent, int max_percent); 02875 02876 02877 /* these are for my [Derek Foreman's ?] debugging, they will disappear */ 02878 /* ts B11012 : 02879 Of course, API symbols will not disappear. But these functions are of 02880 few use, as they only print DEBUG messages. 02881 */ 02882 void burn_structure_print_disc(struct burn_disc *d); 02883 void burn_structure_print_session(struct burn_session *s); 02884 void burn_structure_print_track(struct burn_track *t); 02885 02886 /** Sets the write type for the write_opts struct. 02887 Note: write_type BURN_WRITE_SAO is currently not capable of writing a mix 02888 of data and audio tracks. You must use BURN_WRITE_TAO for such sessions. 02889 @param opts The write opts to change 02890 @param write_type The write type to use 02891 @param block_type The block type to use 02892 @return Returns 1 on success and 0 on failure. 02893 */ 02894 int burn_write_opts_set_write_type(struct burn_write_opts *opts, 02895 enum burn_write_types write_type, 02896 int block_type); 02897 02898 02899 /* ts A70207 */ 02900 /** As an alternative to burn_write_opts_set_write_type() this function tries 02901 to find a suitable write type and block type for a given write job 02902 described by opts and disc. To be used after all other setups have been 02903 made, i.e. immediately before burn_disc_write(). 02904 @param opts The nearly complete write opts to change 02905 @param disc The already composed session and track model 02906 @param reasons This text string collects reasons for decision resp. failure 02907 @param flag Bitfield for control purposes: 02908 bit0= do not choose type but check the one that is already set 02909 bit1= do not issue error messages via burn_msgs queue 02910 (is automatically set with bit0) 02911 @return Chosen write type. BURN_WRITE_NONE on failure. 02912 @since 0.3.2 02913 */ 02914 enum burn_write_types burn_write_opts_auto_write_type( 02915 struct burn_write_opts *opts, struct burn_disc *disc, 02916 char reasons[BURN_REASONS_LEN], int flag); 02917 02918 02919 /** Supplies toc entries for writing - not normally required for cd mastering 02920 @param opts The write opts to change 02921 @param count The number of entries 02922 @param toc_entries 02923 */ 02924 void burn_write_opts_set_toc_entries(struct burn_write_opts *opts, 02925 int count, 02926 struct burn_toc_entry *toc_entries); 02927 02928 /** Sets the session format for a disc 02929 @param opts The write opts to change 02930 @param format The session format to set 02931 */ 02932 void burn_write_opts_set_format(struct burn_write_opts *opts, int format); 02933 02934 /** Sets the simulate value for the write_opts struct . 02935 This corresponds to the Test Write bit in MMC mode page 05h. Several media 02936 types do not support this. See struct burn_multi_caps.might_simulate for 02937 actual availability of this feature. 02938 If the media is suitable, the drive will perform burn_disc_write() as a 02939 simulation instead of effective write operations. This means that the 02940 media content and burn_disc_get_status() stay unchanged. 02941 Note: With stdio-drives, the target file gets eventually created, opened, 02942 lseeked, and closed, but not written. So there are effects on it. 02943 Warning: Call burn_random_access_write() will never do simulation because 02944 it does not get any burn_write_opts. 02945 @param opts The write opts to change 02946 @param sim Non-zero enables simulation, 0 enables real writing 02947 @return Returns 1 on success and 0 on failure. 02948 */ 02949 int burn_write_opts_set_simulate(struct burn_write_opts *opts, int sim); 02950 02951 /** Controls buffer underrun prevention. This is only needed with CD media 02952 and possibly with old DVD-R drives. All other media types are not 02953 vulnerable to burn failure due to buffer underrun. 02954 @param opts The write opts to change 02955 @param underrun_proof if non-zero, buffer underrun protection is enabled 02956 @return Returns 1 if the drive announces to be capable of underrun 02957 prevention, 02958 Returns 0 if not. 02959 */ 02960 int burn_write_opts_set_underrun_proof(struct burn_write_opts *opts, 02961 int underrun_proof); 02962 02963 /** Sets whether to use opc or not with the write_opts struct 02964 @param opts The write opts to change 02965 @param opc If non-zero, optical power calibration will be performed at 02966 start of burn 02967 02968 */ 02969 void burn_write_opts_set_perform_opc(struct burn_write_opts *opts, int opc); 02970 02971 02972 /** The Q sub-channel of a CD may contain a Media Catalog Number of 13 decimal 02973 digits. This call sets the string of digits, but does not yet activate it 02974 for writing. 02975 @param opts The write opts to change 02976 @param mediacatalog The 13 decimal digits as ASCII bytes. I.e. '0' = 0x30. 02977 */ 02978 void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts, 02979 unsigned char mediacatalog[13]); 02980 02981 /** This call activates the Media Catalog Number for writing. The digits of 02982 that number have to be set by call burn_write_opts_set_mediacatalog(). 02983 @param opts The write opts to change 02984 @param has_mediacatalog 1= activate writing of catalog to Q sub-channel 02985 0= deactivate it 02986 */ 02987 void burn_write_opts_set_has_mediacatalog(struct burn_write_opts *opts, 02988 int has_mediacatalog); 02989 02990 02991 /* ts A61106 */ 02992 /** Sets the multi flag which eventually marks the emerging session as not 02993 being the last one and thus creating a BURN_DISC_APPENDABLE media. 02994 Note: DVD-R[W] in write mode BURN_WRITE_SAO are not capable of this. 02995 DVD-R DL are not capable of this at all. 02996 libburn will refuse to write if burn_write_opts_set_multi() is 02997 enabled under such conditions. 02998 @param opts The option object to be manipulated 02999 @param multi 1=media will be appendable, 0=media will be closed (default) 03000 @since 0.2.6 03001 */ 03002 void burn_write_opts_set_multi(struct burn_write_opts *opts, int multi); 03003 03004 /* ts B11204 */ 03005 /** Submit an array of CD-TEXT packs which shall be written to the Lead-in 03006 of a SAO write run on CD. 03007 @param opts The option object to be manipulated 03008 @param text_packs Array of bytes which form CD-TEXT packs of 18 bytes 03009 each. For a description of the format of the array, 03010 see file doc/cdtext.txt. 03011 No header of 4 bytes must be prepended which would 03012 tell the number of pack bytes + 2. 03013 This parameter may be NULL if the currently attached 03014 array of packs shall be removed. 03015 @param num_packs The number of 18 byte packs in text_packs. 03016 This parameter may be 0 if the currently attached 03017 array of packs shall be removed. 03018 @param flag Bitfield for control purposes. 03019 bit0= do not verify checksums 03020 bit1= repair mismatching checksums 03021 bit2= repair checksums if they are 00 00 with each pack 03022 @return 1 on success, <= 0 on failure 03023 @since 1.2.0 03024 */ 03025 int burn_write_opts_set_leadin_text(struct burn_write_opts *opts, 03026 unsigned char *text_packs, 03027 int num_packs, int flag); 03028 03029 03030 /* ts A61222 */ 03031 /** Sets a start address for writing to media and write modes which allow to 03032 choose this address at all (for now: DVD+RW, DVD-RAM, formatted DVD-RW). 03033 now). The address is given in bytes. If it is not -1 then a write run 03034 will fail if choice of start address is not supported or if the block 03035 alignment of the address is not suitable for media and write mode. 03036 Alignment to 32 kB blocks is supposed to be safe with DVD media. 03037 Call burn_disc_get_multi_caps() can obtain the necessary media info. See 03038 resulting struct burn_multi_caps elements .start_adr , .start_alignment , 03039 .start_range_low , .start_range_high . 03040 @param opts The write opts to change 03041 @param value The address in bytes (-1 = start at default address) 03042 @since 0.3.0 03043 */ 03044 void burn_write_opts_set_start_byte(struct burn_write_opts *opts, off_t value); 03045 03046 03047 /* ts A70213 */ 03048 /** Caution: still immature and likely to change. Problems arose with 03049 sequential DVD-RW on one drive. 03050 03051 Controls whether the whole available space of the media shall be filled up 03052 by the last track of the last session. 03053 @param opts The write opts to change 03054 @param fill_up_media If 1 : fill up by last track, if 0 = do not fill up 03055 @since 0.3.4 03056 */ 03057 void burn_write_opts_set_fillup(struct burn_write_opts *opts, 03058 int fill_up_media); 03059 03060 03061 /* ts A70303 */ 03062 /** Eventually makes libburn ignore the failure of some conformance checks: 03063 - the check whether CD write+block type is supported by the drive 03064 - the check whether the media profile supports simulated burning 03065 @param opts The write opts to change 03066 @param use_force 1=ignore above checks, 0=refuse work on failed check 03067 @since 0.3.4 03068 */ 03069 void burn_write_opts_set_force(struct burn_write_opts *opts, int use_force); 03070 03071 03072 /* ts A80412 */ 03073 /** Eventually makes use of the more modern write command AAh WRITE12 and 03074 sets the Streaming bit. With DVD-RAM and BD this can override the 03075 traditional slowdown to half nominal speed. But if it speeds up writing 03076 then it also disables error management and correction. Weigh your 03077 priorities. This affects the write operations of burn_disc_write() 03078 and subsequent calls of burn_random_access_write(). 03079 @param opts The write opts to change 03080 @param value 0=use 2Ah WRITE10, 1=use AAh WRITE12 with Streaming bit 03081 @since 0.6.4: 03082 >=16 use WRITE12 but not before the LBA given by value 03083 @since 0.4.6 03084 */ 03085 void burn_write_opts_set_stream_recording(struct burn_write_opts *opts, 03086 int value); 03087 03088 /* ts A91115 */ 03089 /** Overrides the write chunk size for DVD and BD media which is normally 03090 determined according to media type and setting of stream recording. 03091 A chunk size of 64 KB may improve throughput with bus systems which show 03092 latency problems. 03093 @param opts The write opts to change 03094 @param obs Number of bytes which shall be sent by a single write command. 03095 0 means automatic size, 32768 and 65336 are the only other 03096 accepted sizes for now. 03097 @since 0.7.4 03098 */ 03099 void burn_write_opts_set_dvd_obs(struct burn_write_opts *opts, int obs); 03100 03101 03102 /* ts B20406 */ 03103 /** Overrides the automatic decision whether to pad up the last write chunk to 03104 its full size. This applies to DVD, BD and stdio: pseudo-drives. 03105 Note: This override may get enabled fixely already at compile time by 03106 defining macro Libburn_dvd_always_obs_paD . 03107 @param opts The write opts to change 03108 @param pad 1 means to pad up in any case, 0 means automatic decision. 03109 @since 1.2.4 03110 */ 03111 void burn_write_opts_set_obs_pad(struct burn_write_opts *opts, int pad); 03112 03113 03114 /* ts A91115 */ 03115 /** Sets the rythm by which stdio pseudo drives force their output data to 03116 be consumed by the receiving storage device. This forcing keeps the memory 03117 from being clogged with lots of pending data for slow devices. 03118 @param opts The write opts to change 03119 @param rythm Number of 2KB output blocks after which fsync(2) is 03120 performed. -1 means no fsync(), 0 means default, 03121 elsewise the value must be >= 32. 03122 Default is currently 8192 = 16 MB. 03123 @since 0.7.4 03124 */ 03125 void burn_write_opts_set_stdio_fsync(struct burn_write_opts *opts, int rythm); 03126 03127 03128 /** Sets whether to read in raw mode or not 03129 @param opts The read opts to change 03130 @param raw_mode If non-zero, reading will be done in raw mode, so that everything in the data tracks on the 03131 disc is read, including headers. 03132 */ 03133 void burn_read_opts_set_raw(struct burn_read_opts *opts, int raw_mode); 03134 03135 /** Sets whether to report c2 errors or not 03136 @param opts The read opts to change 03137 @param c2errors If non-zero, report c2 errors. 03138 */ 03139 void burn_read_opts_set_c2errors(struct burn_read_opts *opts, int c2errors); 03140 03141 /** Sets whether to read subcodes from audio tracks or not 03142 @param opts The read opts to change 03143 @param subcodes_audio If non-zero, read subcodes from audio tracks on the disc. 03144 */ 03145 void burn_read_opts_read_subcodes_audio(struct burn_read_opts *opts, 03146 int subcodes_audio); 03147 03148 /** Sets whether to read subcodes from data tracks or not 03149 @param opts The read opts to change 03150 @param subcodes_data If non-zero, read subcodes from data tracks on the disc. 03151 */ 03152 void burn_read_opts_read_subcodes_data(struct burn_read_opts *opts, 03153 int subcodes_data); 03154 03155 /** Sets whether to recover errors if possible 03156 @param opts The read opts to change 03157 @param hardware_error_recovery If non-zero, attempt to recover errors if possible. 03158 */ 03159 void burn_read_opts_set_hardware_error_recovery(struct burn_read_opts *opts, 03160 int hardware_error_recovery); 03161 03162 /** Sets whether to report recovered errors or not 03163 @param opts The read opts to change 03164 @param report_recovered_errors If non-zero, recovered errors will be reported. 03165 */ 03166 void burn_read_opts_report_recovered_errors(struct burn_read_opts *opts, 03167 int report_recovered_errors); 03168 03169 /** Sets whether blocks with unrecoverable errors should be read or not 03170 @param opts The read opts to change 03171 @param transfer_damaged_blocks If non-zero, blocks with unrecoverable errors will still be read. 03172 */ 03173 void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts, 03174 int transfer_damaged_blocks); 03175 03176 /** Sets the number of retries to attempt when trying to correct an error 03177 @param opts The read opts to change 03178 @param hardware_error_retries The number of retries to attempt when correcting an error. 03179 */ 03180 void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts, 03181 unsigned char hardware_error_retries); 03182 03183 03184 /* ts A90815 */ 03185 /** Gets the list of profile codes supported by the drive. 03186 Profiles depict the feature sets which constitute media types. For 03187 known profile codes and names see burn_disc_get_profile(). 03188 @param d is the drive to query 03189 @param num_profiles returns the number of supported profiles 03190 @param profiles returns the profile codes 03191 @param is_current returns the status of the corresponding profile code: 03192 1= current, i.e. the matching media is loaded 03193 0= not current, i.e. the matching media is not loaded 03194 @return always 1 for now 03195 @since 0.7.0 03196 */ 03197 int burn_drive_get_all_profiles(struct burn_drive *d, int *num_profiles, 03198 int profiles[64], char is_current[64]); 03199 03200 03201 /* ts A90815 */ 03202 /** Obtains the profile name associated with a profile code. 03203 @param profile_code the profile code to be translated 03204 @param name returns the profile name (e.g. "DVD+RW") 03205 @return 1= known profile code , 0= unknown profile code 03206 @since 0.7.0 03207 */ 03208 int burn_obtain_profile_name(int profile_code, char name[80]); 03209 03210 03211 /** Gets the maximum write speed for a drive and eventually loaded media. 03212 The return value might change by the media type of already loaded media, 03213 again by call burn_drive_grab() and again by call burn_disc_read_atip(). 03214 @param d Drive to query 03215 @return Maximum write speed in K/s 03216 */ 03217 int burn_drive_get_write_speed(struct burn_drive *d); 03218 03219 03220 /* ts A61021 */ 03221 /** Gets the minimum write speed for a drive and eventually loaded media. 03222 The return value might change by the media type of already loaded media, 03223 again by call burn_drive_grab() and again by call burn_disc_read_atip(). 03224 @param d Drive to query 03225 @return Minimum write speed in K/s 03226 @since 0.2.6 03227 */ 03228 int burn_drive_get_min_write_speed(struct burn_drive *d); 03229 03230 03231 /** Gets the maximum read speed for a drive 03232 @param d Drive to query 03233 @return Maximum read speed in K/s 03234 */ 03235 int burn_drive_get_read_speed(struct burn_drive *d); 03236 03237 03238 /* ts A61226 */ 03239 /** Obtain a copy of the current speed descriptor list. The drive's list gets 03240 updated on various occasions such as burn_drive_grab() but the copy 03241 obtained here stays untouched. It has to be disposed via 03242 burn_drive_free_speedlist() when it is not longer needed. Speeds 03243 may appear several times in the list. The list content depends much on 03244 drive and media type. It seems that .source == 1 applies mostly to CD media 03245 whereas .source == 2 applies to any media. 03246 @param d Drive to query 03247 @param speed_list The copy. If empty, *speed_list gets returned as NULL. 03248 @return 1=success , 0=list empty , <0 severe error 03249 @since 0.3.0 03250 */ 03251 int burn_drive_get_speedlist(struct burn_drive *d, 03252 struct burn_speed_descriptor **speed_list); 03253 03254 /* ts A70713 */ 03255 /** Look up the fastest speed descriptor which is not faster than the given 03256 speed_goal. If it is 0, then the fastest one is chosen among the 03257 descriptors with the highest end_lba. If it is -1 then the slowest speed 03258 descriptor is chosen regardless of end_lba. Parameter flag decides whether 03259 the speed goal means write speed or read speed. 03260 @param d Drive to query 03261 @param speed_goal Upper limit for speed, 03262 0=search for maximum speed , -1 search for minimum speed 03263 @param best_descr Result of the search, NULL if no match 03264 @param flag Bitfield for control purposes 03265 bit0= look for best read speed rather than write speed 03266 bit1= look for any source type (else look for source==2 first 03267 and for any other source type only with CD media) 03268 @return >0 indicates a valid best_descr, 0 = no valid best_descr 03269 @since 0.3.8 03270 */ 03271 int burn_drive_get_best_speed(struct burn_drive *d, int speed_goal, 03272 struct burn_speed_descriptor **best_descr, int flag); 03273 03274 03275 /* ts A61226 */ 03276 /** Dispose a speed descriptor list copy which was obtained by 03277 burn_drive_get_speedlist(). 03278 @param speed_list The list copy. *speed_list gets set to NULL. 03279 @return 1=list disposed , 0= *speedlist was already NULL 03280 @since 0.3.0 03281 */ 03282 int burn_drive_free_speedlist(struct burn_speed_descriptor **speed_list); 03283 03284 03285 /* ts A70203 */ 03286 /* @since 0.3.2 */ 03287 /** The reply structure for burn_disc_get_multi_caps() 03288 */ 03289 struct burn_multi_caps { 03290 03291 /* Multi-session capability allows to keep the media appendable after 03292 writing a session. It also guarantees that the drive will be able 03293 to predict and use the appropriate Next Writeable Address to place 03294 the next session on the media without overwriting the existing ones. 03295 It does not guarantee that the selected write type is able to do 03296 an appending session after the next session. (E.g. CD SAO is capable 03297 of multi-session by keeping a disc appendable. But .might_do_sao 03298 will be 0 afterwards, when checking the appendable media.) 03299 1= media may be kept appendable by burn_write_opts_set_multi(o,1) 03300 0= media will not be appendable 03301 */ 03302 int multi_session; 03303 03304 /* Multi-track capability allows to write more than one track source 03305 during a single session. The written tracks can later be found in 03306 libburn's TOC model with their start addresses and sizes. 03307 1= multiple tracks per session are allowed 03308 0= only one track per session allowed 03309 */ 03310 int multi_track; 03311 03312 /* Start-address capability allows to set a non-zero address with 03313 burn_write_opts_set_start_byte(). Eventually this has to respect 03314 .start_alignment and .start_range_low, .start_range_high in this 03315 structure. 03316 1= non-zero start address is allowed 03317 0= only start address 0 is allowed (to depict the drive's own idea 03318 about the appropriate write start) 03319 */ 03320 int start_adr; 03321 03322 /** The alignment for start addresses. 03323 ( start_address % start_alignment ) must be 0. 03324 */ 03325 off_t start_alignment; 03326 03327 /** The lowest permissible start address. 03328 */ 03329 off_t start_range_low; 03330 03331 /** The highest addressable start address. 03332 */ 03333 off_t start_range_high; 03334 03335 /** Potential availability of write modes 03336 4= needs no size prediction, not to be chosen automatically 03337 3= needs size prediction, not to be chosen automatically 03338 2= available, no size prediction necessary 03339 1= available, needs exact size prediction 03340 0= not available 03341 With CD media (profiles 0x09 and 0x0a) check also the elements 03342 *_block_types of the according write mode. 03343 */ 03344 int might_do_tao; 03345 int might_do_sao; 03346 int might_do_raw; 03347 03348 /** Generally advised write mode. 03349 Not necessarily the one chosen by burn_write_opts_auto_write_type() 03350 because the burn_disc structure might impose particular demands. 03351 */ 03352 enum burn_write_types advised_write_mode; 03353 03354 /** Write mode as given by parameter wt of burn_disc_get_multi_caps(). 03355 */ 03356 enum burn_write_types selected_write_mode; 03357 03358 /** Profile number which was current when the reply was generated */ 03359 int current_profile; 03360 03361 /** Wether the current profile indicates CD media. 1=yes, 0=no */ 03362 int current_is_cd_profile; 03363 03364 /* ts A70528 */ 03365 /* @since 0.3.8 */ 03366 /** Wether the current profile is able to perform simulated write */ 03367 int might_simulate; 03368 }; 03369 03370 /** Allocates a struct burn_multi_caps (see above) and fills it with values 03371 which are appropriate for the drive and the loaded media. The drive 03372 must be grabbed for this call. The returned structure has to be disposed 03373 via burn_disc_free_multi_caps() when no longer needed. 03374 @param d The drive to inquire 03375 @param wt With BURN_WRITE_NONE the best capabilities of all write modes 03376 get returned. If set to a write mode like BURN_WRITE_SAO the 03377 capabilities with that particular mode are returned and the 03378 return value is 0 if the desired mode is not possible. 03379 @param caps returns the info structure 03380 @param flag Bitfield for control purposes (unused yet, submit 0) 03381 @return < 0 : error , 0 : writing seems impossible , 1 : writing possible 03382 @since 0.3.2 03383 */ 03384 int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt, 03385 struct burn_multi_caps **caps, int flag); 03386 03387 /** Removes from memory a multi session info structure which was returned by 03388 burn_disc_get_multi_caps(). The pointer *caps gets set to NULL. 03389 @param caps the info structure to dispose (note: pointer to pointer) 03390 @return 0 : *caps was already NULL, 1 : memory object was disposed 03391 @since 0.3.2 03392 */ 03393 int burn_disc_free_multi_caps(struct burn_multi_caps **caps); 03394 03395 03396 /** Gets a copy of the toc_entry structure associated with a track 03397 @param t Track to get the entry from 03398 @param entry Struct for the library to fill out 03399 */ 03400 void burn_track_get_entry(struct burn_track *t, struct burn_toc_entry *entry); 03401 03402 /** Gets a copy of the toc_entry structure associated with a session's lead out 03403 @param s Session to get the entry from 03404 @param entry Struct for the library to fill out 03405 */ 03406 void burn_session_get_leadout_entry(struct burn_session *s, 03407 struct burn_toc_entry *entry); 03408 03409 /** Gets an array of all complete sessions for the disc 03410 THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A SESSION 03411 The result array contains *num + burn_disc_get_incomplete_sessions() 03412 elements. All above *num are incomplete sessions. 03413 Typically there is at most one incomplete session with one empty track. 03414 DVD+R and BD-R seem to allow more than one track with even readable data. 03415 @param d Disc to get session array for 03416 @param num Returns the number of sessions in the array 03417 @return array of sessions 03418 */ 03419 struct burn_session **burn_disc_get_sessions(struct burn_disc *d, 03420 int *num); 03421 03422 /* ts B30112 */ 03423 /* @since 1.2.8 */ 03424 /** Obtains the number of incomplete sessions which are recorded in the 03425 result array of burn_disc_get_sessions() after the complete sessions. 03426 See above. 03427 @param d Disc object to inquire 03428 @return Number of incomplete sessions 03429 */ 03430 int burn_disc_get_incomplete_sessions(struct burn_disc *d); 03431 03432 03433 int burn_disc_get_sectors(struct burn_disc *d); 03434 03435 /** Gets an array of all the tracks for a session 03436 THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A TRACK 03437 @param s session to get track array for 03438 @param num Returns the number of tracks in the array 03439 @return array of tracks 03440 */ 03441 struct burn_track **burn_session_get_tracks(struct burn_session *s, 03442 int *num); 03443 03444 int burn_session_get_sectors(struct burn_session *s); 03445 03446 /** Gets the mode of a track 03447 @param track the track to query 03448 @return the track's mode 03449 */ 03450 int burn_track_get_mode(struct burn_track *track); 03451 03452 /** Returns whether the first track of a session is hidden in the pregap 03453 @param session the session to query 03454 @return non-zero means the first track is hidden 03455 */ 03456 int burn_session_get_hidefirst(struct burn_session *session); 03457 03458 /** Returns the library's version in its parts. 03459 This is the runtime counterpart of the three build time macros 03460 burn_header_version_* below. 03461 @param major The major version number 03462 @param minor The minor version number 03463 @param micro The micro version number 03464 */ 03465 void burn_version(int *major, int *minor, int *micro); 03466 03467 03468 /* ts A80129 */ 03469 /* @since 0.4.4 */ 03470 /** These three release version numbers tell the revision of this header file 03471 and of the API it describes. They are memorized by applications at build 03472 time. 03473 Immediately after burn_initialize() an application should do this check: 03474 burn_version(&major, &minor, µ); 03475 if(major > burn_header_version_major 03476 || (major == burn_header_version_major 03477 && (minor > burn_header_version_minor 03478 || (minor == burn_header_version_minor 03479 && micro >= burn_header_version_micro)))) { 03480 ... Young enough. Go on with program run .... 03481 } else { 03482 ... Too old. Do not use this libburn version ... 03483 } 03484 03485 */ 03486 #define burn_header_version_major 1 03487 #define burn_header_version_minor 2 03488 #define burn_header_version_micro 8 03489 /** Note: 03490 Above version numbers are also recorded in configure.ac because libtool 03491 wants them as parameters at build time. 03492 For the library compatibility check, BURN_*_VERSION in configure.ac 03493 are not decisive. Only the three numbers above do matter. 03494 */ 03495 /** Usage discussion: 03496 03497 Some developers of the libburnia project have differing 03498 opinions how to ensure the compatibility of libaries 03499 and applications. 03500 03501 It is about whether to use at compile time and at runtime 03502 the version numbers isoburn_header_version_* provided here. 03503 Thomas Schmitt advises to use them. 03504 Vreixo Formoso advises to use other means. 03505 03506 At compile time: 03507 03508 Vreixo Formoso advises to leave proper version matching 03509 to properly programmed checks in the the application's 03510 build system, which will eventually refuse compilation. 03511 03512 Thomas Schmitt advises to use the macros defined here 03513 for comparison with the application's requirements of 03514 library revisions and to eventually break compilation. 03515 03516 Both advises are combinable. I.e. be master of your 03517 build system and have #if checks in the source code 03518 of your application, nevertheless. 03519 03520 At runtime (via *_is_compatible()): 03521 03522 Vreixo Formoso advises to compare the application's 03523 requirements of library revisions with the runtime 03524 library. This is to allow runtime libraries which are 03525 young enough for the application but too old for 03526 the lib*.h files seen at compile time. 03527 03528 Thomas Schmitt advises to compare the header 03529 revisions defined here with the runtime library. 03530 This is to enforce a strictly monotonous chain 03531 of revisions from app to header to library, 03532 at the cost of excluding some older libraries. 03533 03534 These two advises are mutually exclusive. 03535 03536 */ 03537 03538 /* ts A91226 */ 03539 /** Obtain the id string of the SCSI transport interface. 03540 This interface may be a system specific adapter module of libburn or 03541 an adapter to a supporting library like libcdio. 03542 @param flag Bitfield for control puposes, submit 0 for now 03543 @return A pointer to the id string. Do not alter the string content. 03544 @since 0.7.6 03545 */ 03546 char *burn_scsi_transport_id(int flag); 03547 03548 /* ts A60924 : ticket 74 */ 03549 /** Control queueing and stderr printing of messages from libburn. 03550 Severity may be one of "NEVER", "ABORT", "FATAL", "FAILURE", "SORRY", 03551 "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG", "ALL". 03552 @param queue_severity Gives the minimum limit for messages to be queued. 03553 Default: "NEVER". If you queue messages then you 03554 must consume them by burn_msgs_obtain(). 03555 @param print_severity Does the same for messages to be printed directly 03556 to stderr. Default: "FATAL". 03557 @param print_id A text prefix to be printed before the message. 03558 @return >0 for success, <=0 for error 03559 @since 0.2.6 03560 */ 03561 int burn_msgs_set_severities(char *queue_severity, 03562 char *print_severity, char *print_id); 03563 03564 /* ts A60924 : ticket 74 */ 03565 /* @since 0.2.6 */ 03566 #define BURN_MSGS_MESSAGE_LEN 4096 03567 03568 /** Obtain the oldest pending libburn message from the queue which has at 03569 least the given minimum_severity. This message and any older message of 03570 lower severity will get discarded from the queue and is then lost forever. 03571 @param minimum_severity may be one of "NEVER", "ABORT", "FATAL", 03572 "FAILURE", "SORRY", "WARNING", "HINT", "NOTE", "UPDATE", 03573 "DEBUG", "ALL". 03574 To call with minimum_severity "NEVER" will discard the 03575 whole queue. 03576 @param error_code Will become a unique error code as listed in 03577 libburn/libdax_msgs.h 03578 @param msg_text Must provide at least BURN_MSGS_MESSAGE_LEN bytes. 03579 @param os_errno Will become the eventual errno related to the message 03580 @param severity Will become the severity related to the message and 03581 should provide at least 80 bytes. 03582 @return 1 if a matching item was found, 0 if not, <0 for severe errors 03583 @since 0.2.6 03584 */ 03585 int burn_msgs_obtain(char *minimum_severity, 03586 int *error_code, char msg_text[], int *os_errno, 03587 char severity[]); 03588 03589 03590 /* ts A70922 */ 03591 /** Submit a message to the libburn queueing system. It will be queued or 03592 printed as if it was generated by libburn itself. 03593 @param error_code The unique error code of your message. 03594 Submit 0 if you do not have reserved error codes within 03595 the libburnia project. 03596 @param msg_text Not more than BURN_MSGS_MESSAGE_LEN characters of 03597 message text. 03598 @param os_errno Eventual errno related to the message. Submit 0 if 03599 the message is not related to a operating system error. 03600 @param severity One of "ABORT", "FATAL", "FAILURE", "SORRY", "WARNING", 03601 "HINT", "NOTE", "UPDATE", "DEBUG". Defaults to "FATAL". 03602 @param d An eventual drive to which the message shall be related. 03603 Submit NULL if the message is not specific to a 03604 particular drive object. 03605 @return 1 if message was delivered, <=0 if failure 03606 @since 0.4.0 03607 */ 03608 int burn_msgs_submit(int error_code, char msg_text[], int os_errno, 03609 char severity[], struct burn_drive *d); 03610 03611 03612 /* ts A71016 */ 03613 /** Convert a severity name into a severity number, which gives the severity 03614 rank of the name. 03615 @param severity_name A name as with burn_msgs_submit(), e.g. "SORRY". 03616 @param severity_number The rank number: the higher, the more severe. 03617 @param flag Bitfield for control purposes (unused yet, submit 0) 03618 @return >0 success, <=0 failure 03619 @since 0.4.0 03620 */ 03621 int burn_text_to_sev(char *severity_name, int *severity_number, int flag); 03622 03623 03624 /* ts A80202 */ 03625 /** Convert a severity number into a severity name 03626 @param severity_number The rank number: the higher, the more severe. 03627 @param severity_name A name as with burn_msgs_submit(), e.g. "SORRY". 03628 @param flag Bitfield for control purposes (unused yet, submit 0) 03629 @return >0 success, <=0 failure 03630 @since 0.4.4 03631 */ 03632 int burn_sev_to_text(int severity_number, char **severity_name, int flag); 03633 03634 03635 /* ts B21214 */ 03636 /** Return a blank separated list of severity names. Sorted from low 03637 to high severity. 03638 @param flag Bitfield for control purposes (unused yet, submit 0) 03639 @return A constant string with the severity names 03640 @since 1.2.6 03641 */ 03642 char *burn_list_sev_texts(int flag); 03643 03644 03645 /* ts A70915 */ 03646 /** Replace the messenger object handle of libburn by a compatible handle 03647 obtained from a related library. 03648 See also: libisofs, API function iso_get_messenger(). 03649 @param messenger The foreign but compatible message handle. 03650 @return 1 : success, <=0 : failure 03651 @since 0.4.0 03652 */ 03653 int burn_set_messenger(void *messenger); 03654 03655 03656 /* ts A61002 */ 03657 /* @since 0.2.6 */ 03658 /** The prototype of a handler function suitable for burn_set_signal_handling() 03659 Such a function has to return -2 if it does not want the process to 03660 exit with value 1. 03661 */ 03662 typedef int (*burn_abort_handler_t)(void *handle, int signum, int flag); 03663 03664 /** Control built-in signal handling. Either by setting an own handler or 03665 by activating the built-in signal handler. 03666 03667 A function parameter handle of NULL activates the built-in abort handler. 03668 Depending on mode it may cancel all drive operations, wait for all drives 03669 to become idle, exit(1). It may also prepare function 03670 burn_drive_get_status() for waiting and performing exit(1). 03671 If parameter handle may be NULL or a text that shall be used as prefix for 03672 pacifier messages of burn_abort_pacifier(). Other than with an application 03673 provided handler, the prefix char array does not have to be kept existing 03674 until the eventual signal event. 03675 Before version 0.7.8 only action 0 was available. I.e. the built-in handler 03676 waited for the drives to become idle and then performed exit(1) directly. 03677 But during burn_disc_write() onto real CD or DVD, FreeBSD 8.0 pauses the 03678 other threads until the signal handler returns. 03679 The new actions try to avoid this deadlock. It is advised to use action 3 03680 at least during burn_disc_write(), burn_disc_erase(), burn_disc_format(): 03681 burn_set_signal_handling(text, NULL, 0x30); 03682 and to call burn_is_aborting(0) when the drive is BURN_DRIVE_IDLE. 03683 If burn_is_aborting(0) returns 1, then call burn_abort() and exit(1). 03684 03685 @param handle Opaque handle eventually pointing to an application 03686 provided memory object 03687 @param handler A function to be called on signals, if the handling bits 03688 in parameter mode are set 0. 03689 It will get parameter handle as argument. flag will be 0. 03690 It should finally call burn_abort(). See there. 03691 If the handler function returns 2 or -2, then the wrapping 03692 signal handler of libburn will return and let the program 03693 continue its operations. Any other return value causes 03694 exit(1). 03695 @param mode : bit0 - bit3: Handling of received signals: 03696 0 Install libburn wrapping signal handler, which will call 03697 handler(handle, signum, 0) on nearly all signals 03698 1 Enable system default reaction on all signals 03699 2 Try to ignore nearly all signals 03700 10 like mode 2 but handle SIGABRT like with mode 0 03701 bit4 - bit7: With handler == NULL : 03702 Action of built-in handler. "control thread" is the one 03703 which called burn_set_signal_handling(). 03704 All actions activate receive mode 2 to ignore further 03705 signals. 03706 0 Same as 1 (for pre-0.7.8 backward compatibility) 03707 @since 0.7.8 03708 1 Catch the control thread in abort handler, call 03709 burn_abort(>0) and finally exit(1). 03710 Does not always work with FreeBSD. 03711 2 Call burn_abort(-1) and return from handler. When the 03712 control thread calls burn_drive_get_status(), then do 03713 burn_abort(>0) instead, and finally exit(1). 03714 Does not always work with FreeBSD. 03715 3 Call burn_abort(-1), return from handler. It is duty of 03716 the application to detect a pending abort condition 03717 by calling burn_is_aborting() and to wait for all 03718 drives to become idle. E.g. by calling burn_abort(>0). 03719 4 Like 3, but without calling burn_abort(-1). Only the 03720 indicator of burn_is_aborting() gets set. 03721 @since 0.2.6 03722 */ 03723 void burn_set_signal_handling(void *handle, burn_abort_handler_t handler, 03724 int mode); 03725 03726 03727 /* ts B00304 */ 03728 /* Inquire whether the built-in abort handler was triggered by a signal. 03729 This has to be done to detect pending abort handling if signal handling 03730 was set to the built-in handler and action was set to 2 or 3. 03731 @param flag Bitfield for control purposes (unused yet, submit 0) 03732 @return 0 = no abort was triggered 03733 >0 = action that was triggered (action 0 is reported as 1) 03734 @since 0.7.8 03735 */ 03736 int burn_is_aborting(int flag); 03737 03738 03739 /* ts A70811 */ 03740 /** Write data in random access mode. 03741 The drive must be grabbed successfully before calling this function which 03742 circumvents usual libburn session processing and rather writes data without 03743 preparations or finalizing. This will work only with overwriteable media 03744 which are also suitable for burn_write_opts_set_start_byte(). The same 03745 address alignment restrictions as with this function apply. I.e. for DVD 03746 it is best to align to 32 KiB blocks (= 16 LBA units). The amount of data 03747 to be written is subject to the same media dependent alignment rules. 03748 Again, 32 KiB is most safe. 03749 Call burn_disc_get_multi_caps() can obtain the necessary media info. See 03750 resulting struct burn_multi_caps elements .start_adr , .start_alignment , 03751 .start_range_low , .start_range_high . 03752 Other than burn_disc_write() this is a synchronous call which returns 03753 only after the write transaction has ended (sucessfully or not). So it is 03754 wise not to transfer giant amounts of data in a single call. 03755 Important: Data have to fit into the already formatted area of the media. 03756 @param d The drive to which to write 03757 @param byte_address The start address of the write in byte 03758 (1 LBA unit = 2048 bytes) (do respect media alignment) 03759 @param data The bytes to be written 03760 @param data_count The number of those bytes (do respect media alignment) 03761 data_count == 0 is permitted (e.g. to flush the 03762 drive buffer without further data transfer). 03763 @param flag Bitfield for control purposes: 03764 bit0 = flush the drive buffer after eventual writing 03765 @return 1=sucessful , <=0 : number of transfered bytes * -1 03766 @since 0.4.0 03767 */ 03768 int burn_random_access_write(struct burn_drive *d, off_t byte_address, 03769 char *data, off_t data_count, int flag); 03770 03771 03772 /* ts A81215 */ 03773 /** Inquire the maximum amount of readable data. 03774 It is supposed that all LBAs in the range from 0 to media_read_acpacity-1 03775 can be read via burn_read_data() although some of them may never have been 03776 recorded. If tracks are recognizable then it is better to only read 03777 LBAs which are part of some track. 03778 If the drive is actually a large file or block device, then the capacity 03779 is curbed to a maximum of 0x7ffffff0 blocks = 4 TB - 32 KB. 03780 @param d The drive from which to read 03781 @param capacity Will return the result if valid 03782 @param flag Bitfield for control purposes: Unused yet, submit 0. 03783 @return 1=sucessful , <=0 an error occured 03784 @since 0.6.0 03785 */ 03786 int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag); 03787 03788 03789 /* ts A70812 */ 03790 /** Read data in random access mode. 03791 The drive must be grabbed successfully before calling this function. 03792 With all currently supported drives and media the byte_address has to 03793 be aligned to 2048 bytes. Only data tracks with 2048 bytes per sector 03794 can be read this way. I.e. not CD-audio, not CD-video-stream ... 03795 This is a synchronous call which returns only after the full read job 03796 has ended (sucessfully or not). So it is wise not to read giant amounts 03797 of data in a single call. 03798 @param d The drive from which to read 03799 @param byte_address The start address of the read in byte (aligned to 2048) 03800 @param data A memory buffer capable of taking data_size bytes 03801 @param data_size The amount of data to be read. This does not have to 03802 be aligned to any block size. 03803 @param data_count The amount of data actually read (interesting on error) 03804 @param flag Bitfield for control purposes: 03805 bit0= - reserved - 03806 bit1= do not submit error message if read error 03807 bit2= on error do not try to read a second time 03808 with single block steps. 03809 @since 0.5.2 03810 bit3= return -2 on permission denied error rather than 03811 issueing a warning message. 03812 @since 1.0.6 03813 bit4= return -3 on SCSI error 03814 5 64 00 ILLEGAL MODE FOR THIS TRACK 03815 and prevent this error from being reported as 03816 event message. Do not retry reading in this case. 03817 (Useful to try the last two blocks of a CD 03818 track which might be non-data because of TAO.) 03819 @since 1.2.6 03820 @return 1=sucessful , <=0 an error occured 03821 with bit3: -2= permission denied error 03822 @since 0.4.0 03823 */ 03824 int burn_read_data(struct burn_drive *d, off_t byte_address, 03825 char data[], off_t data_size, off_t *data_count, int flag); 03826 03827 03828 /* ts B21119 */ 03829 /** Read CD audio sectors in random access mode. 03830 The drive must be grabbed successfully before calling this function. 03831 Only CD audio tracks with 2352 bytes per sector can be read this way. 03832 I.e. not data tracks, not CD-video-stream, ... 03833 03834 Note that audio data do not have exact block addressing. If you read a 03835 sequence of successive blocks then you will get a seamless stream 03836 of data. But the actual start and end position of this audio stream 03837 will differ by a few dozens of milliseconds, depending on individual 03838 CD and individual drive. 03839 Expect leading and trailing zeros, as well as slight truncation. 03840 03841 @param d The drive from which to read. 03842 It must be a real MMC drive (i.e. not a stdio file) 03843 and it must have a CD loaded (i.e. not DVD or BD). 03844 @param sector_no The sector number (Logical Block Address) 03845 It may be slightly below 0, depending on drive and 03846 medium. -150 is a lower limit. 03847 @param data A memory buffer capable of taking data_size bytes 03848 @param data_size The amount of data to be read. This must be aligned 03849 to full multiples of 2352. 03850 @param data_count The amount of data actually read (interesting on error) 03851 @param flag Bitfield for control purposes: 03852 bit0= - reserved - 03853 bit1= do not submit error message if read error 03854 bit2= on error do not try to read a second time 03855 with single block steps. 03856 bit3= Enable DAP : "flaw obscuring mechanisms like 03857 audio data mute and interpolate" 03858 bit4= return -3 on SCSI error 03859 5 64 00 ILLEGAL MODE FOR THIS TRACK 03860 and prevent this error from being reported as 03861 event message. Do not retry reading in this case. 03862 (Useful to try the last two blocks of a CD 03863 track which might be non-audio because of TAO.) 03864 @return 1=sucessful , <=0 an error occured 03865 with bit3: -2= permission denied error 03866 @since 1.2.6 03867 */ 03868 int burn_read_audio(struct burn_drive *d, int sector_no, 03869 char data[], off_t data_size, off_t *data_count, int flag); 03870 03871 03872 /* ts A70904 */ 03873 /** Inquire whether the drive object is a real MMC drive or a pseudo-drive 03874 created by a stdio: address. 03875 @param d The drive to inquire 03876 @return 0= null-drive 03877 1= real MMC drive 03878 2= stdio-drive, random access, read-write 03879 3= stdio-drive, sequential, write-only 03880 4= stdio-drive, random access, read-only 03881 (only if enabled by burn_allow_drive_role_4()) 03882 5= stdio-drive, random access, write-only 03883 (only if enabled by burn_allow_drive_role_4()) 03884 @since 0.4.0 03885 */ 03886 int burn_drive_get_drive_role(struct burn_drive *d); 03887 03888 03889 /* ts B10312 */ 03890 /** Allow drive role 4 "random access read-only" 03891 and drive role 5 "random access write-only". 03892 By default a random access file assumes drive role 2 "read-write" 03893 regardless whether it is actually readable or writeable. 03894 If enabled, random-access file objects which recognizably allow no 03895 writing will be classified as role 4 and those which allow no reading 03896 will get role 5. 03897 Candidates are drive addresses of the form stdio:/dev/fd/# , where # is 03898 the integer number of an open file descriptor. If this descriptor was 03899 opened read-only resp. write-only, then it gets role 4 resp. role 5. 03900 Other paths may get tested by an attempt to open them for read-write 03901 (role 2) resp. read-only (role 4) resp. write-only (role 5). See bit1. 03902 @param allowed Bitfield for control purposes: 03903 bit0= Enable roles 4 and 5 for drives which get 03904 aquired after this call 03905 bit1= with bit0: 03906 Test whether the file can be opened for 03907 read-write resp. read-only resp. write-only. 03908 Classify as roles 2 resp. 4 resp. 5. 03909 bit2= with bit0 and bit1: 03910 Classify files which cannot be opened at all 03911 as role 0 : useless dummy. 03912 Else classify as role 2. 03913 bit3= Classify non-empty role 5 drives as 03914 BURN_DISC_APPENDABLE with Next Writeable Address 03915 after the end of the file. It is nevertheless 03916 possible to change this address by call 03917 burn_write_opts_set_start_byte(). 03918 @since 1.0.6 03919 */ 03920 void burn_allow_drive_role_4(int allowed); 03921 03922 03923 /* ts A70923 */ 03924 /** Find out whether a given address string would lead to the given drive 03925 object. This should be done in advance for track source addresses 03926 with parameter drive_role set to 2. 03927 Although a real MMC drive should hardly exist as two drive objects at 03928 the same time, this can easily happen with stdio-drives. So if more than 03929 one drive is used by the application, then this gesture is advised: 03930 burn_drive_d_get_adr(d2, adr2); 03931 if (burn_drive_equals_adr(d1, adr2, burn_drive_get_drive_role(d2))) 03932 ... Both drive objects point to the same storage facility ... 03933 03934 @param d1 Existing drive object 03935 @param adr2 Address string to be tested. Prefix "stdio:" overrides 03936 parameter drive_role2 by either 0 or 2 as appropriate. 03937 The string must be shorter than BURN_DRIVE_ADR_LEN. 03938 @param drive_role2 Role as burn_drive_get_drive_role() would attribute 03939 to adr2 if it was a drive. Use value 2 for checking track 03940 sources resp. pseudo-drive addresses without "stdio:". 03941 Use 1 for checking drive addresses including those with 03942 prefix "stdio:". 03943 @return 1= adr2 leads to d1 , 0= adr2 seems not to lead to d1, 03944 -1 = adr2 is bad 03945 @since 0.4.0 03946 */ 03947 int burn_drive_equals_adr(struct burn_drive *d1, char *adr2, int drive_role2); 03948 03949 03950 03951 /* 03952 Audio track data extraction facility. 03953 */ 03954 03955 /* Maximum size for address paths and fmt_info strings */ 03956 #define LIBDAX_AUDIOXTR_STRLEN 4096 03957 03958 03959 /** Extractor object encapsulating intermediate states of extraction. 03960 The clients of libdax_audioxtr shall only allocate pointers to this 03961 struct and get a storage object via libdax_audioxtr_new(). 03962 Appropriate initial value for the pointer is NULL. 03963 */ 03964 struct libdax_audioxtr; 03965 03966 03967 /** Open an audio file, check wether suitable, create extractor object. 03968 @param xtr Opaque handle to extractor. Gets attached extractor object. 03969 @param path Address of the audio file to extract. "-" is stdin (but might 03970 be not suitable for all futurely supported formats). 03971 @param flag Bitfield for control purposes (unused yet, submit 0) 03972 @return >0 success 03973 0 unsuitable format 03974 -1 severe error 03975 -2 path not found 03976 @since 0.2.4 03977 */ 03978 int libdax_audioxtr_new(struct libdax_audioxtr **xtr, char *path, int flag); 03979 03980 03981 /** Obtain identification parameters of opened audio source. 03982 @param xtr Opaque handle to extractor 03983 @param fmt Gets pointed to the audio file format id text: ".wav" , ".au" 03984 @param fmt_info Gets pointed to a format info text telling parameters 03985 @param num_channels e.g. 1=mono, 2=stereo, etc 03986 @param sample_rate e.g. 11025, 44100 03987 @param bits_per_sample e.g. 8= 8 bits per sample, 16= 16 bits ... 03988 @param msb_first Byte order of samples: 0= Intel = Little Endian 03989 1= Motorola = Big Endian 03990 @param flag Bitfield for control purposes (unused yet, submit 0) 03991 @return >0 success, <=0 failure 03992 @since 0.2.4 03993 */ 03994 int libdax_audioxtr_get_id(struct libdax_audioxtr *xtr, 03995 char **fmt, char **fmt_info, 03996 int *num_channels, int *sample_rate, 03997 int *bits_per_sample, int *msb_first, int flag); 03998 03999 04000 /** Obtain a prediction about the extracted size based on internal information 04001 of the formatted file. 04002 @param xtr Opaque handle to extractor 04003 @param size Gets filled with the predicted size 04004 @param flag Bitfield for control purposes (unused yet, submit 0) 04005 @return 1 prediction was possible , 0 no prediction could be made 04006 @since 0.2.4 04007 */ 04008 int libdax_audioxtr_get_size(struct libdax_audioxtr *o, off_t *size, int flag); 04009 04010 04011 /** Obtain next buffer full of extracted data in desired format (only raw audio 04012 for now). 04013 @param xtr Opaque handle to extractor 04014 @param buffer Gets filled with extracted data 04015 @param buffer_size Maximum number of bytes to be filled into buffer 04016 @param flag Bitfield for control purposes 04017 bit0= do not stop at predicted end of data 04018 @return >0 number of valid buffer bytes, 04019 0 End of file 04020 -1 operating system reports error 04021 -2 usage error by application 04022 @since 0.2.4 04023 */ 04024 int libdax_audioxtr_read(struct libdax_audioxtr *xtr, 04025 char buffer[], int buffer_size, int flag); 04026 04027 04028 /** Try to obtain a file descriptor which will deliver extracted data 04029 to normal calls of read(2). This may fail because the format is 04030 unsuitable for that, but ".wav" is ok. If this call succeeds the xtr 04031 object will have forgotten its file descriptor and libdax_audioxtr_read() 04032 will return a usage error. One may use *fd after libdax_audioxtr_destroy() 04033 and will have to close it via close(2) when done with it. 04034 @param xtr Opaque handle to extractor 04035 @param fd Eventually returns the file descriptor number 04036 @param flag Bitfield for control purposes 04037 bit0= do not dup(2) and close(2) but hand out original fd 04038 @return 1 success, 0 cannot hand out fd , -1 severe error 04039 @since 0.2.4 04040 */ 04041 int libdax_audioxtr_detach_fd(struct libdax_audioxtr *o, int *fd, int flag); 04042 04043 04044 /** Clean up after extraction and destroy extractor object. 04045 @param xtr Opaque handle to extractor, *xtr is allowed to be NULL, 04046 *xtr is set to NULL by this function 04047 @param flag Bitfield for control purposes (unused yet, submit 0) 04048 @return 1 = destroyed object, 0 = was already destroyed 04049 @since 0.2.4 04050 */ 04051 int libdax_audioxtr_destroy(struct libdax_audioxtr **xtr, int flag); 04052 04053 04054 #ifndef DOXYGEN 04055 04056 BURN_END_DECLS 04057 04058 #endif 04059 04060 04061 /* ts A91205 */ 04062 /* The following experiments may be interesting in future: 04063 */ 04064 04065 /* Perform OPC explicitely. 04066 # define Libburn_pioneer_dvr_216d_with_opC 1 04067 */ 04068 04069 /* Load mode page 5 and modify it rather than composing from scratch. 04070 # define Libburn_pioneer_dvr_216d_load_mode5 1 04071 */ 04072 04073 /* Inquire drive events and react by reading configuration or starting unit. 04074 # define Libburn_pioneer_dvr_216d_get_evenT 1 04075 */ 04076 04077 /* ts A91112 */ 04078 /* Do not probe CD modes but declare only data and audio modes supported. 04079 For other modes resp. real probing one has to call 04080 burn_drive_probe_cd_write_modes(). 04081 04082 */ 04083 #define Libburn_dummy_probe_write_modeS 1 04084 04085 /* ts B30112 */ 04086 /* Handle DVD+R with reserved tracks in incomplete first session 04087 by loading info about the incomplete session into struct burn_disc 04088 */ 04089 #define Libburn_disc_with_incomplete_sessioN 1 04090 04091 04092 /* Early experimental: 04093 Do not define Libburn_develop_quality_scaN unless you want to work 04094 towards a usable implementation. 04095 If it gets enabled, then the call must be published in libburn/libburn.ver 04096 */ 04097 #ifdef Libburn_develop_quality_scaN 04098 04099 /* ts B21108 */ 04100 /* Experiments mit quality scan command F3 on Optiarc drive */ 04101 int burn_nec_optiarc_rep_err_rate(struct burn_drive *d, 04102 int start_lba, int rate_period, int flag); 04103 04104 #endif /* Libburn_develop_quality_scaN */ 04105 04106 04107 04108 #endif /*LIBBURN_H*/