Moved tao_to_sao_tsize into libburn, let cdrskin use auto_write_type and precheck

This commit is contained in:
Thomas Schmitt 2007-02-21 20:53:28 +00:00
parent b6475c3d84
commit 115f03cf63
9 changed files with 288 additions and 141 deletions

View File

@ -133,6 +133,7 @@ or
*/
#define Cdrskin_libburn_has_set_filluP 1
#define Cdrskin_libburn_has_get_spacE 1
#define Cdrskin_libburn_write_mode_ruleS 1
#endif /* Cdrskin_libburn_0_3_3 */
@ -177,7 +178,6 @@ or
#ifdef Cdrskin_new_api_tesT
/* put macros under test caveat here */
#define Cdrskin_allow_sao_for_appendablE 1
#endif /* Cdrskin_new_api_tesT */
@ -455,13 +455,6 @@ int Sfile_multi_read_argv(char *progname, char **filenames, int filename_count,
continue;
{ret= 0; goto ex;}
}
#ifdef Cdrskin_new_api_tesT
if(pass>0)
fprintf(stderr,"cdrskin: DEBUG : Reading arguments from file '%s'\n",
filenames[i]);
#endif
line_no= 0;
while(Sfile_fgets(buf,sizeof(buf)-1,fp)!=NULL) {
line_no++;
@ -922,10 +915,6 @@ int Cdrtrack_get_size(struct CdrtracK *track, double *size, double *padding,
burn_track_get_counters(track->libburn_track,&readcounter,&writecounter);
*size= readcounter;
*padding= writecounter-readcounter;
/*
fprintf(stderr,"cdrskin_debug: sizeof(off_t)=%d\n",
sizeof(off_t));
*/
} else if(flag&2)
*padding= track->tao_to_sao_tsize;
@ -1244,6 +1233,7 @@ int Cdrtrack_add_to_session(struct CdrtracK *track, int trackno,
}
burn_track_define_data(tr,0,(int) lib_padding,sector_pad_up,
track->track_type);
burn_track_set_default_size(tr, (off_t) track->tao_to_sao_tsize);
burn_track_set_byte_swap(tr,
(track->track_type==BURN_AUDIO && track->swap_audio_bytes));
fixed_size= track->fixed_size;
@ -1300,6 +1290,8 @@ flag:
}
#ifndef Cdrskin_libburn_write_mode_ruleS
int Cdrtrack_activate_tao_tsize(struct CdrtracK *track, int flag)
{
if(track->fixed_size<=0.0)
@ -1307,6 +1299,8 @@ int Cdrtrack_activate_tao_tsize(struct CdrtracK *track, int flag)
return(track->fixed_size>0.0);
}
#endif /* ! Cdrskin_libburn_write_mode_ruleS */
int Cdrtrack_get_sectors(struct CdrtracK *track, int flag)
{
@ -1523,13 +1517,6 @@ int Cdrpreskin_destroy(struct CdrpreskiN **preskin, int flag)
int Cdrpreskin_set_severities(struct CdrpreskiN *preskin, char *queue_severity,
char *print_severity, int flag)
{
/*
if(preskin->verbosity>=Cdrskin_verbose_debuG)
fprintf(stderr,
"cdrskin: DEBUG : queue_severity='%s' print_severity='%s'\n",
queue_severity,print_severity);
*/
if(queue_severity!=NULL)
strcpy(preskin->queue_severity,queue_severity);
if(print_severity!=NULL)
@ -1845,10 +1832,13 @@ return:
o->scan_demands_drive= 1;
} else if(strcmp(argv[i],"--devices")==0) {
#ifndef Cdrskin_extra_leaN
printf("Note: If this hangs for a while then there is a drive with\n");
printf(" unexpected problems (e.g. ill DMA).\n");
printf(" One may exclude such a device file by removing r- and w-\n");
printf(" permissions for all cdrskin users.\n");
#endif /* ! Cdrskin_extra_leaN */
o->no_whitelist= 1;
} else if(strncmp(argv[i],"dev_translation=",16)==0) {
@ -2192,7 +2182,7 @@ see_cdrskin_eng_html:;
} else if(strcmp(argv[i],"-v")==0 || strcmp(argv[i],"-verbose")==0) {
(o->verbosity)++;
printf("cdrskin: verbosity level : %d\n",o->verbosity);
ClN(printf("cdrskin: verbosity level : %d\n",o->verbosity));
set_severities:;
if(o->verbosity>=Cdrskin_verbose_debuG)
Cdrpreskin_set_severities(o,"NEVER","DEBUG",0);
@ -2479,8 +2469,10 @@ struct CdrskiN {
int drive_is_busy; /* Wether drive was told to do something cancel-worthy */
struct burn_drive *grabbed_drive;
#ifndef Cdrskin_extra_leaN
/** Abort test facility */
double abort_after_bytecount;
#endif /* ! Cdrskin_extra_leaN */
/** Some intermediate option info which is stored until setup finalization */
@ -2567,7 +2559,9 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag)
o->drive_is_grabbed= 0;
o->drive_is_busy= 0;
o->grabbed_drive= NULL;
#ifndef Cdrskin_extra_leaN
o->abort_after_bytecount= -1.0;
#endif /* ! Cdrskin_extra_leaN */
o->tao_to_sao_tsize= 0.0;
o->stdin_source_used= 0;
@ -3166,7 +3160,7 @@ wrong_devno:;
}
if(strlen(synthetic_adr)>0) {
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: converted address '%s' to '%s'\n",adr,synthetic_adr);
ClN(printf("cdrskin: converted address '%s' to '%s'\n",adr,synthetic_adr));
ret= Cdrskin_driveno_of_location(skin,synthetic_adr,driveno,0);
if(ret<=0) {
fprintf(stderr,
@ -3176,8 +3170,8 @@ wrong_devno:;
}
}
if((*driveno)>=skin->n_drives || (*driveno)<0) {
fprintf(stderr,"cdrskin: obtained drive number %d from '%s'\n",
*driveno,adr);
ClN(fprintf(stderr,"cdrskin: obtained drive number %d from '%s'\n",
*driveno,adr));
goto wrong_devno;
}
return(1);
@ -3446,7 +3440,7 @@ int Cdrskin_checkdrive(struct CdrskiN *skin, char *profile_name, int flag)
char btldev[Cdrskin_adrleN];
if(!(flag&1))
printf("cdrskin: pseudo-checkdrive on drive %d\n",skin->driveno);
ClN(printf("cdrskin: pseudo-checkdrive on drive %d\n",skin->driveno));
if(skin->driveno>=skin->n_drives || skin->driveno<0) {
fprintf(stderr,"cdrskin: FATAL : there is no drive #%d\n",skin->driveno);
{ret= 0; goto ex;}
@ -3630,7 +3624,7 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag)
int profile_number= 0;
char profile_name[80];
printf("cdrskin: pseudo-atip on drive %d\n",skin->driveno);
ClN(printf("cdrskin: pseudo-atip on drive %d\n",skin->driveno));
ret= Cdrskin_grab_drive(skin,0);
if(ret<=0)
return(ret);
@ -3884,7 +3878,7 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
#ifdef Cdrskin_libburn_has_pretend_fulL
if(s==BURN_DISC_UNSUITABLE) {
if(skin->force_is_set) {
fprintf(stderr,"cdrskin: NOTE : -force blank=... : Treating unsuitable media as burn_disc_full\n");
ClN(fprintf(stderr,"cdrskin: NOTE : -force blank=... : Treating unsuitable media as burn_disc_full\n"));
ret= burn_disc_pretend_full(drive);
s= burn_disc_get_status(drive);
} else
@ -4353,6 +4347,84 @@ ex:;
}
#ifdef Cdrskin_libburn_write_mode_ruleS
/** After everything else about burn_write_opts and burn_disc is set up, this
call determines the effective write mode and checks wether the drive
promises to support it.
*/
int Cdrskin_activate_write_mode(struct CdrskiN *skin,
struct burn_write_opts *opts,
struct burn_disc *disc,
int flag)
{
int profile_number= -1, current_is_cd= 1, ret, was_still_default= 0;
char profile_name[80], reasons[1024];
enum burn_disc_status s= BURN_DISC_UNGRABBED;
enum burn_write_types wt;
profile_name[0]= 0;
if(skin->grabbed_drive) {
burn_disc_get_profile(skin->grabbed_drive,&profile_number,profile_name);
s= burn_disc_get_status(skin->grabbed_drive);
}
if(profile_number!=0x09 && profile_number!=0x0a)
current_is_cd= 0;
if(strcmp(skin->preskin->write_mode_name,"DEFAULT")==0) {
was_still_default= 1;
wt= burn_write_opts_auto_write_type(opts, disc, reasons, 0);
if(wt==BURN_WRITE_NONE) {
if(strncmp(reasons,"MEDIA: ",7)==0)
ret= -1;
else
ret= 0;
goto report_failure;
}
skin->write_type= wt;
if(wt==BURN_WRITE_RAW)
strcpy(skin->preskin->write_mode_name,"RAW/RAW96R");
else if(wt==BURN_WRITE_TAO)
strcpy(skin->preskin->write_mode_name,"TAO");
else if(wt==BURN_WRITE_SAO)
strcpy(skin->preskin->write_mode_name,"SAO");
else
sprintf(skin->preskin->write_mode_name,"LIBBURN/%d", (int) wt);
}
if(strcmp(skin->preskin->write_mode_name,"RAW/RAW96R")==0) {
skin->write_type= BURN_WRITE_RAW;
skin->block_type= BURN_BLOCK_RAW96R;
} else if(strcmp(skin->preskin->write_mode_name,"TAO")==0) {
skin->write_type= BURN_WRITE_TAO;
skin->block_type= BURN_BLOCK_MODE1;
} else if(strncmp(skin->preskin->write_mode_name,"LIBBURN/",8)==0) {
skin->block_type= BURN_BLOCK_MODE1;
} else {
strcpy(skin->preskin->write_mode_name,"SAO");
skin->write_type= BURN_WRITE_SAO;
skin->block_type= BURN_BLOCK_SAO;
}
if(!was_still_default)
burn_write_opts_set_write_type(opts,skin->write_type,skin->block_type);
ret = burn_precheck_write(opts,disc,reasons,0);
if(ret<=0) {
report_failure:;
if(ret!=-1)
fprintf(stderr,"cdrskin: Reason: %s\n",reasons);
fprintf(stderr,"cdrskin: Media : %s%s\n",
s==BURN_DISC_BLANK?"blank ":
s==BURN_DISC_APPENDABLE?"appendable ":
s==BURN_DISC_FULL?"** closed ** ":"",
profile_name[0]?profile_name:
s==BURN_DISC_EMPTY?"no media":"unknown media");
return(0);
}
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: Write type : %s\n", skin->preskin->write_mode_name);
return(1);
}
#else /* Cdrskin_libburn_write_mode_ruleS */
/** Determines the effective write mode and checks wether the drive promises
to support it.
@param s state of target media, obtained from burn_disc_get_status(),
@ -4574,6 +4646,8 @@ it_is_done:;
return(1);
}
#endif /* ! Cdrskin_libburn_write_mode_ruleS */
/** Burn data via libburn according to the parameters set in skin.
@return <=0 error, 1 success
@ -4597,8 +4671,8 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
printf("cdrskin: beginning to %s disc\n",
skin->tell_media_space?"estimate":"burn");
if(skin->fill_up_media && skin->multi) {
fprintf(stderr,
"cdrskin: NOTE : Option --fill_up_media disabled option -multi\n");
ClN(fprintf(stderr,
"cdrskin: NOTE : Option --fill_up_media disabled option -multi\n"));
skin->multi= 0;
}
ret= Cdrskin_grab_drive(skin,0);
@ -4609,6 +4683,9 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
if(skin->verbosity>=Cdrskin_verbose_progresS)
Cdrskin_report_disc_status(skin,s,0);
#ifndef Cdrskin_libburn_write_mode_ruleS
#ifdef Cdrskin_allow_libburn_taO
if (s!=BURN_DISC_APPENDABLE && s!=BURN_DISC_BLANK) {
#else
@ -4618,6 +4695,7 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
fprintf(stderr,"cdrskin: FATAL : no writeable media detected.\n");
goto burn_failed;
}
ret= Cdrskin_activate_write_mode(skin,s,0);
if(ret<=0) {
fprintf(stderr,
@ -4625,6 +4703,9 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
goto burn_failed;
}
#endif /* ! Cdrskin_libburn_write_mode_ruleS */
disc= burn_disc_create();
session= burn_session_create();
ret= burn_disc_add_session(disc,session,BURN_POS_END);
@ -4651,6 +4732,7 @@ burn_failed:;
skin->fixed_size+= size+padding;
}
#ifndef Cdrskin_libburn_write_mode_ruleS
if (s==BURN_DISC_APPENDABLE) {
#ifdef Cdrskin_allow_sao_for_appendablE
;
@ -4662,6 +4744,35 @@ burn_failed:;
}
#endif /* ! Cdrskin_allow_sao_for_appendablE */
}
#endif /* ! Cdrskin_libburn_write_mode_ruleS */
o= burn_write_opts_new(drive);
burn_write_opts_set_perform_opc(o, 0);
#ifdef Cdrskin_libburn_has_multI
burn_write_opts_set_multi(o,skin->multi);
#endif
#ifdef Cdrskin_libburn_has_set_start_bytE
burn_write_opts_set_start_byte(o, skin->write_start_address);
#endif
#ifdef Cdrskin_libburn_has_set_filluP
burn_write_opts_set_fillup(o, skin->fill_up_media);
#endif
if(skin->dummy_mode) {
fprintf(stderr,
"cdrskin: NOTE : -dummy mode will prevent actual writing\n");
burn_write_opts_set_simulate(o, 1);
}
burn_write_opts_set_underrun_proof(o,skin->burnfree);
#ifdef Cdrskin_libburn_write_mode_ruleS
ret= Cdrskin_activate_write_mode(skin,o,disc,0);
if(ret<=0)
goto burn_failed;
#else /* Cdrskin_libburn_write_mode_ruleS */
burn_write_opts_set_write_type(o,skin->write_type,skin->block_type);
#endif
#ifndef Cdrskin_extra_leaN
@ -4711,42 +4822,12 @@ burn_failed:;
}
}
if(!skin->tell_media_space) {
Cdrskin_wait_before_action(skin,0);
ret= Cdrskin_fill_fifo(skin,0);
if(ret<=0) {
fprintf(stderr,"cdrskin: FATAL : filling of fifo failed\n");
goto ex;
}
}
#endif /* ! Cdrskin_extra_leaN */
o= burn_write_opts_new(drive);
burn_write_opts_set_perform_opc(o, 0);
#ifdef Cdrskin_libburn_has_multI
burn_write_opts_set_multi(o,skin->multi);
#endif
#ifdef Cdrskin_libburn_has_set_start_bytE
burn_write_opts_set_start_byte(o, skin->write_start_address);
#endif
#ifdef Cdrskin_libburn_has_set_filluP
burn_write_opts_set_fillup(o, skin->fill_up_media);
#endif
burn_write_opts_set_write_type(o,skin->write_type,skin->block_type);
if(skin->dummy_mode) {
fprintf(stderr,
"cdrskin: NOTE : -dummy mode will prevent actual writing\n");
burn_write_opts_set_simulate(o, 1);
}
burn_write_opts_set_underrun_proof(o,skin->burnfree);
if(skin->tell_media_space || skin->track_counter<=0) {
/* write capacity estimation and return without actual burning */
#ifdef Cdrskin_libburn_has_get_spacE
off_t free_space;
char msg[80];
@ -4758,6 +4839,7 @@ burn_failed:;
} else
printf("%s",msg);
#endif /* Cdrskin_libburn_has_get_spacE */
if(skin->track_counter>0)
fprintf(stderr,
"cdrskin: NOTE : %s burn run suppressed by option --tell_media_space\n",
@ -4765,6 +4847,14 @@ burn_failed:;
{ret= 1; goto ex;}
}
#ifndef Cdrskin_extra_leaN
Cdrskin_wait_before_action(skin,0);
ret= Cdrskin_fill_fifo(skin,0);
if(ret<=0) {
fprintf(stderr,"cdrskin: FATAL : filling of fifo failed\n");
goto ex;
}
#endif /* ! Cdrskin_extra_leaN */
Cdrskin_adjust_speed(skin,0);
if(skin->verbosity>=Cdrskin_verbose_progresS) {
@ -4798,6 +4888,11 @@ burn_failed:;
Cdrskin_burn_pacifier(skin,drive_status,&p,start_time,&last_time,
&total_count,&last_count,&min_buffer_fill,0);
if(max_track<skin->supposed_track_idx)
max_track= skin->supposed_track_idx;
#ifndef Cdrskin_extra_leaN
/* <<< debugging : artificial abort without a previous signal */;
if(skin->abort_after_bytecount>=0.0 &&
@ -4812,11 +4907,6 @@ burn_failed:;
exit(1);
}
if(max_track<skin->supposed_track_idx)
max_track= skin->supposed_track_idx;
#ifndef Cdrskin_extra_leaN
if(skin->fifo==NULL || fifo_disabled) {
usleep(20000);
} else {
@ -5033,8 +5123,8 @@ obtain_nwa:;
"cdrskin: SORRY : Cannot obtain next writeable address\n");
{ret= 0; goto ex;}
}
fprintf(stderr,
"cdrskin: NOTE : Guessing next writeable address from leadout\n");
ClN(fprintf(stderr,
"cdrskin: NOTE : Guessing next writeable address from leadout\n"));
burn_session_get_leadout_entry(sessions[num_sessions-1],&toc_entry);
#ifdef Cdrskin_libburn_has_toc_entry_extensionS
if(toc_entry.extensions_valid&1) { /* DVD extension valid */
@ -5113,9 +5203,9 @@ int Cdrskin_eject(struct CdrskiN *skin, int flag)
if(ret>0 || i>=max_try-1)
break;
if(skin->verbosity>=Cdrskin_verbose_progresS)
fprintf(stderr,
ClN(fprintf(stderr,
"cdrskin: NOTE : Attempt #%d of %d failed to grab drive for eject\n",
i+1,max_try);
i+1,max_try));
usleep(1000000);
}
if(ret>0) {
@ -5273,6 +5363,7 @@ no_volunteer:;
continue;
}
#ifndef Cdrskin_extra_leaN
if(strncmp(argv[i],"abort_after_bytecount=",22)==0) {
skin->abort_after_bytecount= Scanf_io_size(argv[i]+22,0);
fprintf(stderr,
@ -5280,11 +5371,15 @@ no_volunteer:;
skin->abort_after_bytecount);
} else if(strcmp(argv[i],"--abort_handler")==0) {
#else /* ! Cdrskin_extra_leaN */
if(strcmp(argv[i],"--abort_handler")==0) {
#endif
/* is handled in Cdrpreskin_setup() */;
} else if(strncmp(argv[i],"-abort_max_wait=",16)==0) {
value_pt= argv[i]+16;
goto set_abort_max_wait;
} else if(strncmp(argv[i],"abort_max_wait=",15)==0) {
value_pt= argv[i]+15;
set_abort_max_wait:;
@ -5301,20 +5396,21 @@ set_abort_max_wait:;
skin->abort_max_wait);
}
} else if(strcmp(argv[i],"--allow_setuid")==0) {
/* is handled in Cdrpreskin_setup() */;
} else if(strcmp(argv[i],"--any_track")==0) {
skin->single_track= -1;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf(
"cdrskin: --any_track : will accept any unknown option as track source\n");
ClN(printf(
"cdrskin: --any_track : will accept any unknown option as track source\n"));
} else if(strcmp(argv[i],"-atip")==0) {
if(skin->do_atip<1)
skin->do_atip= 1;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: will put out some -atip style lines\n");
ClN(printf("cdrskin: will put out some -atip style lines\n"));
} else if(strcmp(argv[i],"-audio")==0) {
skin->track_type= BURN_AUDIO;
@ -5368,7 +5464,7 @@ set_blank:;
return(0);
}
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: blank mode : blank=%s\n",blank_mode);
ClN(printf("cdrskin: blank mode : blank=%s\n",blank_mode));
} else if(strcmp(argv[i],"--bragg_with_audio")==0) {
/* OBSOLETE 0.2.3 : was handled in Cdrpreskin_setup() */;
@ -5414,7 +5510,7 @@ set_blank:;
if(ret<=0)
return(0);
#endif /* Cdrskin_extra_leaN */
#endif /* ! Cdrskin_extra_leaN */
} else if(strncmp(argv[i],"-dev=",5)==0) {
@ -5440,12 +5536,12 @@ set_driveropts:;
if(strcmp(value_pt,"burnfree")==0 || strcmp(value_pt,"burnproof")==0) {
skin->burnfree= 1;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: burnfree : on\n");
ClN(printf("cdrskin: burnfree : on\n"));
} else if(strcmp(argv[i]+11,"noburnfree")==0 ||
strcmp(argv[i]+11,"noburnproof")==0 ) {
skin->burnfree= 0;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: burnfree : off\n");
ClN(printf("cdrskin: burnfree : off\n"));
} else if(strcmp(argv[i]+11,"help")==0) {
/* handled in Cdrpreskin_setup() */;
} else
@ -5457,7 +5553,7 @@ set_driveropts:;
} else if(strcmp(argv[i],"-eject")==0) {
skin->do_eject= 1;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: eject after work : on\n");
ClN(printf("cdrskin: eject after work : on\n"));
} else if(strncmp(argv[i],"eject_device=",13)==0) {
if(strlen(argv[i]+13)>=sizeof(skin->eject_device)) {
@ -5469,10 +5565,10 @@ set_driveropts:;
strcpy(skin->eject_device,argv[i]+13);
if(skin->verbosity>=Cdrskin_verbose_cmD)
#ifdef Cdrskin_burn_drive_eject_brokeN
printf("cdrskin: eject_device : %s\n",skin->eject_device);
ClN(printf("cdrskin: eject_device : %s\n",skin->eject_device));
#else
printf("cdrskin: ignoring obsolete eject_device=%s\n",
skin->eject_device);
ClN(printf("cdrskin: ignoring obsolete eject_device=%s\n",
skin->eject_device));
#endif
@ -5482,7 +5578,7 @@ set_driveropts:;
skin->fifo_enabled= 0;
skin->fifo_size= 0;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: option fs=... disabled\n");
ClN(printf("cdrskin: option fs=... disabled\n"));
} else if(strcmp(argv[i],"--fifo_start_empty")==0) { /* obsoleted */
skin->fifo_start_at= 0;
@ -5498,16 +5594,21 @@ set_driveropts:;
} else if(strcmp(argv[i],"--fifo_per_track")==0) {
skin->fifo_per_track= 1;
#endif /* ! Cdrskin_extra_leaN */
#ifdef Cdrskin_libburn_has_set_filluP
} else if(strcmp(argv[i],"--fill_up_media")==0) {
skin->fill_up_media= 1;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: will fill up last track to full free media space\n");
ClN(printf(
"cdrskin: will fill up last track to full free media space\n"));
#endif
} else if(strcmp(argv[i],"-force")==0) {
skin->force_is_set= 1;
#ifndef Cdrskin_extra_leaN
} else if(strncmp(argv[i],"-fs=",4)==0) {
value_pt= argv[i]+4;
goto fs_equals;
@ -5627,7 +5728,7 @@ msifile_equals:;
} else if(strcmp(argv[i],"-nopad")==0) {
skin->padding= 0.0;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: padding : off\n");
ClN(printf("cdrskin: padding : off\n"));
} else if(strcmp(argv[i],"--old_pseudo_scsi_adr")==0) {
/* is handled in Cdrpreskin_setup() */;
@ -5636,7 +5737,7 @@ msifile_equals:;
skin->padding= 15*2048;
skin->set_by_padsize= 0;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: padding : %.f\n",skin->padding);
ClN(printf("cdrskin: padding : %.f\n",skin->padding));
} else if(strncmp(argv[i],"-padsize=",9)==0) {
value_pt= argv[i]+9;
@ -5647,7 +5748,7 @@ set_padsize:;
skin->padding= Scanf_io_size(argv[i]+8,0);
skin->set_by_padsize= 1;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: padding : %.f\n",skin->padding);
ClN(printf("cdrskin: padding : %.f\n",skin->padding));
} else if(strcmp(argv[i],"--prodvd_cli_compatible")==0) {
skin->prodvd_cli_compatible= 1;
@ -5664,8 +5765,8 @@ set_padsize:;
} else if(strcmp(argv[i],"--single_track")==0) {
skin->single_track= 1;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf(
"cdrskin: --single_track : will only accept last argument as track source\n");
ClN(printf(
"cdrskin: --single_track : will only accept last argument as track source\n"));
} else if(strncmp(argv[i],"-speed=",7)==0) {
value_pt= argv[i]+7;
@ -5682,7 +5783,7 @@ set_speed:;
/* >>> cdrecord speed=0 -> minimum speed , libburn -> maximum speed */;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: speed : %f\n",skin->x_speed);
ClN(printf("cdrskin: speed : %f\n",skin->x_speed));
} else if(strcmp(argv[i],"-swab")==0) {
skin->swap_audio_bytes= 0;
@ -5697,7 +5798,7 @@ set_speed:;
fprintf(stderr,"cdrskin: HINT : Try option tao_to_sao_tsize=650m\n");
return(0);
}
printf("cdrskin: NOTE : substituting mode -tao by mode -sao\n");
ClN(printf("cdrskin: NOTE : substituting mode -tao by mode -sao\n"));
strcpy(skin->preskin->write_mode_name,"SAO");
#endif /* ! Cdrskin_allow_libburn_taO */
@ -5706,6 +5807,8 @@ set_speed:;
skin->tao_to_sao_tsize= Scanf_io_size(argv[i]+17,0);
if(skin->tao_to_sao_tsize>Cdrskin_tracksize_maX)
goto track_too_large;
#ifndef Cdrskin_extra_leaN
if(skin->verbosity>=Cdrskin_verbose_cmD)
#ifdef Cdrskin_allow_libburn_taO
printf("cdrskin: size default for non-tao write modes: %.f\n",
@ -5713,6 +5816,7 @@ set_speed:;
printf("cdrskin: replace -tao by -sao with fixed size : %.f\n",
#endif
skin->tao_to_sao_tsize);
#endif /* ! Cdrskin_extra_leaN */
#ifdef Cdrskin_libburn_has_get_spacE
} else if(strcmp(argv[i],"--tell_media_space")==0) {
@ -5722,7 +5826,7 @@ set_speed:;
} else if(strcmp(argv[i],"-toc")==0) {
skin->do_atip= 2;
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: will put out some -atip style lines plus -toc\n");
ClN(printf("cdrskin: will put out some -atip style lines plus -toc\n"));
} else if(strncmp(argv[i],"-tsize=",7)==0) {
value_pt= argv[i]+7;
@ -5737,7 +5841,7 @@ track_too_large:;
return(0);
}
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: fixed track size : %.f\n",skin->fixed_size);
ClN(printf("cdrskin: fixed track size : %.f\n",skin->fixed_size));
} else if(strcmp(argv[i],"-v")==0 || strcmp(argv[i],"-verbose")==0) {
/* is handled in Cdrpreskin_setup() */;
@ -5748,7 +5852,8 @@ track_too_large:;
} else if(strncmp(argv[i],"write_start_address=",20)==0) {
skin->write_start_address= Scanf_io_size(argv[i]+20,0);
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: fixed track size : %.f\n",skin->fixed_size);
ClN(printf("cdrskin: write start address : %.f\n",
skin->write_start_address));
} else if( i==argc-1 ||
(skin->single_track==0 && strchr(argv[i],'=')==NULL
@ -5831,6 +5936,7 @@ ignore_unknown:;
if(flag&1) /* no finalizing yet */
return(1);
#ifndef Cdrskin_extra_leaN
if(skin->verbosity>=Cdrskin_verbose_cmD) {
if(skin->preskin->abort_handler==1)
printf("cdrskin: installed abort handler.\n");
@ -5843,6 +5949,7 @@ ignore_unknown:;
else if(skin->preskin->abort_handler==-1)
printf("cdrskin: will install abort handler in eventual burn loop.\n");
}
#endif /* ! Cdrskin_extra_leaN */
if(strlen(skin->preskin->raw_device_adr)>0 ||
strlen(skin->preskin->device_adr)>0) {
@ -5921,8 +6028,9 @@ int Cdrskin_create(struct CdrskiN **o, struct CdrpreskiN **preskin,
#endif
if(strlen((*preskin)->device_adr)>0) { /* disable scan for all others */
printf("cdrskin: NOTE : greying out all drives besides given dev='%s'\n",
(*preskin)->device_adr);
ClN(printf(
"cdrskin: NOTE : greying out all drives besides given dev='%s'\n",
(*preskin)->device_adr));
burn_drive_add_whitelist((*preskin)->device_adr);
}
@ -6107,7 +6215,7 @@ int main(int argc, char **argv)
if(ret<=0)
{exit_value= 3; goto ex;}
if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: called as : %s\n",argv[0]);
ClN(printf("cdrskin: called as : %s\n",argv[0]));
if(skin->verbosity>=Cdrskin_verbose_debuG) {
#ifdef Cdrskin_oldfashioned_api_usE

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.02.19.225102"
#define Cdrskin_timestamP "2007.02.21.205244"

View File

@ -369,8 +369,8 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
/* ts A70219 : intended to replace all further tests here and many
tests in burn_*_write_sync()
*/
strcpy(reasons, "Write job parameters seem unsuitable:\n");
if (burn_precheck_write(opts, disc, reasons + strlen(reasons), 0)
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

View File

@ -1677,6 +1677,7 @@ int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt,
d->best_format_size - 2048;
}
}
o->might_do_sao = 3;
o->might_do_tao = 2;
o->advised_write_mode = BURN_WRITE_TAO;
} else /* unknown media */

View File

@ -1005,12 +1005,13 @@ void burn_disc_read(struct burn_drive *drive, const struct burn_read_opts *o);
@param o The options for the writing operation.
@param disc The descrition of the disc to be created
@param reasons Eventually returns a list of rejection reason statements
@param silent 1= do not issue error messages , 0= report severe problems
@param silent 1= do not issue error messages , 0= report problems
@return 1 ok, -1= no recordable media detected, 0= other failure
*/
int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
char reasons[1024], int silent);
/* <<< enabling switch for internal usage and trust in this functiion */
/* <<< enabling switch for internal usage and trust in this function */
#define Libburn_precheck_write_ruleS 1
@ -1276,6 +1277,7 @@ int burn_write_opts_set_write_type(struct burn_write_opts *opts,
@param flag Bitfield for control purposes:
bit0= do not choose type but check the one that is already set
bit1= do not issue error messages via burn_msgs queue
(is automatically set with bit0)
@return Chosen write type. BURN_WRITE_NONE on failure.
*/
enum burn_write_types burn_write_opts_auto_write_type(
@ -1516,6 +1518,7 @@ struct burn_multi_caps {
off_t start_range_high;
/** Potential availability of write modes
3= allowed but not to be chosen automatically
2= available, no size prediction necessary
1= available, needs exact size prediction
0= not available
@ -1526,7 +1529,9 @@ struct burn_multi_caps {
int might_do_sao;
int might_do_raw;
/** Advised write mode.
/** Generally advised write mode.
Not necessarily the one chosen by burn_write_opts_auto_write_type()
because the burn_disc structure might impose particular demands.
*/
enum burn_write_types advised_write_mode;

View File

@ -363,9 +363,8 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x00020136 (SORRY,HIGH) = DAO burning restricted to single fixed size track
0x00020137 (HINT,HIGH) = TAO would be possible
0x00020138 (FATAL,HIGH) = Cannot reserve track
0x00020139 (WARN,HIGH) = Unsuitable write type and/or block types detected
to become ^ SORRY ^ soon
0x00020139 (SORRY,HIGH) = Write job parameters are unsuitable
0x0002013a (FATAL,HIGH) = No suitable media detected
libdax_audioxtr:
0x00020200 (SORRY,HIGH) = Cannot open audio source file

View File

@ -173,6 +173,10 @@ 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 choose type but check the one that is already set
bit1= do not issue error messages via burn_msgs queue
*/
enum burn_write_types burn_write_opts_auto_write_type(
struct burn_write_opts *opts, struct burn_disc *disc,
char reasons[1024], int flag)
@ -186,6 +190,19 @@ enum burn_write_types burn_write_opts_auto_write_type(
reasons[0] = 0;
if (d->status != BURN_DISC_BLANK &&
d->status != BURN_DISC_APPENDABLE){
if (d->status == BURN_DISC_FULL)
strcat(reasons, "MEDIA: closed or not recordable, ");
else
strcat(reasons,"MEDIA: no writeable media detected, ");
if (!(flag & 3))
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002013a,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"No suitable media detected", 0, 0);
return BURN_WRITE_NONE;
}
ret = burn_disc_get_write_mode_demands(disc, opts, &demands,
!!opts->fill_up_media);
if (ret <= 0) {
@ -193,12 +210,6 @@ enum burn_write_types burn_write_opts_auto_write_type(
{wt = BURN_WRITE_NONE; goto ex;}
}
if (demands.exotic_track && !d->current_is_cd_profile) {
if (!(flag & 2))
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020123,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"DVD Media are unsuitable for desired track type",
0, 0);
if (demands.audio)
strcat(reasons, "audio track prohibited by non-CD, ");
else
@ -207,24 +218,22 @@ enum burn_write_types burn_write_opts_auto_write_type(
}
if ((flag & 1) && opts->write_type != BURN_WRITE_SAO)
goto try_tao;
reason_pt = reasons + strlen(reasons);
strcat(reasons, "SAO: ");
if (d->status != BURN_DISC_BLANK) {
strcat(reasons, "write type SAO works only on blank media, ");
goto try_tao;
}
burn_disc_free_multi_caps(&caps);
ret = burn_disc_get_multi_caps(d, BURN_WRITE_SAO, &caps, 0);
if (ret < 0) {
no_caps:;
if (!(flag & 2))
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002012a,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Cannot inquire write mode capabilities",
0, 0);
strcat(reasons, "cannot inquire write mode capabilities, ");
{wt = BURN_WRITE_NONE; goto ex;}
} else if (ret == 0) {
strcat(reasons, "SAO: no SAO offered by drive and media, ");
strcat(reasons, "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, ");
@ -250,14 +259,14 @@ no_caps:;
if (demands.unknown_track_size == 2 && !(flag & 1)) {
strcat(reasons, "would have to use default track sizes, ");
goto no_sao;
}
} else if (caps->might_do_sao == 3 && !(flag & 1))
goto try_tao;
do_sao:;
if (!(flag & 1))
burn_write_opts_set_write_type(
opts, BURN_WRITE_SAO, BURN_BLOCK_SAO);
{wt = BURN_WRITE_SAO; goto ex;}
no_sao:;
strcat(reasons, "\n");
try_tao:;
if ((flag & 1) && opts->write_type != BURN_WRITE_TAO)
goto try_raw;
@ -293,7 +302,6 @@ no_tao:;
goto do_sao;
if (!d->current_is_cd_profile)
goto no_write_mode;
strcat(reasons, "\n");
try_raw:;
if ((flag & 1) && opts->write_type != BURN_WRITE_RAW)
goto no_write_mode;
@ -304,8 +312,10 @@ try_raw:;
reason_pt = reasons + strlen(reasons);
strcat(reasons, "RAW: ");
if (!d->current_is_cd_profile)
strcat(reasons, "prohibited by non-CD, ");
if ((d->block_types[BURN_WRITE_TAO] & demands.block_types) !=
strcat(reasons, "write type RAW prohibited by non-CD, ");
else if (d->status != BURN_DISC_BLANK)
strcat(reasons, "write type RAW works only on blank media, ");
else if ((d->block_types[BURN_WRITE_TAO] & demands.block_types) !=
demands.block_types)
strcat(reasons, "drive dislikes block type, ");
if (strcmp(reason_pt, "RAW: ") != 0)
@ -316,15 +326,16 @@ try_raw:;
{wt = BURN_WRITE_RAW; goto ex;}
no_write_mode:;
if (!(flag & (1 | 2)))
wt = BURN_WRITE_NONE;
ex:;
burn_disc_free_multi_caps(&caps);
if (wt == BURN_WRITE_NONE && !(flag & 3)) {
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);
wt = BURN_WRITE_NONE;
ex:;
burn_disc_free_multi_caps(&caps);
}
return wt;
}

View File

@ -356,6 +356,7 @@ int burn_track_set_sectors(struct burn_track *t, int sectors)
/* ts A70218 */
int burn_track_set_size(struct burn_track *t, off_t size)
{
t->open_ended = (size <= 0);
return t->source->set_size(t->source, size);
}

View File

@ -1256,16 +1256,22 @@ int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
{
enum burn_write_types wt;
struct burn_drive *d = o->drive;
char msg[160];
char msg[160], *reason_pt;
int no_media = 0;
reason_pt= reasons;
reasons[0] = 0;
/* check write mode against write job */
reasons[0] = 0;
wt = burn_write_opts_auto_write_type(o, disc, reasons,
1 | ((!!silent) << 1));
if (wt == BURN_WRITE_NONE)
return 0;
wt = burn_write_opts_auto_write_type(o, disc, reasons, 1);
if (wt == BURN_WRITE_NONE) {
if (strncmp(reasons, "MEDIA: ", 7)==0)
no_media = 1;
goto ex;
}
sprintf(reasons, "%s: ", d->current_profile_text);
reason_pt= reasons + strlen(reasons);
if (d->current_profile == 0x09 || d->current_profile == 0x0a) {
if (!burn_disc_write_is_ok(o, disc, (!!silent) << 1))
strcat(reasons, "unsuitable track mode found, ");
@ -1293,9 +1299,25 @@ int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
strcat(reasons, "no suitable media profile detected, ");
}
if (strlen(reasons) > strlen(d->current_profile_text) + 2)
return 0;
}
ex:;
if (reason_pt[0]) {
if (no_media) {
if (!silent)
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x0002013a,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"No suitable media detected", 0, 0);
return -1;
}
if (!silent)
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x00020139,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Write job parameters are unsuitable", 0, 0);
return 0;
}
return 1;
}