New struct burn_toc_entry extension for Last Recorded Address

This commit is contained in:
Thomas Schmitt 2009-09-09 15:38:47 +00:00
parent 3dbc958c05
commit 9ccad6a9d9
3 changed files with 30 additions and 13 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2009.09.09.134030" #define Cdrskin_timestamP "2009.09.09.153951"

View File

@ -349,7 +349,7 @@ struct burn_toc_entry
*/ */
unsigned char extensions_valid; unsigned char extensions_valid;
/* ts A70201 : DVD extension. /* ts A70201 : DVD extension. extensions_valid:bit0
If invalid the members are guaranteed to be 0. */ If invalid the members are guaranteed to be 0. */
/* @since 0.3.2 */ /* @since 0.3.2 */
/* Tracks and session numbers are 16 bit. Here are the high bytes. */ /* Tracks and session numbers are 16 bit. Here are the high bytes. */
@ -360,6 +360,13 @@ struct burn_toc_entry
/* min, sec, and frame may be too small if DVD extension is valid */ /* min, sec, and frame may be too small if DVD extension is valid */
int track_blocks; int track_blocks;
/* ts A90909 : LRA extension. extensions_valid:bit1 */
/* @since 0.7.2 */
/* MMC-5 6.27.3.18 : The Last Recorded Address is valid for DVD-R,
DVD-R DL when LJRS = 00b, DVD-RW, HD DVD-R, and BD-R.
This would mean profiles: 0x11, 0x15, 0x13, 0x14, 0x51, 0x41, 0x42
*/
int last_recorded_address;
}; };

View File

