Allowed stdio tracks of known size to end in TAO mode on premature EOF

This commit is contained in:
Thomas Schmitt 2011-01-03 19:51:30 +00:00
parent 3b5aeb0f81
commit 0b25a4d258
5 changed files with 28 additions and 9 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2010.12.13.075956" #define Cdrskin_timestamP "2011.01.03.195125"

View File

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2010 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2011 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. 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) if (!shortage)
goto ex; goto ex;
/* ts A61031 */ /* ts A61031 - B10103 */
if (shortage >= count) if (shortage >= count)
track->track_data_done = 1; 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; goto ex;
/* If we're still short, and there's a "next" pointer, we pull from that. /* 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; return 0;
/* ts A61031 */ /* 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); unget_sector(o, t->mode);
return 2; return 2;
} }

View File

@ -1,6 +1,6 @@
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2010 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2011 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -170,6 +170,8 @@ struct burn_track *burn_track_create(void)
/* ts A61031 */ /* ts A61031 */
t->open_ended = 0; t->open_ended = 0;
t->track_data_done = 0; t->track_data_done = 0;
/* ts B10103 */
t->end_on_premature_eoi = 0;
t->postgap = 0; t->postgap = 0;
t->pregap1 = 0; t->pregap1 = 0;

View File

@ -1,6 +1,6 @@
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2010 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2011 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -55,6 +55,14 @@ struct burn_track
int open_ended; int open_ended;
/** End of open ended track flag : offset+payload+tail are delivered */ /** End of open ended track flag : offset+payload+tail are delivered */
int track_data_done; 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 /** The audio/data mode for the entry. Derived from control and
possibly from reading the track's first sector. */ possibly from reading the track's first sector. */

View File

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2010 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2011 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. 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); burn_disc_init_track_status(o, s, tnum, sectors);
open_ended = burn_track_is_open_ended(t); 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 */ /* attach stdio emulators for mmc_*() functions */
if (o->simulate) if (o->simulate)
d->write = burn_stdio_mmc_dummy_write; 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 */ /* transact a (CD sized) sector */
if (!sector_data(o, t, 0)) if (!sector_data(o, t, 0))
{ret= 0; goto ex;} {ret= 0; goto ex;}
if (open_ended) { if (open_ended)
d->progress.sectors = sectors = d->progress.sector; d->progress.sectors = sectors = d->progress.sector;
if (open_ended || t->end_on_premature_eoi) {
if (burn_track_is_data_done(t)) if (burn_track_is_data_done(t))
break; break;
} }
@ -2297,6 +2300,8 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s,
ex:; ex:;
if (d->cancel) if (d->cancel)
burn_source_cancel(t->source); burn_source_cancel(t->source);
if (t->end_on_premature_eoi == 2)
d->cancel = 1;
return ret; return ret;
} }