From b2b6a9bcd8fc1bf723be0f89457a2fb0762ffd11 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 3 Feb 2008 16:41:27 +0000 Subject: [PATCH] New API call isoburn_cancel_prepared_write() --- libisoburn/isoburn.c | 19 +++++++++++++++++++ libisoburn/libisoburn.h | 13 +++++++++++++ xorriso/xorriso_timestamp.h | 2 +- xorriso/xorrisoburn.c | 5 ++++- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/libisoburn/isoburn.c b/libisoburn/isoburn.c index cb2dfbd4..7008b4db 100644 --- a/libisoburn/isoburn.c +++ b/libisoburn/isoburn.c @@ -414,6 +414,25 @@ int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc, } +int isoburn_cancel_prepared_write(struct burn_drive *d, int flag) +{ + int ret; + struct isoburn *o; + + ret= isoburn_find_emulator(&o, d, 0); + if(ret<0 || o==NULL) + return(-1); + if(o->iso_source==NULL) + return(0); + if(o->iso_source->read!=NULL) + return(0); + if(o->iso_source->version<1) + return(0); + o->iso_source->cancel(o->iso_source); + return(1); +} + + void isoburn_version(int *major, int *minor, int *micro) { *major= isoburn_header_version_major; diff --git a/libisoburn/libisoburn.h b/libisoburn/libisoburn.h index 0e51f48a..aadf2473 100644 --- a/libisoburn/libisoburn.h +++ b/libisoburn/libisoburn.h @@ -686,6 +686,19 @@ int isoburn_prepare_new_image(struct burn_drive *in_drive, struct isoburn_imgen_opts *opts, struct burn_drive *out_drive); +/** Revoke isoburn_prepare_new_image() or isoburn_prepare_disc() instead of + running isoburn_disc_write(). + libisofs reserves resources and maybe already starts generating the + image stream when one of above two calls is performed. It is mandatory to + either run isoburn_disc_write() or to revoke the preparations by the + call described here. + @param d The input drive which was used with the preparation call. + @param flag Bitfield, submit 0 for now. + @return <=0 error , 1 = success +*/ +int isoburn_cancel_prepared_write(struct burn_drive *d, int flag); + + /** Start writing of the new session. This call is asynchrounous. I.e. it returns quite soon and the progress has to be watched by a loop with call burn_drive_get_status() until diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 1b57a822..b9b891f1 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.02.03.155704" +#define Xorriso_timestamP "2008.02.03.164038" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index aec741d1..45f1d31a 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -730,7 +730,8 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) if(xorriso->out_drive_handle == xorriso->in_drive_handle || xorriso->in_drive_handle == NULL) { - ret= isoburn_prepare_disc(drive, &disc, sopts); + source_drive= drive; + ret= isoburn_prepare_disc(source_drive, &disc, sopts); } else { s= isoburn_disc_get_status(drive); if(s!=BURN_DISC_BLANK) { @@ -773,6 +774,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) : img_sectors ), media_space); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + isoburn_cancel_prepared_write(source_drive, 0); {ret= 0; goto ex;} } @@ -783,6 +785,7 @@ no_track:; Xorriso_process_msg_queues(xorriso,0); sprintf(xorriso->info_text,"Program error : no track in prepared disc"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); + isoburn_cancel_prepared_write(source_drive, 0); {ret= -1; goto ex;} } tracks= burn_session_get_tracks(sessions[0], &num_tracks);