diff --git a/src/isoburn.c b/src/isoburn.c index 3ce59312..b0619a46 100644 --- a/src/isoburn.c +++ b/src/isoburn.c @@ -239,12 +239,6 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc, if(ret<0) return -1; - // TODO check return values for failure. propertly clean-up on error - - *disc = burn_disc_create(); - session = burn_session_create(); - burn_disc_add_session(*disc, session, BURN_POS_END); - wopts.volnum = 0; wopts.level = opts->level; wopts.flags = opts->flags; @@ -264,11 +258,25 @@ int isoburn_prepare_disc_aux(struct burn_drive *d, struct burn_disc **disc, wopts.input_charset = opts->input_charset; wopts.ouput_charset = opts->ouput_charset; - wopts.ms_block = (new_img ? 0 : o->nwa); + if (new_img) { + wopts.ms_block = 0; + } else { + int lba, nwa; + ret = isoburn_disc_track_lba_nwa(d, NULL, 0, &lba, &nwa); + if (ret != 1) + return -2; + wopts.ms_block = nwa; + } + wopts.src = o->src; wopts.overwrite = (new_img ? NULL : o->target_iso_head); wsrc = iso_source_new_ecma119(o->target_volset, &wopts); - + + // TODO check return values for failure. propertly clean-up on error + + *disc = burn_disc_create(); + session = burn_session_create(); + burn_disc_add_session(*disc, session, BURN_POS_END); track = burn_track_create(); burn_track_set_source(track, wsrc); burn_session_add_track(session, track, BURN_POS_END);