Implemented new option fifo_start_at=

This commit is contained in:
Thomas Schmitt 2006-11-20 13:30:01 +00:00
parent 08f541a7a8
commit 6e09b56c29
5 changed files with 61 additions and 36 deletions

View File

@ -796,7 +796,7 @@ ex:;
/** Fill the fifo as far as possible without writing to destination fd */ /** Fill the fifo as far as possible without writing to destination fd */
int Cdrfifo_fill(struct CdrfifO *o, int flag) int Cdrfifo_fill(struct CdrfifO *o, int size, int flag)
{ {
int ret,fill= 0,space,state; int ret,fill= 0,space,state;
@ -810,6 +810,8 @@ int Cdrfifo_fill(struct CdrfifO *o, int flag)
} else if(state!=1) } else if(state!=1)
break; break;
if(space<=0) if(space<=0)
break;
if(size>=0 && fill>=size)
break; break;
ret= Cdrfifo_try_to_work(o,100000,NULL,NULL,2); ret= Cdrfifo_try_to_work(o,100000,NULL,NULL,2);
if(ret<0) { if(ret<0) {

View File

@ -145,10 +145,11 @@ int Cdrfifo_get_cdr_counters(struct CdrfifO *o,
int Cdrfifo_try_to_work(struct CdrfifO *o, int wait_usec, int Cdrfifo_try_to_work(struct CdrfifO *o, int wait_usec,
char *reply_buffer, int *reply_count, int flag); char *reply_buffer, int *reply_count, int flag);
/** Fill the fifo as far as possible without writing to destination fd /** Fill the fifo as far as possible without writing to destination fd.
@param size if >=0 : end filling after the given number of bytes
@return 1 on success, <=0 on failure @return 1 on success, <=0 on failure
*/ */
int Cdrfifo_fill(struct CdrfifO *o, int flag); int Cdrfifo_fill(struct CdrfifO *o, int size, int flag);
#endif /* Cdrfifo_headerfile_includeD */ #endif /* Cdrfifo_headerfile_includeD */

View File

@ -795,7 +795,7 @@ struct CdrtracK {
/** fd[0] of the fifo pipe. This is from where libburn reads its data. */ /** fd[0] of the fifo pipe. This is from where libburn reads its data. */
int fifo_outlet_fd; int fifo_outlet_fd;
int fifo_size; int fifo_size;
int fifo_start_empty; int fifo_start_at;
/** The possibly external fifo object which knows the real input fd and /** The possibly external fifo object which knows the real input fd and
the fd[1] of the pipe. */ the fd[1] of the pipe. */
@ -816,7 +816,7 @@ int Cdrtrack_set_track_type(struct CdrtracK *o, int track_type, int flag);
@param boss The cdrskin control object (corresponds to session) @param boss The cdrskin control object (corresponds to session)
@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_at to 0
bit1= track is originally stdin bit1= track is originally stdin
*/ */
int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss, int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
@ -830,7 +830,7 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
int *track_type_by_default, int *swap_audio_bytes, int *track_type_by_default, int *swap_audio_bytes,
int flag); int flag);
int Cdrskin_get_fifo_par(struct CdrskiN *skin, int *fifo_enabled, int Cdrskin_get_fifo_par(struct CdrskiN *skin, int *fifo_enabled,
int *fifo_size, int *fifo_start_empty, int flag); int *fifo_size, int *fifo_start_at, int flag);
(*track)= o= TSOB_FELD(struct CdrtracK,1); (*track)= o= TSOB_FELD(struct CdrtracK,1);
if(o==NULL) if(o==NULL)
@ -853,7 +853,7 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
o->fifo= NULL; o->fifo= NULL;
o->fifo_outlet_fd= -1; o->fifo_outlet_fd= -1;
o->fifo_size= 0; o->fifo_size= 0;
o->fifo_start_empty= 0; o->fifo_start_at= -1;
o->ff_fifo= NULL; o->ff_fifo= NULL;
o->ff_idx= -1; o->ff_idx= -1;
o->libburn_track= NULL; o->libburn_track= NULL;
@ -867,13 +867,13 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss,
#ifndef Cdrskin_extra_leaN #ifndef Cdrskin_extra_leaN
ret= Cdrskin_get_fifo_par(boss, &(o->fifo_enabled),&(o->fifo_size), ret= Cdrskin_get_fifo_par(boss, &(o->fifo_enabled),&(o->fifo_size),
&(o->fifo_start_empty),0); &(o->fifo_start_at),0);
if(ret<=0) if(ret<=0)
goto failed; goto failed;
#endif /* ! Cdrskin_extra_leaN */ #endif /* ! Cdrskin_extra_leaN */
if(flag&1) if(flag&1)
o->fifo_start_empty= 1; o->fifo_start_at= 0;
return(1); return(1);
failed:; failed:;
Cdrtrack_destroy(track,0); Cdrtrack_destroy(track,0);
@ -1185,11 +1185,15 @@ int Cdrtrack_fill_fifo(struct CdrtracK *track, int flag)
{ {
int ret,buffer_fill,buffer_space; int ret,buffer_fill,buffer_space;
if(track->fifo==NULL || track->fifo_start_empty) if(track->fifo==NULL || track->fifo_start_at==0)
return(2); return(2);
if(track->fifo_start_at>0 && track->fifo_start_at<track->fifo_size)
printf(
"cdrskin: NOTE : Input buffer will be initially filled up to %d bytes\n",
track->fifo_start_at);
printf("Waiting for reader process to fill input buffer ... "); printf("Waiting for reader process to fill input buffer ... ");
fflush(stdout); fflush(stdout);
ret= Cdrfifo_fill(track->fifo,0); ret= Cdrfifo_fill(track->fifo,track->fifo_start_at,0);
if(ret<=0) if(ret<=0)
return(ret); return(ret);
@ -1981,7 +1985,9 @@ set_dev:;
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(
" --fifo_start_empty do not wait for full fifo before burn start\n"); " fifo_start_at=<number> do not wait for full fifo but start burning\n");
printf(
" as soon as the given number of bytes is read\n");
printf( printf(
" grab_drive_and_wait=<num> grab drive, wait given number of\n"); " grab_drive_and_wait=<num> grab drive, wait given number of\n");
printf( printf(
@ -2384,7 +2390,7 @@ struct CdrskiN {
/** fd[0] of the fifo pipe. This is from where libburn reads its data. */ /** fd[0] of the fifo pipe. This is from where libburn reads its data. */
int fifo_outlet_fd; int fifo_outlet_fd;
int fifo_size; int fifo_size;
int fifo_start_empty; int fifo_start_at;
int fifo_per_track; int fifo_per_track;
@ -2481,7 +2487,7 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag)
o->fifo= NULL; o->fifo= NULL;
o->fifo_outlet_fd= -1; o->fifo_outlet_fd= -1;
o->fifo_size= 4*1024*1024; o->fifo_size= 4*1024*1024;
o->fifo_start_empty= 0; o->fifo_start_at= -1;
o->fifo_per_track= 0; o->fifo_per_track= 0;
o->adr_trn= NULL; o->adr_trn= NULL;
o->drives= NULL; o->drives= NULL;
@ -2570,11 +2576,11 @@ int Cdrskin_get_source(struct CdrskiN *skin, char *source_path,
/** Return information about current fifo setting */ /** Return information about current fifo setting */
int Cdrskin_get_fifo_par(struct CdrskiN *skin, int *fifo_enabled, int Cdrskin_get_fifo_par(struct CdrskiN *skin, int *fifo_enabled,
int *fifo_size, int *fifo_start_empty, int flag) int *fifo_size, int *fifo_start_at, int flag)
{ {
*fifo_enabled= skin->fifo_enabled; *fifo_enabled= skin->fifo_enabled;
*fifo_size= skin->fifo_size; *fifo_size= skin->fifo_size;
*fifo_start_empty= skin->fifo_start_empty; *fifo_start_at= skin->fifo_start_at;
return(1); return(1);
} }
@ -5034,8 +5040,16 @@ set_driveropts:;
if(skin->verbosity>=Cdrskin_verbose_cmD) if(skin->verbosity>=Cdrskin_verbose_cmD)
printf("cdrskin: option fs=... disabled\n"); printf("cdrskin: option fs=... disabled\n");
} else if(strcmp(argv[i],"--fifo_start_empty")==0) { } else if(strcmp(argv[i],"--fifo_start_empty")==0) { /* obsoleted */
skin->fifo_start_empty= 1; skin->fifo_start_at= 0;
} else if(strncmp(argv[i],"fifo_start_at=",14)==0) {
value= Scanf_io_size(argv[i]+14,0);
if(value>1024.0*1024.0*1024.0)
value= 1024.0*1024.0*1024.0;
else if(value<0)
value= 0;
skin->fifo_start_at= value;
} else if(strcmp(argv[i],"--fifo_per_track")==0) { } else if(strcmp(argv[i],"--fifo_per_track")==0) {
skin->fifo_per_track= 1; skin->fifo_per_track= 1;
@ -5078,6 +5092,7 @@ gracetime_equals:;
} else if( } else if(
strcmp(argv[i],"--fifo_disable")==0 || strcmp(argv[i],"--fifo_disable")==0 ||
strcmp(argv[i],"--fifo_start_empty")==0 || strcmp(argv[i],"--fifo_start_empty")==0 ||
strncmp(argv[i],"fifo_start_at=",14)==0 ||
strcmp(argv[i],"--fifo_per_track")==0 || strcmp(argv[i],"--fifo_per_track")==0 ||
strncmp(argv[i],"-fs=",4)==0 || strncmp(argv[i],"-fs=",4)==0 ||
strncmp(argv[i],"fs=",3)==0 || strncmp(argv[i],"fs=",3)==0 ||

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2006.11.20.090503" #define Cdrskin_timestamP "2006.11.20.132717"

View File

@ -15,6 +15,8 @@ runs, though. The most comprehensive technical overview of cdrskin
can be found in cdrskin/README . Online available as : can be found in cdrskin/README . Online available as :
http://libburn.pykix.org/browser/trunk/cdrskin/README?format=raw http://libburn.pykix.org/browser/trunk/cdrskin/README?format=raw
About libburn API for burning CD: http://libburn-api.pykix.org
-------------------------------------------------------------------------- --------------------------------------------------------------------------
cdrskin with CD media fails to match its paragon cdrecord on one major field: cdrskin with CD media fails to match its paragon cdrecord on one major field:
@ -36,9 +38,9 @@ cdrskin for its task to emulate cdrecord. There are some, nevertheless,
which provide rather exotic unique features of cdrskin. which provide rather exotic unique features of cdrskin.
The cdrecord-compatible options are listed in the output of The cdrecord-compatible options are listed in the output of
{{{
cdrskin -help cdrskin -help
}}}
where the option "help" has *one* dash. where the option "help" has *one* dash.
For these options you may expect program behavior that is roughly the For these options you may expect program behavior that is roughly the
same as described in original man 1 cdrecord . same as described in original man 1 cdrecord .
@ -46,9 +48,9 @@ same as described in original man 1 cdrecord .
Online: http://cdrecord.berlios.de/old/private/man/cdrecord-2.0.html Online: http://cdrecord.berlios.de/old/private/man/cdrecord-2.0.html
The cdrskin-specific options are listed by The cdrskin-specific options are listed by
{{{
cdrskin --help cdrskin --help
}}}
where the option "help" has *two* dashes. where the option "help" has *two* dashes.
Those have no man page yet. Some are very experimental and should only be Those have no man page yet. Some are very experimental and should only be
@ -60,11 +62,10 @@ Some are of general user interest, though:
--devices allows the sysadmin to scan the system for possible drives --devices allows the sysadmin to scan the system for possible drives
and displays their detected properties. and displays their detected properties.
The drives are listed one per line, with fields: The drives are listed one per line, with fields:
libburn-drive-number, sysadmin-device-file, permissions, vendor, type
libburn-drive-number sysadmin-device-file permissions : vendor type {{{
0 dev='/dev/sg0' rwrw-- : 'HL-DT-ST' 'DVDRAM GSA-4082B' 0 dev='/dev/sg0' rwrw-- : 'HL-DT-ST' 'DVDRAM GSA-4082B'
}}}
This feature is valuable since cdrskin -scanbus will not give you This feature is valuable since cdrskin -scanbus will not give you
the device file name and its current permissions. the device file name and its current permissions.
cdrskin will accept of course the proposed dev= option as address cdrskin will accept of course the proposed dev= option as address
@ -78,7 +79,7 @@ has to offer both, r- and w-permission.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
--fifo_start_empty is a throughput enhancer for unsteady data streams fifo_start_at=<num> is a throughput enhancer for unsteady data streams
like they are produced by a compressing archiver program when piping to like they are produced by a compressing archiver program when piping to
CD on-the-fly. It makes better use of the general property of a FIFO CD on-the-fly. It makes better use of the general property of a FIFO
buffer to transport surplus bandwidth into the future. Yep. A time machine. buffer to transport surplus bandwidth into the future. Yep. A time machine.
@ -102,10 +103,16 @@ underruns, of course.
With a very fat fs=# buffer (128 MB for 12x CD is not unrealistic) this With a very fat fs=# buffer (128 MB for 12x CD is not unrealistic) this
can cause a big delay until burning finally starts and takes its due time. can cause a big delay until burning finally starts and takes its due time.
--fifo_start_empty makes cdrskin start burning without waiting for the fifo_start_at=<num> makes cdrskin start burning after the given number of bytes
FIFO to be full resp. the data stream to end. It can make use of the is read rather than waiting for the FIFO to be completely full resp. the data
seconds spend with drive preparation and lead-in, it risks a few drive stream to end. It risks a few drive buffer underruns at the beginning of burn
buffer underruns at the beginning of burn - but modern drives stand this. - but modern drives stand this.
Usage examples:
{{{
cdrskin ... fs=128m fifo_start_at=20m ...
cdrskin ... fifo_start_at=0 ...
}}}
Note: no FIFO can give you better average throughput than the average Note: no FIFO can give you better average throughput than the average
throughput of the data source and the throughput of the burner. throughput of the data source and the throughput of the burner.
@ -155,15 +162,15 @@ cdrskin the necessary hint.
Example: Your frontend insists in using "0,0,0" and --devices reported Example: Your frontend insists in using "0,0,0" and --devices reported
dev='/dev/hdc' resp. cdrskin dev=ATA -scanbus reported "1,0,0" then this dev='/dev/hdc' resp. cdrskin dev=ATA -scanbus reported "1,0,0" then this
would be the appropriate translation: would be the appropriate translation:
{{{
dev_translation=+0,0,0+/dev/hdc dev_translation=+0,0,0+/dev/hdc
}}}
The "+" character is a separator to be choosen by you. The "+" character is a separator to be choosen by you.
Currently i am not aware of the need to choose any other than "+" Currently i am not aware of the need to choose any other than "+"
unless you get playful with custom translations like unless you get playful with custom translations like
{{{
dev_translation=-"cd+dvd"-1,0,0 dev_translation=-"cd+dvd"-1,0,0
}}}
See http://scdbackup.sourceforge.net/k3b_on_cdrskin.html See http://scdbackup.sourceforge.net/k3b_on_cdrskin.html
for an illustrated example with K3b 0.10 . for an illustrated example with K3b 0.10 .