From 55632c428db65b6ece5545dd1eef6ba77a70e9e1 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 17 Oct 2007 21:42:37 +0000 Subject: [PATCH] Rounding up fabricated nwa to full 32k addresses, API call for exact image size --- libisoburn/trunk/src/burn_wrap.c | 21 ++++++++++++++++++++ libisoburn/trunk/src/libisoburn.h | 17 ++++++++++++++-- libisoburn/trunk/test/xorriso_timestamp.h | 2 +- libisoburn/trunk/test/xorrisoburn.c | 24 +++++++++++++++-------- 4 files changed, 53 insertions(+), 11 deletions(-) diff --git a/libisoburn/trunk/src/burn_wrap.c b/libisoburn/trunk/src/burn_wrap.c index 1361aeaa..223f3eed 100644 --- a/libisoburn/trunk/src/burn_wrap.c +++ b/libisoburn/trunk/src/burn_wrap.c @@ -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; diff --git a/libisoburn/trunk/src/libisoburn.h b/libisoburn/trunk/src/libisoburn.h index d4c2ab9f..00c2e8fd 100644 --- a/libisoburn/trunk/src/libisoburn.h +++ b/libisoburn/trunk/src/libisoburn.h @@ -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, diff --git a/libisoburn/trunk/test/xorriso_timestamp.h b/libisoburn/trunk/test/xorriso_timestamp.h index b8be2c32..0b0c32d5 100644 --- a/libisoburn/trunk/test/xorriso_timestamp.h +++ b/libisoburn/trunk/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.17.213852" +#define Xorriso_timestamP "2007.10.17.214228" diff --git a/libisoburn/trunk/test/xorrisoburn.c b/libisoburn/trunk/test/xorrisoburn.c index 154f94ab..98e0c810 100644 --- a/libisoburn/trunk/test/xorrisoburn.c +++ b/libisoburn/trunk/test/xorrisoburn.c @@ -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)