New API function for image modification

This commit is contained in:
Vreixo Formoso Lopes 2007-09-23 14:57:25 +00:00
parent 05769b25f0
commit 7e54a8ed21
3 changed files with 30 additions and 7 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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));