00001 00002 /* 00003 API definition of libisoburn. 00004 00005 Copyright 2007-2008 Vreixo Formoso Lopes <metalpain2002@yahoo.es> 00006 and Thomas Schmitt <scdbackup@gmx.net> 00007 */ 00008 00009 /** Overview 00010 00011 libisoburn is a frontend for libraries libburn and libisofs which enables 00012 creation and expansion of ISO-9660 filesystems on all CD/DVD media supported 00013 by libburn. This includes media like DVD+RW, which do not support multi-session 00014 management on media level and even plain disk files or block devices. 00015 00016 The price for that is thorough specialization on data files in ISO-9660 00017 filesystem images. So libisoburn is not suitable for audio (CD-DA) or any 00018 other CD layout which does not entirely consist of ISO-9660 sessions. 00019 00020 00021 Connector functions 00022 00023 libisofs and libburn do not depend on each other but share some interfaces 00024 by which they can cooperate. 00025 libisoburn establishes the connection between both modules by creating the 00026 necessary interface objects and attaching them to the right places. 00027 00028 00029 Wrapper functions 00030 00031 The priciple of this frontend is that you may use any call of libisofs or 00032 libburn unless it has a isoburn_*() wrapper listed in the following function 00033 documentation. 00034 00035 E.g. call isoburn_initialize() rather than iso_init(); burn_initialize(); 00036 and call isoburn_drive_scan_and_grab() rather than burn_drive_scan_and_grab(). 00037 But you may call burn_disc_get_profile() directly if you want to display 00038 the media type. 00039 00040 The wrappers will transparently provide the necessary emulations which 00041 are appropriate for particular target drives and media states. 00042 To learn about them you have to read both API descriptions: the one of 00043 the wrapper and the one of the underlying libburn or libisofs call. 00044 00045 Macros BURN_* and functions burn_*() are documented in <libburn/libburn.h> 00046 Macros ISO_* and functions iso_*() are documented in <libisofs/libisofs.h> 00047 00048 00049 Usage model 00050 00051 There may be an input drive and an output drive. Either of them may be missing 00052 with the consequence that no reading resp. writing is possible. 00053 Both drive roles can be fulfilled by the same drive. 00054 00055 Input can be a random access readable libburn drive: 00056 optical media, regular files, block devices. 00057 Output can be any writeable libburn drive: 00058 writeable optical media in burner, writeable file objects (no directories). 00059 00060 libburn demands rw-permissions to drive device file resp. file object. 00061 00062 If the input drive provides a suitable ISO RockRidge image, then its tree 00063 may be loaded into memory and can then be manipulated by libisofs API calls. 00064 The loading is done by isoburn_read_image() under control of 00065 struct isoburn_read_opts which the application obtains from libisoburn 00066 and manipulates by the family of isoburn_ropt_set_*() functions. 00067 00068 Writing of result images is controlled by libisofs related parameters 00069 in a struct isoburn_imgen_opts which the application obtains from libisoburn 00070 and manipulates by the family of isoburn_igopt_set_*() functions. 00071 00072 All multi-session aspects are handled by libisoburn according to these 00073 settings. The application does not have to analyze media state and write 00074 job parameters. It rather states its desires which libisoburn tries to 00075 fulfill, or else will refuse to start the write run. 00076 00077 00078 Setup for Growing, Modifying or Blind Growing 00079 00080 The connector function family offers alternative API calls for performing 00081 the setup for several alternative image generation strategies. 00082 00083 Growing: 00084 If input and output drive are the same, then isoburn_prepare_disc() is to 00085 be used. It will lead to an add-on session on appendable or overwriteable 00086 media with existing ISO image. With blank media it will produce a first 00087 session. 00088 00089 Modifying: 00090 If the output drive is not the input drive, and if it bears blank media 00091 or overwriteable without a valid ISO image, then one may produce a consolidated 00092 image with old and new data. This will copy file data from an eventual input 00093 drive with valid image, add any newly introduced data from the local 00094 filesystem, and produce a first session on output media. 00095 To prepare for such an image generation run, use isoburn_prepare_new_image(). 00096 00097 Blind Growing: 00098 This method reads the old image from one drive and writes the add-on session 00099 to a different drive. That output drive is nevertheless supposed to 00100 finally lead to the same media from where the session was loaded. Usually it 00101 will be stdio:/dev/fd/1 (i.e. stdout) being piped into some burn program 00102 like with this classic gesture: 00103 mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev 00104 Blind growing is prepared by the call isoburn_prepare_blind_grow(). 00105 The input drive should be released immediately after this call in order 00106 to allow the consumer of the output stream to access that drive for writing. 00107 00108 After either of these setups, some peripheral libburn drive parameter settings 00109 like burn_write_opts_set_simulate(), burn_write_opts_set_multi(), 00110 burn_drive_set_speed(), burn_write_opts_set_underrun_proof() should be made. 00111 Do not set the write mode. It will be chosen by libisoburn so it matches job 00112 and media state. 00113 00114 Writing the image 00115 00116 Then one may start image generation and write threads by isoburn_disc_write(). 00117 Progress may be watched at the output drive by burn_drive_get_status() and 00118 isoburn_get_fifo_status(). 00119 00120 At some time, the output drive will be BURN_DRIVE_IDLE indicating that 00121 writing has ended. 00122 One should inquire isoburn_drive_wrote_well() to learn about overall success. 00123 00124 Finally one must call isoburn_activate_session() which will complete any 00125 eventual multi-session emulation. 00126 00127 */ 00128 00129 00130 /* API functions */ 00131 00132 00133 /** Initialize libisoburn, libisofs and libburn. 00134 Wrapper for : iso_init() and burn_initialize() 00135 @since 0.1.0 00136 @param msg A character array for eventual messages (e.g. with errors) 00137 @param flag Bitfield for control purposes (unused yet, submit 0) 00138 @return 1 indicates success, 0 is failure 00139 */ 00140 int isoburn_initialize(char msg[1024], int flag); 00141 00142 00143 /** Check whether all features of header file libisoburn.h from the given 00144 major.minor.micro revision triple can be delivered by the library version 00145 which is performing this call. 00146 An application of libisoburn can easily memorize the version of the 00147 libisofs.h header in its own code. Immediately after isoburn_initialize() 00148 it should simply do this check: 00149 if (! isoburn_is_compatible(isoburn_header_version_major, 00150 isoburn_header_version_minor, 00151 isoburn_header_version_micro, 0)) 00152 ...refuse to start the program with this dynamic library version... 00153 @since 0.1.0 00154 @param major obtained at build time 00155 @param minor obtained at build time 00156 @param micro obtained at build time 00157 @param flag Bitfield for control purposes. Unused yet. Submit 0. 00158 @return 1= library can work for caller 00159 0= library is not usable in some aspects. Caller must restrict 00160 itself to an earlier API version or must not use this libray 00161 at all. 00162 */ 00163 int isoburn_is_compatible(int major, int minor, int micro, int flag); 00164 00165 00166 /** Obtain the three release version numbers of the library. These are the 00167 numbers encountered by the application when linking with libisoburn, 00168 i.e. possibly not before run time. 00169 Better do not base the fundamental compatibility decision of an application 00170 on these numbers. For a reliable check use isoburn_is_compatible(). 00171 @since 0.1.0 00172 @param major The maturity version (0 for now, as we are still learning) 00173 @param minor The development goal version. 00174 @param micro The development step version. This has an additional meaning: 00175 00176 Pare numbers indicate a version with frozen API. I.e. you can 00177 rely on the same set of features to be present in all 00178 published releases with that major.minor.micro combination. 00179 Features of a pare release will stay available and ABI 00180 compatible as long as the SONAME of libisoburn stays "1". 00181 Currently there are no plans to ever change the SONAME. 00182 00183 Odd numbers indicate that API upgrades are in progress. 00184 I.e. new features might be already present or they might 00185 be still missing. Newly introduced features may be changed 00186 incompatibly or even be revoked before release of a pare 00187 version. 00188 So micro revisions {1,3,5,7,9} should never be used for 00189 dynamic linking unless the proper library match can be 00190 guaranteed by external circumstances. 00191 00192 @return 1 success, <=0 might in future become an error indication 00193 */ 00194 void isoburn_version(int *major, int *minor, int *micro); 00195 00196 00197 /** The minimum version of libisofs to be used with this version of libisoburn 00198 at compile time. 00199 @since 0.1.0 00200 */ 00201 #define isoburn_libisofs_req_major 0 00202 #define isoburn_libisofs_req_minor 6 00203 #define isoburn_libisofs_req_micro 6 00204 00205 /** The minimum version of libburn to be used with this version of libisoburn 00206 at compile time. 00207 @since 0.1.0 00208 */ 00209 #define isoburn_libburn_req_major 0 00210 #define isoburn_libburn_req_minor 5 00211 #define isoburn_libburn_req_micro 0 00212 00213 00214 /** The minimum version of libisofs to be used with this version of libisoburn 00215 at runtime. This is checked already in isoburn_initialize() which will 00216 refuse on outdated version. So this call is for information purposes after 00217 successful startup only. 00218 @since 0.1.0 00219 @param major isoburn_libisofs_req_major as seen at build time 00220 @param minor as seen at build time 00221 @param micro as seen at build time 00222 @return 1 success, <=0 might in future become an error indication 00223 */ 00224 int isoburn_libisofs_req(int *major, int *minor, int *micro); 00225 00226 00227 /** The minimum version of libburn to be used with this version of libisoburn 00228 at runtime. This is checked already in isoburn_initialize() which will 00229 refuse on outdated version. So this call is for information purposes after 00230 successful startup only. 00231 @since 0.1.0 00232 @param major isoburn_libburn_req_major as seen at build time 00233 @param minor as seen at build time 00234 @param micro as seen at build time 00235 @return 1 success, <=0 might in future become an error indication 00236 */ 00237 int isoburn_libburn_req(int *major, int *minor, int *micro); 00238 00239 00240 /** These three release version numbers tell the revision of this header file 00241 and of the API it describes. They are memorized by applications at build 00242 time. 00243 @since 0.1.0 00244 */ 00245 #define isoburn_header_version_major 0 00246 #define isoburn_header_version_minor 2 00247 #define isoburn_header_version_micro 2 00248 /** Note: 00249 Above version numbers are also recorded in configure.ac because libtool 00250 wants them as parameters at build time. 00251 For the library compatibility check, ISOBURN_*_VERSION in configure.ac 00252 are not decisive. Only the three numbers here do matter. 00253 */ 00254 /** Usage discussion: 00255 00256 Some developers of the libburnia project have differing 00257 opinions how to ensure the compatibility of libaries 00258 and applications. 00259 00260 It is about whether to use at compile time and at runtime 00261 the version numbers isoburn_header_version_* provided here. 00262 Thomas Schmitt advises to use them. 00263 Vreixo Formoso advises to use other means. 00264 00265 At compile time: 00266 00267 Vreixo Formoso advises to leave proper version matching 00268 to properly programmed checks in the the application's 00269 build system, which will eventually refuse compilation. 00270 00271 Thomas Schmitt advises to use the macros defined here 00272 for comparison with the application's requirements of 00273 library revisions and to eventually break compilation. 00274 00275 Both advises are combinable. I.e. be master of your 00276 build system and have #if checks in the source code 00277 of your application, nevertheless. 00278 00279 At runtime (via *_is_compatible()): 00280 00281 Vreixo Formoso advises to compare the application's 00282 requirements of library revisions with the runtime 00283 library. This is to allow runtime libraries which are 00284 young enough for the application but too old for 00285 the lib*.h files seen at compile time. 00286 00287 Thomas Schmitt advises to compare the header 00288 revisions defined here with the runtime library. 00289 This is to enforce a strictly monotonous chain 00290 of revisions from app to header to library, 00291 at the cost of excluding some older libraries. 00292 00293 These two advises are mutually exclusive. 00294 00295 ----------------------------------------------------- 00296 00297 For an implementation of the Thomas Schmitt approach, 00298 see libisoburn/burn_wrap.c : isoburn_initialize() 00299 This connects libisoburn as "application" with libisofs 00300 as "library". 00301 00302 The compatible part of Vreixo Formoso's approach is implemented 00303 in configure.ac LIBBURN_REQUIRED, LIBISOFS_REQUIRED. 00304 In isoburn_initialize() it would rather test by 00305 iso_lib_is_compatible(isoburn_libisofs_req_major,... 00306 than by 00307 iso_lib_is_compatible(iso_lib_header_version_major,... 00308 and would leave out the ugly compile time traps. 00309 00310 */ 00311 00312 00313 /** Announce to the library an application provided method for immediate 00314 delivery of messages. It is used when no drive is affected directly or 00315 if the drive has no own msgs_submit() method attached by 00316 isoburn_drive_set_msgs_submit. 00317 If no method is preset or if the method is set to NULL then libisoburn 00318 delivers its messages through the message queue of libburn. 00319 @param msgs_submit The function call which implements the method 00320 @param submit_handle Handle to be used as first argument of msgs_submit 00321 @param submit_flag Flag to be used as last argument of msgs_submit 00322 @param flag Unused yet, submit 0 00323 @since 0.2.0 00324 */ 00325 int isoburn_set_msgs_submit(int (*msgs_submit)(void *handle, int error_code, 00326 char msg_text[], int os_errno, 00327 char severity[], int flag), 00328 void *submit_handle, int submit_flag, int flag); 00329 00330 00331 /** Aquire a target drive by its filesystem path resp. libburn persistent 00332 address. 00333 Wrapper for: burn_drive_scan_and_grab() 00334 @since 0.1.0 00335 @param drive_infos On success returns a one element array with the drive 00336 (cdrom/burner). Thus use with driveno 0 only. On failure 00337 the array has no valid elements at all. 00338 The returned array should be freed via burn_drive_info_free() 00339 when the drive is no longer needed. 00340 @param adr The persistent address of the desired drive. 00341 @param load 1 attempt to load the disc tray. 0 no attempt,rather failure. 00342 @return 1 = success , 0 = drive not found , <0 = other error 00343 */ 00344 int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], 00345 char* adr, int load); 00346 00347 00348 /** Aquire a target drive by its filesystem path resp. libburn persistent 00349 address. This is a modern successor of isoburn_drive_scan_and_grab(). 00350 Wrapper for: burn_drive_scan_and_grab() 00351 @since 0.1.2 00352 @param drive_infos On success returns a one element array with the drive 00353 (cdrom/burner). Thus use with driveno 0 only. On failure 00354 the array has no valid elements at all. 00355 The returned array should be freed via burn_drive_info_free() 00356 when the drive is no longer needed. 00357 @param adr The persistent address of the desired drive. 00358 @param flag bit0= attempt to load the disc tray. 00359 Else: failure if not loaded. 00360 bit1= regard overwriteable media as blank 00361 bit2= if the drive is a regular disk file: truncate it to 00362 the write start address 00363 bit3= if the drive reports a read-only profile try to read 00364 table of content by scanning for ISO image headers. 00365 (depending on media type and drive this might 00366 help or it might make the resulting toc even worse) 00367 @return 1 = success , 0 = drive not found , <0 = other error 00368 */ 00369 int isoburn_drive_aquire(struct burn_drive_info *drive_infos[], 00370 char* adr, int flag); 00371 00372 /** Aquire a drive from the burn_drive_info[] array which was obtained by 00373 a previous call of burn_drive_scan(). 00374 Wrapper for: burn_drive_grab() 00375 @since 0.1.0 00376 @param drive The drive to grab. E.g. drive_infos[1].drive . 00377 @param load 1 attempt to load the disc tray. 0 no attempt, rather failure. 00378 @return 1 success, <=0 failure 00379 */ 00380 int isoburn_drive_grab(struct burn_drive *drive, int load); 00381 00382 00383 /** Attach to a drive an application provided method for immediate 00384 delivery of messages. 00385 If no method is set or if the method is set to NULL then libisoburn 00386 delivers messages of the drive through the global msgs_submit() method 00387 set by isoburn_set_msgs_submiti() or by the message queue of libburn. 00388 @since 0.2.0 00389 @param d The drive to which this function, handle and flag shall apply 00390 @param msgs_submit The function call which implements the method 00391 @param submit_handle Handle to be used as first argument of msgs_submit 00392 @param submit_flag Flag to be used as last argument of msgs_submit 00393 @param flag Unused yet, submit 0 00394 */ 00395 int isoburn_drive_set_msgs_submit(struct burn_drive *d, 00396 int (*msgs_submit)(void *handle, int error_code, 00397 char msg_text[], int os_errno, 00398 char severity[], int flag), 00399 void *submit_handle, int submit_flag, int flag); 00400 00401 00402 /** Inquire the media status. Expect the whole spectrum of libburn BURN_DISC_* 00403 with multi-session media. Emulated states with random access media are 00404 BURN_DISC_BLANK and BURN_DISC_APPENDABLE. 00405 Wrapper for: burn_disc_get_status() 00406 @since 0.1.0 00407 @param drive The drive to inquire. 00408 @return The status of the drive, or what kind of disc is in it. 00409 Note: BURN_DISC_UNGRABBED indicates wrong API usage 00410 */ 00411 enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive); 00412 00413 00414 /** Tells whether the media can be treated by isoburn_disc_erase(). 00415 Wrapper for: burn_disc_erasable() 00416 @since 0.1.0 00417 @param drive The drive to inquire. 00418 @return 0=not erasable , else erasable 00419 */ 00420 int isoburn_disc_erasable(struct burn_drive *d); 00421 00422 00423 /** Mark the media as blank. With multi-session media this will call 00424 burn_disc_erase(). With random access media, an eventual ISO-9660 00425 filesystem will get invalidated by altering its start blocks on media. 00426 In case of success, the media is in status BURN_DISC_BLANK afterwards. 00427 Wrapper for: burn_disc_erase() 00428 @since 0.1.0 00429 @param drive The drive with the media to erase. 00430 @param fast 1=fast erase, 0=thorough erase 00431 With DVD-RW, fast erase yields media incapable of multi-session. 00432 */ 00433 void isoburn_disc_erase(struct burn_drive *drive, int fast); 00434 00435 00436 /** Set up isoburn_disc_get_msc1() to return a fabricated value. 00437 This makes only sense between aquiring the drive and reading the 00438 image. After isoburn_read_image() it will confuse the coordination 00439 of libisoburn and libisofs. 00440 Note: Sessions and tracks are counted beginning with 1, not with 0. 00441 @since 0.1.6 00442 @param drive The drive where msc1 is to be set 00443 @param adr_mode Determines how to interpret adr_value and to set msc1. 00444 If adr_value shall represent a number then decimal ASCII 00445 digits are expected. 00446 0= start lba of last session in TOC, ignore adr_value 00447 1= start lba of session number given by adr_value 00448 2= start lba of track given number by adr_value 00449 3= adr_value itself is the lba to be used 00450 4= start lba of last session with volume id 00451 given by adr_value 00452 @parm adr_value A string describing the value to be eventually used. 00453 @param flag Bitfield for control purposes. 00454 bit0= @since 0.2.2 00455 with adr_mode 3: adr_value might be 16 blocks too high 00456 (e.g. -C stemming from growisofs). Probe for ISO head 00457 at adr_value-16 and eventually adjust setting. 00458 */ 00459 int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, 00460 int flag); 00461 00462 00463 /* ----------------------------------------------------------------------- */ 00464 /* 00465 00466 Wrappers for emulation of TOC on overwriteable media 00467 00468 Media which match the overwriteable usage model lack of a history of sessions 00469 and tracks. libburn will not even hand out a burn_disc object for them and 00470 always declare them blank. libisoburn checks for a valid ISO filesystem 00471 header at LBA 0 and eventually declares them appendable. 00472 Nevertheless one can only determine an upper limit of the size of the overall 00473 image (by isoburn_get_min_start_byte()) but not a list of stored sessions 00474 and their LBAs, as it is possible with true multi-session media. 00475 00476 The following wrappers add the capability to obtain a session and track TOC 00477 from emulated multi-session images on overwriteables if the first session 00478 was written by libisoburn-0.1.6 or later (i.e. with a header copy at LBA 32). 00479 00480 Be aware that the structs emitted by these isoburn calls are not compatible 00481 with the libburn structs. I.e. you may use them only with isoburn_toc_* 00482 calls. 00483 isoburn_toc_disc needs to be freed after use. isoburn_toc_session and 00484 isoburn_toc_track vanish together with their isoburn_toc_disc. 00485 */ 00486 00487 /* Opaque handles to media, session, track */ 00488 struct isoburn_toc_disc; 00489 struct isoburn_toc_session; 00490 struct isoburn_toc_track; 00491 00492 00493 /** Obtain a master handle for the table of content. 00494 This handle governs allocated resources which have to be released by 00495 isoburn_toc_disc_free() when no longer needed. 00496 Wrapper for: burn_drive_get_disc() 00497 @since 0.1.6 00498 @param drive The drive with the media to inspect 00499 @return NULL in case there is no content info, else it is a valid handle 00500 */ 00501 struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d); 00502 00503 00504 /** Tell the number of 2048 byte blocks covered by the table of content. 00505 Wrapper for: burn_disc_get_sectors() 00506 @since 0.1.6 00507 @param disc The master handle of the media 00508 @return number of blocks, <=0 indicates unknown or unreadable state 00509 */ 00510 int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc); 00511 00512 00513 /** Get the array of session handles from the table of content. 00514 Wrapper for: burn_disc_get_sessions() 00515 @since 0.1.6 00516 @param disc The master handle of the media 00517 @param num returns the number of sessions in the array 00518 @return the address of the array of session handles 00519 */ 00520 struct isoburn_toc_session **isoburn_toc_disc_get_sessions( 00521 struct isoburn_toc_disc *disc, int *num); 00522 00523 00524 /** Tell the number of 2048 byte blocks covered by a particular session. 00525 Wrapper for: burn_session_get_sectors() 00526 @since 0.1.6 00527 @param s The session handle 00528 @return number of blocks, <=0 indicates unknown or unreadable state 00529 */ 00530 int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s); 00531 00532 00533 /** Obtain a copy of the entry which describes the end of a particular session. 00534 Wrapper for: burn_session_get_leadout_entry() 00535 @since 0.1.6 00536 @param s The session handle 00537 @param entry A pointer to memory provided by the caller. It will be filled 00538 with info according to struct burn_toc_entry as defined 00539 in libburn.h 00540 */ 00541 void isoburn_toc_session_get_leadout_entry(struct isoburn_toc_session *s, 00542 struct burn_toc_entry *entry); 00543 00544 00545 /** Get the array of track handles from a particular session. 00546 Wrapper for: burn_session_get_tracks() 00547 @since 0.1.6 00548 @param s The session handle 00549 @param num returns the number of tracks in the array 00550 @return the address of the array of track handles 00551 */ 00552 struct isoburn_toc_track **isoburn_toc_session_get_tracks( 00553 struct isoburn_toc_session *s, int *num); 00554 00555 00556 /** Obtain a copy of the entry which describes a particular itrack. 00557 Wrapper for: burn_track_get_entry() 00558 @since 0.1.6 00559 @param s The track handle 00560 @param entry A pointer to memory provided by the caller. It will be filled 00561 with info according to struct burn_toc_entry as defined 00562 in libburn.h 00563 */ 00564 void isoburn_toc_track_get_entry(struct isoburn_toc_track *t, 00565 struct burn_toc_entry *entry); 00566 00567 00568 /** Release the memory associated with a master handle of media. 00569 The handle is invalid afterwards and may not be used any more. 00570 Wrapper for: burn_disc_free() 00571 @since 0.1.6 00572 @param disc The master handle of the media 00573 */ 00574 void isoburn_toc_disc_free(struct isoburn_toc_disc *disc); 00575 00576 00577 /** Try whether the data at the given address look like a ISO 9660 00578 image header and obtain its alleged size. Depending on the info mode 00579 one other string of text information can be retrieved too. 00580 @since 0.1.6 00581 @param drive The drive with the media to inspect 00582 @param lba The block number from where to read 00583 @param image_blocks The number of 2048 bytes blocks 00584 @param info Caller provided memory, enough to take eventual info reply 00585 @param flag bit0-7: info return mode 00586 0= do not return anything in info (do not even touch it) 00587 1= copy volume id to info (info needs 33 bytes) 00588 2= @since 0.2.2 : 00589 copy 64 kB header to info (needs 65536 bytes) 00590 bit13= @since 0.2.2: 00591 do not read head from media but use first 64 kB from info 00592 bit14= check both half buffers (not only second) 00593 return 2 if found in first block 00594 bit15= return-1 on read error 00595 @return >0 seems to be a valid ISO image, 0 format not recognized, <0 error 00596 */ 00597 int isoburn_read_iso_head(struct burn_drive *d, int lba, 00598 int *image_blocks, char *info, int flag); 00599 00600 00601 /* ----------------------------------------------------------------------- */ 00602 /* 00603 00604 Options for image reading. 00605 00606 An application shall create an option set object by isoburn_ropt_new(), 00607 program it by isoburn_ropt_set_*(), use it with isoburn_read_image(), 00608 and finally delete it by isoburn_ropt_destroy(). 00609 00610 */ 00611 /* ----------------------------------------------------------------------- */ 00612 00613 struct isoburn_read_opts; 00614 00615 /** Produces a set of image read options, initialized with default values. 00616 @since 0.1.0 00617 @param o the newly created option set object 00618 @param flag Bitfield for control purposes. Submit 0 for now. 00619 @return 1=ok , <0 = failure 00620 */ 00621 int isoburn_ropt_new(struct isoburn_read_opts **o, int flag); 00622 00623 00624 /** Deletes an option set which was created by isoburn_ropt_new(). 00625 @since 0.1.0 00626 @param o The option set to work on 00627 @param flag Bitfield for control purposes. Submit 0 for now. 00628 @return 1= **o destroyed , 0= *o was already NULL (harmless) 00629 */ 00630 int isoburn_ropt_destroy(struct isoburn_read_opts **o, int flag); 00631 00632 00633 /** Which existing ISO 9660 extensions in the image to read or not to read. 00634 Whether to read the content of an existing image at all. 00635 The bits can be combined by | resp. inquired by &. 00636 @since 0.1.0 00637 @param ext Bitfield: 00638 bit0= norock 00639 Do not read Rock Ridge extensions 00640 bit1= nojoliet 00641 Do not read Joliet extensions 00642 bit2= noiso1999 00643 Do not read ISO 9660:1999 enhanced tree 00644 bit3= preferjoliet 00645 When both Joliet and RR extensions are present, the RR 00646 tree is used. If you prefer using Joliet, set this to 1. 00647 bit4= pretend_blank 00648 Always create empty image.Ignore any image on input drive. 00649 @return 1 success, <=0 failure 00650 */ 00651 #define isoburn_ropt_norock 1 00652 #define isoburn_ropt_nojoliet 2 00653 #define isoburn_ropt_noiso1999 4 00654 #define isoburn_ropt_preferjoliet 8 00655 #define isoburn_ropt_pretend_blank 16 00656 int isoburn_ropt_set_extensions(struct isoburn_read_opts *o, int ext); 00657 int isoburn_ropt_get_extensions(struct isoburn_read_opts *o, int *ext); 00658 00659 00660 /** Default attributes to use if no RockRidge extension gets loaded. 00661 @since 0.1.0 00662 @param o The option set to work on 00663 @param uid user id number (see /etc/passwd) 00664 @param gid group id number (see /etc/group) 00665 @param mode permissions (not file type) as of man 2 stat. 00666 With directories, r-permissions will automatically imply 00667 x-permissions. See isoburn_ropt_set_default_dirperms() below. 00668 @return 1 success, <=0 failure 00669 */ 00670 int isoburn_ropt_set_default_perms(struct isoburn_read_opts *o, 00671 uid_t uid, gid_t gid, mode_t mode); 00672 int isoburn_ropt_get_default_perms(struct isoburn_read_opts *o, 00673 uid_t *uid, gid_t *gid, mode_t *mode); 00674 00675 /** Default attributes to use on directories if no RockRidge extension 00676 gets loaded. 00677 Above call isoburn_ropt_set_default_perms() automatically adds 00678 x-permissions to r-permissions for directories. This call here may 00679 be done afterwards to set independend permissions for directories, 00680 especially to override the automatically added x-permissions. 00681 @since 0.1.0 00682 @param o The option set to work on 00683 @param mode permissions (not file type) as of man 2 stat. 00684 @return 1 success, <=0 failure 00685 */ 00686 int isoburn_ropt_set_default_dirperms(struct isoburn_read_opts *o, 00687 mode_t mode); 00688 int isoburn_ropt_get_default_dirperms(struct isoburn_read_opts *o, 00689 mode_t *mode); 00690 00691 00692 00693 /** Set the character set for reading RR file names from ISO images. 00694 @since 0.1.0 00695 @param o The option set to work on 00696 @param input_charset Set this to NULL to use the default locale charset. 00697 For selecting a particular character set, submit its 00698 name, e.g. as listed by program iconv -l. 00699 Example: "UTF-8". 00700 @return 1 success, <=0 failure 00701 */ 00702 int isoburn_ropt_set_input_charset(struct isoburn_read_opts *o, 00703 char *input_charset); 00704 int isoburn_ropt_get_input_charset(struct isoburn_read_opts *o, 00705 char **input_charset); 00706 00707 00708 /** After calling function isoburn_read_image() there are informations 00709 available in the option set. 00710 This info can be obtained as bits in parameter has_what. Like: 00711 joliet_available = (has_what & isoburn_ropt_has_joliet); 00712 @since 0.1.0 00713 @param o The option set to work on 00714 @param size Number of image data blocks, 2048 bytes each. 00715 @param has_what Bitfield: 00716 bit0= has_rockridge 00717 RockRidge extension info is available (POSIX filesystem) 00718 bit1= has_joliet 00719 Joliet extension info is available (suitable for MS-Windows) 00720 bit2= has_iso1999 00721 ISO version 2 Enhanced Volume Descriptor is available. 00722 This is rather exotic. 00723 bit3= has_el_torito 00724 El-Torito boot record is present 00725 @return 1 success, <=0 failure 00726 */ 00727 #define isoburn_ropt_has_rockridge 1 00728 #define isoburn_ropt_has_joliet 2 00729 #define isoburn_ropt_has_iso1999 4 00730 #define isoburn_ropt_has_el_torito 8 00731 int isoburn_ropt_get_size_what(struct isoburn_read_opts *o, 00732 uint32_t *size, int *has_what); 00733 00734 00735 /* ----------------------------------------------------------------------- */ 00736 /* End of Options for image reading */ 00737 /* ----------------------------------------------------------------------- */ 00738 00739 /* ----------------------------------------------------------------------- */ 00740 /* 00741 00742 Options for image generation by libisofs and image transport to libburn. 00743 00744 An application shall create an option set by isoburn_igopt_new(), 00745 program it by isoburn_igopt_set_*(), use it with either 00746 isoburn_prepare_new_image() or isoburn_prepare_disc(), and finally delete 00747 it by isoburn_igopt_destroy(). 00748 00749 */ 00750 /* ----------------------------------------------------------------------- */ 00751 00752 struct isoburn_imgen_opts; 00753 00754 /** Produces a set of generation and transfer options, initialized with default 00755 values. 00756 @since 0.1.0 00757 @param o the newly created option set object 00758 @param flag Bitfield for control purposes. Submit 0 for now. 00759 @return 1=ok , <0 = failure 00760 */ 00761 int isoburn_igopt_new(struct isoburn_imgen_opts **o, int flag); 00762 00763 00764 /** Deletes an option set which was created by isoburn_igopt_new(). 00765 @since 0.1.0 00766 @param o The option set to give up 00767 @param flag Bitfield for control purposes. Submit 0 for now. 00768 @return 1= **o destroyed , 0= *o was already NULL (harmless) 00769 */ 00770 int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag); 00771 00772 00773 /** ISO level to write at. 00774 @since 0.1.0 00775 @param o The option set to work on 00776 @param level is a term of the ISO 9660 standard. It should be one of: 00777 1= filenames restricted to form 8.3 00778 2= filenames allowed up to 31 characters 00779 @return 1 success, <=0 failure 00780 */ 00781 int isoburn_igopt_set_level(struct isoburn_imgen_opts *o, int level); 00782 int isoburn_igopt_get_level(struct isoburn_imgen_opts *o, int *level); 00783 00784 00785 /** Which extensions to support. 00786 @since 0.1.0 00787 @param o The option set to work on 00788 @param ext Bitfield: 00789 bit0= rockridge 00790 Rock Ridge extensions add POSIX file attributes like 00791 owner, group, access permissions, long filenames. Very 00792 advisable if the designed audience has Unix style systems. 00793 bit1= joliet 00794 Longer filenames for Windows systems. 00795 Weaker than RockRidge, but also readable with Linux. 00796 bit2= iso1999 00797 This is rather exotic. Better do not surprise the readers. 00798 @return 1 success, <=0 failure 00799 */ 00800 #define isoburn_igopt_rockridge 1 00801 #define isoburn_igopt_joliet 2 00802 #define isoburn_igopt_iso1999 4 00803 int isoburn_igopt_set_extensions(struct isoburn_imgen_opts *o, int ext); 00804 int isoburn_igopt_get_extensions(struct isoburn_imgen_opts *o, int *ext); 00805 00806 /** Relaxed constraints. Setting any of the bits to 1 break the specifications, 00807 but it is supposed to work on most moderns systems. Use with caution. 00808 @since 0.1.0 00809 @param o The option set to work on 00810 @param relax Bitfield: 00811 bit0= omit_version_numbers 00812 Omit the version number (";1") at the end of the 00813 ISO-9660 identifiers. Version numbers are usually 00814 not used. 00815 bit1= allow_deep_paths 00816 Allow ISO-9660 directory hierarchy to be deeper 00817 than 8 levels. 00818 bit2= allow_longer_paths 00819 Allow path in the ISO-9660 tree to have more than 00820 255 characters. 00821 bit3= max_37_char_filenames 00822 Allow a single file or directory hierarchy to have 00823 up to 37 characters. This is larger than the 31 00824 characters allowed by ISO level 2, and the extra space 00825 is taken from the version number, so this also forces 00826 omit_version_numbers. 00827 bit4= no_force_dots 00828 ISO-9660 forces filenames to have a ".", that separates 00829 file name from extension. libisofs adds it if original 00830 filename has none. Set this to 1 to prevent this 00831 behavior. 00832 bit5= allow_lowercase 00833 Allow lowercase characters in ISO-9660 filenames. 00834 By default, only uppercase characters, numbers and 00835 a few other characters are allowed. 00836 bit6= allow_full_ascii 00837 Allow all ASCII characters to be appear on an ISO-9660 00838 filename. Note * that "/" and "\0" characters are never 00839 allowed, even in RR names. 00840 bit7= joliet_longer_paths 00841 Allow paths in the Joliet tree to have more than 00842 240 characters. 00843 @return 1 success, <=0 failure 00844 */ 00845 #define isoburn_igopt_omit_version_numbers 1 00846 #define isoburn_igopt_allow_deep_paths 2 00847 #define isoburn_igopt_allow_longer_paths 4 00848 #define isoburn_igopt_max_37_char_filenames 8 00849 #define isoburn_igopt_no_force_dots 16 00850 #define isoburn_igopt_allow_lowercase 32 00851 #define isoburn_igopt_allow_full_ascii 64 00852 #define isoburn_igopt_joliet_longer_paths 128 00853 int isoburn_igopt_set_relaxed(struct isoburn_imgen_opts *o, int relax); 00854 int isoburn_igopt_get_relaxed(struct isoburn_imgen_opts *o, int *relax); 00855 00856 00857 /** Whether and how files should be sorted. 00858 @since 0.1.0 00859 @param o The option set to work on 00860 @param value Bitfield: bit0= sort_files_by_weight 00861 files should be sorted based on their weight. 00862 Weight is attributed to files in the image 00863 by libisofs call iso_node_set_sort_weight(). 00864 @return 1 success, <=0 failure 00865 */ 00866 #define isoburn_igopt_sort_files_by_weight 1 00867 int isoburn_igopt_set_sort_files(struct isoburn_imgen_opts *o, int value); 00868 int isoburn_igopt_get_sort_files(struct isoburn_imgen_opts *o, int *value); 00869 00870 00871 /** Set the override values for files and directory permissions. 00872 The parameters replace_* these take one of three values: 0, 1 or 2. 00873 If 0, the corresponding attribute will be kept as set in the IsoNode 00874 at the time of image generation. 00875 If set to 1, the corresponding attrib. will be changed by a default 00876 suitable value. 00877 With value 2, the attrib. will be changed with the value specified 00878 in the corresponding *_mode options. Note that only the permissions 00879 are set, the file type remains unchanged. 00880 @since 0.1.0 00881 @param o The option set to work on 00882 @param replace_dir_mode whether and how to override directories 00883 @param replace_file_mode whether and how to override files of other type 00884 @param dir_mode Mode to use on dirs with replace_dir_mode == 2. 00885 @param file_mode; Mode to use on files with replace_file_mode == 2. 00886 @return 1 success, <=0 failure 00887 */ 00888 int isoburn_igopt_set_over_mode(struct isoburn_imgen_opts *o, 00889 int replace_dir_mode, int replace_file_mode, 00890 mode_t dir_mode, mode_t file_mode); 00891 int isoburn_igopt_get_over_mode(struct isoburn_imgen_opts *o, 00892 int *replace_dir_mode, int *replace_file_mode, 00893 mode_t *dir_mode, mode_t *file_mode); 00894 00895 /** Set the override values values for group id and user id. 00896 The rules are like with above overriding of mode values. replace_* controls 00897 whether and how. The other two parameters provide values for eventual use. 00898 @since 0.1.0 00899 @param o The option set to work on 00900 @param replace_uid whether and how to override user ids 00901 @param replace_gid whether and how to override group ids 00902 @param uid User id to use with replace_uid == 2. 00903 @param gid Group id to use on files with replace_gid == 2. 00904 @return 1 success, <=0 failure 00905 */ 00906 int isoburn_igopt_set_over_ugid(struct isoburn_imgen_opts *o, 00907 int replace_uid, int replace_gid, 00908 uid_t uid, gid_t gid); 00909 int isoburn_igopt_get_over_ugid(struct isoburn_imgen_opts *o, 00910 int *replace_uid, int *replace_gid, 00911 uid_t *uid, gid_t *gid); 00912 00913 /** Set the charcter set to use for representing filenames in the image. 00914 @since 0.1.0 00915 @param o The option set to work on 00916 @param output_charset Set this to NULL to use the default output charset. 00917 For selecting a particular character set, submit its 00918 name, e.g. as listed by program iconv -l. 00919 Example: "UTF-8". 00920 @return 1 success, <=0 failure 00921 */ 00922 int isoburn_igopt_set_out_charset(struct isoburn_imgen_opts *o, 00923 char *output_charset); 00924 int isoburn_igopt_get_out_charset(struct isoburn_imgen_opts *o, 00925 char **output_charset); 00926 00927 00928 /** The number of bytes to be used for the fifo which decouples libisofs 00929 and libburn for better throughput and for reducing the risk of 00930 interrupting signals hitting the libburn thread which operates the 00931 MMC drive. 00932 The size will be rounded up to the next full 2048. 00933 Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway). 00934 @since 0.1.0 00935 @param o The option set to work on 00936 @param fifo_size Number of bytes to use 00937 @return 1 success, <=0 failure 00938 */ 00939 int isoburn_igopt_set_fifo_size(struct isoburn_imgen_opts *o, int fifo_size); 00940 int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size); 00941 00942 00943 /** Obtain after image preparation the block address where the session will 00944 start on media. 00945 This value cannot be set by the application but only be inquired. 00946 @since 0.1.4 00947 @param o The option set to work on 00948 @param lba The block number of the session start on media. 00949 <0 means that no address has been determined yet. 00950 @return 1 success, <=0 failure 00951 */ 00952 int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba); 00953 00954 00955 /* ----------------------------------------------------------------------- */ 00956 /* End of Options for image generation */ 00957 /* ----------------------------------------------------------------------- */ 00958 00959 00960 /** Get the image attached to a drive, if any. 00961 @since 0.1.0 00962 @param d The drive to inquire 00963 @return A reference to attached image, or NULL if the drive has no image 00964 attached. This reference needs to be released via iso_image_unref() 00965 when it is not longer needed. 00966 */ 00967 IsoImage *isoburn_get_attached_image(struct burn_drive *d); 00968 00969 00970 /** Load the ISO filesystem directory tree from the media in the given drive. 00971 This will give libisoburn the base on which it can let libisofs perform 00972 image growing or image modification. The loaded volset gets attached 00973 to the drive object and handed out to the application. 00974 Not a wrapper, but peculiar to libisoburn. 00975 @since 0.1.0 00976 @param d The drive which holds an existing ISO filesystem or blank media. 00977 d is allowed to be NULL which produces an empty ISO image. In 00978 this case one has to call before writing isoburn_attach_volset() 00979 with the volset from this call and with the intended output 00980 drive. 00981 @param read_opts The read options which can be chosen by the application 00982 @param image the image read, if the disc is blank it will have no files. 00983 This reference needs to be released via iso_image_unref() when 00984 it is not longer needed. The drive, if not NULL, will hold an 00985 own reference which it will release when it gets a new volset 00986 or when it gets released via isoburn_drive_release(). 00987 You can pass NULL if you already have a reference or you plan to 00988 obtain it later with isoburn_get_attached_image(). Of course, if 00989 you haven't specified a valid drive (i.e., if d == NULL), this 00990 parameter can't be NULL. 00991 @return <=0 error , 1 = success 00992 */ 00993 int isoburn_read_image(struct burn_drive *d, 00994 struct isoburn_read_opts *read_opts, 00995 IsoImage **image); 00996 00997 /** Set a callback function for producing pacifier messages during the lengthy 00998 process of image reading. The callback function and the application handle 00999 are stored until they are needed for the underlying call to libisofs. 01000 Other than with libisofs the handle is managed entirely by the application. 01001 An idle .free() function is exposed to libisofs. The handle has to stay 01002 valid until isoburn_read_image() is done. It has to be detached by 01003 isoburn_set_read_pacifier(drive, NULL, NULL); 01004 before it may be removed from memory. 01005 @since 0.1.0 01006 @param drive The drive which will be used with isoburn_read_image() 01007 It has to be aquired by an isoburn_* wrapper call. 01008 @param read_pacifier The callback function 01009 @param app_handle The app handle which the callback function can obtain 01010 via iso_image_get_attached_data() from its IsoImage* 01011 @return 1 success, <=0 failure 01012 */ 01013 int isoburn_set_read_pacifier(struct burn_drive *drive, 01014 int (*read_pacifier)(IsoImage*, IsoFileSource*), 01015 void *app_handle); 01016 01017 01018 /** Set the IsoImage to be used with a drive. This eventually releases 01019 the reference to the old IsoImage attached to the drive. 01020 Caution: Use with care. It hardly makes sense to replace an image that 01021 reflects a valid ISO image on media. 01022 This call is rather intended for writing a newly created and populated 01023 image to blank media. The use case in xorriso is to let an image survive 01024 the change or demise of the outdev target drive. 01025 @since 0.1.0 01026 @param d The drive which shall be write target of the volset. 01027 @param image The image that represents the image to be written. 01028 This image pointer MUST already be a valid reference suitable 01029 for iso_image_unref(). 01030 It may have been obtained by appropriate libisofs calls or by 01031 isoburn_read_image() with d==NULL. 01032 @return <=0 error , 1 = success 01033 */ 01034 int isoburn_attach_image(struct burn_drive *d, IsoImage *image); 01035 01036 01037 /** Return the best possible estimation of the currently available capacity of 01038 the media. This might depend on particular write option settings and on 01039 drive state. 01040 An eventual start address for emulated multi-session will be subtracted 01041 from the capacity estimation given by burn_disc_available_space(). 01042 Negative results get defaulted to 0. 01043 Wrapper for: burn_disc_available_space() 01044 @since 0.1.0 01045 @param d The drive to query. 01046 @param o If not NULL: write parameters to be set on drive before query 01047 @return number of most probably available free bytes 01048 */ 01049 off_t isoburn_disc_available_space(struct burn_drive *d, 01050 struct burn_write_opts *o); 01051 01052 01053 /** Obtain the start block number of the most recent session on media. In 01054 case of random access media this will always be 0. Succesfull return is 01055 not a guarantee that there is a ISO-9660 image at all. The call will fail, 01056 nevertheless,if isoburn_disc_get_status() returns not BURN_DISC_APPENDABLE. 01057 Note: The result of this call may be fabricated by a previous call of 01058 isoburn_set_msc1() which can override the rule to load the most recent 01059 session. 01060 Wrapper for: burn_disc_get_msc1() 01061 @since 0.1.0 01062 @param d The drive to inquire 01063 @param start_lba Contains on success the start address in 2048 byte blocks 01064 @return <=0 error , 1 = success 01065 */ 01066 int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba); 01067 01068 01069 /** Use this with trackno==0 to obtain the predicted start block number of the 01070 new session. The interesting number is returned in parameter nwa. 01071 Wrapper for: burn_disc_track_lba_nwa() 01072 @since 0.1.0 01073 @param d The drive to inquire 01074 @param o If not NULL: write parameters to be set on drive before query 01075 @param trackno Submit 0. 01076 @param lba return value: start lba 01077 @param nwa return value: Next Writeable Address 01078 @return 1=nwa is valid , 0=nwa is not valid , -1=error 01079 */ 01080 int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o, 01081 int trackno, int *lba, int *nwa); 01082 01083 01084 /** Obtain the size which was attributed to an emulated appendable on actually 01085 overwriteable media. This value is supposed to be <= 2048 * nwa as of 01086 isoburn_disc_track_lba_nwa(). 01087 @since 0.1.0 01088 @param drive The drive holding the media. 01089 @param start_byte The reply value counted in bytes, not in sectors. 01090 @param flag Unused yet. Submit 0. 01091 @return 1=stat_byte is valid, 0=not an emulated appendable, -1=error 01092 */ 01093 int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte, 01094 int flag); 01095 01096 01097 /** To choose the expansion method of Growing: 01098 Create a disc object for writing the new session from the created or loaded 01099 iso_volset which has been manipulated via libisofs, to the same media from 01100 where the image was eventually loaded. This struct burn_disc is ready for 01101 use by a subsequent call to isoburn_disc_write(). 01102 After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE 01103 again, the burn_disc object has to be disposed by burn_disc_free(). 01104 @since 0.1.0 01105 @param drive The combined source and target drive, grabbed with 01106 isoburn_drive_scan_and_grab(). . 01107 @param disc Returns the newly created burn_disc object. 01108 @param opts Image generation options, see isoburn_igopt_*() 01109 @return <=0 error , 1 = success 01110 */ 01111 int isoburn_prepare_disc(struct burn_drive *drive, struct burn_disc **disc, 01112 struct isoburn_imgen_opts *opts); 01113 01114 01115 /** To choose the expansion method of Modifying: 01116 Create a disc object for producing a new image from a previous image 01117 plus the changes made by user. The generated burn_disc is suitable 01118 to be written to a grabbed drive with blank writeable media. 01119 But you must not use the same drive for input and output, because data 01120 will be read from the source drive while at the same time the target 01121 drive is already writing. 01122 The resulting burn_disc object has to be disposed when all its writing 01123 is done and the drive is BURN_DRIVE_IDLE again after asynchronous 01124 burn_disc_write(). 01125 @since 0.1.0 01126 @param in_drive The input drive, grabbed with isoburn_drive_aquire() or 01127 one of its alternatives. 01128 @param disc Returns the newly created burn_disc object. 01129 @param opts Options for image generation and data transport to media. 01130 @param out_drive The output drive, from isoburn_drive_aquire() et.al.. 01131 @return <=0 error , 1 = success 01132 */ 01133 int isoburn_prepare_new_image(struct burn_drive *in_drive, 01134 struct burn_disc **disc, 01135 struct isoburn_imgen_opts *opts, 01136 struct burn_drive *out_drive); 01137 01138 01139 /** To choose the expansion method of Blind Growing: 01140 Create a disc object for writing an add-on session from the created or 01141 loaded IsoImage which has been manipulated via libisofs, to a different 01142 drive than the one from where it was loaded. 01143 Usually output will be stdio:/dev/fd/1 (i.e. stdout) being piped 01144 into some burn program like with this classic gesture: 01145 mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev 01146 Parameter translation into libisoburn: 01147 $dev is the address by which parameter in_drive of this call was aquired 01148 $msc1 was set by isoburn_set_msc1() before image reading 01149 or was detected from the in_drive media 01150 $nwa is a parameter of this call 01151 or can be used as detected from the in_drive media 01152 01153 This call waits for libisofs output to become available and then detaches 01154 the input drive object from the data source object by which libisofs was 01155 reading from the input drive. 01156 So, as far as libisofs is concerned, that drive may be released immediately 01157 after this call in order to allow the consumer to access the drive for 01158 writing. 01159 The consumer should wait for input to become available and only then open 01160 its burn drive. With cdrecord this is caused by option -waiti. 01161 01162 The resulting burn_disc object has to be disposed when all its writing 01163 is done and the drive is BURN_DRIVE_IDLE again after asynchronous 01164 burn_disc_write(). 01165 @since 0.2.2 01166 @param in_drive The input drive,grabbed with isoburn_drive_scan_and_grab(). 01167 @param disc Returns the newly created burn_disc object. 01168 @param opts Options for image generation and data transport to media. 01169 @param out_drive The output drive, from isoburn_drive_aquire() et.al.. 01170 typically stdio:/dev/fd/1 . 01171 @param nwa The address (2048 byte block count) where the add-on 01172 session will be finally stored on a mountable media 01173 or in a mountable file. 01174 If nwa is -1 then the address is used as determined from 01175 the in_drive media. 01176 @return <=0 error , 1 = success 01177 */ 01178 int isoburn_prepare_blind_grow(struct burn_drive *d, struct burn_disc **disc, 01179 struct isoburn_imgen_opts *opts, 01180 struct burn_drive *out_drive, int nwa); 01181 01182 01183 /** 01184 Revoke isoburn_prepare_new_image() or isoburn_prepare_disc() instead of 01185 running isoburn_disc_write(). 01186 libisofs reserves resources and maybe already starts generating the 01187 image stream when one of above two calls is performed. It is mandatory to 01188 either run isoburn_disc_write() or to revoke the preparations by the 01189 call described here. 01190 @since 0.1.0 01191 @param input_drive The drive resp. in_drive which was used with the 01192 preparation call. 01193 @param output_drive The out_drive used with isoburn_prepare_new_image(), 01194 NULL if none. 01195 @param flag Bitfield, submit 0 for now. 01196 bit0= -reserved for internal use- 01197 @return <0 error, 0= no pending preparations detectable, 1 = canceled 01198 */ 01199 int isoburn_cancel_prepared_write(struct burn_drive *input_drive, 01200 struct burn_drive *output_drive, int flag); 01201 01202 01203 /** Start writing of the new session. 01204 This call is asynchrounous. I.e. it returns quite soon and the progress has 01205 to be watched by a loop with call burn_drive_get_status() until 01206 BURN_DRIVE_IDLE is returned. 01207 Wrapper for: burn_disc_write() 01208 @since 0.1.0 01209 @param o Options which control the burn process. See burnwrite_opts_*() 01210 in libburn.h. 01211 @param disc Disc object created either by isoburn_prepare_disc() or by 01212 isoburn_prepare_new_image(). 01213 */ 01214 void isoburn_disc_write(struct burn_write_opts *o, struct burn_disc *disc); 01215 01216 01217 /** Inquire state and fill parameters of the fifo which is attached to 01218 the emerging track. This should be done in the pacifier loop while 01219 isoburn_disc_write() or burn_disc_write() are active. 01220 This works only with drives obtained by isoburn_drive_scan_and_grab() 01221 or isoburn_drive_grab(). If isoburn_prepare_new_image() was used, then 01222 parameter out_drive must have announced the track output drive. 01223 Hint: If only burn_write_opts and not burn_drive is known, then the drive 01224 can be obtained by burn_write_opts_get_drive(). 01225 @since 0.1.0 01226 @parm d The drive to which the track with the fifo gets burned. 01227 @param size The total size of the fifo 01228 @param free_bytes The current free capacity of the fifo 01229 @param status_text Returns a pointer to a constant text, see below 01230 @return <0 reply invalid, >=0 fifo status code: 01231 bit0+1=input status, bit2=consumption status, i.e: 01232 0="standby" : data processing not started yet 01233 1="active" : input and consumption are active 01234 2="ending" : input has ended without error 01235 3="failing" : input had error and ended, 01236 4="unused" : ( consumption has ended before processing start ) 01237 5="abandoned" : consumption has ended prematurely 01238 6="ended" : consumption has ended without input error 01239 7="aborted" : consumption has ended after input error 01240 */ 01241 int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes, 01242 char **status_text); 01243 01244 01245 /** Inquire whether the most recent write run was successful. 01246 Wrapper for: burn_drive_wrote_well() 01247 @since 0.1.0 01248 @param d The drive to inquire 01249 @return 1=burn seems to have went well, 0=burn failed 01250 */ 01251 int isoburn_drive_wrote_well(struct burn_drive *d); 01252 01253 01254 /** Call this after isoburn_disc_write has finished and burn_drive_wrote_well() 01255 indicates success. It will eventually complete the emulation of 01256 multi-session functionality, if needed at all. Let libisoburn decide. 01257 Not a wrapper, but peculiar to libisoburn. 01258 @since 0.1.0 01259 @param d The output drive to which the session was written 01260 @return 1 success , <=0 failure 01261 */ 01262 int isoburn_activate_session(struct burn_drive *drive); 01263 01264 01265 /** Wait after normal end of operations until libisofs ended all write 01266 threads and freed resource reservations. 01267 This call is not mandatory. But without it, messages from the ending 01268 threads might appear after the application ended its write procedure. 01269 @since 0.1.0 01270 @param input_drive The drive resp. in_drive which was used with the 01271 preparation call. 01272 @param output_drive The out_drive used with isoburn_prepare_new_image(), 01273 NULL if none. 01274 @param flag Bitfield, submit 0 for now. 01275 @return <=0 error , 1 = success 01276 */ 01277 int isoburn_sync_after_write(struct burn_drive *input_drive, 01278 struct burn_drive *output_drive, int flag); 01279 01280 01281 /** Release an aquired drive. 01282 Wrapper for: burn_drive_release() 01283 @since 0.1.0 01284 @param drive The drive to be released 01285 @param eject 1= eject media from drive , 0= do not eject 01286 */ 01287 void isoburn_drive_release(struct burn_drive *drive, int eject); 01288 01289 01290 /** Shutdown all three libraries. 01291 Wrapper for : iso_finish() and burn_finish(). 01292 @since 0.1.0 01293 */ 01294 void isoburn_finish(void); 01295 01296 01297 /* 01298 The following calls are for expert applications only. 01299 An application should have a special reason to use them. 01300 */ 01301 01302 01303 /** Inquire wether the media needs emulation or would be suitable for 01304 generic multi-session via libburn. 01305 @since 0.1.0 01306 @param d The drive to inquire 01307 @return 0 is generic multi-session 01308 1 is emulated multi-session 01309 -1 is not suitable for isoburn 01310 */ 01311 int isoburn_needs_emulation(struct burn_drive *drive); 01312 01313
1.5.6