From 1195ef109c0f0fb9a3924eb94961de47d4bebc18 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 17 Feb 2010 14:12:23 +0000 Subject: [PATCH] Avoided random percentage display at start of blanking --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/async.c | 25 +++++++++++++++++++++++ libburn/trunk/libburn/drive.c | 14 +++++++++++-- libburn/trunk/libburn/write.c | 3 +++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index b2da18fc..63a19082 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2010.02.16.194147" +#define Cdrskin_timestamP "2010.02.17.141409" diff --git a/libburn/trunk/libburn/async.c b/libburn/trunk/libburn/async.c index 50ed43ca..d13e0578 100644 --- a/libburn/trunk/libburn/async.c +++ b/libburn/trunk/libburn/async.c @@ -232,6 +232,22 @@ static void *scan_worker_func(struct w_list *w) return NULL; } +static void reset_progress(struct burn_drive *d, int sessions, int tracks, + int indices, int sectors, int flag) +{ + /* reset the progress indicator */ + d->progress.session = 0; + d->progress.sessions = sessions; + d->progress.track = 0; + d->progress.tracks = tracks; + d->progress.index = 0; + d->progress.indices = indices; + d->progress.start_sector = 0; + d->progress.sectors = sectors; + d->progress.sector = 0; +} + + int burn_drive_scan(struct burn_drive_info *drives[], unsigned int *n_drives) { struct scan_opts o; @@ -314,6 +330,7 @@ void burn_disc_erase(struct burn_drive *drive, int fast) /* a ssert(drive); */ /* a ssert(!SCAN_GOING()); */ /* a ssert(!find_worker(drive)); */ + if((drive == NULL)) { libdax_msgs_submit(libdax_messenger, drive->global_index, 0x00020104, @@ -329,6 +346,9 @@ void burn_disc_erase(struct burn_drive *drive, int fast) 0, 0); return; } + + reset_progress(drive, 1, 1, 1, 0x10000, 0); + /* A70103 : will be set to 0 by burn_disc_erase_sync() */ drive->cancel = 1; @@ -383,6 +403,8 @@ void burn_disc_format(struct burn_drive *drive, off_t size, int flag) int ok = 0, ret; char msg[160]; + reset_progress(drive, 1, 1, 1, 0x10000, 0); + if ((SCAN_GOING()) || find_worker(drive) != NULL) { libdax_msgs_submit(libdax_messenger, drive->global_index, 0x00020102, @@ -547,6 +569,9 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc) return; } + reset_progress(d, disc->sessions, disc->session[0]->tracks, + disc->session[0]->track[0]->indices, 0, 0); + /* For the next lines any return indicates failure */ d->cancel = 1; diff --git a/libburn/trunk/libburn/drive.c b/libburn/trunk/libburn/drive.c index c2962385..89d59d21 100644 --- a/libburn/trunk/libburn/drive.c +++ b/libburn/trunk/libburn/drive.c @@ -621,8 +621,9 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast) d->idata->product); d->cancel = 0; - d->busy = BURN_DRIVE_ERASING; - d->erase(d, fast); + +#ifdef Libburn_reset_progress_asynC + /* <<< This is now done in async.c */ /* reset the progress */ d->progress.session = 0; d->progress.sessions = 1; @@ -633,6 +634,11 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast) d->progress.start_sector = 0; d->progress.sectors = 0x10000; d->progress.sector = 0; +#endif /* Libburn_reset_progress_asynC */ + + d->erase(d, fast); + d->busy = BURN_DRIVE_ERASING; + /* read the initial 0 stage */ while (!d->test_unit_ready(d) && d->get_erase_progress(d) == 0) sleep(1); @@ -659,6 +665,8 @@ void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag) char msg[80]; struct buffer buf, *buf_mem = d->buffer; +#ifdef Libburn_reset_progress_asynC + /* <<< This is now done in async.c */ /* reset the progress */ d->progress.session = 0; d->progress.sessions = 1; @@ -669,6 +677,8 @@ void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag) d->progress.start_sector = 0; d->progress.sectors = 0x10000; d->progress.sector = 0; +#endif /* Libburn_reset_progress_asynC */ + stages = 1 + ((flag & 1) && size > 1024 * 1024); d->cancel = 0; d->busy = BURN_DRIVE_FORMATTING; diff --git a/libburn/trunk/libburn/write.c b/libburn/trunk/libburn/write.c index 3db74fa3..78ffb7f9 100644 --- a/libburn/trunk/libburn/write.c +++ b/libburn/trunk/libburn/write.c @@ -942,6 +942,8 @@ int burn_disc_init_write_status(struct burn_write_opts *o, d->cancel = 0; +#ifdef Libburn_reset_progress_asynC + /* <<< This is now done in async.c */ /* init progress before showing the state */ d->progress.session = 0; d->progress.sessions = disc->sessions; @@ -956,6 +958,7 @@ int burn_disc_init_write_status(struct burn_write_opts *o, d->progress.sectors = 0; d->progress.sector = 0; d->progress.track = 0; +#endif /* Libburn_reset_progress_asynC */ /* ts A61023 */ d->progress.buffer_capacity = 0;