More accurate determination of size with check_media what=image

This commit is contained in:
Thomas Schmitt 2012-02-14 10:32:43 +00:00
parent 719ef2a6d3
commit 3c0bc5bc16
2 changed files with 32 additions and 5 deletions

View File

@ -171,7 +171,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, char *show_adr,
int flag)
{
int ret, hret, not_writeable= 0, has_what, aquire_flag, load_lba, ext;
int lba, track, session, params_flag, adr_mode, read_ret;
int lba, track, session, params_flag, adr_mode, read_ret, start_lba;
uint32_t size, offst;
struct burn_drive_info *dinfo= NULL, *out_dinfo= NULL, *in_dinfo= NULL;
struct burn_drive *drive= NULL, *out_drive= NULL, *in_drive= NULL;
@ -384,6 +384,11 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, char *show_adr,
goto ex;
} else {
iso_image_ref((IsoImage *) xorriso->in_volset_handle);
start_lba= -1;
ret= Xorriso_get_drive_handles(xorriso, &in_dinfo, &in_drive,
"on attempt to attach ISO image object to outdev", 0);
if(ret > 0)
start_lba= isoburn_get_attached_start_lba(in_drive);
ret= isoburn_attach_image(drive, (IsoImage *) xorriso->in_volset_handle);
if(ret<=0) {
sprintf(xorriso->info_text,
@ -391,6 +396,8 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, char *show_adr,
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
{ret= -1; goto ex;}
}
if(start_lba >= 0)
isoburn_attach_start_lba(drive, lba, 0);
}
if(!(flag&32))
Xorriso_toc(xorriso, 1 | 2 | 8);
@ -525,12 +532,19 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, char *show_adr,
if(xorriso->out_drive_handle != NULL &&
xorriso->out_drive_handle != xorriso->in_drive_handle) {
start_lba= -1;
ret= Xorriso_get_drive_handles(xorriso, &in_dinfo, &in_drive,
"on attempt to attach ISO image volset to outdev", 0);
if(ret > 0)
start_lba= isoburn_get_attached_start_lba(in_drive);
ret= Xorriso_get_drive_handles(xorriso, &out_dinfo, &out_drive,
"on attempt to attach ISO image volset to outdev", 2);
if(ret<=0)
goto ex;
iso_image_ref((IsoImage *) xorriso->in_volset_handle);
isoburn_attach_image(out_drive, xorriso->in_volset_handle);
if(start_lba >= 0)
isoburn_attach_start_lba(out_drive, ret, 0);
}
Xorriso_process_msg_queues(xorriso,0);
isoburn_ropt_get_size_what(ropts, &size, &has_what);
@ -2632,18 +2646,31 @@ int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist,
}
}
} else if(mode == 1) { /* isoburn disc capacity */
} else if(mode == 1) { /* Image range */
/* Default is the emulated disc capacity.
*/
isoburn_disc= isoburn_toc_drive_get_disc(drive);
if(isoburn_disc == NULL)
goto libburn_whole_disc;
blocks= media_blocks= isoburn_toc_disc_get_sectors(isoburn_disc);
/* If possible, determine the end address of the loaded ISO image.
*/
track_lba= isoburn_get_attached_start_lba(drive);
if(track_lba >= 0) {
ret= isoburn_read_iso_head(drive, track_lba, &track_blocks, NULL, 0);
if(ret > 0) {
blocks= media_blocks= track_lba + track_blocks;
}
}
if(start_lba >= 0)
blocks-= start_lba;
if(media_blocks <= 0)
goto libburn_whole_disc;
xorriso->pacifier_total= blocks;
ret= Xorriso_check_interval(xorriso, *spotlist, job, start_lba, blocks,
read_chunk, 0, 0);
read_chunk, 0, (4 * (xorriso->do_md5 & 1)));
if(ret <= 0)
goto ex;
} else if(mode == 2) {
@ -2659,7 +2686,7 @@ libburn_whole_disc:;
blocks-= start_lba;
xorriso->pacifier_total= blocks;
ret= Xorriso_check_interval(xorriso, *spotlist, job, start_lba, blocks,
read_chunk, 0, 0);
read_chunk, 0, (4 * (xorriso->do_md5 & 1)));
if(ret <= 0)
goto ex;
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2012.02.14.103107"
#define Xorriso_timestamP "2012.02.14.103256"