From c98dd9b0a72e0fa6100636cc25dc83331dcd1341 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 2 Nov 2006 21:17:32 +0000 Subject: [PATCH] Installed status communications about closing session ("Fixating") --- cdrskin/cdrskin.c | 61 +++++++++++++++++++++++++++---------- cdrskin/cdrskin_timestamp.h | 2 +- libburn/libburn.h | 11 ++++++- libburn/write.c | 26 ++++++++++++++-- 4 files changed, 80 insertions(+), 20 deletions(-) diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 4684f07..de235d3 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -905,7 +905,7 @@ int Cdrtrack_get_size(struct CdrtracK *track, double *size, double *padding, *padding= track->padding; #ifdef Cdrskin_allow_libburn_taO if((flag&1) && track->libburn_track!=NULL) { - off_t readcounter,writecounter; + off_t readcounter= 0,writecounter= 0; burn_track_get_counters(track->libburn_track,&readcounter,&writecounter); *size= readcounter; @@ -2315,7 +2315,8 @@ struct CdrskiN { /** Progress state info: wether libburn is actually processing payload data */ int is_writing; - + /** Previously detected drive state */ + enum burn_drive_status previous_drive_status; /** abort parameters */ int abort_max_wait; @@ -2398,6 +2399,7 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag) o->n_drives= 0; o->driveno= 0; o->is_writing= 0; + o->previous_drive_status = BURN_DRIVE_IDLE; o->abort_max_wait= 74*60; o->lib_is_initialized= (flag&1); o->control_pid= getpid(); @@ -3604,7 +3606,7 @@ int Cdrskin_wait_before_action(struct CdrskiN *skin, int flag) } } if(skin->verbosity>=Cdrskin_verbose_progresS) - printf(" Operation starts.\n"); + {printf(" Operation starts.\n");fflush(stdout);} return(1); } @@ -3674,19 +3676,25 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) start_time= Sfile_microtime(0); while(burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) { if(loop_counter>0) - if(skin->verbosity>=Cdrskin_verbose_progresS) + if(skin->verbosity>=Cdrskin_verbose_progresS) { + int percent= 50; + + if(p.sectors>0) /* i want a display of 1 to 99 percent */ + percent= 1.0+((double) p.sector+1.0)/((double) p.sectors)*98.0; fprintf(stderr, - "\rcdrskin: blanking sector %d (%lu seconds elapsed) ", - p.sector,(unsigned long) (Sfile_microtime(0)-start_time)); - sleep(2); + "\rcdrskin: blanking ( done %2d%% , %lu seconds elapsed ) ", + percent,(unsigned long) (Sfile_microtime(0)-start_time)); + } + sleep(1); loop_counter++; } blanking_done:; skin->drive_is_busy= 0; if(skin->verbosity>=Cdrskin_verbose_progresS) { - fprintf(stderr,"\n"); + fprintf(stderr, + "\rcdrskin: blanking done \n"); printf("Blanking time: %.3fs\n",Sfile_microtime(0)-start_time); - fprintf(stderr,"cdrskin: blanking done\n"); + fflush(stdout); } Cdrskin_release_drive(skin,0); return(1); @@ -3733,30 +3741,50 @@ int Cdrskin_burn_pacifier(struct CdrskiN *skin, current_time= Sfile_microtime(0); elapsed_total_time= current_time-start_time; elapsed_time= current_time-*last_time; - time_to_tell= (elapsed_time>=1.0); + time_to_tell= (elapsed_time>=1.0)&&(elapsed_total_time>=1.0); if(drive_status==BURN_DRIVE_WRITING) { ; - } else if(drive_status==BURN_DRIVE_WRITING_LEADIN) { + } else if(drive_status==BURN_DRIVE_WRITING_LEADIN + +#ifdef Cdrskin_allow_libburn_taO + || drive_status==BURN_DRIVE_WRITING_PREGAP +#endif + + ) { if(time_to_tell || skin->is_writing) { if(skin->verbosity>=Cdrskin_verbose_progresS) { if(skin->is_writing) fprintf(stderr,"\n"); fprintf(stderr, - "\rcdrskin: writing lead-in since %.f seconds ", + "\rcdrskin: working pre-track (burning since %.f seconds) ", elapsed_total_time); } skin->is_writing= 0; advance_interval= 1; } {ret= 2; goto ex;} - } else if(drive_status==BURN_DRIVE_WRITING_LEADOUT) { + } else if(drive_status==BURN_DRIVE_WRITING_LEADOUT + +#ifdef Cdrskin_allow_libburn_taO + || drive_status==BURN_DRIVE_CLOSING_TRACK + || drive_status==BURN_DRIVE_CLOSING_SESSION +#endif + + ) { + +#ifdef Cdrskin_allow_libburn_taO + if(drive_status==BURN_DRIVE_CLOSING_SESSION && + skin->previous_drive_status!=drive_status) + {printf("\nFixating...\n"); fflush(stdout);} +#endif + if(time_to_tell || skin->is_writing) { if(skin->verbosity>=Cdrskin_verbose_progresS) { if(skin->is_writing) fprintf(stderr,"\n"); fprintf(stderr, - "\rcdrskin: writing lead-out after %.f seconds ", + "\rcdrskin: working post-track (burning since %.f seconds) ", elapsed_total_time); } skin->is_writing= 0; @@ -3802,7 +3830,7 @@ int Cdrskin_burn_pacifier(struct CdrskiN *skin, if(written_total_bytes<1024*1024) { thank_you_for_patience:; - if(time_to_tell || skin->is_writing) { + if(time_to_tell || (skin->is_writing && elapsed_total_time>=1.0)) { if(skin->verbosity>=Cdrskin_verbose_progresS) { if(skin->is_writing) fprintf(stderr,"\n"); @@ -3810,9 +3838,9 @@ thank_you_for_patience:; "\rcdrskin: thank you for being patient since %.f seconds ", elapsed_total_time); } - skin->is_writing= 0; advance_interval= 1; } + skin->is_writing= 0; {ret= 2; goto ex;} } new_mb= written_total_bytes/(1024*1024); @@ -3967,6 +3995,7 @@ ex:; *total_count= *last_count; *last_time= current_time; } + skin->previous_drive_status= drive_status; return(ret); } diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 8a90910..30f337c 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2006.11.01.172004" +#define Cdrskin_timestamP "2006.11.02.211816" diff --git a/libburn/libburn.h b/libburn/libburn.h index 3186a79..e90dfd5 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -217,7 +217,16 @@ enum burn_drive_status /** The drive is erasing a disc */ BURN_DRIVE_ERASING, /** The drive is being grabbed */ - BURN_DRIVE_GRABBING + BURN_DRIVE_GRABBING, + + /* ts A61102 */ + /** The drive gets written zeroes before the track payload data */ + BURN_DRIVE_WRITING_PREGAP, + /** The drive is told to close a track (TAO only) */ + BURN_DRIVE_CLOSING_TRACK, + /** The drive is told to close a session (TAO only) */ + BURN_DRIVE_CLOSING_SESSION + }; /** Information about a track on a disc - this is from the q sub channel of the diff --git a/libburn/write.c b/libburn/write.c index c3e220a..93ac1bc 100644 --- a/libburn/write.c +++ b/libburn/write.c @@ -126,14 +126,21 @@ int burn_write_close_track(struct burn_write_opts *o, int tnum) { char msg[81]; - sprintf(msg, "Closing track %2.2d\n", tnum+1); + sprintf(msg, "Closing track %2.2d", tnum+1); libdax_msgs_submit(libdax_messenger, o->drive->global_index,0x00020119, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH, msg,0,0); + /* ts A61102 */ + o->drive->busy = BURN_DRIVE_CLOSING_TRACK; + /* MMC-1 mentions track number 0xFF for "the incomplete track", MMC-3 does not. I tried both. 0xFF was in effect when other bugs finally gave up and made way for readable tracks. */ o->drive->close_track_session(o->drive, 0, 0xff); /* tnum+1); */ + + /* ts A61102 */ + o->drive->busy = BURN_DRIVE_WRITING; + return 1; } @@ -145,7 +152,14 @@ int burn_write_close_session(struct burn_write_opts *o) LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH, "Closing session", 0, 0); + /* ts A61102 */ + o->drive->busy = BURN_DRIVE_CLOSING_SESSION; + o->drive->close_track_session(o->drive, 1, 0); + + /* ts A61102 */ + o->drive->busy = BURN_DRIVE_WRITING; + return 1; } @@ -491,6 +505,10 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s, /* XXX for tao, we don't want the pregaps but still want post? */ if (o->write_type != BURN_WRITE_TAO) { + + /* ts A61102 */ + d->busy = BURN_DRIVE_WRITING_PREGAP; + if (t->pregap1) d->rlba += 75; if (t->pregap2) @@ -519,6 +537,10 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s, } /* user data */ + + /* ts A61102 */ + d->busy = BURN_DRIVE_WRITING; + sectors = burn_track_get_sectors(t); open_ended = burn_track_is_open_ended(t); @@ -660,7 +682,7 @@ return crap. so we send the command, then ignore the result. when and why it occurs. Multi-session will hardly work on base of flat guessing. */ - sprintf(msg, "Ignored nwa: %d\n", res); + sprintf(msg, "Ignored nwa: %d", res); libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, msg, 0, 0);