Preventing CD-TEXT with sessions that are not pure audio

This commit is contained in:
Thomas Schmitt 2012-01-16 11:23:04 +00:00
parent 1ff314a6d2
commit fbd0ee81a3
3 changed files with 49 additions and 7 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2012.01.16.112048" #define Cdrskin_timestamP "2012.01.16.112258"

View File

@ -1878,6 +1878,7 @@ int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s);
Unsupported types of FILE or TRACK lead to failure of the call. Unsupported types of FILE or TRACK lead to failure of the call.
libburn does not yet support mixing of AUDIO and MODE1/2048. So this call libburn does not yet support mixing of AUDIO and MODE1/2048. So this call
will fail if such a mix is found. will fail if such a mix is found.
CD-TEXT information is allowed only if all tracks are of datatype AUDIO.
Empty lines and lines which start by '#' are ignored. Empty lines and lines which start by '#' are ignored.
@param session Session where to attach tracks. It must not yet have @param session Session where to attach tracks. It must not yet have
tracks or else this call will fail. tracks or else this call will fail.

View File

@ -340,13 +340,13 @@ static void print_cue(struct cue_sheet *sheet)
cue_printify(unit[5]), cue_printify(unit[6]), cue_printify(unit[5]), cue_printify(unit[6]),
cue_printify(unit[7])); cue_printify(unit[7]));
} else if (unit[1] > 99) { } else if (unit[1] > 99) {
printf(" %1X %1X |0x%02X| %02X | %02X | %02X |", printf(" %1X %1X |0x%02X| %2d | %02X | %02X |",
(unit[0] & 0xf0) >> 4, unit[0] & 0xf, (unit[0] & 0xf0) >> 4, unit[0] & 0xf,
unit[1], unit[2], unit[3], unit[4]); unit[1], unit[2], unit[3], unit[4]);
printf(" %02d:%02d:%02d |\n", printf(" %02d:%02d:%02d |\n",
unit[5], unit[6], unit[7]); unit[5], unit[6], unit[7]);
} else { } else {
printf(" %1X %1X | %2d | %02X | %02X | %02X |", printf(" %1X %1X | %2d | %2d | %02X | %02X |",
(unit[0] & 0xf0) >> 4, unit[0] & 0xf, (unit[0] & 0xf0) >> 4, unit[0] & 0xf,
unit[1], unit[2], unit[3], unit[4]); unit[1], unit[2], unit[3], unit[4]);
printf(" %02d:%02d:%02d |\n", printf(" %02d:%02d:%02d |\n",
@ -1351,6 +1351,35 @@ int burn_disc_init_write_status(struct burn_write_opts *o,
} }
static int precheck_write_is_audio(struct burn_disc *disc, int flag)
{
struct burn_session **sessions;
int num_sessions, i, j;
sessions = burn_disc_get_sessions(disc, &num_sessions);
for (i = 0; i < num_sessions; i++)
for (j = 0; j < sessions[i]->tracks; j++)
if (!(sessions[i]->track[j]->mode & BURN_AUDIO))
return 0;
return 1;
}
static int precheck_disc_has_cdtext(struct burn_disc *disc, int flag)
{
struct burn_session **sessions;
int num_sessions, i, ret;
sessions = burn_disc_get_sessions(disc, &num_sessions);
for (i = 0; i < num_sessions; i++) {
ret = burn_cdtext_from_session(sessions[i], NULL, NULL, 1);
if (ret > 0)
return 1;
}
return 0;
}
/* ts A70219 : API */ /* ts A70219 : API */
int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc, int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
char reasons[BURN_REASONS_LEN], int silent) char reasons[BURN_REASONS_LEN], int silent)
@ -1358,7 +1387,7 @@ int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
enum burn_write_types wt; enum burn_write_types wt;
struct burn_drive *d = o->drive; struct burn_drive *d = o->drive;
char *msg = NULL, *reason_pt; char *msg = NULL, *reason_pt;
int no_media = 0; int no_media = 0, ret, has_cdtext;
reason_pt= reasons; reason_pt= reasons;
reasons[0] = 0; reasons[0] = 0;
@ -1385,10 +1414,22 @@ int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
reason_pt= reasons + strlen(reasons); reason_pt= reasons + strlen(reasons);
if (d->status == BURN_DISC_UNSUITABLE) if (d->status == BURN_DISC_UNSUITABLE)
goto unsuitable_profile; goto unsuitable_profile;
if (d->current_profile != 0x09 && d->current_profile != 0x0a) if (o->num_text_packs > 0) {
if (o->num_text_packs > 0) has_cdtext = 1;
} else {
has_cdtext = precheck_disc_has_cdtext(disc, 0);
}
if (has_cdtext > 0) {
if (d->current_profile == 0x09 || d->current_profile == 0x0a) {
ret = precheck_write_is_audio(disc, 0);
if (ret <= 0)
strcat(reasons,
"CD-TEXT supported only with pure audio CD media, ");
} else {
strcat(reasons, strcat(reasons,
"CD-TEXT supported only with write CD media, "); "CD-TEXT supported only with CD media, ");
}
}
if (d->drive_role == 2 || d->drive_role == 5 || if (d->drive_role == 2 || d->drive_role == 5 ||
d->current_profile == 0x1a || d->current_profile == 0x12 || d->current_profile == 0x1a || d->current_profile == 0x12 ||
d->current_profile == 0x43) { d->current_profile == 0x43) {