From eae1198606f27727f1c770d32fe63280d2b2e352 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 30 Jan 2007 17:54:39 +0000 Subject: [PATCH] Preparations for DVD-R[W] Sequential Recording --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/mmc.c | 19 ++++++++++++------- libburn/trunk/libburn/write.c | 22 ++++++++++------------ 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 6a408546..be244b6f 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.01.29.175822" +#define Cdrskin_timestamP "2007.01.30.165317" diff --git a/libburn/trunk/libburn/mmc.c b/libburn/trunk/libburn/mmc.c index d21e6597..a46d6731 100644 --- a/libburn/trunk/libburn/mmc.c +++ b/libburn/trunk/libburn/mmc.c @@ -44,7 +44,7 @@ extern struct libdax_msgs *libdax_messenger; #define Libburn_support_dvd_raM 1 -/* ts A70129 >>> EXPERIMENTAL +/* ts A70129 >>> EXPERIMENTAL UNTESTED #define Libburn_support_dvd_r_seQ 1 */ @@ -168,6 +168,7 @@ int mmc_get_nwa(struct burn_drive *d, int trackno, int *lba, int *nwa) struct buffer buf; struct command c; unsigned char *data; + int i; mmc_function_spy("mmc_get_nwa"); c.retry = 1; @@ -178,11 +179,15 @@ int mmc_get_nwa(struct burn_drive *d, int trackno, int *lba, int *nwa) if (d->current_profile == 0x1a || d->current_profile == 0x13 || d->current_profile == 0x12 ) /* DVD+RW , DVD-RW restricted overwrite , DVD-RAM */ - c.opcode[5] = 1; + trackno = 1; + else if (d->current_profile == 0x11 || + d->current_profile == 0x14) /* DVD-R[W] Sequential */ + trackno = d->last_track_no; else /* mmc5r03c.pdf: valid only for CD, DVD+R, DVD+R DL */ - c.opcode[5] = 0xFF; - } else - c.opcode[5] = trackno; + trackno = 0xFF; + } + for (i = 0; i < 4; i++) + c.opcode[2 + i] = (trackno >> (24 - 8 * i)) & 0xff; c.page = &buf; c.dir = FROM_DRIVE; d->issue_command(d, &c); @@ -538,6 +543,7 @@ void mmc_read_disc_info(struct burn_drive *d) /* ts A61020 */ d->start_lba = d->end_lba = -2000000000; d->erasable = 0; + d->last_track_no = 1; /* ts A61202 */ d->toc_entries = 0; @@ -595,7 +601,6 @@ void mmc_read_disc_info(struct burn_drive *d) */ d->status = BURN_DISC_BLANK; - d->last_track_no = 0; break; case 1: d->status = BURN_DISC_APPENDABLE; @@ -1816,7 +1821,7 @@ int mmc_setup_drive(struct burn_drive *d) d->needs_close_session = 0; d->bg_format_status = -1; d->num_format_descr = 0; - d->last_track_no = 0; + d->last_track_no = 1; return 1; } diff --git a/libburn/trunk/libburn/write.c b/libburn/trunk/libburn/write.c index 542b6240..5fc8c6ae 100644 --- a/libburn/trunk/libburn/write.c +++ b/libburn/trunk/libburn/write.c @@ -196,8 +196,7 @@ int burn_write_close_track(struct burn_write_opts *o, struct burn_session *s, MMC-3 does not. I tried both. 0xFF was in effect when other bugs finally gave up and made way for readable tracks. */ /* ts A70129 - Probably the right value would be d->last_track_no+tnum for - appendables + Probably the right value for appendables is d->last_track_no */ d->close_track_session(o->drive, 0, 0xff); @@ -901,13 +900,10 @@ int burn_disc_close_track_dvd_minus_r(struct burn_write_opts *o, return 2; d->busy = BURN_DRIVE_CLOSING_SESSION; - /* 0xff was a name for the last track in MMC-1 but later - it vanished. One would need to determine the absolute - logical track number in multi-session situations. - Probably: d->last_track_no+tnum - */ - d->close_track_session(d, 0, 0xff); /* CLOSE TRACK, 001b */ + /* Ignoring tnum here and hoping that d->last_track_no is correct */ + d->close_track_session(d, 0, d->last_track_no); /* CLOSE TRACK, 001b */ d->busy = BURN_DRIVE_WRITING; + d->last_track_no++; return 1; } @@ -953,7 +949,7 @@ int burn_dvd_write_track(struct burn_write_opts *o, d->progress.sector++; } - /* Pad up buffer to next full 32 kB */ + /* Pad up buffer to next full o->obs (usually 32 kB) */ if (o->obs_pad && out->bytes > 0 && out->bytes < o->obs) { memset(out->data + out->bytes, 0, o->obs - out->bytes); out->sectors += (o->obs - out->bytes) / 2048; @@ -1024,8 +1020,8 @@ int burn_disc_close_session_dvd_minus_r(struct burn_write_opts *o, { struct burn_drive *d = o->drive; - if (d->current_has_feat21h != 1) /* only for Incremental writing */ - return 2; + if (d->current_has_feat21h != 1) + return 2; /* only for Incremental writing */ d->busy = BURN_DRIVE_CLOSING_SESSION; d->close_track_session(d, 1, 0); /* CLOSE SESSION, 010b */ @@ -1177,7 +1173,7 @@ int burn_disc_setup_dvd_minus_rw(struct burn_write_opts *o, } -/* ts A70129 */ +/* ts A70129 : for DVD-R[W] Sequential Recoding */ int burn_disc_setup_dvd_minus_r(struct burn_write_opts *o, struct burn_disc *disc) { @@ -1304,6 +1300,8 @@ int burn_dvd_write_sync(struct burn_write_opts *o, msg, 0,0); goto early_failure; } + /* ??? padding needed ??? cowardly doing it for now */ + o->obs_pad = 1; /* fill-up track's last 32k buffer */ } else { sprintf(msg, "Unsuitable media detected. Profile %4.4Xh %s",