From e7ab799c76ad23a5bd75001784dd351a9f0580c2 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 5 Dec 2008 17:10:27 +0000 Subject: [PATCH] New API function isoburn_get_mount_params() --- libisoburn/burn_wrap.c | 85 +++++++++++++++++++++++++++++++++++-- libisoburn/libisoburn.h | 42 ++++++++++++++++-- xorriso/xorriso_timestamp.h | 2 +- 3 files changed, 120 insertions(+), 9 deletions(-) diff --git a/libisoburn/burn_wrap.c b/libisoburn/burn_wrap.c index b583be00..bbad77e9 100644 --- a/libisoburn/burn_wrap.c +++ b/libisoburn/burn_wrap.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifndef Xorriso_standalonE @@ -1041,7 +1042,9 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba, } ret= isoburn_read_iso_head_parse(d, buffer+32*1024, image_blocks, info, info_mode); - return(ret); + if(ret<=0) + return(ret); + return(1); } @@ -1509,12 +1512,14 @@ int isoburn_drive_set_msgs_submit(struct burn_drive *d, /* @param flag bit0= with adr_mode 3: adr_value might be 16 blocks too high + bit1= insist in seeing a disc object with at least one session + bit2= with adr_mode 4: use adr_value as regular expression */ int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, int flag) { int ret, num_sessions, num_tracks, adr_num, i, j, total_tracks; - int lba, best_lba, size; + int lba, best_lba, size, re_valid= 0; char volid[33], msg[160]; struct isoburn *o; struct isoburn_toc_disc *disc= NULL; @@ -1522,6 +1527,8 @@ int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, struct isoburn_toc_track **tracks= NULL; static char mode_names[][20]= {"auto", "session", "track", "lba", "volid"}; static int max_mode_names= 4; + regex_t re; + regmatch_t match[1]; ret= isoburn_find_emulator(&o, d, 0); if(ret<0) @@ -1530,7 +1537,7 @@ int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, return(-1); adr_num= atoi(adr_value); - if(adr_mode!=3) { + if(adr_mode!=3 || (flag & 2)) { disc= isoburn_toc_drive_get_disc(d); if(disc==NULL) { not_found:; @@ -1589,6 +1596,13 @@ not_found:; } } else if(adr_mode==4) { /* search for volume id that is equal to adr_value */ + if(flag & 4) { + ret= regcomp(&re, adr_value, 0); + if(ret != 0) + flag&= ~4; + else + re_valid= 1; + } best_lba= -1; for(i=0; ifabricated_msc1; + ret= isoburn_set_msc1(d, adr_mode, adr_value, 2 | (flag & 4)); + if(ret <= 0) + return(ret); + *lba= o->fabricated_msc1; + + disc= isoburn_toc_drive_get_disc(d); + if(disc==NULL) + {ret= -1; goto ex;} /* cannot happen because checked by isoburn_set_msc1 */ + sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions); + if(sessions==NULL || num_sessions<=0) + {ret= -1; goto ex;} /* cannot happen because checked by isoburn_set_msc1 */ + total_tracks= 0; + for(i=0; ifabricated_msc1= msc1_mem; + return(2 - is_iso); +} + + diff --git a/libisoburn/libisoburn.h b/libisoburn/libisoburn.h index 933fffd2..ae77ab73 100644 --- a/libisoburn/libisoburn.h +++ b/libisoburn/libisoburn.h @@ -336,7 +336,8 @@ int isoburn_set_msgs_submit(int (*msgs_submit)(void *handle, int error_code, (cdrom/burner). Thus use with driveno 0 only. On failure the array has no valid elements at all. The returned array should be freed via burn_drive_info_free() - when the drive is no longer needed. + when the drive is no longer needed. But before this is done + one has to call isoburn_drive_release(drive_infos[0].drive). @param adr The persistent address of the desired drive. @param load 1 attempt to load the disc tray. 0 no attempt,rather failure. @return 1 = success , 0 = drive not found , <0 = other error @@ -353,7 +354,8 @@ int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], (cdrom/burner). Thus use with driveno 0 only. On failure the array has no valid elements at all. The returned array should be freed via burn_drive_info_free() - when the drive is no longer needed. + when the drive is no longer needed. But before this is done + one has to call isoburn_drive_release(drive_infos[0].drive). @param adr The persistent address of the desired drive. @param flag bit0= attempt to load the disc tray. Else: failure if not loaded. @@ -375,6 +377,7 @@ int isoburn_drive_aquire(struct burn_drive_info *drive_infos[], Wrapper for: burn_drive_grab() @since 0.1.0 @param drive The drive to grab. E.g. drive_infos[1].drive . + Call isoburn_drive_release(drive) when it it no longer needed. @param load 1 attempt to load the disc tray. 0 no attempt, rather failure. @return 1 success, <=0 failure */ @@ -450,12 +453,14 @@ void isoburn_disc_erase(struct burn_drive *drive, int fast); 3= adr_value itself is the lba to be used 4= start lba of last session with volume id given by adr_value - @parm adr_value A string describing the value to be eventually used. + @param adr_value A string describing the value to be eventually used. @param flag Bitfield for control purposes. bit0= @since 0.2.2 with adr_mode 3: adr_value might be 16 blocks too high (e.g. -C stemming from growisofs). Probe for ISO head at adr_value-16 and eventually adjust setting. + bit1= insist in seeing a disc object with at least one session + bit2= with adr_mode 4: use adr_value as regular expression */ int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value, int flag); @@ -600,6 +605,35 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba, int *image_blocks, char *info, int flag); +/** Try to convert the given entity address into various entity addresses + which would describe it. + Note: Sessions and tracks are counted beginning with 1, not with 0. + @since 0.3.2 + @param drive The drive where msc1 is to be set + @param adr_mode Determines how to interpret the input adr_value. + If adr_value shall represent a number then decimal ASCII + digits are expected. + 0= start lba of last session in TOC, ignore adr_value + 1= start lba of session number given by adr_value + 2= start lba of track given number by adr_value + 3= adr_value itself is the lba to be used + 4= start lba of last session with volume id + given by adr_value + @param adr_value A string describing the value to be eventually used. + @param lba returns the block address of the entity, -1 means invalid + @param track returns the track number of the entity, -1 means invalid + @param session returns the session number of the entity, -1 means invalid + @param volid returns the volume id of the entity if it is a ISO session + @param flag Bitfield for control purposes. + bit2= with adr_mode 4: use adr_value as regular expression + @return <=0 error , 1 ok, ISO session, 2 ok, not an ISO session +*/ +int isoburn_get_mount_params(struct burn_drive *d, + int adr_mode, char *adr_value, + int *lba, int *track, int *session, + char volid[33], int flag); + + /* ----------------------------------------------------------------------- */ /* @@ -1243,7 +1277,7 @@ void isoburn_disc_write(struct burn_write_opts *o, struct burn_disc *disc); Hint: If only burn_write_opts and not burn_drive is known, then the drive can be obtained by burn_write_opts_get_drive(). @since 0.1.0 - @parm d The drive to which the track with the fifo gets burned. + @param d The drive to which the track with the fifo gets burned. @param size The total size of the fifo @param free_bytes The current free capacity of the fifo @param status_text Returns a pointer to a constant text, see below diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index b7e1c0da..eba99bc6 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.12.04.175459" +#define Xorriso_timestamP "2008.12.05.171005"