Took fill_up_media into respect with automatic write mode decisions

This commit is contained in:
Thomas Schmitt 2007-02-15 20:16:22 +00:00
parent 6defb724c4
commit de724a3b64
5 changed files with 93 additions and 42 deletions

View File

@ -4360,7 +4360,7 @@ int Cdrskin_activate_write_mode(struct CdrskiN *skin, enum burn_disc_status s,
{
int ok, was_still_default= 0, block_type_demand,track_type,sector_size, i;
int profile_number= -1, track_type_1= 0, mixed_mode= 0, unpredicted_size= 0;
int might_do_tao= 0, might_do_sao= 1, allows_multi= 1, ret;
int might_do_tao= 0, might_do_sao= 1, allows_multi= 1, ret, current_is_cd= 1;
struct burn_drive_info *drive_info = NULL;
char profile_name[80];
double fixed_size= 0.0, tao_to_sao_tsize= 0.0, dummy;
@ -4372,6 +4372,8 @@ int Cdrskin_activate_write_mode(struct CdrskiN *skin, enum burn_disc_status s,
#ifdef Cdrskin_libburn_has_get_profilE
if(skin->grabbed_drive)
burn_disc_get_profile(skin->grabbed_drive,&profile_number,profile_name);
if(profile_number!=0x09 && profile_number!=0x0a)
current_is_cd= 0;
#endif
#ifdef Cdrskin_allow_libburn_taO
@ -4402,20 +4404,28 @@ int Cdrskin_activate_write_mode(struct CdrskiN *skin, enum burn_disc_status s,
mixed_mode= 1;
Cdrtrack_get_size(skin->tracklist[i],&fixed_size,
&tao_to_sao_tsize,&dummy,2);
if(fixed_size<=0)
/* <<< until CD-SAO does fill-up: filluped last CD track length undefined */
if(fixed_size<=0 &&
!(current_is_cd==0 && skin->fill_up_media && i==skin->track_counter-1))
unpredicted_size= 1+(tao_to_sao_tsize<=0);
}
if(strcmp(skin->preskin->write_mode_name,"DEFAULT")==0) {
was_still_default= 1;
if((s == BURN_DISC_APPENDABLE || mixed_mode) && might_do_tao) {
if((s==BURN_DISC_APPENDABLE || mixed_mode ||
(current_is_cd && skin->fill_up_media) ) && might_do_tao) {
strcpy(skin->preskin->write_mode_name,"TAO");
was_still_default= 2; /* prevents trying of SAO if drive dislikes TAO*/
} else if(unpredicted_size && might_do_tao) {
strcpy(skin->preskin->write_mode_name,"TAO");
if(unpredicted_size>1)
was_still_default= 2; /* prevents trying of SAO */
} else if(s==BURN_DISC_BLANK && skin->track_counter==1 &&
skin->fill_up_media && might_do_sao && !current_is_cd) {
/* to avoid problems on my NEC with blank DVD-RW and TAO fill_up_media */
strcpy(skin->preskin->write_mode_name,"SAO");
} else if((profile_number==0x1a || profile_number==0x13 ||
profile_number==0x12 ||
profile_number==0x11 || profile_number==0x14)
@ -4747,7 +4757,8 @@ burn_failed:;
#endif /* Cdrskin_libburn_has_get_spacE */
if(skin->track_counter>0)
fprintf(stderr,
"cdrskin: NOTE : Burn run suppressed by option --tell_media_space\n");
"cdrskin: NOTE : %s burn run suppressed by option --tell_media_space\n",
skin->preskin->write_mode_name);
{ret= 1; goto ex;}
}

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.02.14.203635"
#define Cdrskin_timestamP "2007.02.15.201506"

View File

@ -1703,13 +1703,15 @@ int burn_disc_free_multi_caps(struct burn_multi_caps **caps)
}
/* ts A70207 : evaluate write mode related peculiarities of a disc */
/* ts A70207 : evaluate write mode related peculiarities of a disc
@param flag bit0= fill_up_media is active
*/
int burn_disc_get_write_mode_demands(struct burn_disc *disc,
struct burn_disc_mode_demands *result, int flag)
{
struct burn_session *session;
struct burn_track *track;
int i, j, mode;
int i, j, mode, unknown_track_sizes = 0, last_track_is_unknown = 0;
memset((char *) result, 0, sizeof(struct burn_disc_mode_demands));
if (disc == NULL)
@ -1725,8 +1727,12 @@ int burn_disc_get_write_mode_demands(struct burn_disc *disc,
result->multi_track = 1;
for (j = 0; j < session->tracks; j++) {
track = session->track[j];
if (burn_track_is_open_ended(track))
if (burn_track_is_open_ended(track)) {
result->unknown_track_size = 1;
unknown_track_sizes++;
last_track_is_unknown = 1;
} else
last_track_is_unknown = 0;
if (mode != track->mode)
result->mixed_mode = 1;
if (track->mode != BURN_MODE1)
@ -1735,5 +1741,9 @@ int burn_disc_get_write_mode_demands(struct burn_disc *disc,
result->audio = 1;
}
}
if (flag&1) {/* fill_up_media will define the size of the last track */
if (unknown_track_sizes == 1 && last_track_is_unknown)
result->unknown_track_size = 0;
}
return (disc->sessions > 0);
}

View File

@ -173,6 +173,9 @@ void burn_write_opts_set_start_byte(struct burn_write_opts *opts, off_t value)
/* ts A70207 API */
/* @param flag Bitfield for control purposes
bit0=do not look for suitable type but check preset type in opts
*/
enum burn_write_types burn_write_opts_auto_write_type(
struct burn_write_opts *opts, struct burn_disc *disc,
char reasons[1024], int flag)
@ -184,7 +187,9 @@ enum burn_write_types burn_write_opts_auto_write_type(
char *reason_pt;
reasons[0] = 0;
ret = burn_disc_get_write_mode_demands(disc, &demands, 0);
ret = burn_disc_get_write_mode_demands(disc, &demands,
!!opts->fill_up_media);
if (ret <= 0) {
strcat(reasons, "cannot recognize job demands, ");
return BURN_WRITE_NONE;
@ -201,7 +206,8 @@ enum burn_write_types burn_write_opts_auto_write_type(
strcat(reasons, "exotic track prohibited by non-CD, ");
return BURN_WRITE_NONE;
}
if ((flag & 1) && opts->write_type != BURN_WRITE_SAO)
goto try_tao;
ret = burn_disc_get_multi_caps(d, BURN_WRITE_SAO, &caps, 0);
if (ret < 0) {
no_caps:;
@ -212,28 +218,33 @@ no_caps:;
0, 0);
strcat(reasons, "cannot inquire write mode capabilities, ");
return BURN_WRITE_NONE;
} if (ret > 0) {
reason_pt = reasons + strlen(reasons);
strcat(reasons, "SAO: ");
if ((opts->multi || demands.multi_session) &&
!caps->multi_session)
strcat(reasons, "multi session capability lacking, ");
if (demands.multi_track && !caps->multi_track)
strcat(reasons, "multi track capability lacking, ");
if (demands.unknown_track_size)
strcat(reasons, "track size unpredictable, ");
if (demands.mixed_mode)
strcat(reasons, "tracks of different modes mixed, ");
if (strcmp(reason_pt, "SAO: ") != 0)
goto no_sao;
burn_write_opts_set_write_type(opts,
BURN_WRITE_SAO, BURN_BLOCK_SAO);
return BURN_WRITE_SAO;
} else
} else if (ret == 0) {
strcat(reasons, "SAO: no SAO offered by drive and media, ");
goto no_sao;
}
reason_pt = reasons + strlen(reasons);
strcat(reasons, "SAO: ");
if ((opts->multi || demands.multi_session) &&
!caps->multi_session)
strcat(reasons, "multi session capability lacking, ");
if (demands.multi_track && !caps->multi_track)
strcat(reasons, "multi track capability lacking, ");
if (demands.unknown_track_size)
strcat(reasons, "track size unpredictable, ");
if (demands.mixed_mode)
strcat(reasons, "tracks of different modes mixed, ");
if (d->current_is_cd_profile && opts->fill_up_media)
strcat(reasons, "cd sao cannot do media fill up yet, ");
if (strcmp(reason_pt, "SAO: ") != 0)
goto no_sao;
burn_write_opts_set_write_type(opts, BURN_WRITE_SAO, BURN_BLOCK_SAO);
return BURN_WRITE_SAO;
no_sao:;
burn_disc_free_multi_caps(&caps);
strcat(reasons, "\n");
try_tao:;
if ((flag & 1) && opts->write_type != BURN_WRITE_TAO)
goto no_tao;
reason_pt = reasons + strlen(reasons);
strcat(reasons, "TAO: ");
ret = burn_disc_get_multi_caps(d, BURN_WRITE_TAO, &caps, 0);
@ -241,24 +252,37 @@ no_sao:;
goto no_caps;
if (ret == 0) {
strcat(reasons, "no TAO offered by drive and media, ");
no_write_mode:;
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002012b,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Drive offers no suitable write mode with this job",
0, 0);
return BURN_WRITE_NONE;
goto no_tao;
}
if ((opts->multi || demands.multi_session) && !caps->multi_session)
strcat(reasons, "multi session capability lacking, ");
if (demands.multi_track && !caps->multi_track)
strcat(reasons, "multi track capability lacking, ");
if (d->current_is_cd_profile) {
/* >>> check block types */;
}
if (strcmp(reason_pt, "TAO: ") != 0)
goto no_write_mode;
goto no_tao;
/* ( TAO data/audio block size will be handled automatically ) */
burn_write_opts_set_write_type(opts,
BURN_WRITE_TAO, BURN_BLOCK_MODE1);
return BURN_WRITE_TAO;
no_tao:;
if (!d->current_is_cd_profile)
goto no_write_mode;
/* >>> evaluate RAW modes */;
no_write_mode:;
libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002012b,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Drive offers no suitable write mode with this job",
0, 0);
return BURN_WRITE_NONE;
}

View File

@ -966,9 +966,6 @@ int burn_dvd_write_track(struct burn_write_opts *o,
/* ts A70213 : eventually expand size of track to max */
burn_track_apply_fillup(t, d->media_capacity_remaining, 0);
sectors = burn_track_get_sectors(t);
open_ended = burn_track_is_open_ended(t);
/* <<< */
{
char msg[160];
@ -990,6 +987,11 @@ int burn_dvd_write_track(struct burn_write_opts *o,
goto ex;
}
sectors = burn_track_get_sectors(t);
open_ended = burn_track_is_open_ended(t);
/* >>> ts A70215 : what about offset padding ? */
burn_disc_init_track_status(o, s, tnum, sectors);
for (i = 0; open_ended || i < sectors; i++) {
@ -1011,6 +1013,8 @@ int burn_dvd_write_track(struct burn_write_opts *o,
d->progress.sector++;
}
/* >>> ts A70215 : what about tail padding ? */
/* 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);
@ -1257,7 +1261,7 @@ int burn_disc_setup_dvd_minus_r(struct burn_write_opts *o,
int burn_dvd_write_sync(struct burn_write_opts *o,
struct burn_disc *disc)
{
int i, ret, sx, tx, mode, exotic_track = 0, dao_is_ok;
int i, ret, sx, tx, mode, exotic_track = 0, dao_is_ok, o_end;
struct burn_drive *d = o->drive;
char msg[160];
@ -1344,11 +1348,13 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
} else if (d->current_profile == 0x11 || d->current_profile == 0x14) {
/* DVD-R , DVD-RW Sequential */
o_end = burn_track_is_open_ended(disc->session[0]->track[0]);
if(o->fill_up_media)
o_end = 0;
dao_is_ok =
(disc->sessions == 1 &&
disc->session[0]->tracks == 1 &&
(! burn_track_is_open_ended(
disc->session[0]->track[0])) &&
(!o_end) &&
(!o->multi) && d->status == BURN_DISC_BLANK
);
if (o->write_type == BURN_WRITE_TAO &&