Implemented libburn builtin fine granulated drive buffer min-fill recording
This commit is contained in:
@ -388,9 +388,11 @@ struct burn_progress {
|
||||
int index;
|
||||
/** The starting logical block address */
|
||||
int start_sector;
|
||||
/** The number of sector */
|
||||
/** On write: The number of sectors.
|
||||
On blank: 0x10000 as upper limit for relative progress steps */
|
||||
int sectors;
|
||||
/** The current sector being processed */
|
||||
/** On write: The current sector being processed.
|
||||
On blank: Relative progress steps 0 to 0x10000 */
|
||||
int sector;
|
||||
|
||||
/* ts A61023 */
|
||||
@ -398,6 +400,14 @@ struct burn_progress {
|
||||
unsigned buffer_capacity;
|
||||
/** The free space in the drive buffer (might be slightly outdated) */
|
||||
unsigned buffer_available;
|
||||
|
||||
/* ts A61119 */
|
||||
/** The number of bytes sent to the drive buffer */
|
||||
off_t buffered_bytes;
|
||||
/** The minimum number of buffered bytes. (Caution: Before surely
|
||||
one buffer size of bytes was processed, this value is 0xffffffff.)
|
||||
*/
|
||||
unsigned buffer_min_fill;
|
||||
};
|
||||
|
||||
/** Initialize the library.
|
||||
|
@ -874,6 +874,14 @@ int mmc_read_buffer_capacity(struct burn_drive *d)
|
||||
(data[4]<<24)|(data[5]<<16)|(data[6]<<8)|data[7];
|
||||
d->progress.buffer_available =
|
||||
(data[8]<<24)|(data[9]<<16)|(data[10]<<8)|data[11];
|
||||
if (d->progress.buffered_bytes >= d->progress.buffer_capacity){
|
||||
double fill;
|
||||
|
||||
fill = d->progress.buffer_capacity
|
||||
- d->progress.buffer_available;
|
||||
if (fill < d->progress.buffer_min_fill && fill>=0)
|
||||
d->progress.buffer_min_fill = fill;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -228,6 +228,8 @@ static unsigned char *get_sector(struct burn_write_opts *opts,
|
||||
track->writecount += out->bytes;
|
||||
track->written_sectors += out->sectors;
|
||||
}
|
||||
/* ts A61119 */
|
||||
d->progress.buffered_bytes += out->bytes;
|
||||
|
||||
d->nwa += out->sectors;
|
||||
out->bytes = 0;
|
||||
|
@ -125,6 +125,8 @@ int burn_write_flush(struct burn_write_opts *o, struct burn_track *track)
|
||||
track->writecount += d->buffer->bytes;
|
||||
track->written_sectors += d->buffer->sectors;
|
||||
}
|
||||
/* ts A61119 */
|
||||
d->progress.buffered_bytes += d->buffer->bytes;
|
||||
|
||||
d->nwa += d->buffer->sectors;
|
||||
d->buffer->bytes = 0;
|
||||
@ -178,6 +180,7 @@ int burn_write_close_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
d->nwa += d->buffer->sectors;
|
||||
t->writecount += d->buffer->bytes;
|
||||
t->written_sectors += d->buffer->sectors;
|
||||
d->progress.buffered_bytes += d->buffer->bytes;
|
||||
}
|
||||
d->cancel = cancelled;
|
||||
}
|
||||
@ -651,7 +654,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
|
||||
burn_print(12, "track %d is %d sectors long\n", tnum, sectors);
|
||||
|
||||
/* ts A61030 : this cannot happen. tnum is alsways < s-tracks */
|
||||
/* ts A61030 : this cannot happen. tnum is always < s->tracks */
|
||||
if (tnum == s->tracks)
|
||||
tmp = sectors > 150 ? 150 : sectors;
|
||||
|
||||
@ -710,6 +713,8 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
/* A61101 : probably this is not all payload data */
|
||||
/* A61108 : but audio count is short without this */
|
||||
t->writecount += d->buffer->bytes;
|
||||
t->written_sectors += d->buffer->sectors;
|
||||
d->progress.buffered_bytes += d->buffer->bytes;
|
||||
|
||||
d->nwa += d->buffer->sectors;
|
||||
d->buffer->bytes = 0;
|
||||
@ -815,6 +820,8 @@ return crap. so we send the command, then ignore the result.
|
||||
/* ts A61023 */
|
||||
d->progress.buffer_capacity = 0;
|
||||
d->progress.buffer_available = 0;
|
||||
d->progress.buffered_bytes = 0;
|
||||
d->progress.buffer_min_fill = 0xffffffff;
|
||||
|
||||
d->busy = BURN_DRIVE_WRITING;
|
||||
|
||||
|
Reference in New Issue
Block a user