From f7c7e61aa0e37c19e35a01738d7e95d1b932737a Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 12 Jul 2007 17:31:57 +0000 Subject: [PATCH] New options modesty_on_drive= and minbuf= --- libburn/trunk/cdrskin/cdrskin.1 | 35 ++++++- libburn/trunk/cdrskin/cdrskin.c | 110 +++++++++++++++++++++- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- 3 files changed, 143 insertions(+), 4 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin.1 b/libburn/trunk/cdrskin/cdrskin.1 index ce838184..e2f8edd2 100644 --- a/libburn/trunk/cdrskin/cdrskin.1 +++ b/libburn/trunk/cdrskin/cdrskin.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH CDRSKIN 1 "April 22, 2007" +.TH CDRSKIN 1 "July 12, 2007" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -423,6 +423,13 @@ This option can be performed on track sources which are regular files or block devices. For the first track of the session it can be performed on any type of source if there is a fifo of at least 64 kiB. See option fs= . .TP +.BI minbuf= percentage +Equivalent to: +.br +modesty_on_drive=1:min_percent=:max_percent=95 +.br +Percentage is permissible between 25 and 95. +.TP .BI msifile= path Run option -msinfo and copy the result line into the file given by path. Unlike -msinfo this option does not redirect all normal output away from @@ -796,6 +803,32 @@ Try to ignore any signals rather than to abort the program. This is not a very good idea. You might end up waiting a very long time for cdrskin to finish. .TP +.BI modesty_on_drive= [:min_percent=][:max_percent=] +Mode 1 keeps the program from trying to write to the burner drive while its +buffer is in danger to be filled by more than max_percent. If this filling is +exceeded then the program will wait until the filling is at most min_percent. +.br +This can ease the load on operating system and drive controller and thus help +with achieving better input bandwidth if disk and burner are not on independent +controllers (like hda and hdb). Unsufficient input bandwidth is indicated by +output "(fifo xy%)" of option -v if xy is lower than 90 for some time. +modesty_on_drive= might hamper output bandwidth and cause buffer underruns. +.br +To have max_percent larger than the burner's best actual +buffer fill has the same effect as min_percent==max_percent. Some burners +do not use their full buffer with all media types. Watch output "[buf xy%]" +of option -v to get an impression of the actual buffer usage. Some burners +are not suitable because they report buffer fill with granularity too large +in size or time. +.br +Mode 0 disables this feature. Mode -1 keeps it unchanged. Default is: +.br +modesty_on_drive=0:min_percent=65:max_percent=95 +.br +Percentages are permissible in the range of 25 to 100. +This mode can be activated only if option speed= is given with a number > 0 +which should be realistic, i.e. appropriate for drive and media. +.TP .BI \--no_abort_handler On signals exit even if the drive is in busy state. This is not a very good idea. You might end up with a stuck drive that refuses to hand out the media. diff --git a/libburn/trunk/cdrskin/cdrskin.c b/libburn/trunk/cdrskin/cdrskin.c index ad4563d0..decf6966 100644 --- a/libburn/trunk/cdrskin/cdrskin.c +++ b/libburn/trunk/cdrskin/cdrskin.c @@ -131,7 +131,7 @@ or /* Place novelty switch macros here. Move them down to Cdrskin_libburn_from_pykix_svN on version leap */ -/* - no novelty switches currently - */ +#define Cdrskin_libburn_has_set_waitinG 1 #endif /* Cdrskin_libburn_0_3_7 */ @@ -2209,6 +2209,9 @@ set_dev:; printf( " --ignore_signals try to ignore any signals rather than to abort\n"); printf(" --list_ignored_options list all ignored cdrecord options.\n"); +#ifdef Cdrskin_libburn_has_set_waitinG + printf(" modesty_on_drive= no writing into full drive buffer\n"); +#endif printf(" --no_abort_handler exit even if the drive is in busy state\n"); printf(" --no_blank_appendable refuse to blank appendable CD-RW\n"); printf(" --no_convert_fs_adr only literal translations of dev=\n"); @@ -2304,6 +2307,10 @@ see_cdrskin_eng_html:; fprintf(stderr,"\t-toc\t\tretrieve and print TOC/PMA data\n"); fprintf(stderr, "\t-atip\t\tretrieve media state, print \"Is *erasable\"\n"); +#ifdef Cdrskin_libburn_has_set_waitinG + fprintf(stderr, + "\tminbuf=percent\tset lower limit for drive buffer modesty\n"); +#endif #ifdef Cdrskin_libburn_has_multI fprintf(stderr, "\t-multi\t\tgenerate a TOC that allows multi session\n"); @@ -2616,6 +2623,9 @@ struct CdrskiN { enum burn_write_types write_type; int block_type; int multi; + int modesty_on_drive; + int min_buffer_percent; + int max_buffer_percent; double write_start_address; int assert_write_lba; @@ -2748,6 +2758,9 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag) o->write_type= BURN_WRITE_SAO; o->block_type= BURN_BLOCK_SAO; o->multi= 0; + o->modesty_on_drive= 0; + o->min_buffer_percent= 65; + o->max_buffer_percent= 95; o->write_start_address= -1.0; o->assert_write_lba= -1; o->burnfree= 1; @@ -2938,7 +2951,7 @@ int Cdrskin_fill_fifo(struct CdrskiN *skin, int flag) /** Inform libburn about the consumer x-speed factor of skin */ int Cdrskin_adjust_speed(struct CdrskiN *skin, int flag) { - int k_speed; + int k_speed, modesty= 0; if(skin->x_speed<0) k_speed= 0; /* libburn.h promises 0 to be max speed. */ @@ -2952,6 +2965,15 @@ int Cdrskin_adjust_speed(struct CdrskiN *skin, int flag) ClN(fprintf(stderr,"cdrskin_debug: k_speed= %d\n",k_speed)); burn_drive_set_speed(skin->drives[skin->driveno].drive,k_speed,k_speed); + +#ifdef Cdrskin_libburn_has_set_waitinG + if(k_speed>0) + modesty= skin->modesty_on_drive; + burn_drive_set_buffer_waiting(skin->drives[skin->driveno].drive, + modesty, -1, -1, -1, + skin->min_buffer_percent, + skin->max_buffer_percent); +#endif return(1); } @@ -6097,6 +6119,90 @@ gracetime_equals:; printf("%s\n",ignored_full_options[k]); printf("\n"); + } else if(strncmp(argv[i],"-minbuf=",8)==0) { + value_pt= argv[i]+8; + goto minbuf_equals; + } else if(strncmp(argv[i],"minbuf=",7)==0) { + value_pt= argv[i]+7; +minbuf_equals:; +#ifdef Cdrskin_libburn_has_set_waitinG + skin->modesty_on_drive= 1; + sscanf(value_pt,"%lf",&value); + if (value<25 || value>95) { + fprintf(stderr, + "cdrskin: FATAL : minbuf= value must be between 25 and 95\n"); + return(0); + } + skin->min_buffer_percent= value; + skin->max_buffer_percent= 95; + ClN(printf("cdrskin: minbuf=%d percent desired buffer fill\n", + skin->min_buffer_percent)); +#else + fprintf(stderr, + "cdrskin: SORRY : Option minbuf= is not available yet.\n"); + return(0); +#endif + + } else if(strncmp(argv[i],"modesty_on_drive=",17)==0) { +#ifdef Cdrskin_libburn_has_set_waitinG + value_pt= argv[i]+17; + if(*value_pt=='0') { + skin->modesty_on_drive= 0; + if(skin->verbosity>=Cdrskin_verbose_cmD) + ClN(printf( + "cdrskin: modesty_on_drive=0 : buffer waiting by os driver\n")); + } else if(*value_pt=='1') { + skin->modesty_on_drive= 1; + if(skin->verbosity>=Cdrskin_verbose_cmD) + ClN(printf( + "cdrskin: modesty_on_drive=1 : buffer waiting by libburn\n")); + } else if(*value_pt=='-' && argv[i][18]=='1') { + skin->modesty_on_drive= -1; + if(skin->verbosity>=Cdrskin_verbose_cmD) + ClN(printf( + "cdrskin: modesty_on_drive=-1 : buffer waiting as libburn defaults\n")); + } else { + fprintf(stderr, + "cdrskin: FATAL : modesty_on_drive= must be -1, 0 or 1\n"); + return(0); + } + while(1) { + value_pt= strchr(value_pt,':'); + if(value_pt==NULL) + break; + value_pt++; + if(strncmp(value_pt,"min_percent=",12)==0) { + sscanf(value_pt+12,"%lf",&value); + if (value<25 || value>100) { + fprintf(stderr, + "cdrskin: FATAL : modest_on_drive= min_percent value must be between 25 and 100\n"); + return(0); + } + skin->min_buffer_percent= value; + ClN(printf("cdrskin: modesty_on_drive : %d percent min buffer fill\n", + skin->min_buffer_percent)); + } else if(strncmp(value_pt,"max_percent=",12)==0) { + sscanf(value_pt+12,"%lf",&value); + if (value<25 || value>100) { + fprintf(stderr, + "cdrskin: FATAL : modest_on_drive= max_percent value must be between 25 and 100\n"); + return(0); + } + skin->max_buffer_percent= value; + ClN(printf("cdrskin: modesty_on_drive : %d percent max buffer fill\n", + skin->max_buffer_percent)); + } else { + fprintf(stderr, + "cdrskin: SORRY : modest_on_drive= unknown option code : %s\n", + value_pt); + } + } +#else + fprintf(stderr, + "cdrskin: SORRY : Option modesty_on_drive= is not available yet.\n"); + return(0); +#endif + } else if(strcmp(argv[i],"-multi")==0) { #ifdef Cdrskin_libburn_has_multI skin->multi= 1; diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 61564bfd..27fc1c30 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.07.12.171727" +#define Cdrskin_timestamP "2007.07.12.171832"