From 0b25a4d258f718b613655a94d07b90410235bffc Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 3 Jan 2011 19:51:30 +0000 Subject: [PATCH] Allowed stdio tracks of known size to end in TAO mode on premature EOF --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/sector.c | 12 ++++++++---- libburn/structure.c | 4 +++- libburn/structure.h | 10 +++++++++- libburn/write.c | 9 +++++++-- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index dfa72ef..9661961 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2010.12.13.075956" +#define Cdrskin_timestamP "2011.01.03.195125" diff --git a/libburn/sector.c b/libburn/sector.c index c5e3660..dddc8bb 100644 --- a/libburn/sector.c +++ b/libburn/sector.c @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2010 Thomas Schmitt + Copyright (c) 2006 - 2011 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -179,10 +179,14 @@ static void get_bytes(struct burn_track *track, int count, unsigned char *data) if (!shortage) goto ex; - /* ts A61031 */ + /* ts A61031 - B10103 */ if (shortage >= count) track->track_data_done = 1; - if (track->open_ended) + if (track->end_on_premature_eoi && !track->open_ended) { + /* Memorize that premature end of input happened */ + track->end_on_premature_eoi = 2; + } + if (track->open_ended || track->end_on_premature_eoi) goto ex; /* If we're still short, and there's a "next" pointer, we pull from that. @@ -688,7 +692,7 @@ int sector_data(struct burn_write_opts *o, struct burn_track *t, int psub) return 0; /* ts A61031 */ - if (t->open_ended && t->track_data_done) { + if ((t->open_ended || t->end_on_premature_eoi) && t->track_data_done) { unget_sector(o, t->mode); return 2; } diff --git a/libburn/structure.c b/libburn/structure.c index d05acf7..d9070af 100644 --- a/libburn/structure.c +++ b/libburn/structure.c @@ -1,6 +1,6 @@ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2010 Thomas Schmitt + Copyright (c) 2006 - 2011 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -170,6 +170,8 @@ struct burn_track *burn_track_create(void) /* ts A61031 */ t->open_ended = 0; t->track_data_done = 0; + /* ts B10103 */ + t->end_on_premature_eoi = 0; t->postgap = 0; t->pregap1 = 0; diff --git a/libburn/structure.h b/libburn/structure.h index 6f31303..7c093f4 100644 --- a/libburn/structure.h +++ b/libburn/structure.h @@ -1,6 +1,6 @@ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2010 Thomas Schmitt + Copyright (c) 2006 - 2011 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -55,6 +55,14 @@ struct burn_track int open_ended; /** End of open ended track flag : offset+payload+tail are delivered */ int track_data_done; + /* ts B10103 */ + /** End track writing on premature End-of-input if source is of + defined length. + 0= normal operation in case of eoi + 1= be ready to end track writing on eoi + 2= eoi was encountered with previously set value of 1 + */ + int end_on_premature_eoi; /** The audio/data mode for the entry. Derived from control and possibly from reading the track's first sector. */ diff --git a/libburn/write.c b/libburn/write.c index 94d1245..a43afc1 100644 --- a/libburn/write.c +++ b/libburn/write.c @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2010 Thomas Schmitt + Copyright (c) 2006 - 2011 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -2257,6 +2257,8 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s, burn_disc_init_track_status(o, s, tnum, sectors); open_ended = burn_track_is_open_ended(t); + t->end_on_premature_eoi = (o->write_type == BURN_WRITE_TAO); + /* attach stdio emulators for mmc_*() functions */ if (o->simulate) d->write = burn_stdio_mmc_dummy_write; @@ -2269,8 +2271,9 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s, /* transact a (CD sized) sector */ if (!sector_data(o, t, 0)) {ret= 0; goto ex;} - if (open_ended) { + if (open_ended) d->progress.sectors = sectors = d->progress.sector; + if (open_ended || t->end_on_premature_eoi) { if (burn_track_is_data_done(t)) break; } @@ -2297,6 +2300,8 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s, ex:; if (d->cancel) burn_source_cancel(t->source); + if (t->end_on_premature_eoi == 2) + d->cancel = 1; return ret; }