From aa9d33c9e329f19d927b190f01f1e5923b54fea7 Mon Sep 17 00:00:00 2001 From: Vreixo Formoso Lopes Date: Sun, 23 Sep 2007 14:57:25 +0000 Subject: [PATCH] New API function for image modification --- src/isoburn.c | 19 +++++++++++++++---- src/isoburn.h | 3 --- src/libisoburn.h | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/isoburn.c b/src/isoburn.c index 10b8e065..dd9ffd33 100644 --- a/src/isoburn.c +++ b/src/isoburn.c @@ -48,7 +48,6 @@ int isoburn_new(struct isoburn **objpt, int flag) o->emulation_mode= 0; o->min_start_byte= 0; o->nwa= 0; - o->treatment= 1; o->src= NULL; o->fabricated_disc_status= BURN_DISC_UNREADY; for(i=0;i<65536;i++) @@ -233,7 +232,9 @@ int isoburn_find_by_drive(struct isoburn **pt, struct burn_drive *d, int flag) return(0); } -int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc) +static +int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc, + int new_img) { struct burn_source *wsrc; struct burn_session *session; @@ -272,9 +273,9 @@ int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc) wopts.input_charset = NULL; wopts.ouput_charset = NULL; - wopts.ms_block = o->nwa; + wopts.ms_block = (new_img ? 0 : o->nwa); wopts.src = o->src; - wopts.overwrite = o->target_iso_head; + wopts.overwrite = (new_img ? NULL : o->target_iso_head); wsrc = iso_source_new_ecma119(o->target_volset, &wopts); track = burn_track_create(); @@ -283,3 +284,13 @@ int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc) return 1; } + +int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc) +{ + return isoburn_prepare_disc_aux(d, disc, 0); +} + +int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc) +{ + return isoburn_prepare_disc_aux(d, disc, 1); +} diff --git a/src/isoburn.h b/src/isoburn.h index e29a8119..c1189924 100644 --- a/src/isoburn.h +++ b/src/isoburn.h @@ -47,9 +47,6 @@ struct isoburn { enum burn_disc_status fabricated_disc_status; /* --- Vreixo's part --- */ - - /* Expansion treatment strategy: 1= grow, 2= modify, (any use for 0 ?) */ - int treatment; /* The data source for reading the old image */ struct data_source *src; diff --git a/src/libisoburn.h b/src/libisoburn.h index 0dc848ae..9e2291f3 100644 --- a/src/libisoburn.h +++ b/src/libisoburn.h @@ -148,8 +148,22 @@ int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o, @param disc A burn_disc suitable to pass to isoburn_disc_write. @return <=0 error , 1 = success */ +// TODO we need to pass reduced ecma119_source_opts int isoburn_prepare_disc(struct burn_drive *d, struct burn_disc **disc); + +/** Prepare a disc for creating a new image from the contents of a previous + image volset plus the changes made by user. The generated burn_disc is + suitable to be written to any libburn drive. You shouldn't use the same + drive you're using as source. + @param d The source drive, grabbed with isoburn_drive_scan_and_grab(). + @param disc A burn_disc suitable to pass to burn_disc_write. + @return <=0 error , 1 = success +*/ +// TODO we need to pass reduced ecma119_source_opts +int isoburn_prepare_new_image(struct burn_drive *d, struct burn_disc **disc); + + /** 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 @@ -172,6 +186,7 @@ int isoburn_activate_session(struct burn_drive *drive); @param pacifier_func If not NULL: a function to produce appeasing messages. See burn_abort_pacifier() in libburn.h for an example. */ +// TODO implement this int isoburn_perform_write(struct burn_write_opts *o, int (*pacifier_func)(void *handle, int patience, int elapsed));