Made single track TAO work without fixed size (compile -experimental)

This commit is contained in:
2006-10-31 18:48:18 +00:00
parent 114307a679
commit 5af92d13fe
7 changed files with 118 additions and 15 deletions

View File

@ -125,7 +125,7 @@ static void get_bytes(struct burn_track *track, int count, unsigned char *data)
valid = track->source->read(track->source, data + curr, count - curr);
} else valid = 0;
if (valid == -1) {
if (valid <= 0) { /* ts A61031 : extended from (valid == -1) */
track->eos = 1;
valid = 0;
}
@ -159,6 +159,12 @@ static void get_bytes(struct burn_track *track, int count, unsigned char *data)
if (!shortage)
goto ex;
/* ts A61031 */
if (shortage >= count)
track->track_data_done = 1;
if (track->open_ended)
goto ex;
/* If we're still short, and there's a "next" pointer, we pull from that.
if that depletes, we'll just fill with 0s.
*/
@ -233,6 +239,32 @@ static unsigned char *get_sector(struct burn_write_opts *opts, int inmode)
return ret;
}
/* ts A61031 */
/* Revoke the counting of the most recent sector handed out by get_sector() */
static void unget_sector(struct burn_write_opts *opts, int inmode)
{
struct burn_drive *d = opts->drive;
struct buffer *out = d->buffer;
int outmode;
int seclen;
outmode = get_outmode(opts);
if (outmode == 0)
outmode = inmode;
/* ts A61009 : react on eventual failure of burn_sector_length()
(should not happen if API tested properly).
Ensures out->bytes >= out->sectors */
seclen = burn_sector_length(outmode);
if (seclen <= 0)
return NULL;
seclen += burn_subcode_length(outmode);
out->bytes -= seclen;
out->sectors--;
}
/* either inmode == outmode, or outmode == raw. anything else is bad news */
/* ts A61010 : changed type to int in order to propagate said bad news */
/** @return 1 is ok, <= 0 is failure */
@ -598,6 +630,12 @@ int sector_data(struct burn_write_opts *o, struct burn_track *t, int psub)
if (convert_data(o, t, t->mode, data) <= 0)
return 0;
/* ts A61031 */
if (t->open_ended && t->track_data_done) {
unget_sector(o, t->mode);
return 2;
}
if (!t->source->read_sub)
subcode_user(o, subs, t->entry->point,
t->entry->control, 1, &t->isrc, psub);

View File

@ -22,6 +22,10 @@ enum burn_source_status burn_track_set_source(struct burn_track *t,
return BURN_SOURCE_FAILED;
s->refcount++;
t->source = s;
/* ts A61031 */
t->open_ended= (s->get_size(s) <= 0);
return BURN_SOURCE_OK;
}

View File

@ -115,6 +115,12 @@ struct burn_track *burn_track_create(void)
t->pad = 1;
t->entry = NULL;
t->source = NULL;
/* ts A61031 */
t->eos = 0;
t->open_ended = 0;
t->track_data_done = 0;
t->postgap = 0;
t->pregap1 = 0;
t->pregap2 = 0;
@ -318,6 +324,18 @@ int burn_track_get_sectors(struct burn_track *t)
return sectors;
}
/* ts A61031 */
int burn_track_is_open_ended(struct burn_track *t)
{
return !!t->open_ended;
}
/* ts A61031 */
int burn_track_is_data_done(struct burn_track *t)
{
return !!t->track_data_done;
}
int burn_track_get_shortage(struct burn_track *t)
{
int size;

View File

@ -31,6 +31,13 @@ struct burn_track
struct burn_source *source;
/** End of Source flag */
int eos;
/* ts A61031 */
/** Source is of undefined length */
int open_ended;
/** End of open ended track flag : offset+payload+tail are delivered */
int track_data_done;
/** The audio/data mode for the entry. Derived from control and
possibly from reading the track's first sector. */
int mode;
@ -71,4 +78,10 @@ struct burn_disc
int burn_track_get_shortage(struct burn_track *t);
/* ts A61031 : might go to libburn.h */
int burn_track_is_open_ended(struct burn_track *t);
int burn_track_is_data_done(struct burn_track *t);
#endif /* BURN__STRUCTURE_H */

View File

@ -469,7 +469,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
{
struct burn_track *t = s->track[tnum];
struct burn_drive *d = o->drive;
int i, tmp = 0;
int i, tmp = 0, open_ended = 0;
int sectors;
d->rlba = -150;
@ -505,6 +505,11 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
/* user data */
sectors = burn_track_get_sectors(t);
open_ended = burn_track_is_open_ended(t);
/* <<< ts A61031 */
fprintf(stderr, "libburn_experimental: sectors= %d , open_ended= %d\n",
sectors,open_ended);
/* Update progress */
d->progress.start_sector = d->nwa;
@ -521,7 +526,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
if (tnum == s->tracks)
tmp = sectors > 150 ? 150 : sectors;
for (i = 0; i < sectors - tmp; i++) {
for (i = 0; open_ended || i < sectors - tmp; i++) {
/* ts A61023 : http://libburn.pykix.org/ticket/14
From time to time inquire drive buffer */
@ -531,6 +536,13 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
if (!sector_data(o, t, 0))
return 0;
/* ts A61031 */
if (open_ended) {
d->progress.sectors = sectors = i;
if (burn_track_is_data_done(t))
break;
}
/* update current progress */
d->progress.sector++;
}