Made available drive buffer fill during write
This commit is contained in:
@ -295,7 +295,7 @@ struct burn_drive_info
|
||||
/** This is currently the string which is used as persistent
|
||||
drive address. But be warned: there is NO GUARANTEE that this
|
||||
will stay so. Always use function burn_drive_get_adr() to
|
||||
inquire a persisten address. ^^^^^^ ALWAYS ^^^^^^ */
|
||||
inquire a persistent address. ^^^^^^ ALWAYS ^^^^^^ */
|
||||
|
||||
/** Can the drive read DVD-RAM discs */
|
||||
unsigned int read_dvdram:1;
|
||||
@ -378,6 +378,12 @@ struct burn_progress {
|
||||
int sectors;
|
||||
/** The current sector being processed */
|
||||
int sector;
|
||||
|
||||
/* ts A61023 */
|
||||
/** The capacity of the drive buffer */
|
||||
unsigned buffer_capacity;
|
||||
/** The free space in the drive buffer (might be slightly outdated) */
|
||||
unsigned buffer_available;
|
||||
};
|
||||
|
||||
/** Initialize the library.
|
||||
|
@ -47,6 +47,9 @@ static unsigned char MMC_TRACK_INFO[] = { 0x52, 0, 0, 0, 0, 0, 0, 16, 0, 0 };
|
||||
static unsigned char MMC_SEND_CUE_SHEET[] =
|
||||
{ 0x5D, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
/* ts A61023 : get size and free space of drive buffer */
|
||||
static unsigned char MMC_READ_BUFFER_CAPACITY[] = { 0x5C, 0, 0, 0, 0, 0, 0, 16, 0, 0 };
|
||||
|
||||
|
||||
static int mmc_function_spy_do_tell = 0;
|
||||
|
||||
@ -771,6 +774,40 @@ void mmc_sync_cache(struct burn_drive *d)
|
||||
d->issue_command(d, &c);
|
||||
}
|
||||
|
||||
|
||||
/* ts A61023 : http://libburn.pykix.org/ticket/14
|
||||
get size and free space of drive buffer
|
||||
*/
|
||||
int mmc_read_buffer_capacity(struct burn_drive *d)
|
||||
{
|
||||
struct buffer buf;
|
||||
struct command c;
|
||||
unsigned char *data;
|
||||
|
||||
mmc_function_spy("mmc_read_buffer_capacity");
|
||||
memcpy(c.opcode, MMC_READ_BUFFER_CAPACITY,
|
||||
sizeof(MMC_READ_BUFFER_CAPACITY));
|
||||
c.retry = 1;
|
||||
c.oplen = sizeof(MMC_READ_BUFFER_CAPACITY);
|
||||
c.page = &buf;
|
||||
c.page->bytes = 0;
|
||||
c.page->sectors = 0;
|
||||
|
||||
c.dir = FROM_DRIVE;
|
||||
d->issue_command(d, &c);
|
||||
|
||||
/* >>> ??? error diagnostics */
|
||||
|
||||
data = c.page->data;
|
||||
|
||||
d->progress.buffer_capacity =
|
||||
(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];
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* ts A61021 : the mmc specific part of sg.c:enumerate_common()
|
||||
*/
|
||||
int mmc_setup_drive(struct burn_drive *d)
|
||||
@ -787,6 +824,7 @@ int mmc_setup_drive(struct burn_drive *d)
|
||||
d->get_nwa = mmc_get_nwa;
|
||||
d->close_disc = mmc_close_disc;
|
||||
d->close_session = mmc_close_session;
|
||||
d->read_buffer_capacity = mmc_read_buffer_capacity;
|
||||
|
||||
/* ts A61020 */
|
||||
d->start_lba= -2000000000;
|
||||
@ -794,3 +832,4 @@ int mmc_setup_drive(struct burn_drive *d)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,9 @@ void mmc_get_configuration(struct burn_drive *);
|
||||
int mmc_get_nwa(struct burn_drive *);
|
||||
void mmc_send_cue_sheet(struct burn_drive *, struct cue_sheet *);
|
||||
|
||||
/* ts A61023 : get size and free space of drive buffer */
|
||||
int mmc_read_buffer_capacity(struct burn_drive *d);
|
||||
|
||||
/* ts A61021 : the mmc specific part of sg.c:enumerate_common()
|
||||
*/
|
||||
int mmc_setup_drive(struct burn_drive *d);
|
||||
|
@ -196,6 +196,10 @@ struct burn_drive
|
||||
struct scsi_mode_data *mdata;
|
||||
int toc_entries;
|
||||
struct burn_toc_entry *toc_entry;
|
||||
|
||||
/* ts A61023 : get size and free space of drive buffer */
|
||||
int (*read_buffer_capacity) (struct burn_drive *d);
|
||||
|
||||
};
|
||||
|
||||
/* end of generic 'drive' data structures */
|
||||
|
@ -485,12 +485,19 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
/* ts A60831: added tnum-line, extended print message on proposal
|
||||
by bonfire-app@wanadoo.fr in http://libburn.pykix.org/ticket/58 */
|
||||
d->progress.track = tnum;
|
||||
|
||||
burn_print(12, "track %d is %d sectors long\n", tnum, sectors);
|
||||
|
||||
if (tnum == s->tracks)
|
||||
tmp = sectors > 150 ? 150 : sectors;
|
||||
|
||||
for (i = 0; i < sectors - tmp; i++) {
|
||||
|
||||
/* ts A61023 : http://libburn.pykix.org/ticket/14
|
||||
From time to time inquire drive buffer */
|
||||
if ((i%64)==0)
|
||||
d->read_buffer_capacity(d);
|
||||
|
||||
if (!sector_data(o, t, 0))
|
||||
return 0;
|
||||
|
||||
@ -499,6 +506,11 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
|
||||
}
|
||||
for (; i < sectors; i++) {
|
||||
burn_print(1, "last track, leadout prep\n");
|
||||
|
||||
/* ts A61023 */
|
||||
if ((i%64)==0)
|
||||
d->read_buffer_capacity(d);
|
||||
|
||||
if (!sector_data(o, t, 1))
|
||||
return 0;
|
||||
|
||||
@ -597,6 +609,10 @@ return crap. so we send the command, then ignore the result.
|
||||
d->progress.sectors = 0;
|
||||
d->progress.sector = 0;
|
||||
|
||||
/* ts A61023 */
|
||||
d->progress.buffer_capacity = 0;
|
||||
d->progress.buffer_available = 0;
|
||||
|
||||
d->busy = BURN_DRIVE_WRITING;
|
||||
|
||||
for (i = 0; i < disc->sessions; i++) {
|
||||
|
Reference in New Issue
Block a user