Defaulting sessions without leadout entry

This commit is contained in:
Thomas Schmitt 2008-12-03 08:52:44 +00:00
parent 717ad0f412
commit 175061615e
4 changed files with 70 additions and 8 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2008.11.29.140404"
#define Cdrskin_timestamP "2008.12.03.085219"

View File

@ -531,7 +531,9 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x0002015c (FAILURE,HIGH) = Fifo size is smaller than desired peek buffer
0x0002015d (FAILURE,HIGH) = Fifo input ended short of desired peek buffer size
0x0002015e (FATAL,HIGH) = Fifo is already under consumption when peeking
0x0002015f (MISHAP,HIGH) = Damaged CD table-of-content detected and truncated
0x0002015f (MISHAP,HIGH) = Damaged CD table-of-content detected and truncated
0x00020160 (WARNING,HIGH) = Session without leadout encountered
0x00020161 (WARNING,HIGH) = Empty session deleted
libdax_audioxtr:
0x00020200 (SORRY,HIGH) = Cannot open audio source file

View File

@ -1143,8 +1143,9 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len)
struct buffer buf;
struct command c;
int dlen;
int i, bpl= 12, old_alloc_len;
int i, bpl= 12, old_alloc_len, t_idx;
unsigned char *tdata;
char msg[321];
if (*alloc_len < 4)
return 0;
@ -1220,7 +1221,9 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len)
ts A61007 : if re-enabled then not via Assert.
a ssert(((dlen - 2) % 11) == 0);
*/
d->toc_entry = calloc(d->toc_entries, sizeof(struct burn_toc_entry));
/* ts A81202: plus number of sessions as reserve for leadout default */
d->toc_entry = calloc(d->toc_entries + (unsigned char) c.page->data[3],
sizeof(struct burn_toc_entry));
if(d->toc_entry == NULL) /* ts A70825 */
return 0;
tdata = c.page->data + 4;
@ -1307,6 +1310,42 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len)
d->status = BURN_DISC_FULL;
toc_find_modes(d);
/* ts A81202 ticket 146 : a drive reported a session with no leadout */
for (i = 0; i < d->disc->sessions; i++) {
if (d->disc->session[i]->leadout_entry != NULL)
continue;
sprintf(msg, "Session %d of %d encountered without leadout",
i + 1, d->disc->sessions);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020160,
LIBDAX_MSGS_SEV_WARNING, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
/* Produce default leadout entry from last track of session
which will thus get its size set to 0 */;
if (d->disc->session[i]->track != NULL &&
d->disc->session[i]->tracks > 0) {
t_idx = d->toc_entries++;
memcpy(d->toc_entry + t_idx,
d->disc->session[i]->track[
d->disc->session[i]->tracks - 1]->entry,
sizeof(struct burn_toc_entry));
d->toc_entry[t_idx].point = 0xA2;
d->disc->session[i]->leadout_entry =
d->toc_entry + t_idx;
} else {
burn_disc_remove_session(d->disc, d->disc->session[i]);
sprintf(msg,
"Empty session %d deleted. Now %d sessions.",
i + 1, d->disc->sessions);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020161,
LIBDAX_MSGS_SEV_WARNING, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
i--;
}
}
/* A80808 */
burn_disc_cd_toc_extensions(d->disc, 0);

View File

@ -104,6 +104,30 @@ int burn_disc_add_session(struct burn_disc *d, struct burn_session *s,
return 1;
}
/* ts A81202: this function was in the API but not implemented.
*/
int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s)
{
int i, skip = 0;
if (d->session == NULL)
return 0;
for (i = 0; i < d->sessions; i++) {
if (s == d->session[i]) {
skip++;
continue;
}
d->session[i - skip] = d->session[i];
}
if (!skip)
return 0;
burn_session_free(s);
d->sessions--;
return 1;
}
struct burn_track *burn_track_create(void)
{
struct burn_track *t;
@ -531,8 +555,7 @@ int burn_disc_cd_toc_extensions(struct burn_disc *d, int flag)
{
int sidx= 0, tidx= 0;
struct burn_toc_entry *entry, *prev_entry= NULL;
/* ts A81126 : ticket 146 : There is a SIGSEGV in here */
/* ts A81126 : ticket 146 : There was a SIGSEGV in here */
char msg_data[321], *msg;
strcpy(msg_data,
@ -554,8 +577,6 @@ int burn_disc_cd_toc_extensions(struct burn_disc *d, int flag)
sidx, d->sessions);
goto failure;
}
/* ts A81126 : ticket 146 :
This is the main suspect for the SIGSEGV */
if (d->session[sidx]->leadout_entry == NULL) {
sprintf(msg,
" Session %d of %d: Leadout entry missing.",