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

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

View File

@ -169,6 +169,7 @@ or
#define Cdrskin_no_aftergrab_loopS 1
#define Cdrskin_libburn_has_get_profilE 1
#define Cdrskin_libburn_has_set_start_bytE 1
#define Cdrskin_libburn_has_wrote_welL 1
#endif /* Cdrskin_libburn_0_2_7 */
#ifndef Cdrskin_libburn_versioN
@ -4367,7 +4368,7 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
enum burn_drive_status drive_status;
struct burn_progress p;
struct burn_drive *drive;
int ret,loop_counter= 0,max_track= -1,i,hflag,nwa,num;
int ret,loop_counter= 0,max_track= -1,i,hflag,nwa,num, wrote_well= 2;
int fifo_disabled= 0,fifo_percent,total_min_fill,mb,min_buffer_fill= 101;
double put_counter,get_counter,empty_counter,full_counter;
double start_time,last_time;
@ -4615,6 +4616,11 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
skin->drive_is_busy= 0;
if(skin->verbosity>=Cdrskin_verbose_progresS)
printf("\n");
#ifdef Cdrskin_libburn_has_wrote_welL
wrote_well = burn_drive_wrote_well(drive);
#endif
if(max_track<0) {
printf("Track 01: Total bytes read/written: %.f/%.f (%.f sectors).\n",
total_count,total_count,total_count/sector_size);
@ -4630,7 +4636,7 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
#ifndef Cdrskin_extra_leaN
if(skin->fifo!=NULL && skin->fifo_size>0) {
if(skin->fifo!=NULL && skin->fifo_size>0 && wrote_well) {
int dummy,final_fill;
Cdrfifo_get_buffer_state(skin->fifo,&final_fill,&dummy,0);
if(final_fill>0) {
@ -4696,10 +4702,16 @@ fifo_full_at_end:;
#endif /* ! Cdrskin_extra_leaN */
ret= 1;
if(wrote_well) {
if(skin->verbosity>=Cdrskin_verbose_progresS)
printf("cdrskin: burning done\n");
ret= 1;
} else {
if(skin->verbosity>=Cdrskin_verbose_progresS)
printf("cdrskin: burning failed\n");
fprintf(stderr,"cdrskin: FATAL : burning failed.\n");
ret= 0;
}
ex:;
skin->drive_is_busy= 0;
if(skin->verbosity>=Cdrskin_verbose_debuG)

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2006.12.23.102201"
#define Cdrskin_timestamP "2006.12.23.141315"

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