Made Libburn_precheck_write_ruleS unconditional code

ZeroFourZero
Thomas Schmitt 15 years ago
parent bdff3ac16c
commit bdf862b429
  1. 2
      cdrskin/cdrskin_timestamp.h
  2. 39
      libburn/async.c
  3. 3
      libburn/libburn.h
  4. 181
      libburn/write.c

@ -1 +1 @@
#define Cdrskin_timestamP "2007.09.08.164924"
#define Cdrskin_timestamP "2007.09.08.174757"

@ -349,10 +349,6 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
{
struct write_opts o;
char reasons[BURN_REASONS_LEN+80];
#ifndef Libburn_precheck_write_ruleS
int i, j, mode, mixed_mode = 0;
#endif
/* ts A61006 */
/* a ssert(!SCAN_GOING()); */
@ -396,47 +392,12 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
strcpy(reasons, "Write job parameters are unsuitable:\n");
if (burn_precheck_write(opts, disc, reasons + strlen(reasons), 1)
== BURN_WRITE_NONE) {
#ifndef Libburn_precheck_write_ruleS
libdax_msgs_submit(libdax_messenger,
opts->drive->global_index, 0x00020139,
LIBDAX_MSGS_SEV_WARNING, LIBDAX_MSGS_PRIO_HIGH,
reasons, 0, 0);
#else
libdax_msgs_submit(libdax_messenger,
opts->drive->global_index, 0x00020139,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
reasons, 0, 0);
return;
#endif /* Libburn_precheck_write_ruleS */
}
#ifndef Libburn_precheck_write_ruleS
/* <<< covered burn_precheck_write() */
/* ts A61009 : obsolete Assert in sector_headers() */
if (! burn_disc_write_is_ok(opts, disc, 0)) /* issues own msgs */
return;
/* <<< covered burn_precheck_write() */
/* ts A70122 : libburn SAO code mishandles mode changes */
for (i = 0; i < disc->sessions; i++) {
if (disc->session[i]->tracks <= 0)
continue;
mode = disc->session[i]->track[0]->mode;
for (j = 1; j < disc->session[i]->tracks; j++)
if (mode != disc->session[i]->track[j]->mode)
mixed_mode = 1;
}
if (mixed_mode && opts->write_type == BURN_WRITE_SAO) {
libdax_msgs_submit(libdax_messenger,
opts->drive->global_index, 0x00020133,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Cannot mix data and audio in SAO mode", 0, 0);
return;
}
#endif /* ! Libburn_precheck_write_ruleS */
opts->drive->cancel = 0; /* End of the return = failure area */

@ -1114,9 +1114,6 @@ void burn_disc_read(struct burn_drive *drive, const struct burn_read_opts *o);
int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
char reasons[BURN_REASONS_LEN], int silent);
/* <<< enabling switch for internal usage and trust in this function */
#define Libburn_precheck_write_ruleS 1
/** Write a disc in the drive. The drive must be grabbed successfully before
calling this function. Always ensure that the drive reports a status of

@ -1484,63 +1484,10 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
struct burn_track *t;
char msg[160];
#ifndef Libburn_precheck_write_ruleS
int exotic_track = 0, dao_is_ok, sx, tx, mode;
#endif
d->needs_close_session = 0;
#ifndef Libburn_precheck_write_ruleS
/* <<< covered by burn_precheck_write() */
for (sx = 0; sx < disc->sessions; sx++)
for (tx = 0 ; tx < disc->session[sx]->tracks; tx++) {
mode = disc->session[sx]->track[tx]->mode;
if (disc->session[sx]->track[tx]->mode != BURN_MODE1)
exotic_track = 1;
}
if (exotic_track) {
sprintf(msg,"DVD Media are unsuitable for desired track type");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020123,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
goto early_failure;
}
/* <<< covered by burn_precheck_write() */
if (d->current_profile == 0x1a || d->current_profile == 0x13 ||
d->current_profile == 0x12) {
/* DVD+RW , DVD-RW Restricted Overwrite , DVD-RAM */
if (disc->sessions!=1 || disc->session[0]->tracks>1
|| o->multi ) {
sprintf(msg,
"Burning is restricted to a single track and no multi-session on %s",
d->current_profile_text);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002011f,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
goto early_failure;
}
}
#endif /* ! Libburn_precheck_write_ruleS */
if (d->current_profile == 0x1a || d->current_profile == 0x12) {
/* DVD+RW , DVD-RAM */
#ifndef Libburn_precheck_write_ruleS
/* <<< covered by burn_precheck_write() */
if (o->start_byte >= 0 && (o->start_byte % 2048)) {
sprintf(msg,
"Write start address not properly aligned to 2048");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020126,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
goto early_failure;
}
#endif /* ! Libburn_precheck_write_ruleS */
ret = 1;
if (d->current_profile == 0x1a)
ret = burn_disc_setup_dvd_plus_rw(o, disc);
@ -1557,20 +1504,6 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
} else if (d->current_profile == 0x13) {
/* DVD-RW Restricted Overwrite */
#ifndef Libburn_precheck_write_ruleS
/* <<< covered by burn_precheck_write() */
if (o->start_byte >= 0 && (o->start_byte % 32768)) {
sprintf(msg,
"Write start address not properly aligned to 32K");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020126,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
goto early_failure;
}
#endif /* ! Libburn_precheck_write_ruleS */
ret = burn_disc_setup_dvd_minus_rw(o, disc);
if (ret <= 0) {
sprintf(msg,
@ -1591,69 +1524,6 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
t = disc->session[0]->track[0];
o_end = ( burn_track_is_open_ended(t) && !o->fill_up_media );
default_size = burn_track_get_default_size(t);
#ifndef Libburn_precheck_write_ruleS
dao_is_ok =
(disc->sessions == 1 &&
disc->session[0]->tracks == 1 &&
(default_size > 0 || !o_end) &&
(!o->multi) && d->status == BURN_DISC_BLANK
);
if (o->write_type == BURN_WRITE_TAO &&
!d->current_has_feat21h) {
/* <<< ??? keep this automatic write type change ? */
if (dao_is_ok) {
o->write_type = BURN_WRITE_SAO;
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x00020134,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
"Defaulted TAO to DAO (lack of feature 21h)",
0, 0);
/* <<< covered by burn_precheck_write() */
} else {
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x00020135,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Cannot perform TAO (lack of feature 21h), job unsuitable for DAO",
0, 0);
goto early_failure;
}
} else if (o->write_type == BURN_WRITE_SAO && !dao_is_ok) {
/* <<< covered by burn_precheck_write() */
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020136,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"DAO burning is restricted to a single fixed size track and no multi-session",
0, 0);
/* <<< ??? keep this automatic advise ? */
if (d->current_has_feat21h)
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x00020137,
LIBDAX_MSGS_SEV_HINT,
LIBDAX_MSGS_PRIO_HIGH,
"TAO would be possible and could do the job",
0, 0);
goto early_failure;
}
/* <<< covered by burn_precheck_write() */
if (o->start_byte >= 0) {
sprintf(msg, "Write start address not supported");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020125,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
goto early_failure;
}
#endif /* ! Libburn_precheck_write_ruleS */
if (o->write_type == BURN_WRITE_SAO && o_end) {
sprintf(msg, "Activated track default size %.f",
(double) default_size);
@ -1681,11 +1551,6 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
t = disc->session[0]->track[0];
o_end = ( burn_track_is_open_ended(t) && !o->fill_up_media );
default_size = burn_track_get_default_size(t);
#ifndef Libburn_precheck_write_ruleS
/* >>> oldfashioned checks hopefully never re-enabled */
#endif /* ! Libburn_precheck_write_ruleS */
if (o->write_type == BURN_WRITE_SAO && o_end) {
sprintf(msg, "Activated track default size %.f",
(double) default_size);
@ -1707,19 +1572,6 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
}
/* ??? padding needed ??? cowardly doing it for now */
o->obs_pad = 1; /* fill-up track's last 32k buffer */
#ifndef Libburn_precheck_write_ruleS
/* <<< covered by burn_precheck_write() */
} else {
sprintf(msg, "Unsuitable media detected. Profile %4.4Xh %s",
d->current_profile, d->current_profile_text);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002011e,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
goto early_failure;
#endif /* ! Libburn_precheck_write_ruleS */
}
o->obs = 32*1024; /* buffer flush trigger for sector.c:get_sector() */
@ -1968,45 +1820,12 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc)
return;
}
#ifndef Libburn_precheck_write_ruleS
/* <<< covered by burn_precheck_write() */
if (o->start_byte >= 0) {
sprintf(msg, "Write start address not supported");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020124,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
goto fail_wo_sync;
}
#endif /* ! Libburn_precheck_write_ruleS */
/* ts A70218 */
if (o->write_type == BURN_WRITE_SAO) {
#ifndef Libburn_precheck_write_ruleS
/* <<< covered by burn_precheck_write() "appended session" */
if (disc->sessions > 1) {
sao_restriction_violated:;
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002012f,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"SAO is restricted to a single session with fixed track sizes",
0, 0);
goto fail_wo_sync;
}
#endif /* ! Libburn_precheck_write_ruleS */
for (i = 0 ; i < disc->session[0]->tracks; i++) {
t = disc->session[0]->track[i];
if (burn_track_is_open_ended(t)) {
default_size = burn_track_get_default_size(t);
#ifndef Libburn_precheck_write_ruleS
/* <<< covered by burn_precheck_write() */
if (default_size <= 0)
goto sao_restriction_violated;
#endif /* ! Libburn_precheck_write_ruleS */
sprintf(msg,
"Activated track default size %.f",
(double) default_size);

Loading…
Cancel
Save