From 0406428c37fb96bf9bb111305041481964eefc19 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 20 Nov 2006 13:30:01 +0000 Subject: [PATCH] Implemented new option fifo_start_at= --- libburn/trunk/cdrskin/cdrfifo.c | 4 +- libburn/trunk/cdrskin/cdrfifo.h | 5 ++- libburn/trunk/cdrskin/cdrskin.c | 45 +++++++++++++++-------- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/cdrskin/wiki_plain.txt | 41 ++++++++++++--------- 5 files changed, 61 insertions(+), 36 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrfifo.c b/libburn/trunk/cdrskin/cdrfifo.c index 008468f3..13e48206 100644 --- a/libburn/trunk/cdrskin/cdrfifo.c +++ b/libburn/trunk/cdrskin/cdrfifo.c @@ -796,7 +796,7 @@ ex:; /** 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; @@ -810,6 +810,8 @@ int Cdrfifo_fill(struct CdrfifO *o, int flag) } else if(state!=1) break; if(space<=0) + break; + if(size>=0 && fill>=size) break; ret= Cdrfifo_try_to_work(o,100000,NULL,NULL,2); if(ret<0) { diff --git a/libburn/trunk/cdrskin/cdrfifo.h b/libburn/trunk/cdrskin/cdrfifo.h index 17d0b0ca..2c702ee0 100644 --- a/libburn/trunk/cdrskin/cdrfifo.h +++ b/libburn/trunk/cdrskin/cdrfifo.h @@ -145,10 +145,11 @@ int Cdrfifo_get_cdr_counters(struct CdrfifO *o, int Cdrfifo_try_to_work(struct CdrfifO *o, int wait_usec, 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 */ -int Cdrfifo_fill(struct CdrfifO *o, int flag); +int Cdrfifo_fill(struct CdrfifO *o, int size, int flag); #endif /* Cdrfifo_headerfile_includeD */ diff --git a/libburn/trunk/cdrskin/cdrskin.c b/libburn/trunk/cdrskin/cdrskin.c index 9b440f12..710f9f66 100644 --- a/libburn/trunk/cdrskin/cdrskin.c +++ b/libburn/trunk/cdrskin/cdrskin.c @@ -795,7 +795,7 @@ struct CdrtracK { /** fd[0] of the fifo pipe. This is from where libburn reads its data. */ int fifo_outlet_fd; int fifo_size; - int fifo_start_empty; + int fifo_start_at; /** The possibly external fifo object which knows the real input fd and 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 trackno The index in the cdrskin tracklist array (is not constant) @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 */ 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 flag); 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); if(o==NULL) @@ -853,7 +853,7 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss, o->fifo= NULL; o->fifo_outlet_fd= -1; o->fifo_size= 0; - o->fifo_start_empty= 0; + o->fifo_start_at= -1; o->ff_fifo= NULL; o->ff_idx= -1; o->libburn_track= NULL; @@ -867,13 +867,13 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss, #ifndef Cdrskin_extra_leaN 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) goto failed; #endif /* ! Cdrskin_extra_leaN */ if(flag&1) - o->fifo_start_empty= 1; + o->fifo_start_at= 0; return(1); failed:; Cdrtrack_destroy(track,0); @@ -1185,11 +1185,15 @@ int Cdrtrack_fill_fifo(struct CdrtracK *track, int flag) { 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); + if(track->fifo_start_at>0 && track->fifo_start_atfifo_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 ... "); fflush(stdout); - ret= Cdrfifo_fill(track->fifo,0); + ret= Cdrfifo_fill(track->fifo,track->fifo_start_at,0); if(ret<=0) return(ret); @@ -1981,7 +1985,9 @@ set_dev:; printf(" --fifo_disable disable fifo despite any fs=...\n"); printf(" --fifo_per_track use a separate fifo for each track\n"); printf( - " --fifo_start_empty do not wait for full fifo before burn start\n"); + " fifo_start_at= do not wait for full fifo but start burning\n"); + printf( + " as soon as the given number of bytes is read\n"); printf( " grab_drive_and_wait= grab drive, wait given number of\n"); printf( @@ -2384,7 +2390,7 @@ struct CdrskiN { /** fd[0] of the fifo pipe. This is from where libburn reads its data. */ int fifo_outlet_fd; int fifo_size; - int fifo_start_empty; + int fifo_start_at; int fifo_per_track; @@ -2481,7 +2487,7 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag) o->fifo= NULL; o->fifo_outlet_fd= -1; o->fifo_size= 4*1024*1024; - o->fifo_start_empty= 0; + o->fifo_start_at= -1; o->fifo_per_track= 0; o->adr_trn= NULL; o->drives= NULL; @@ -2570,11 +2576,11 @@ int Cdrskin_get_source(struct CdrskiN *skin, char *source_path, /** Return information about current fifo setting */ 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_size= skin->fifo_size; - *fifo_start_empty= skin->fifo_start_empty; + *fifo_start_at= skin->fifo_start_at; return(1); } @@ -5034,8 +5040,16 @@ set_driveropts:; if(skin->verbosity>=Cdrskin_verbose_cmD) printf("cdrskin: option fs=... disabled\n"); - } else if(strcmp(argv[i],"--fifo_start_empty")==0) { - skin->fifo_start_empty= 1; + } else if(strcmp(argv[i],"--fifo_start_empty")==0) { /* obsoleted */ + 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) { skin->fifo_per_track= 1; @@ -5078,6 +5092,7 @@ gracetime_equals:; } else if( strcmp(argv[i],"--fifo_disable")==0 || strcmp(argv[i],"--fifo_start_empty")==0 || + strncmp(argv[i],"fifo_start_at=",14)==0 || strcmp(argv[i],"--fifo_per_track")==0 || strncmp(argv[i],"-fs=",4)==0 || strncmp(argv[i],"fs=",3)==0 || diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index fc19e603..8f17b8fe 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2006.11.20.090503" +#define Cdrskin_timestamP "2006.11.20.132717" diff --git a/libburn/trunk/cdrskin/wiki_plain.txt b/libburn/trunk/cdrskin/wiki_plain.txt index 56da7986..006e6fc8 100644 --- a/libburn/trunk/cdrskin/wiki_plain.txt +++ b/libburn/trunk/cdrskin/wiki_plain.txt @@ -15,6 +15,8 @@ runs, though. The most comprehensive technical overview of cdrskin can be found in cdrskin/README . Online available as : 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: @@ -36,9 +38,9 @@ cdrskin for its task to emulate cdrecord. There are some, nevertheless, which provide rather exotic unique features of cdrskin. The cdrecord-compatible options are listed in the output of - +{{{ cdrskin -help - +}}} where the option "help" has *one* dash. For these options you may expect program behavior that is roughly the 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 The cdrskin-specific options are listed by - +{{{ cdrskin --help - +}}} where the option "help" has *two* dashes. 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 and displays their detected properties. 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' - +}}} This feature is valuable since cdrskin -scanbus will not give you the device file name and its current permissions. 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= is a throughput enhancer for unsteady data streams 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 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 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 to be full resp. the data stream to end. It can make use of the -seconds spend with drive preparation and lead-in, it risks a few drive -buffer underruns at the beginning of burn - but modern drives stand this. +fifo_start_at= makes cdrskin start burning after the given number of bytes +is read rather than waiting for the FIFO to be completely full resp. the data +stream to end. It risks a few drive buffer underruns at the beginning of burn +- 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 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 dev='/dev/hdc' resp. cdrskin dev=ATA -scanbus reported "1,0,0" then this would be the appropriate translation: - +{{{ dev_translation=+0,0,0+/dev/hdc - +}}} The "+" character is a separator to be choosen by you. Currently i am not aware of the need to choose any other than "+" unless you get playful with custom translations like - +{{{ dev_translation=-"cd+dvd"-1,0,0 - +}}} See http://scdbackup.sourceforge.net/k3b_on_cdrskin.html for an illustrated example with K3b 0.10 .