New API function to inquire burn success (and avoid confusing messages)

This commit is contained in:
2006-12-23 14:12:55 +00:00
parent 750b897ef0
commit 1ce6ec4a3a
5 changed files with 47 additions and 19 deletions

View File

@ -1281,3 +1281,9 @@ int burn_disc_get_profile(struct burn_drive *d, int *pno, char name[80])
}
/* ts A61223 : New API function */
int burn_drive_wrote_well(struct burn_drive *d)
{
return !d->cancel;
}

View File

@ -811,6 +811,17 @@ void burn_disc_write(struct burn_write_opts *o, struct burn_disc *disc);
*/
void burn_drive_cancel(struct burn_drive *drive);
/* ts A61223 */
/** Inquire wether the most recent write run was successful. Reasons for
non-success may be: rejection of burn parameters, abort during fatal errors
during write, a call to burn_drive_cancel() by the application thread.
@param d The drive to inquire.
@return 1=burn seems to have went well, 0=burn failed
*/
int burn_drive_wrote_well(struct burn_drive *d);
/** Convert a minute-second-frame (MSF) value to sector count
@param m Minute component
@param s Second component

View File

@ -921,7 +921,7 @@ int burn_disc_setup_dvd_plus_rw(struct burn_write_opts *o,
if (o->start_byte >= 0)
d->nwa = o->start_byte / 2048;
sprintf(msg, "Write start address is %d * 2048\n", d->nwa);
sprintf(msg, "Write start address is %d * 2048", d->nwa);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020127,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
@ -971,6 +971,15 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
msg, 0,0);
goto early_failure;
}
if (o->start_byte >= 0 && (o->start_byte % 2048)) {
sprintf(msg,
"Write start address not properly aligned to 2048");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020125,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0,0);
goto early_failure;
}
ret = burn_disc_setup_dvd_plus_rw(o, disc);
if (ret <= 0) {
@ -982,15 +991,6 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
msg, 0,0);
goto early_failure;
}
if (o->start_byte >= 0 && (o->start_byte % 2048)) {
sprintf(msg,
"Write start address not properly aligned to 2048");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020125,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0,0);
goto early_failure;
}
} else {
sprintf(msg, "Unsuitable media detected. Profile %4.4Xh %s",
@ -1027,9 +1027,6 @@ ex:;
return ret;
early_failure:;
pthread_mutex_lock(&d->access_lock);
d->cancel = 1;
pthread_mutex_unlock(&d->access_lock);
return 0;
}
@ -1047,6 +1044,7 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc)
burn_message_clear_queue();
*/
d->cancel = 0;
d->buffer = &buf;
memset(d->buffer, 0, sizeof(struct buffer));
d->rlba = -150;
@ -1207,5 +1205,6 @@ fail_wo_sync:;
libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010b,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Burn run failed", 0, 0);
d->cancel = 1;
d->busy = BURN_DRIVE_IDLE;
}