Rowed forth from revision 73. Now hopefully compliant to man cdrecord

This commit is contained in:
Thomas Schmitt 2006-09-01 14:48:54 +00:00
parent 4f3e5e3913
commit 3a02f8c14e
2 changed files with 13 additions and 42 deletions

View File

@ -707,6 +707,7 @@ struct CdrtracK {
char source_path[Cdrskin_strleN]; char source_path[Cdrskin_strleN];
int source_fd; int source_fd;
int is_from_stdin;
double fixed_size; double fixed_size;
double padding; double padding;
int track_type; int track_type;
@ -735,6 +736,7 @@ int Cdrtrack_destroy(struct CdrtracK **o, int flag);
@param trackno The index in the cdrskin tracklist array (is not constant) @param trackno The index in the cdrskin tracklist array (is not constant)
@param flag Bitfield for control purposes: @param flag Bitfield for control purposes:
bit0= set fifo_start_empty to 1 bit0= set fifo_start_empty to 1
bit1= track is originally stdin
*/ */
int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss, int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
int trackno, int flag) int trackno, int flag)
@ -754,6 +756,7 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
o->trackno= trackno; o->trackno= trackno;
o->source_path[0]= 0; o->source_path[0]= 0;
o->source_fd= -1; o->source_fd= -1;
o->is_from_stdin= !!(flag&2);
o->fixed_size= 0.0; o->fixed_size= 0.0;
o->padding= 0.0; o->padding= 0.0;
o->track_type= BURN_MODE1; o->track_type= BURN_MODE1;
@ -915,7 +918,7 @@ int Cdrtrack_attach_fifo(struct CdrtracK *track, int *outlet_fd,
*/ */
int Cdrtrack_fill_fifo(struct CdrtracK *track, int flag) int Cdrtrack_fill_fifo(struct CdrtracK *track, int flag)
{ {
int ret; int ret,buffer_fill,buffer_space;
if(track->fifo==NULL || track->fifo_start_empty) if(track->fifo==NULL || track->fifo_start_empty)
return(2); return(2);
@ -924,22 +927,17 @@ int Cdrtrack_fill_fifo(struct CdrtracK *track, int flag)
ret= Cdrfifo_fill(track->fifo,0); ret= Cdrfifo_fill(track->fifo,0);
if(ret<=0) if(ret<=0)
return(ret); return(ret);
return(1);
}
/** Ticket 55: check fifos for input, throw error on 0-bytes /** Ticket 55: check fifos for input, throw error on 0-bytes from stdin
@return <=0 abort run, 1 go on with burning @return <=0 abort run, 1 go on with burning
*/ */
int Cdrtrack_demand_fifo_data(struct CdrtracK *track, int flag) if(track->is_from_stdin) {
{
int ret,buffer_fill,buffer_space;
ret= Cdrfifo_get_buffer_state(track->fifo,&buffer_fill,&buffer_space,0); ret= Cdrfifo_get_buffer_state(track->fifo,&buffer_fill,&buffer_space,0);
if(ret<0 || buffer_fill<=0) { if(ret<0 || buffer_fill<=0) {
fprintf(stderr, fprintf(stderr,"\ncdrskin: FATAL : (First track) fifo did not read a single byte from stdin\n");
"\ncdrskin: FATAL : (First track) fifo did not read a single byte\n");
return(0); return(0);
} }
}
return(1); return(1);
} }
@ -1523,9 +1521,6 @@ set_dev:;
printf( printf(
" eject_device=<path> set the device address for command eject\n"); " eject_device=<path> set the device address for command eject\n");
#endif #endif
printf(
" --fifo_abort_on_empty abort if first fifo fill yields no bytes\n");
printf(" (disabled by: --fifo_start_empty)\n");
printf(" --fifo_disable disable fifo despite any fs=...\n"); printf(" --fifo_disable disable fifo despite any fs=...\n");
printf(" --fifo_per_track use a separate fifo for each track\n"); printf(" --fifo_per_track use a separate fifo for each track\n");
printf( printf(
@ -1802,17 +1797,6 @@ static double Cdrskin_libburn_cd_speed_factoR= 176.0;
static double Cdrskin_libburn_cd_speed_addoN= 50.0; static double Cdrskin_libburn_cd_speed_addoN= 50.0;
/** Default settings which deviate from cdrecord but are actually deemed
preferrable over original cdrecord behavior. To be set from outside.
*/
#ifdef Cdrskin_fifo_abort_on_emptY
#undef Cdrskin_fifo_abort_on_emptY
#define Cdrskin_fifo_abort_on_emptY 1
#else
#define Cdrskin_fifo_abort_on_emptY 0
#endif /* ! Cdrskin_fifo_abort_on_emptY */
/** The program run control object. Defaults: see Cdrskin_new(). */ /** The program run control object. Defaults: see Cdrskin_new(). */
struct CdrskiN { struct CdrskiN {
@ -1881,7 +1865,6 @@ struct CdrskiN {
int fifo_size; int fifo_size;
int fifo_start_empty; int fifo_start_empty;
int fifo_per_track; int fifo_per_track;
int fifo_abort_on_empty;
/** User defined address translation */ /** User defined address translation */
@ -1973,7 +1956,6 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag)
o->fifo_size= 4*1024*1024; o->fifo_size= 4*1024*1024;
o->fifo_start_empty= 0; o->fifo_start_empty= 0;
o->fifo_per_track= 0; o->fifo_per_track= 0;
o->fifo_abort_on_empty= Cdrskin_fifo_abort_on_emptY;
o->adr_trn= NULL; o->adr_trn= NULL;
o->drives= NULL; o->drives= NULL;
o->n_drives= 0; o->n_drives= 0;
@ -2107,11 +2089,6 @@ int Cdrskin_fill_fifo(struct CdrskiN *skin, int flag)
return(ret); return(ret);
printf("input buffer ready.\n"); printf("input buffer ready.\n");
fflush(stdout); fflush(stdout);
if(skin->fifo_abort_on_empty) {
ret= Cdrtrack_demand_fifo_data(skin->tracklist[0],0);
if(ret<=0)
return(ret);
}
return(1); return(1);
} }
@ -3826,9 +3803,6 @@ set_driveropts:;
#ifndef Cdrskin_extra_leaN #ifndef Cdrskin_extra_leaN
} else if(strcmp(argv[i],"--fifo_abort_on_empty")==0) {
skin->fifo_abort_on_empty= 1;
} else if(strcmp(argv[i],"--fifo_disable")==0) { } else if(strcmp(argv[i],"--fifo_disable")==0) {
skin->fifo_enabled= 0; skin->fifo_enabled= 0;
skin->fifo_size= 0; skin->fifo_size= 0;
@ -4053,7 +4027,8 @@ track_too_large:;
return(0); return(0);
} }
ret= Cdrtrack_new(&(skin->tracklist[skin->track_counter]),skin, ret= Cdrtrack_new(&(skin->tracklist[skin->track_counter]),skin,
skin->track_counter,0); skin->track_counter,
(strcmp(skin->source_path,"-")==0)<<1);
if(ret<=0) { if(ret<=0) {
fprintf(stderr, fprintf(stderr,
"cdrskin: FATAL : creation of track control object failed.\n"); "cdrskin: FATAL : creation of track control object failed.\n");

View File

@ -31,9 +31,6 @@ do
elif test "$i" = "-newapi" elif test "$i" = "-newapi"
then then
def_opts="$def_opts -DCdrskin_new_api_tesT" def_opts="$def_opts -DCdrskin_new_api_tesT"
elif test "$i" = "-fifo_abort_on_empty"
then
def_opts="$def_opts -DCdrskin_fifo_abort_on_emptY"
elif test "$i" = "-do_not_compile_cdrskin" elif test "$i" = "-do_not_compile_cdrskin"
then then
compile_cdrskin=0 compile_cdrskin=0
@ -60,7 +57,6 @@ do
echo " -cvs_A51208 set macro to match libburn-CVS of 8 Dec 2005." echo " -cvs_A51208 set macro to match libburn-CVS of 8 Dec 2005."
echo " -cvs_A60220 set macro to match libburn-CVS of 20 Feb 2006." echo " -cvs_A60220 set macro to match libburn-CVS of 20 Feb 2006."
echo " -do_not_compile_cdrskin omit compilation of cdrskin/cdrskin." echo " -do_not_compile_cdrskin omit compilation of cdrskin/cdrskin."
echo " -fifo_abort_on_empty make --fifo_abort_on_empty default."
echo " -newapi follow newer API style guide." echo " -newapi follow newer API style guide."
echo " -do_diet produce capability reduced lean version." echo " -do_diet produce capability reduced lean version."
echo " -do_strip apply program strip to compiled programs." echo " -do_strip apply program strip to compiled programs."