Flushing buffer to MMC before a new track begins
This commit is contained in:
parent
286697bc21
commit
c95665c1e0
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2012.01.13.101844"
|
||||
#define Cdrskin_timestamP "2012.01.13.122205"
|
||||
|
@ -223,6 +223,36 @@ ex:;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ts B20113 : outsourced from get_sector() */
|
||||
int sector_write_buffer(struct burn_drive *d,
|
||||
struct burn_track *track, int flag)
|
||||
{
|
||||
int err;
|
||||
struct buffer *out;
|
||||
|
||||
out = d->buffer;
|
||||
if (out->sectors <= 0)
|
||||
return 2;
|
||||
err = d->write(d, d->nwa, out);
|
||||
if (err == BE_CANCELLED)
|
||||
return 0;
|
||||
|
||||
/* ts A61101 */
|
||||
if(track != NULL) {
|
||||
track->writecount += out->bytes;
|
||||
track->written_sectors += out->sectors;
|
||||
}
|
||||
/* ts A61119 */
|
||||
d->progress.buffered_bytes += out->bytes;
|
||||
|
||||
d->nwa += out->sectors;
|
||||
out->bytes = 0;
|
||||
out->sectors = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* ts A61009 : seems to hand out sector start pointer in opts->drive->buffer
|
||||
and to count hand outs as well as reserved bytes */
|
||||
/* ts A61101 : added parameter track for counting written bytes */
|
||||
@ -231,7 +261,7 @@ static unsigned char *get_sector(struct burn_write_opts *opts,
|
||||
{
|
||||
struct burn_drive *d = opts->drive;
|
||||
struct buffer *out = d->buffer;
|
||||
int outmode, seclen;
|
||||
int outmode, seclen, write_ret;
|
||||
unsigned char *ret;
|
||||
|
||||
outmode = get_outmode(opts);
|
||||
@ -250,22 +280,9 @@ static unsigned char *get_sector(struct burn_write_opts *opts,
|
||||
/* (there is enough buffer size reserve for track->cdxa_conversion) */
|
||||
if (out->bytes + seclen > BUFFER_SIZE ||
|
||||
(opts->obs > 0 && out->bytes + seclen > opts->obs)) {
|
||||
int err;
|
||||
err = d->write(d, d->nwa, out);
|
||||
if (err == BE_CANCELLED)
|
||||
write_ret = sector_write_buffer(d, track, 0);
|
||||
if (write_ret <= 0)
|
||||
return NULL;
|
||||
|
||||
/* ts A61101 */
|
||||
if(track != NULL) {
|
||||
track->writecount += out->bytes;
|
||||
track->written_sectors += out->sectors;
|
||||
}
|
||||
/* ts A61119 */
|
||||
d->progress.buffered_bytes += out->bytes;
|
||||
|
||||
d->nwa += out->sectors;
|
||||
out->bytes = 0;
|
||||
out->sectors = 0;
|
||||
}
|
||||
ret = out->data + out->bytes;
|
||||
out->bytes += seclen;
|
||||
|
@ -24,6 +24,10 @@ int sector_postgap(struct burn_write_opts *, unsigned char tno,
|
||||
int sector_lout(struct burn_write_opts *, unsigned char control, int mode);
|
||||
int sector_data(struct burn_write_opts *, struct burn_track *t, int psub);
|
||||
|
||||
/* ts B20113 */
|
||||
int sector_write_buffer(struct burn_drive *d,
|
||||
struct burn_track *track, int flag);
|
||||
|
||||
/* ts A61009 */
|
||||
int sector_headers_is_ok(struct burn_write_opts *o, int mode);
|
||||
|
||||
|
@ -1052,7 +1052,12 @@ int burn_disc_init_track_status(struct burn_write_opts *o,
|
||||
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;
|
||||
d->progress.sector = 0;
|
||||
|
||||
@ -1121,6 +1126,13 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
if (!sector_pregap(o, t->entry->point,
|
||||
t->entry->control, t->mode))
|
||||
{ ret = 0; goto ex; }
|
||||
|
||||
/* Flush buffer to avoid influence of previous track or pregap
|
||||
on track counter */
|
||||
ret = sector_write_buffer(d, NULL, 0);
|
||||
if (ret <= 0)
|
||||
goto ex;
|
||||
|
||||
} else {
|
||||
o->control = t->entry->control;
|
||||
d->send_write_parameters(d, s, tnum, o);
|
||||
|
Loading…
Reference in New Issue
Block a user