New -read_speed prefixes "soft_force:" and "soft_corr:"
This commit is contained in:
@ -1408,12 +1408,31 @@ int Xorriso_option_sleep(struct XorrisO *xorriso, char *duration, int flag)
|
||||
/* Commands -speed , -read_speed */
|
||||
/* @param flag bit0= -read_speed rather than -speed
|
||||
*/
|
||||
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag)
|
||||
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed_in, int flag)
|
||||
{
|
||||
int is_cd= 1, unit_found= 0, ret, profile_number, intspeed= 1;
|
||||
int is_cd= 1, unit_found= 0, ret, profile_number, intspeed= 1, for_force= 0;
|
||||
double num= -2.0;
|
||||
char *cpt, profile_name[80];
|
||||
char *cpt, profile_name[80], *speed;
|
||||
|
||||
speed= speed_in;
|
||||
|
||||
if(strncmp(speed, "soft_corr:", 10) == 0 && (flag & 1)) {
|
||||
sscanf(speed + 10, "%lf", &num);
|
||||
if(num > 1.0e9 || num < 0.0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-read_speed soft_corr: Value too small or too large (0 to 1e9): '%s'",
|
||||
speed + 10);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
xorriso->read_speed_corr= num;
|
||||
return(1);
|
||||
}
|
||||
|
||||
if(strncmp(speed, "soft_force:", 11) == 0 && (flag & 1)) {
|
||||
for_force= 1;
|
||||
speed+= 11;
|
||||
}
|
||||
if(speed[0] == 0 || strcmp(speed, "any") == 0 || strcmp(speed, "max") == 0) {
|
||||
intspeed= 0;
|
||||
} else if(strcmp(speed, "min") == 0) {
|
||||
@ -1425,13 +1444,8 @@ int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag)
|
||||
if(num <= 0)
|
||||
intspeed= num;
|
||||
}
|
||||
if(intspeed <= 0) {
|
||||
if(flag & 1)
|
||||
xorriso->read_speed= intspeed;
|
||||
else
|
||||
xorriso->write_speed= intspeed;
|
||||
return(1);
|
||||
}
|
||||
if(intspeed <= 0)
|
||||
goto set_speed_and_exit;
|
||||
|
||||
for(cpt= speed+strlen(speed)-1; cpt>=speed; cpt--)
|
||||
if(isdigit(*cpt) || *cpt=='.')
|
||||
@ -1472,17 +1486,24 @@ bd_speed:;
|
||||
|
||||
if(num> 2.0e9) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-speed: Value too large or not recognizable: '%s'", speed);
|
||||
"%s: Value too large or not recognizable: '%s'",
|
||||
flag & 1 ? "-read_speed" : "-speed", speed);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
intspeed= num;
|
||||
if(intspeed < num)
|
||||
intspeed++;
|
||||
if(flag & 1)
|
||||
xorriso->read_speed= intspeed;
|
||||
else
|
||||
|
||||
set_speed_and_exit:;
|
||||
if(flag & 1) {
|
||||
if(for_force)
|
||||
xorriso->read_speed_force= intspeed;
|
||||
else
|
||||
xorriso->read_speed= intspeed;
|
||||
} else {
|
||||
xorriso->write_speed= intspeed;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user