Rounding up fabricated nwa to full 32k addresses, API call for exact image size

This commit is contained in:
Thomas Schmitt 2007-10-17 21:42:37 +00:00
parent 5e7d775a16
commit 55632c428d
4 changed files with 53 additions and 11 deletions

View File

@ -393,6 +393,9 @@ int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag)
if(value % caps->start_alignment)
value+= caps->start_alignment - (value % caps->start_alignment);
o->nwa= value/2048;
/* If suitable for alignment, round up to full 16 sector addresses */
if((o->nwa%16) && ((16*2048) % caps->start_alignment)==0 )
o->nwa+= 16 - (o->nwa%16);
ret= 1;
ex:
if(caps!=NULL)
@ -401,6 +404,24 @@ ex:
}
int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte,
int flag)
{
int ret;
struct isoburn *o;
ret= isoburn_find_emulator(&o, d, 0);
if(ret<0)
return(-1);
if(ret==0)
return(0);
*start_byte= o->min_start_byte;
if(o->min_start_byte<=0)
return(0);
return(1);
}
int isoburn_drive_wrote_well(struct burn_drive *d)
{
int ret;

View File

@ -205,8 +205,21 @@ int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o,
int trackno, int *lba, int *nwa);
/** Prepare a disc for writting the new session.
@param disc A burn_disc suitable to pass to isoburn_disc_write.
/** Obtain the size which was attributed to an emulated appendable on actually
overwriteable media. This value is supposed to be <= 2048 * nwa as of
isoburn_disc_track_lba_nwa().
@param drive The drive holding the media.
@param start_byte The reply value counted in bytes, not in sectors.
@param flag Unused yet. Submit 0.
@return 1=stat_byte is valid, 0=not an emulated appendable, -1=error
*/
int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte,
int flag);
/** Prepare a disc for writing the new session.
@param drive The target drive
@param disc A burn_disc suitable to pass to isoburn_disc_write().
@return <=0 error , 1 = success
*/
int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc,

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.17.213852"
#define Xorriso_timestamP "2007.10.17.214228"

View File

@ -557,13 +557,23 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
sprintf(respt+strlen(respt), "is not recognizable\n");
Xorriso_result(xorriso,0);
if(s != BURN_DISC_FULL && s!= BURN_DISC_APPENDABLE)
if(s != BURN_DISC_FULL && s != BURN_DISC_APPENDABLE)
return(1);
disc= burn_drive_get_disc(drive);
if (disc==NULL) {
Xorriso_process_msg_queues(xorriso,0);
#define Xorriso_with_isoburn_get_min_start_bytE 1
#ifdef Xorriso_with_isoburn_get_min_start_bytE
{ off_t start_byte= 0;
ret= isoburn_get_min_start_byte(drive, &start_byte, 0);
nwa= start_byte / 2048;
}
#else
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
#endif
if(ret<=0) {
sprintf(xorriso->info_text, "Cannot obtain Table Of Content");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
@ -611,17 +621,15 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
sprintf(respt+strlen(respt), "leadout lba: %9d\n", lba);
Xorriso_result(xorriso,0);
last_track_size= lba - last_track_start;
if (s == BURN_DISC_APPENDABLE) {
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
if(ret<=0)
nwa= 0;
}
}
}
if (s == BURN_DISC_APPENDABLE && nwa>0) {
sprintf(respt, "Media nwa : %ds\n", nwa);
Xorriso_result(xorriso,0);
ret= isoburn_disc_track_lba_nwa(drive, NULL, 0, &lba, &nwa);
if(ret>0) {
sprintf(respt, "Media nwa : %ds\n", nwa);
Xorriso_result(xorriso,0);
}
}
if (disc!=NULL)