From 29a08956f674547d334709a95df8020b8b496741 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 13 Jan 2012 17:10:06 +0000 Subject: [PATCH] Implemented index reporting for struct burn_progress --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/sector.c | 9 ++++++++- libburn/trunk/libburn/write.c | 19 ++++++++++++------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 9a6f1a6c..19f6b6c7 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2012.01.13.151126" +#define Cdrskin_timestamP "2012.01.13.170914" diff --git a/libburn/trunk/libburn/sector.c b/libburn/trunk/libburn/sector.c index 2f420d65..45bfb31b 100644 --- a/libburn/trunk/libburn/sector.c +++ b/libburn/trunk/libburn/sector.c @@ -228,7 +228,7 @@ ex:; int sector_write_buffer(struct burn_drive *d, struct burn_track *track, int flag) { - int err; + int err, i; struct buffer *out; out = d->buffer; @@ -242,6 +242,13 @@ int sector_write_buffer(struct burn_drive *d, if(track != NULL) { track->writecount += out->bytes; track->written_sectors += out->sectors; + + /* Determine index of d->nwa */ + for (i = d->progress.index; i + 1 < track->indices; i++) { + if (track->index[i + 1] > d->nwa + out->sectors) + break; + d->progress.index = i + 1; + } } /* ts A61119 */ d->progress.buffered_bytes += out->bytes; diff --git a/libburn/trunk/libburn/write.c b/libburn/trunk/libburn/write.c index 60ac5fb7..27fb99c6 100644 --- a/libburn/trunk/libburn/write.c +++ b/libburn/trunk/libburn/write.c @@ -1047,15 +1047,13 @@ ex:; /* ts A61218 : outsourced from burn_write_track() */ int burn_disc_init_track_status(struct burn_write_opts *o, - struct burn_session *s, int tnum, int sectors) + struct burn_session *s, struct burn_track *t, + int tnum, int sectors) { struct burn_drive *d = o->drive; /* Update progress */ - /* >>> ts B20113 : This is wrong, because nwa does not count buffered - but yet unwritten sectors. - */ d->progress.start_sector = d->nwa; d->progress.sectors = sectors; @@ -1065,6 +1063,13 @@ int burn_disc_init_track_status(struct burn_write_opts *o, by bonfire-app@wanadoo.fr in http://libburn.pykix.org/ticket/58 */ d->progress.track = tnum; + /* ts B20113 */ + d->progress.indices = t->indices; + d->progress.index = 0; + if (d->progress.indices > 1) + if (t->index[0] == 0x7fffffff) + d->progress.index = 1; + /* ts A61102 */ d->busy = BURN_DRIVE_WRITING; @@ -1172,7 +1177,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s, sectors = burn_track_get_sectors(t); open_ended = burn_track_is_open_ended(t); - burn_disc_init_track_status(o, s, tnum, sectors); + burn_disc_init_track_status(o, s, t, tnum, sectors); /* ts A61030 : this cannot happen. tnum is always < s->tracks */ if (tnum == s->tracks) @@ -1821,7 +1826,7 @@ int burn_dvd_write_track(struct burn_write_opts *o, /* (offset padding is done within sector_data()) */ - burn_disc_init_track_status(o, s, tnum, sectors); + burn_disc_init_track_status(o, s, t, tnum, sectors); for (i = 0; open_ended || i < sectors; i++) { /* From time to time inquire drive buffer */ @@ -2660,7 +2665,7 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s, BURN_ALLOC_MEM(buf, char, bufsize); sectors = burn_track_get_sectors(t); - burn_disc_init_track_status(o, s, tnum, sectors); + burn_disc_init_track_status(o, s, t, tnum, sectors); open_ended = burn_track_is_open_ended(t); t->end_on_premature_eoi = (o->write_type == BURN_WRITE_TAO);