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 12 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 9 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 3 00247 #define isoburn_header_version_micro 1 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. But before this is done 00340 one has to call isoburn_drive_release(drive_infos[0].drive). 00341 @param adr The persistent address of the desired drive. 00342 @param load 1 attempt to load the disc tray. 0 no attempt,rather failure. 00343 @return 1 = success , 0 = drive not found , <0 = other error 00344 */ 00345 int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], 00346 char* adr, int load); 00347 00348 00349 /** Aquire a target drive by its filesystem path resp. libburn persistent 00350 address. This is a modern successor of isoburn_drive_scan_and_grab(). 00351 Wrapper for: burn_drive_scan_and_grab() 00352 @since 0.1.2 00353 @param drive_infos On success returns a one element array with the drive 00354 (cdrom/burner). Thus use with driveno 0 only. On failure 00355 the array has no valid elements at all. 00356 The returned array should be freed via burn_drive_info_free() 00357 when the drive is no longer needed. But before this is done 00358 one has to call isoburn_drive_release(drive_infos[0].drive). 00359 @param adr The persistent address of the desired drive. 00360 @param flag bit0= attempt to load the disc tray. 00361 Else: failure if not loaded. 00362 bit1= regard overwriteable media as blank 00363 bit2= if the drive is a regular disk file: truncate it to 00364 the write start address 00365 bit3= if the drive reports a read-only profile try to read 00366 table of content by scanning for ISO image headers. 00367 (depending on media type and drive this might 00368 help or it might make the resulting toc even worse) 00369 bit4= do not emulate table of content on overwriteable media 00370 @return 1 = success , 0 = drive not found , <0 = other error 00371 */ 00372 int isoburn_drive_aquire(struct burn_drive_info *drive_infos[], 00373 char* adr, int flag); 00374 00375 /** Aquire a drive from the burn_drive_info[] array which was obtained by 00376 a previous call of burn_drive_scan(). 00377 Wrapper for: burn_drive_grab() 00378 @since 0.1.0 00379 @param drive The drive to grab. E.g. drive_infos[1].drive . 00380 Call isoburn_drive_release(drive) when it it no longer needed. 00381 @param load 1 attempt to load the disc tray. 0 no attempt, rather failure. 00382 @return 1 success, <=0 failure 00383 */ 00384 int isoburn_drive_grab(struct burn_drive *drive, int load); 00385 00386 00387 /** Attach to a drive an application provided method for immediate 00388 delivery of messages. 00389 If no method is set or if the method is set to NULL then libisoburn 00390 delivers messages of the drive through the global msgs_submit() method 00391 set by isoburn_set_msgs_submiti() or by the message queue of libburn. 00392 @since 0.2.0 00393 @param d The drive to which this function, handle and flag shall apply 00394 @param msgs_submit The function call which implements the method 00395 @param submit_handle Handle to be used as first argument of msgs_submit 00396 @param submit_flag Flag to be used as last argument of msgs_submit 00397 @param flag Unused yet, submit 0 00398 */ 00399 int isoburn_drive_set_msgs_submit(struct burn_drive *d, 00400 int (*msgs_submit)(void *handle, int error_code, 00401 char msg_text[], int os_errno, 00402 char severity[], int flag), 00403 void *submit_handle, int submit_flag, int flag); 00404 00405 00406 /** Inquire the media status. Expect the whole spectrum of libburn BURN_DISC_* 00407 with multi-session media. Emulated states with random access media are 00408 BURN_DISC_BLANK and BURN_DISC_APPENDABLE. 00409 Wrapper for: burn_disc_get_status() 00410 @since 0.1.0 00411 @param drive The drive to inquire. 00412 @return The status of the drive, or what kind of disc is in it. 00413 Note: BURN_DISC_UNGRABBED indicates wrong API usage 00414 */ 00415 enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive); 00416 00417 00418 /** Tells whether the media can be treated by isoburn_disc_erase(). 00419 Wrapper for: burn_disc_erasable() 00420 @since 0.1.0 00421 @param drive The drive to inquire. 00422 @return 0=not erasable , else erasable 00423 */ 00424 int isoburn_disc_erasable(struct burn_drive *d); 00425 00426 00427 /** Mark the media as blank. With multi-session media this will call 00428 burn_disc_erase(). With random access media, an eventual ISO-9660 00429 filesystem will get invalidated by altering its start blocks on media. 00430 In case of success, the media is in status BURN_DISC_BLANK afterwards. 00431 Wrapper for: burn_disc_erase() 00432 @since 0.1.0 00433 @param drive The drive with the media to erase. 00434 @param fast 1=fast erase, 0=thorough erase 00435 With DVD-RW, fast erase yields media incapable of multi-session. 00436 */ 00437 void isoburn_disc_erase(struct burn_drive *drive, int fast); 00438 00439 00440 /** Set up isoburn_disc_get_msc1() to return a fabricated value. 00441 This makes only sense between aquiring the drive and reading the 00442 image. After isoburn_read_image() it will confuse the coordination 00443 of libisoburn and libisofs. 00444 Note: Sessions and tracks are counted beginning with 1, not with 0. 00445 @since 0.1.6 00446 @param drive The drive where msc1 is to be set 00447 @param adr_mode Determines how to interpret adr_value and to set msc1. 00448 If adr_value shall represent a number then decimal ASCII 00449 digits are expected. 00450 0= start lba of last session in TOC, ignore adr_value 00451 1= start lba of session number given by adr_value 00452 2= start lba of track given number by adr_value 00453 3= adr_value itself is the lba to be used 00454 4= start lba of last session with volume id 00455 given by adr_value 00456 @param adr_value A string describing the value to be eventually used. 00457 @param flag Bitfield for control purposes. 00458 bit0= @since 0.2.2 00459 with adr_mode 3: adr_value might be 16 blocks too high 00460 (e.g. -C stemming from growisofs). Probe for ISO head 00461 at adr_value-16 and eventually adjust setting. 00462 bit1= insist in seeing a disc object with at least one session 00463 bit2= with adr_mode 4: use adr_value as regular expression 00464 */ 00465 int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, 00466 int flag); 00467 00468 00469 /* ----------------------------------------------------------------------- */ 00470 /* 00471 00472 Wrappers for emulation of TOC on overwriteable media 00473 00474 Media which match the overwriteable usage model lack of a history of sessions 00475 and tracks. libburn will not even hand out a burn_disc object for them and 00476 always declare them blank. libisoburn checks for a valid ISO filesystem 00477 header at LBA 0 and eventually declares them appendable. 00478 Nevertheless one can only determine an upper limit of the size of the overall 00479 image (by isoburn_get_min_start_byte()) but not a list of stored sessions 00480 and their LBAs, as it is possible with true multi-session media. 00481 00482 The following wrappers add the capability to obtain a session and track TOC 00483 from emulated multi-session images on overwriteables if the first session 00484 was written by libisoburn-0.1.6 or later (i.e. with a header copy at LBA 32). 00485 00486 Be aware that the structs emitted by these isoburn calls are not compatible 00487 with the libburn structs. I.e. you may use them only with isoburn_toc_* 00488 calls. 00489 isoburn_toc_disc needs to be freed after use. isoburn_toc_session and 00490 isoburn_toc_track vanish together with their isoburn_toc_disc. 00491 */ 00492 00493 /* Opaque handles to media, session, track */ 00494 struct isoburn_toc_disc; 00495 struct isoburn_toc_session; 00496 struct isoburn_toc_track; 00497 00498 00499 /** Obtain a master handle for the table of content. 00500 This handle governs allocated resources which have to be released by 00501 isoburn_toc_disc_free() when no longer needed. 00502 Wrapper for: burn_drive_get_disc() 00503 @since 0.1.6 00504 @param drive The drive with the media to inspect 00505 @return NULL in case there is no content info, else it is a valid handle 00506 */ 00507 struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d); 00508 00509 00510 /** Tell the number of 2048 byte blocks covered by the table of content. 00511 This number includes the eventual gaps between sessions and tracks. 00512 So this call is not really a wrapper for burn_disc_get_sectors(). 00513 @since 0.1.6 00514 @param disc The master handle of the media 00515 @return number of blocks, <=0 indicates unknown or unreadable state 00516 */ 00517 int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc); 00518 00519 00520 /** Get the array of session handles from the table of content. 00521 Wrapper for: burn_disc_get_sessions() 00522 @since 0.1.6 00523 @param disc The master handle of the media 00524 @param num returns the number of sessions in the array 00525 @return the address of the array of session handles 00526 */ 00527 struct isoburn_toc_session **isoburn_toc_disc_get_sessions( 00528 struct isoburn_toc_disc *disc, int *num); 00529 00530 00531 /** Tell the number of 2048 byte blocks covered by a particular session. 00532 Wrapper for: burn_session_get_sectors() 00533 @since 0.1.6 00534 @param s The session handle 00535 @return number of blocks, <=0 indicates unknown or unreadable state 00536 */ 00537 int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s); 00538 00539 00540 /** Obtain a copy of the entry which describes the end of a particular session. 00541 Wrapper for: burn_session_get_leadout_entry() 00542 @since 0.1.6 00543 @param s The session handle 00544 @param entry A pointer to memory provided by the caller. It will be filled 00545 with info according to struct burn_toc_entry as defined 00546 in libburn.h 00547 */ 00548 void isoburn_toc_session_get_leadout_entry(struct isoburn_toc_session *s, 00549 struct burn_toc_entry *entry); 00550 00551 00552 /** Get the array of track handles from a particular session. 00553 Wrapper for: burn_session_get_tracks() 00554 @since 0.1.6 00555 @param s The session handle 00556 @param num returns the number of tracks in the array 00557 @return the address of the array of track handles 00558 */ 00559 struct isoburn_toc_track **isoburn_toc_session_get_tracks( 00560 struct isoburn_toc_session *s, int *num); 00561 00562 00563 /** Obtain a copy of the entry which describes a particular track. 00564 Wrapper for: burn_track_get_entry() 00565 @since 0.1.6 00566 @param s The track handle 00567 @param entry A pointer to memory provided by the caller. It will be filled 00568 with info according to struct burn_toc_entry as defined 00569 in libburn.h 00570 */ 00571 void isoburn_toc_track_get_entry(struct isoburn_toc_track *t, 00572 struct burn_toc_entry *entry); 00573 00574 00575 /** Release the memory associated with a master handle of media. 00576 The handle is invalid afterwards and may not be used any more. 00577 Wrapper for: burn_disc_free() 00578 @since 0.1.6 00579 @param disc The master handle of the media 00580 */ 00581 void isoburn_toc_disc_free(struct isoburn_toc_disc *disc); 00582 00583 00584 /** Try whether the data at the given address look like a ISO 9660 00585 image header and obtain its alleged size. Depending on the info mode 00586 one other string of text information can be retrieved too. 00587 @since 0.1.6 00588 @param drive The drive with the media to inspect 00589 @param lba The block number from where to read 00590 @param image_blocks The number of 2048 bytes blocks 00591 @param info Caller provided memory, enough to take eventual info reply 00592 @param flag bit0-7: info return mode 00593 0= do not return anything in info (do not even touch it) 00594 1= copy volume id to info (info needs 33 bytes) 00595 2= @since 0.2.2 : 00596 copy 64 kB header to info (needs 65536 bytes) 00597 bit13= @since 0.2.2: 00598 do not read head from media but use first 64 kB from info 00599 bit14= check both half buffers (not only second) 00600 return 2 if found in first block 00601 bit15= return-1 on read error 00602 @return >0 seems to be a valid ISO image, 0 format not recognized, <0 error 00603 */ 00604 int isoburn_read_iso_head(struct burn_drive *d, int lba, 00605 int *image_blocks, char *info, int flag); 00606 00607 00608 /** Try to convert the given entity address into various entity addresses 00609 which would describe it. 00610 Note: Sessions and tracks are counted beginning with 1, not with 0. 00611 @since 0.3.2 00612 @param drive The drive where msc1 is to be set 00613 @param adr_mode Determines how to interpret the input adr_value. 00614 If adr_value shall represent a number then decimal ASCII 00615 digits are expected. 00616 0= start lba of last session in TOC, ignore adr_value 00617 1= start lba of session number given by adr_value 00618 2= start lba of track given number by adr_value 00619 3= adr_value itself is the lba to be used 00620 4= start lba of last session with volume id 00621 given by adr_value 00622 @param adr_value A string describing the value to be eventually used. 00623 @param lba returns the block address of the entity, -1 means invalid 00624 @param track returns the track number of the entity, -1 means invalid 00625 @param session returns the session number of the entity, -1 means invalid 00626 @param volid returns the volume id of the entity if it is a ISO session 00627 @param flag Bitfield for control purposes. 00628 bit2= with adr_mode 4: use adr_value as regular expression 00629 @return <=0 error , 1 ok, ISO session, 2 ok, not an ISO session 00630 */ 00631 int isoburn_get_mount_params(struct burn_drive *d, 00632 int adr_mode, char *adr_value, 00633 int *lba, int *track, int *session, 00634 char volid[33], int flag); 00635 00636 00637 /* ----------------------------------------------------------------------- */ 00638 /* 00639 00640 Options for image reading. 00641 00642 An application shall create an option set object by isoburn_ropt_new(), 00643 program it by isoburn_ropt_set_*(), use it with isoburn_read_image(), 00644 and finally delete it by isoburn_ropt_destroy(). 00645 00646 */ 00647 /* ----------------------------------------------------------------------- */ 00648 00649 struct isoburn_read_opts; 00650 00651 /** Produces a set of image read options, initialized with default values. 00652 @since 0.1.0 00653 @param o the newly created option set object 00654 @param flag Bitfield for control purposes. Submit 0 for now. 00655 @return 1=ok , <0 = failure 00656 */ 00657 int isoburn_ropt_new(struct isoburn_read_opts **o, int flag); 00658 00659 00660 /** Deletes an option set which was created by isoburn_ropt_new(). 00661 @since 0.1.0 00662 @param o The option set to work on 00663 @param flag Bitfield for control purposes. Submit 0 for now. 00664 @return 1= **o destroyed , 0= *o was already NULL (harmless) 00665 */ 00666 int isoburn_ropt_destroy(struct isoburn_read_opts **o, int flag); 00667 00668 00669 /** Which existing ISO 9660 extensions in the image to read or not to read. 00670 Whether to read the content of an existing image at all. 00671 The bits can be combined by | resp. inquired by &. 00672 @since 0.1.0 00673 @param ext Bitfield: 00674 bit0= norock 00675 Do not read Rock Ridge extensions 00676 bit1= nojoliet 00677 Do not read Joliet extensions 00678 bit2= noiso1999 00679 Do not read ISO 9660:1999 enhanced tree 00680 bit3= preferjoliet 00681 When both Joliet and RR extensions are present, the RR 00682 tree is used. If you prefer using Joliet, set this to 1. 00683 bit4= pretend_blank 00684 Always create empty image.Ignore any image on input drive. 00685 @return 1 success, <=0 failure 00686 */ 00687 #define isoburn_ropt_norock 1 00688 #define isoburn_ropt_nojoliet 2 00689 #define isoburn_ropt_noiso1999 4 00690 #define isoburn_ropt_preferjoliet 8 00691 #define isoburn_ropt_pretend_blank 16 00692 int isoburn_ropt_set_extensions(struct isoburn_read_opts *o, int ext); 00693 int isoburn_ropt_get_extensions(struct isoburn_read_opts *o, int *ext); 00694 00695 00696 /** Default attributes to use if no RockRidge extension gets loaded. 00697 @since 0.1.0 00698 @param o The option set to work on 00699 @param uid user id number (see /etc/passwd) 00700 @param gid group id number (see /etc/group) 00701 @param mode permissions (not file type) as of man 2 stat. 00702 With directories, r-permissions will automatically imply 00703 x-permissions. See isoburn_ropt_set_default_dirperms() below. 00704 @return 1 success, <=0 failure 00705 */ 00706 int isoburn_ropt_set_default_perms(struct isoburn_read_opts *o, 00707 uid_t uid, gid_t gid, mode_t mode); 00708 int isoburn_ropt_get_default_perms(struct isoburn_read_opts *o, 00709 uid_t *uid, gid_t *gid, mode_t *mode); 00710 00711 /** Default attributes to use on directories if no RockRidge extension 00712 gets loaded. 00713 Above call isoburn_ropt_set_default_perms() automatically adds 00714 x-permissions to r-permissions for directories. This call here may 00715 be done afterwards to set independend permissions for directories, 00716 especially to override the automatically added x-permissions. 00717 @since 0.1.0 00718 @param o The option set to work on 00719 @param mode permissions (not file type) as of man 2 stat. 00720 @return 1 success, <=0 failure 00721 */ 00722 int isoburn_ropt_set_default_dirperms(struct isoburn_read_opts *o, 00723 mode_t mode); 00724 int isoburn_ropt_get_default_dirperms(struct isoburn_read_opts *o, 00725 mode_t *mode); 00726 00727 00728 00729 /** Set the character set for reading RR file names from ISO images. 00730 @since 0.1.0 00731 @param o The option set to work on 00732 @param input_charset Set this to NULL to use the default locale charset. 00733 For selecting a particular character set, submit its 00734 name, e.g. as listed by program iconv -l. 00735 Example: "UTF-8". 00736 @return 1 success, <=0 failure 00737 */ 00738 int isoburn_ropt_set_input_charset(struct isoburn_read_opts *o, 00739 char *input_charset); 00740 int isoburn_ropt_get_input_charset(struct isoburn_read_opts *o, 00741 char **input_charset); 00742 00743 00744 /** After calling function isoburn_read_image() there are informations 00745 available in the option set. 00746 This info can be obtained as bits in parameter has_what. Like: 00747 joliet_available = (has_what & isoburn_ropt_has_joliet); 00748 @since 0.1.0 00749 @param o The option set to work on 00750 @param size Number of image data blocks, 2048 bytes each. 00751 @param has_what Bitfield: 00752 bit0= has_rockridge 00753 RockRidge extension info is available (POSIX filesystem) 00754 bit1= has_joliet 00755 Joliet extension info is available (suitable for MS-Windows) 00756 bit2= has_iso1999 00757 ISO version 2 Enhanced Volume Descriptor is available. 00758 This is rather exotic. 00759 bit3= has_el_torito 00760 El-Torito boot record is present 00761 @return 1 success, <=0 failure 00762 */ 00763 #define isoburn_ropt_has_rockridge 1 00764 #define isoburn_ropt_has_joliet 2 00765 #define isoburn_ropt_has_iso1999 4 00766 #define isoburn_ropt_has_el_torito 8 00767 int isoburn_ropt_get_size_what(struct isoburn_read_opts *o, 00768 uint32_t *size, int *has_what); 00769 00770 00771 /* ----------------------------------------------------------------------- */ 00772 /* End of Options for image reading */ 00773 /* ----------------------------------------------------------------------- */ 00774 00775 /* ----------------------------------------------------------------------- */ 00776 /* 00777 00778 Options for image generation by libisofs and image transport to libburn. 00779 00780 An application shall create an option set by isoburn_igopt_new(), 00781 program it by isoburn_igopt_set_*(), use it with either 00782 isoburn_prepare_new_image() or isoburn_prepare_disc(), and finally delete 00783 it by isoburn_igopt_destroy(). 00784 00785 */ 00786 /* ----------------------------------------------------------------------- */ 00787 00788 struct isoburn_imgen_opts; 00789 00790 /** Produces a set of generation and transfer options, initialized with default 00791 values. 00792 @since 0.1.0 00793 @param o the newly created option set object 00794 @param flag Bitfield for control purposes. Submit 0 for now. 00795 @return 1=ok , <0 = failure 00796 */ 00797 int isoburn_igopt_new(struct isoburn_imgen_opts **o, int flag); 00798 00799 00800 /** Deletes an option set which was created by isoburn_igopt_new(). 00801 @since 0.1.0 00802 @param o The option set to give up 00803 @param flag Bitfield for control purposes. Submit 0 for now. 00804 @return 1= **o destroyed , 0= *o was already NULL (harmless) 00805 */ 00806 int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag); 00807 00808 00809 /** ISO level to write at. 00810 @since 0.1.0 00811 @param o The option set to work on 00812 @param level is a term of the ISO 9660 standard. It should be one of: 00813 1= filenames restricted to form 8.3 00814 2= filenames allowed up to 31 characters 00815 @return 1 success, <=0 failure 00816 */ 00817 int isoburn_igopt_set_level(struct isoburn_imgen_opts *o, int level); 00818 int isoburn_igopt_get_level(struct isoburn_imgen_opts *o, int *level); 00819 00820 00821 /** Which extensions to support. 00822 @since 0.1.0 00823 @param o The option set to work on 00824 @param ext Bitfield: 00825 bit0= rockridge 00826 Rock Ridge extensions add POSIX file attributes like 00827 owner, group, access permissions, long filenames. Very 00828 advisable if the designed audience has Unix style systems. 00829 bit1= joliet 00830 Longer filenames for Windows systems. 00831 Weaker than RockRidge, but also readable with Linux. 00832 bit2= iso1999 00833 This is rather exotic. Better do not surprise the readers. 00834 @return 1 success, <=0 failure 00835 */ 00836 #define isoburn_igopt_rockridge 1 00837 #define isoburn_igopt_joliet 2 00838 #define isoburn_igopt_iso1999 4 00839 int isoburn_igopt_set_extensions(struct isoburn_imgen_opts *o, int ext); 00840 int isoburn_igopt_get_extensions(struct isoburn_imgen_opts *o, int *ext); 00841 00842 /** Relaxed constraints. Setting any of the bits to 1 break the specifications, 00843 but it is supposed to work on most moderns systems. Use with caution. 00844 @since 0.1.0 00845 @param o The option set to work on 00846 @param relax Bitfield: 00847 bit0= omit_version_numbers 00848 Omit the version number (";1") at the end of the 00849 ISO-9660 identifiers. Version numbers are usually 00850 not used. 00851 bit1= allow_deep_paths 00852 Allow ISO-9660 directory hierarchy to be deeper 00853 than 8 levels. 00854 bit2= allow_longer_paths 00855 Allow path in the ISO-9660 tree to have more than 00856 255 characters. 00857 bit3= max_37_char_filenames 00858 Allow a single file or directory hierarchy to have 00859 up to 37 characters. This is larger than the 31 00860 characters allowed by ISO level 2, and the extra space 00861 is taken from the version number, so this also forces 00862 omit_version_numbers. 00863 bit4= no_force_dots 00864 ISO-9660 forces filenames to have a ".", that separates 00865 file name from extension. libisofs adds it if original 00866 filename has none. Set this to 1 to prevent this 00867 behavior. 00868 bit5= allow_lowercase 00869 Allow lowercase characters in ISO-9660 filenames. 00870 By default, only uppercase characters, numbers and 00871 a few other characters are allowed. 00872 bit6= allow_full_ascii 00873 Allow all ASCII characters to be appear on an ISO-9660 00874 filename. Note * that "/" and "\0" characters are never 00875 allowed, even in RR names. 00876 bit7= joliet_longer_paths 00877 Allow paths in the Joliet tree to have more than 00878 240 characters. 00879 bit8= always_gmt 00880 Write timestamps as GMT although the specs prescribe local 00881 time with eventual non-zero timezone offset. Negative 00882 timezones (west of GMT) can trigger bugs in some operating 00883 systems which typically appear in mounted ISO images as if 00884 the timezone shift from GMT was applied twice 00885 (e.g. in New York 22:36 becomes 17:36). 00886 bit9= rrip_version_1_10 00887 Write Rock Ridge info as of specification RRIP-1.10 rather 00888 than RRIP-1.12: signature "RRIP_1991A" rather than 00889 "IEEE_1282", field PX without file serial number. 00890 bit10= dir_rec_mtime 00891 Store as ECMA-119 Directory Record timestamp the mtime 00892 of the source rather than the image creation time. 00893 00894 @return 1 success, <=0 failure 00895 */ 00896 #define isoburn_igopt_omit_version_numbers 1 00897 #define isoburn_igopt_allow_deep_paths 2 00898 #define isoburn_igopt_allow_longer_paths 4 00899 #define isoburn_igopt_max_37_char_filenames 8 00900 #define isoburn_igopt_no_force_dots 16 00901 #define isoburn_igopt_allow_lowercase 32 00902 #define isoburn_igopt_allow_full_ascii 64 00903 #define isoburn_igopt_joliet_longer_paths 128 00904 #define isoburn_igopt_always_gmt 256 00905 #define isoburn_igopt_rrip_version_1_10 512 00906 #define isoburn_igopt_dir_rec_mtime 1024 00907 int isoburn_igopt_set_relaxed(struct isoburn_imgen_opts *o, int relax); 00908 int isoburn_igopt_get_relaxed(struct isoburn_imgen_opts *o, int *relax); 00909 00910 00911 /** Whether and how files should be sorted. 00912 @since 0.1.0 00913 @param o The option set to work on 00914 @param value Bitfield: bit0= sort_files_by_weight 00915 files should be sorted based on their weight. 00916 Weight is attributed to files in the image 00917 by libisofs call iso_node_set_sort_weight(). 00918 @return 1 success, <=0 failure 00919 */ 00920 #define isoburn_igopt_sort_files_by_weight 1 00921 int isoburn_igopt_set_sort_files(struct isoburn_imgen_opts *o, int value); 00922 int isoburn_igopt_get_sort_files(struct isoburn_imgen_opts *o, int *value); 00923 00924 00925 /** Set the override values for files and directory permissions. 00926 The parameters replace_* these take one of three values: 0, 1 or 2. 00927 If 0, the corresponding attribute will be kept as set in the IsoNode 00928 at the time of image generation. 00929 If set to 1, the corresponding attrib. will be changed by a default 00930 suitable value. 00931 With value 2, the attrib. will be changed with the value specified 00932 in the corresponding *_mode options. Note that only the permissions 00933 are set, the file type remains unchanged. 00934 @since 0.1.0 00935 @param o The option set to work on 00936 @param replace_dir_mode whether and how to override directories 00937 @param replace_file_mode whether and how to override files of other type 00938 @param dir_mode Mode to use on dirs with replace_dir_mode == 2. 00939 @param file_mode; Mode to use on files with replace_file_mode == 2. 00940 @return 1 success, <=0 failure 00941 */ 00942 int isoburn_igopt_set_over_mode(struct isoburn_imgen_opts *o, 00943 int replace_dir_mode, int replace_file_mode, 00944 mode_t dir_mode, mode_t file_mode); 00945 int isoburn_igopt_get_over_mode(struct isoburn_imgen_opts *o, 00946 int *replace_dir_mode, int *replace_file_mode, 00947 mode_t *dir_mode, mode_t *file_mode); 00948 00949 /** Set the override values values for group id and user id. 00950 The rules are like with above overriding of mode values. replace_* controls 00951 whether and how. The other two parameters provide values for eventual use. 00952 @since 0.1.0 00953 @param o The option set to work on 00954 @param replace_uid whether and how to override user ids 00955 @param replace_gid whether and how to override group ids 00956 @param uid User id to use with replace_uid == 2. 00957 @param gid Group id to use on files with replace_gid == 2. 00958 @return 1 success, <=0 failure 00959 */ 00960 int isoburn_igopt_set_over_ugid(struct isoburn_imgen_opts *o, 00961 int replace_uid, int replace_gid, 00962 uid_t uid, gid_t gid); 00963 int isoburn_igopt_get_over_ugid(struct isoburn_imgen_opts *o, 00964 int *replace_uid, int *replace_gid, 00965 uid_t *uid, gid_t *gid); 00966 00967 /** Set the charcter set to use for representing filenames in the image. 00968 @since 0.1.0 00969 @param o The option set to work on 00970 @param output_charset Set this to NULL to use the default output charset. 00971 For selecting a particular character set, submit its 00972 name, e.g. as listed by program iconv -l. 00973 Example: "UTF-8". 00974 @return 1 success, <=0 failure 00975 */ 00976 int isoburn_igopt_set_out_charset(struct isoburn_imgen_opts *o, 00977 char *output_charset); 00978 int isoburn_igopt_get_out_charset(struct isoburn_imgen_opts *o, 00979 char **output_charset); 00980 00981 00982 /** The number of bytes to be used for the fifo which decouples libisofs 00983 and libburn for better throughput and for reducing the risk of 00984 interrupting signals hitting the libburn thread which operates the 00985 MMC drive. 00986 The size will be rounded up to the next full 2048. 00987 Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway). 00988 @since 0.1.0 00989 @param o The option set to work on 00990 @param fifo_size Number of bytes to use 00991 @return 1 success, <=0 failure 00992 */ 00993 int isoburn_igopt_set_fifo_size(struct isoburn_imgen_opts *o, int fifo_size); 00994 int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size); 00995 00996 00997 /** Obtain after image preparation the block address where the session will 00998 start on media. 00999 This value cannot be set by the application but only be inquired. 01000 @since 0.1.4 01001 @param o The option set to work on 01002 @param lba The block number of the session start on media. 01003 <0 means that no address has been determined yet. 01004 @return 1 success, <=0 failure 01005 */ 01006 int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba); 01007 01008 01009 /* ----------------------------------------------------------------------- */ 01010 /* End of Options for image generation */ 01011 /* ----------------------------------------------------------------------- */ 01012 01013 01014 /** Get the image attached to a drive, if any. 01015 @since 0.1.0 01016 @param d The drive to inquire 01017 @return A reference to attached image, or NULL if the drive has no image 01018 attached. This reference needs to be released via iso_image_unref() 01019 when it is not longer needed. 01020 */ 01021 IsoImage *isoburn_get_attached_image(struct burn_drive *d); 01022 01023 01024 /** Load the ISO filesystem directory tree from the media in the given drive. 01025 This will give libisoburn the base on which it can let libisofs perform 01026 image growing or image modification. The loaded volset gets attached 01027 to the drive object and handed out to the application. 01028 Not a wrapper, but peculiar to libisoburn. 01029 @since 0.1.0 01030 @param d The drive which holds an existing ISO filesystem or blank media. 01031 d is allowed to be NULL which produces an empty ISO image. In 01032 this case one has to call before writing isoburn_attach_volset() 01033 with the volset from this call and with the intended output 01034 drive. 01035 @param read_opts The read options which can be chosen by the application 01036 @param image the image read, if the disc is blank it will have no files. 01037 This reference needs to be released via iso_image_unref() when 01038 it is not longer needed. The drive, if not NULL, will hold an 01039 own reference which it will release when it gets a new volset 01040 or when it gets released via isoburn_drive_release(). 01041 You can pass NULL if you already have a reference or you plan to 01042 obtain it later with isoburn_get_attached_image(). Of course, if 01043 you haven't specified a valid drive (i.e., if d == NULL), this 01044 parameter can't be NULL. 01045 @return <=0 error , 1 = success 01046 */ 01047 int isoburn_read_image(struct burn_drive *d, 01048 struct isoburn_read_opts *read_opts, 01049 IsoImage **image); 01050 01051 /** Set a callback function for producing pacifier messages during the lengthy 01052 process of image reading. The callback function and the application handle 01053 are stored until they are needed for the underlying call to libisofs. 01054 Other than with libisofs the handle is managed entirely by the application. 01055 An idle .free() function is exposed to libisofs. The handle has to stay 01056 valid until isoburn_read_image() is done. It has to be detached by 01057 isoburn_set_read_pacifier(drive, NULL, NULL); 01058 before it may be removed from memory. 01059 @since 0.1.0 01060 @param drive The drive which will be used with isoburn_read_image() 01061 It has to be aquired by an isoburn_* wrapper call. 01062 @param read_pacifier The callback function 01063 @param app_handle The app handle which the callback function can obtain 01064 via iso_image_get_attached_data() from its IsoImage* 01065 @return 1 success, <=0 failure 01066 */ 01067 int isoburn_set_read_pacifier(struct burn_drive *drive, 01068 int (*read_pacifier)(IsoImage*, IsoFileSource*), 01069 void *app_handle); 01070 01071 01072 /** Set the IsoImage to be used with a drive. This eventually releases 01073 the reference to the old IsoImage attached to the drive. 01074 Caution: Use with care. It hardly makes sense to replace an image that 01075 reflects a valid ISO image on media. 01076 This call is rather intended for writing a newly created and populated 01077 image to blank media. The use case in xorriso is to let an image survive 01078 the change or demise of the outdev target drive. 01079 @since 0.1.0 01080 @param d The drive which shall be write target of the volset. 01081 @param image The image that represents the image to be written. 01082 This image pointer MUST already be a valid reference suitable 01083 for iso_image_unref(). 01084 It may have been obtained by appropriate libisofs calls or by 01085 isoburn_read_image() with d==NULL. 01086 @return <=0 error , 1 = success 01087 */ 01088 int isoburn_attach_image(struct burn_drive *d, IsoImage *image); 01089 01090 01091 /** Return the best possible estimation of the currently available capacity of 01092 the media. This might depend on particular write option settings and on 01093 drive state. 01094 An eventual start address for emulated multi-session will be subtracted 01095 from the capacity estimation given by burn_disc_available_space(). 01096 Negative results get defaulted to 0. 01097 Wrapper for: burn_disc_available_space() 01098 @since 0.1.0 01099 @param d The drive to query. 01100 @param o If not NULL: write parameters to be set on drive before query 01101 @return number of most probably available free bytes 01102 */ 01103 off_t isoburn_disc_available_space(struct burn_drive *d, 01104 struct burn_write_opts *o); 01105 01106 01107 /** Obtain the start block number of the most recent session on media. In 01108 case of random access media this will normally be 0. Successfull return is 01109 not a guarantee that there is a ISO-9660 image at all. The call will fail, 01110 nevertheless,if isoburn_disc_get_status() returns not BURN_DISC_APPENDABLE 01111 or BURN_DISC_FULL. 01112 Note: The result of this call may be fabricated by a previous call of 01113 isoburn_set_msc1() which can override the rule to load the most recent 01114 session. 01115 Wrapper for: burn_disc_get_msc1() 01116 @since 0.1.0 01117 @param d The drive to inquire 01118 @param start_lba Contains on success the start address in 2048 byte blocks 01119 @return <=0 error , 1 = success 01120 */ 01121 int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba); 01122 01123 01124 /** Use this with trackno==0 to obtain the predicted start block number of the 01125 new session. The interesting number is returned in parameter nwa. 01126 Wrapper for: burn_disc_track_lba_nwa() 01127 @since 0.1.0 01128 @param d The drive to inquire 01129 @param o If not NULL: write parameters to be set on drive before query 01130 @param trackno Submit 0. 01131 @param lba return value: start lba 01132 @param nwa return value: Next Writeable Address 01133 @return 1=nwa is valid , 0=nwa is not valid , -1=error 01134 */ 01135 int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o, 01136 int trackno, int *lba, int *nwa); 01137 01138 01139 /** Obtain the size which was attributed to an emulated appendable on actually 01140 overwriteable media. This value is supposed to be <= 2048 * nwa as of 01141 isoburn_disc_track_lba_nwa(). 01142 @since 0.1.0 01143 @param drive The drive holding the media. 01144 @param start_byte The reply value counted in bytes, not in sectors. 01145 @param flag Unused yet. Submit 0. 01146 @return 1=stat_byte is valid, 0=not an emulated appendable, -1=error 01147 */ 01148 int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte, 01149 int flag); 01150 01151 01152 /** To choose the expansion method of Growing: 01153 Create a disc object for writing the new session from the created or loaded 01154 iso_volset which has been manipulated via libisofs, to the same media from 01155 where the image was eventually loaded. This struct burn_disc is ready for 01156 use by a subsequent call to isoburn_disc_write(). 01157 After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE 01158 again, the burn_disc object has to be disposed by burn_disc_free(). 01159 @since 0.1.0 01160 @param drive The combined source and target drive, grabbed with 01161 isoburn_drive_scan_and_grab(). . 01162 @param disc Returns the newly created burn_disc object. 01163 @param opts Image generation options, see isoburn_igopt_*() 01164 @return <=0 error , 1 = success 01165 */ 01166 int isoburn_prepare_disc(struct burn_drive *drive, struct burn_disc **disc, 01167 struct isoburn_imgen_opts *opts); 01168 01169 01170 /** To choose the expansion method of Modifying: 01171 Create a disc object for producing a new image from a previous image 01172 plus the changes made by user. The generated burn_disc is suitable 01173 to be written to a grabbed drive with blank writeable media. 01174 But you must not use the same drive for input and output, because data 01175 will be read from the source drive while at the same time the target 01176 drive is already writing. 01177 The resulting burn_disc object has to be disposed when all its writing 01178 is done and the drive is BURN_DRIVE_IDLE again after asynchronous 01179 burn_disc_write(). 01180 @since 0.1.0 01181 @param in_drive The input drive, grabbed with isoburn_drive_aquire() or 01182 one of its alternatives. 01183 @param disc Returns the newly created burn_disc object. 01184 @param opts Options for image generation and data transport to media. 01185 @param out_drive The output drive, from isoburn_drive_aquire() et.al.. 01186 @return <=0 error , 1 = success 01187 */ 01188 int isoburn_prepare_new_image(struct burn_drive *in_drive, 01189 struct burn_disc **disc, 01190 struct isoburn_imgen_opts *opts, 01191 struct burn_drive *out_drive); 01192 01193 01194 /** To choose the expansion method of Blind Growing: 01195 Create a disc object for writing an add-on session from the created or 01196 loaded IsoImage which has been manipulated via libisofs, to a different 01197 drive than the one from where it was loaded. 01198 Usually output will be stdio:/dev/fd/1 (i.e. stdout) being piped 01199 into some burn program like with this classic gesture: 01200 mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev 01201 Parameter translation into libisoburn: 01202 $dev is the address by which parameter in_drive of this call was aquired 01203 $msc1 was set by isoburn_set_msc1() before image reading 01204 or was detected from the in_drive media 01205 $nwa is a parameter of this call 01206 or can be used as detected from the in_drive media 01207 01208 This call waits for libisofs output to become available and then detaches 01209 the input drive object from the data source object by which libisofs was 01210 reading from the input drive. 01211 So, as far as libisofs is concerned, that drive may be released immediately 01212 after this call in order to allow the consumer to access the drive for 01213 writing. 01214 The consumer should wait for input to become available and only then open 01215 its burn drive. With cdrecord this is caused by option -waiti. 01216 01217 The resulting burn_disc object has to be disposed when all its writing 01218 is done and the drive is BURN_DRIVE_IDLE again after asynchronous 01219 burn_disc_write(). 01220 @since 0.2.2 01221 @param in_drive The input drive,grabbed with isoburn_drive_scan_and_grab(). 01222 @param disc Returns the newly created burn_disc object. 01223 @param opts Options for image generation and data transport to media. 01224 @param out_drive The output drive, from isoburn_drive_aquire() et.al.. 01225 typically stdio:/dev/fd/1 . 01226 @param nwa The address (2048 byte block count) where the add-on 01227 session will be finally stored on a mountable media 01228 or in a mountable file. 01229 If nwa is -1 then the address is used as determined from 01230 the in_drive media. 01231 @return <=0 error , 1 = success 01232 */ 01233 int isoburn_prepare_blind_grow(struct burn_drive *d, struct burn_disc **disc, 01234 struct isoburn_imgen_opts *opts, 01235 struct burn_drive *out_drive, int nwa); 01236 01237 01238 /** 01239 Revoke isoburn_prepare_*() instead of running isoburn_disc_write(). 01240 libisofs reserves resources and maybe already starts generating the 01241 image stream when one of above three calls is performed. It is mandatory to 01242 either run isoburn_disc_write() or to revoke the preparations by the 01243 call described here. 01244 @since 0.1.0 01245 @param input_drive The drive resp. in_drive which was used with the 01246 preparation call. 01247 @param output_drive The out_drive used with isoburn_prepare_new_image(), 01248 NULL if none. 01249 @param flag Bitfield, submit 0 for now. 01250 bit0= -reserved for internal use- 01251 @return <0 error, 0= no pending preparations detectable, 1 = canceled 01252 */ 01253 int isoburn_cancel_prepared_write(struct burn_drive *input_drive, 01254 struct burn_drive *output_drive, int flag); 01255 01256 01257 /** Start writing of the new session. 01258 This call is asynchrounous. I.e. it returns quite soon and the progress has 01259 to be watched by a loop with call burn_drive_get_status() until 01260 BURN_DRIVE_IDLE is returned. 01261 Wrapper for: burn_disc_write() 01262 @since 0.1.0 01263 @param o Options which control the burn process. See burnwrite_opts_*() 01264 in libburn.h. 01265 @param disc Disc object created either by isoburn_prepare_disc() or by 01266 isoburn_prepare_new_image(). 01267 */ 01268 void isoburn_disc_write(struct burn_write_opts *o, struct burn_disc *disc); 01269 01270 01271 /** Inquire state and fill parameters of the fifo which is attached to 01272 the emerging track. This should be done in the pacifier loop while 01273 isoburn_disc_write() or burn_disc_write() are active. 01274 This works only with drives obtained by isoburn_drive_scan_and_grab() 01275 or isoburn_drive_grab(). If isoburn_prepare_new_image() was used, then 01276 parameter out_drive must have announced the track output drive. 01277 Hint: If only burn_write_opts and not burn_drive is known, then the drive 01278 can be obtained by burn_write_opts_get_drive(). 01279 @since 0.1.0 01280 @param d The drive to which the track with the fifo gets burned. 01281 @param size The total size of the fifo 01282 @param free_bytes The current free capacity of the fifo 01283 @param status_text Returns a pointer to a constant text, see below 01284 @return <0 reply invalid, >=0 fifo status code: 01285 bit0+1=input status, bit2=consumption status, i.e: 01286 0="standby" : data processing not started yet 01287 1="active" : input and consumption are active 01288 2="ending" : input has ended without error 01289 3="failing" : input had error and ended, 01290 4="unused" : ( consumption has ended before processing start ) 01291 5="abandoned" : consumption has ended prematurely 01292 6="ended" : consumption has ended without input error 01293 7="aborted" : consumption has ended after input error 01294 */ 01295 int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes, 01296 char **status_text); 01297 01298 01299 /** Inquire whether the most recent write run was successful. 01300 Wrapper for: burn_drive_wrote_well() 01301 @since 0.1.0 01302 @param d The drive to inquire 01303 @return 1=burn seems to have went well, 0=burn failed 01304 */ 01305 int isoburn_drive_wrote_well(struct burn_drive *d); 01306 01307 01308 /** Call this after isoburn_disc_write has finished and burn_drive_wrote_well() 01309 indicates success. It will eventually complete the emulation of 01310 multi-session functionality, if needed at all. Let libisoburn decide. 01311 Not a wrapper, but peculiar to libisoburn. 01312 @since 0.1.0 01313 @param d The output drive to which the session was written 01314 @return 1 success , <=0 failure 01315 */ 01316 int isoburn_activate_session(struct burn_drive *drive); 01317 01318 01319 /** Wait after normal end of operations until libisofs ended all write 01320 threads and freed resource reservations. 01321 This call is not mandatory. But without it, messages from the ending 01322 threads might appear after the application ended its write procedure. 01323 @since 0.1.0 01324 @param input_drive The drive resp. in_drive which was used with the 01325 preparation call. 01326 @param output_drive The out_drive used with isoburn_prepare_new_image(), 01327 NULL if none. 01328 @param flag Bitfield, submit 0 for now. 01329 @return <=0 error , 1 = success 01330 */ 01331 int isoburn_sync_after_write(struct burn_drive *input_drive, 01332 struct burn_drive *output_drive, int flag); 01333 01334 01335 /** Release an aquired drive. 01336 Wrapper for: burn_drive_release() 01337 @since 0.1.0 01338 @param drive The drive to be released 01339 @param eject 1= eject media from drive , 0= do not eject 01340 */ 01341 void isoburn_drive_release(struct burn_drive *drive, int eject); 01342 01343 01344 /** Shutdown all three libraries. 01345 Wrapper for : iso_finish() and burn_finish(). 01346 @since 0.1.0 01347 */ 01348 void isoburn_finish(void); 01349 01350 01351 /* 01352 The following calls are for expert applications only. 01353 An application should have a special reason to use them. 01354 */ 01355 01356 01357 /** Inquire wether the media needs emulation or would be suitable for 01358 generic multi-session via libburn. 01359 @since 0.1.0 01360 @param d The drive to inquire 01361 @return 0 is generic multi-session 01362 1 is emulated multi-session 01363 -1 is not suitable for isoburn 01364 */ 01365 int isoburn_needs_emulation(struct burn_drive *drive); 01366 01367
1.5.6