@ -835,12 +835,13 @@ int mmc_write(struct burn_drive *d, int start, struct buffer *buf)
/* ts A70201 : Set up an entry for mmc_fake_toc() */ /* ts A70201 : Set up an entry for mmc_fake_toc() */
int mmc_fake_toc_entry(struct burn_toc_entry *entry, int session_number, int mmc_fake_toc_entry(struct burn_toc_entry *entry, int session_number,
int track_number, int track_number,
unsigned char *size_data, unsigned char *start_data) unsigned char *size_data, unsigned char *start_data,
unsigned char *last_adr_data)
{ {
int min, sec, frames, num; int min, sec, frames, num;
/* mark DVD extensions as valid */ /* mark DVD extensions and Track Info extension as valid */
entry->extensions_valid |= 1; entry->extensions_valid |= (1 | 2);
/* defaults are as of mmc5r03.pdf 6.26.3.2.4 Fabricated TOC */ /* defaults are as of mmc5r03.pdf 6.26.3.2.4 Fabricated TOC */
entry->session = session_number & 0xff; entry->session = session_number & 0xff;
@ -873,6 +874,7 @@ int mmc_fake_toc_entry(struct burn_toc_entry *entry, int session_number,
entry->pmin = min; entry->pmin = min;
entry->psec = sec; entry->psec = sec;
entry->pframe = frames; entry->pframe = frames;
entry->last_recorded_address = mmc_four_char_to_int(last_adr_data);
return 1; return 1;
} }
@ -887,7 +889,7 @@ static int mmc_read_toc_fmt0_al(struct burn_drive *d, int *alloc_len)
struct command c; struct command c;
int dlen, i, old_alloc_len, session_number, prev_session = -1; int dlen, i, old_alloc_len, session_number, prev_session = -1;
int lba, size; int lba, size;
unsigned char *tdata, size_data[4], start_data[4]; unsigned char *tdata, size_data[4], start_data[4], end_data[4];
if (*alloc_len < 4) if (*alloc_len < 4)
return 0; return 0;
@ -961,8 +963,9 @@ err_ex:;
mmc_four_char_to_int(size_data); mmc_four_char_to_int(size_data);
mmc_int_to_four_char(start_data, lba); mmc_int_to_four_char(start_data, lba);
mmc_int_to_four_char(size_data, 0); mmc_int_to_four_char(size_data, 0);
mmc_int_to_four_char(end_data, lba - 1);
mmc_fake_toc_entry(entry, prev_session, 0xA2, mmc_fake_toc_entry(entry, prev_session, 0xA2,
size_data, start_data); size_data, start_data, end_data);
entry->min= entry->sec= entry->frame= 0; entry->min= entry->sec= entry->frame= 0;
d->disc->session[prev_session - 1]->leadout_entry = d->disc->session[prev_session - 1]->leadout_entry =
entry; entry;
@ -985,11 +988,13 @@ err_ex:;
memcpy(start_data, tdata + 4, 4); memcpy(start_data, tdata + 4, 4);
/* size_data are estimated from next track start */ /* size_data are estimated from next track start */
memcpy(size_data, tdata + 8 + 4, 4); memcpy(size_data, tdata + 8 + 4, 4);
mmc_int_to_four_char(end_data,
mmc_four_char_to_int(size_data) - 1);
size = mmc_four_char_to_int(size_data) - size = mmc_four_char_to_int(size_data) -
mmc_four_char_to_int(start_data); mmc_four_char_to_int(start_data);
mmc_int_to_four_char(size_data, size); mmc_int_to_four_char(size_data, size);
mmc_fake_toc_entry(entry, session_number, i + 1, mmc_fake_toc_entry(entry, session_number, i + 1,
size_data, start_data); size_data, start_data, end_data);
if (prev_session != session_number) if (prev_session != session_number)
d->disc->session[session_number - 1]->firsttrack = i+1; d->disc->session[session_number - 1]->firsttrack = i+1;
d->disc->session[session_number - 1]->lasttrack = i+1; d->disc->session[session_number - 1]->lasttrack = i+1;
@ -1001,8 +1006,10 @@ err_ex:;
entry = &(d->toc_entry[(d->last_track_no - 1) + prev_session]); entry = &(d->toc_entry[(d->last_track_no - 1) + prev_session]);
memcpy(start_data, tdata + 4, 4); memcpy(start_data, tdata + 4, 4);
mmc_int_to_four_char(size_data, 0); mmc_int_to_four_char(size_data, 0);
mmc_int_to_four_char(end_data,
mmc_four_char_to_int(start_data) - 1);
mmc_fake_toc_entry(entry, prev_session, 0xA2, mmc_fake_toc_entry(entry, prev_session, 0xA2,
size_data, start_data); size_data, start_data, end_data);
entry->min= entry->sec= entry->frame= 0; entry->min= entry->sec= entry->frame= 0;
d->disc->session[prev_session - 1]->leadout_entry = entry; d->disc->session[prev_session - 1]->leadout_entry = entry;
} }
@ -1033,7 +1040,7 @@ int mmc_fake_toc(struct burn_drive *d)
struct burn_toc_entry *entry; struct burn_toc_entry *entry;
struct buffer buf; struct buffer buf;
int i, session_number, prev_session = -1, ret, lba, alloc_len = 34; int i, session_number, prev_session = -1, ret, lba, alloc_len = 34;
unsigned char *tdata, size_data[4], start_data[4]; unsigned char *tdata, size_data[4], start_data[4], end_data[4];
char msg[160]; char msg[160];
if (mmc_function_spy(d, "mmc_fake_toc") <= 0) if (mmc_function_spy(d, "mmc_fake_toc") <= 0)
@ -1107,8 +1114,9 @@ int mmc_fake_toc(struct burn_drive *d)
mmc_four_char_to_int(size_data); mmc_four_char_to_int(size_data);
mmc_int_to_four_char(start_data, lba); mmc_int_to_four_char(start_data, lba);
mmc_int_to_four_char(size_data, 0); mmc_int_to_four_char(size_data, 0);
mmc_int_to_four_char(end_data, lba - 1);
mmc_fake_toc_entry(entry, prev_session, 0xA2, mmc_fake_toc_entry(entry, prev_session, 0xA2,
size_data, start_data); size_data, start_data, end_data);
entry->min= entry->sec= entry->frame= 0; entry->min= entry->sec= entry->frame= 0;
d->disc->session[prev_session - 1]->leadout_entry = d->disc->session[prev_session - 1]->leadout_entry =
entry; entry;
@ -1137,8 +1145,9 @@ int mmc_fake_toc(struct burn_drive *d)
memcpy(size_data, tdata + 24, 4); memcpy(size_data, tdata + 24, 4);
memcpy(start_data, tdata + 8, 4); memcpy(start_data, tdata + 8, 4);
memcpy(end_data, tdata + 28, 4);
mmc_fake_toc_entry(entry, session_number, i + 1, mmc_fake_toc_entry(entry, session_number, i + 1,
size_data, start_data); size_data, start_data, end_data);
if (prev_session != session_number) if (prev_session != session_number)
d->disc->session[session_number - 1]->firsttrack = i+1; d->disc->session[session_number - 1]->firsttrack = i+1;
@ -1152,8 +1161,9 @@ int mmc_fake_toc(struct burn_drive *d)
mmc_four_char_to_int(size_data); mmc_four_char_to_int(size_data);
mmc_int_to_four_char(start_data, lba); mmc_int_to_four_char(start_data, lba);
mmc_int_to_four_char(size_data, 0); mmc_int_to_four_char(size_data, 0);
mmc_int_to_four_char(end_data, lba - 1);
mmc_fake_toc_entry(entry, prev_session, 0xA2, mmc_fake_toc_entry(entry, prev_session, 0xA2,
size_data, start_data); size_data, start_data, end_data);
entry->min= entry->sec= entry->frame= 0; entry->min= entry->sec= entry->frame= 0;
d->disc->session[prev_session - 1]->leadout_entry = entry; d->disc->session[prev_session - 1]->leadout_entry = entry;
} }