New command -read_speed
This commit is contained in:
@ -1318,19 +1318,34 @@ int Xorriso_option_sleep(struct XorrisO *xorriso, char *duration, int flag)
|
||||
}
|
||||
|
||||
|
||||
/* Option -speed */
|
||||
/* Commands -speed , -read_speed */
|
||||
/* @param flag bit0= -read_speed rather than -speed
|
||||
*/
|
||||
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag)
|
||||
{
|
||||
int is_cd= 1, unit_found= 0, ret, profile_number;
|
||||
double num;
|
||||
int is_cd= 1, unit_found= 0, ret, profile_number, intspeed= 1;
|
||||
double num= -2.0;
|
||||
char *cpt, profile_name[80];
|
||||
|
||||
if(speed[0]==0 || strcmp(speed, "any")==0) {
|
||||
xorriso->speed= 0; /* full speed */
|
||||
if(speed[0] == 0 || strcmp(speed, "any") == 0 || strcmp(speed, "max") == 0) {
|
||||
intspeed= 0;
|
||||
} else if(strcmp(speed, "min") == 0) {
|
||||
intspeed= -1;
|
||||
} else if(strcmp(speed, "none") == 0) {
|
||||
intspeed= -2;
|
||||
} else {
|
||||
sscanf(speed,"%lf",&num);
|
||||
if(num <= 0)
|
||||
intspeed= num;
|
||||
}
|
||||
if(intspeed <= 0) {
|
||||
if(flag & 1)
|
||||
xorriso->read_speed= intspeed;
|
||||
else
|
||||
xorriso->write_speed= intspeed;
|
||||
return(1);
|
||||
}
|
||||
|
||||
sscanf(speed,"%lf",&num);
|
||||
for(cpt= speed+strlen(speed)-1; cpt>=speed; cpt--)
|
||||
if(isdigit(*cpt) || *cpt=='.')
|
||||
break;
|
||||
@ -1357,7 +1372,8 @@ dvd_speed:;
|
||||
bd_speed:;
|
||||
num*= 4495.625;
|
||||
} else {
|
||||
ret= Xorriso_get_profile(xorriso, &profile_number, profile_name, 2);
|
||||
ret= Xorriso_get_profile(xorriso, &profile_number, profile_name,
|
||||
2 * !(flag & 1));
|
||||
is_cd= (ret==2);
|
||||
if(is_cd)
|
||||
goto cd_speed;
|
||||
@ -1373,9 +1389,13 @@ bd_speed:;
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
xorriso->speed= num;
|
||||
if(xorriso->speed<num)
|
||||
xorriso->speed++;
|
||||
intspeed= num;
|
||||
if(intspeed < num)
|
||||
intspeed++;
|
||||
if(flag & 1)
|
||||
xorriso->read_speed= intspeed;
|
||||
else
|
||||
xorriso->write_speed= intspeed;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user