Burning DVD-R DAO with 2 kB size granularity rather than 32 kB

This commit is contained in:
Thomas Schmitt 2011-03-12 09:35:04 +00:00
parent b945974dc7
commit 1b166f484d
3 changed files with 15 additions and 8 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.03.10.132603" #define Cdrskin_timestamP "2011.03.12.093520"

View File

@ -347,9 +347,10 @@ int mmc_reserve_track(struct burn_drive *d, off_t size)
memcpy(c.opcode, MMC_RESERVE_TRACK, sizeof(MMC_RESERVE_TRACK)); memcpy(c.opcode, MMC_RESERVE_TRACK, sizeof(MMC_RESERVE_TRACK));
*/ */
c.retry = 1; c.retry = 1;
/* Round to 32 KiB and divide by 2048
(by nice binary rounding trick learned from dvd+rw-tools) */ lba = size / 2048;
lba = ((size + (off_t) 0x7fff) >> 11) & ~0xf; if (size % 2048)
lba++;
mmc_int_to_four_char(c.opcode+5, lba); mmc_int_to_four_char(c.opcode+5, lba);
sprintf(msg, "reserving track of %d blocks", lba); sprintf(msg, "reserving track of %d blocks", lba);

View File

@ -1119,11 +1119,13 @@ int burn_disc_open_track_dvd_minus_r(struct burn_write_opts *o,
#endif #endif
if (o->write_type == BURN_WRITE_SAO) { /* DAO */ if (o->write_type == BURN_WRITE_SAO) { /* DAO */
/* Round track size up to write chunk size and reserve track */
size = ((off_t) burn_track_get_sectors(s->track[tnum])) size = ((off_t) burn_track_get_sectors(s->track[tnum]))
* (off_t) 2048; * (off_t) 2048;
if (size % o->obs)
/* Eventually round track size up to write chunk */
if (o->obs_pad && (size % o->obs))
size += (off_t) (o->obs - (size % o->obs)); size += (off_t) (o->obs - (size % o->obs));
ret = d->reserve_track(d, size); ret = d->reserve_track(d, size);
if (ret <= 0) { if (ret <= 0) {
sprintf(msg, "Cannot reserve track of %.f bytes", sprintf(msg, "Cannot reserve track of %.f bytes",
@ -1164,6 +1166,10 @@ int burn_disc_open_track_dvd_plus_r(struct burn_write_opts *o,
/* Round track size up to write chunk size and reserve track */ /* Round track size up to write chunk size and reserve track */
size = ((off_t) burn_track_get_sectors(s->track[tnum])) size = ((off_t) burn_track_get_sectors(s->track[tnum]))
* (off_t) 2048; * (off_t) 2048;
/* o->obs should be 32k or 64k already. But 32k alignment
was once performed in d->reserve_track() */
if (o->obs % 32768)
o->obs += 32768 - (o->obs % 32768);
if (size % o->obs) if (size % o->obs)
size += (off_t) (o->obs - (size % o->obs)); size += (off_t) (o->obs - (size % o->obs));
ret = d->reserve_track(d, size); ret = d->reserve_track(d, size);
@ -1892,6 +1898,8 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
msg, 0, 0); msg, 0, 0);
burn_track_set_size(t, default_size); burn_track_set_size(t, default_size);
} }
/* Whether to fill-up last 32k buffer of track. */
o->obs_pad = (o->write_type != BURN_WRITE_SAO);
ret = burn_disc_setup_dvd_minus_r(o, disc); ret = burn_disc_setup_dvd_minus_r(o, disc);
if (ret <= 0) { if (ret <= 0) {
sprintf(msg, sprintf(msg,
@ -1902,8 +1910,6 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
msg, 0, 0); msg, 0, 0);
goto early_failure; goto early_failure;
} }
/* ??? padding needed ??? cowardly doing it for now */
o->obs_pad = 1; /* fill-up track's last 32k buffer */
} else if (d->current_profile == 0x1b || d->current_profile == 0x2b || } else if (d->current_profile == 0x1b || d->current_profile == 0x2b ||
d->current_profile == 0x41) { d->current_profile == 0x41) {