New API function isoburn_read_iso_head()

This commit is contained in:
Thomas Schmitt 2008-05-07 21:43:25 +00:00
parent 585445ccc8
commit e92b796215
3 changed files with 27 additions and 8 deletions

View File

@ -925,10 +925,11 @@ int isoburn_report_iso_error(int iso_error_code, char msg_text[], int os_errno,
} }
/* @param flag bit0-7: info return mode /* API
@param flag bit0-7: info return mode
0= do not return anything in info (do not even touch it) 0= do not return anything in info (do not even touch it)
1= return volume id 1= return volume id
@return 1 seems to be a valid ISO image , 0 seems not to be ISO, <0 error @return 1 seems to be a valid ISO image , 0 format not recognized, <0 error
*/ */
int isoburn_read_iso_head(struct burn_drive *d, int lba, int isoburn_read_iso_head(struct burn_drive *d, int lba,
int *image_blocks, char *info, int flag) int *image_blocks, char *info, int flag)
@ -937,6 +938,7 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba,
int ret, i, info_mode; int ret, i, info_mode;
off_t data_count; off_t data_count;
*image_blocks= 0;
ret = burn_read_data(d, ((off_t) lba) * (off_t) 2048, (char *) buffer, ret = burn_read_data(d, ((off_t) lba) * (off_t) 2048, (char *) buffer,
(off_t) 64*1024, &data_count, 2); /* no error messages */ (off_t) 64*1024, &data_count, 2); /* no error messages */
if(ret<=0) if(ret<=0)
@ -945,7 +947,7 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba,
data= buffer+32*1024; data= buffer+32*1024;
/* is this an ISO image ? */ /* is this an ISO image ? */
if(data[0]!=1) if(data[0]!=1)
return(0); return(0);
if(strncmp((char *) (data+1),"CD001",5)!=0) if(strncmp((char *) (data+1),"CD001",5)!=0)
return(0); return(0);
@ -1174,16 +1176,16 @@ failure:;
int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc) int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc)
{ {
struct isoburn_toc_entry *t; struct isoburn_toc_entry *t;
int count= 0; int ret= 0;
if(disc==NULL) if(disc==NULL)
return(0); return(0);
if(disc->toc!=NULL) { if(disc->toc!=NULL) {
for(t= disc->toc; t!=NULL; t= t->next) for(t= disc->toc; t!=NULL; t= t->next)
count+= t->track_blocks; ret= t->start_lba + t->track_blocks;
} else if(disc->disc!=NULL) } else if(disc->disc!=NULL)
count= burn_disc_get_sectors(disc->disc); ret= burn_disc_get_sectors(disc->disc);
return(count); return(ret);
} }

View File

@ -495,6 +495,23 @@ void isoburn_toc_track_get_entry(struct isoburn_toc_track *t,
void isoburn_toc_disc_free(struct isoburn_toc_disc *disc); void isoburn_toc_disc_free(struct isoburn_toc_disc *disc);
/** Try whether at the data at the given address look like a ISO 9660
image header and obtain its alleged size. Depending on the info mode
one other string of text information can be retrieved too.
@since 0.1.6
@param drive The drive with the media to inspect
@param lba The block number from where to read
@param image_blocks The number of 2048 bytes blocks
@param info Caller provided memory, enough to take eventual info reply
@param flag bit0-7: info return mode
0= do not return anything in info (do not even touch it)
1= return volume id (info needs 33 bytes)
@return 1 seems to be a valid ISO image , 0 format not recognized, <0 error
*/
int isoburn_read_iso_head(struct burn_drive *d, int lba,
int *image_blocks, char *info, int flag);
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* /*

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.05.07.175640" #define Xorriso_timestamP "2008.05.07.214343"