New command -read_speed
This commit is contained in:
@ -529,7 +529,8 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, char *show_adr,
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
|
||||
if(xorriso->read_speed != -2)
|
||||
burn_drive_set_speed(drive, xorriso->read_speed, 0);
|
||||
read_ret= ret= isoburn_read_image(drive, ropts, &volset);
|
||||
|
||||
/* <<< Resetting to normal thresholds */
|
||||
@ -1592,12 +1593,15 @@ int Xorriso_choose_speed_factor(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
|
||||
/* @return <=0 error, 1 success
|
||||
/* @flag bit0= do not issue TOC
|
||||
bit1= Report about outdev (else indev)
|
||||
bit2= Report about write speed (else read speed)
|
||||
@return <=0 error, 1 success
|
||||
*/
|
||||
int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
||||
int Xorriso_list_speeds_sub(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret, high= -1, low= 0x7fffffff, is_cd= 0, i;
|
||||
int recent_profile= 0;
|
||||
int ret, high= -1, low= 0x7fffffff, is_cd= 0, i, speed;
|
||||
int recent_profile= 0, inout_flag;
|
||||
char *respt, *speed_unit= "D";
|
||||
double speed_factor= 1385000.0, cd_factor= 75.0 * 2352;
|
||||
struct burn_drive_info *dinfo;
|
||||
@ -1606,8 +1610,14 @@ int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
||||
|
||||
respt= xorriso->result_line;
|
||||
|
||||
inout_flag= (flag & 2);
|
||||
if(inout_flag && xorriso->out_drive_handle == NULL)
|
||||
inout_flag= 0;
|
||||
else if(xorriso->in_drive_handle == NULL)
|
||||
inout_flag= 2;
|
||||
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
|
||||
"on attempt to obtain speed descriptor list", 1 | 2);
|
||||
"on attempt to obtain speed descriptor list",
|
||||
1 | inout_flag);
|
||||
if(ret<=0)
|
||||
return(0);
|
||||
if(ret == 2)
|
||||
@ -1618,18 +1628,21 @@ int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
ret= Xorriso_toc(xorriso, 3);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot obtain overview of drive and media content");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
ret= 0; goto ex;
|
||||
if(!(flag & 1)) {
|
||||
ret= Xorriso_toc(xorriso, 1 | inout_flag);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot obtain overview of drive and media content");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
}
|
||||
|
||||
for (item= speed_list; item != NULL; item= item->next) {
|
||||
|
||||
sprintf(xorriso->info_text, "speed= %5dk , source= %d",
|
||||
item->write_speed, item->source);
|
||||
sprintf(xorriso->info_text,
|
||||
"read_speed= %5dk , write_speed= %5dk , source= %d",
|
||||
item->read_speed, item->write_speed, item->source);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
||||
|
||||
if(item->profile_loaded >= 0x08 && item->profile_loaded <= 0x0a)
|
||||
@ -1638,29 +1651,35 @@ int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
||||
recent_profile= item->profile_loaded;
|
||||
if(item->source == 1) {
|
||||
/* CD mode page 2Ah : report only if not same speed by GET PERFORMANCE */
|
||||
if(!(flag & 4))
|
||||
continue; /* 2Ah only tells write speed */
|
||||
for(other= speed_list; other != NULL; other= other->next)
|
||||
if(other->source == 2 && item->write_speed == other->write_speed)
|
||||
break;
|
||||
if(other != NULL)
|
||||
continue;
|
||||
}
|
||||
Xorriso_choose_speed_factor(xorriso, item->write_speed,
|
||||
if(flag & 4) {
|
||||
sprintf(respt, "Write speed : ");
|
||||
speed= item->write_speed;
|
||||
} else {
|
||||
sprintf(respt, "Read speed : ");
|
||||
speed= item->read_speed;
|
||||
}
|
||||
Xorriso_choose_speed_factor(xorriso, speed,
|
||||
item->profile_loaded,
|
||||
&speed_factor, &speed_unit, 0);
|
||||
sprintf(respt, "Write speed : ");
|
||||
sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n",
|
||||
item->write_speed,
|
||||
((double) item->write_speed) * 1000.0 / speed_factor,
|
||||
speed_unit);
|
||||
speed, ((double) speed) * 1000.0 / speed_factor, speed_unit);
|
||||
Xorriso_result(xorriso,0);
|
||||
if(item->write_speed > high)
|
||||
high= item->write_speed;
|
||||
if(item->write_speed < low)
|
||||
low= item->write_speed;
|
||||
if(speed > high)
|
||||
high= speed;
|
||||
if(speed < low)
|
||||
low= speed;
|
||||
}
|
||||
|
||||
/* Maybe there is ATIP info */
|
||||
if(is_cd) {
|
||||
/* Maybe there is ATIP info (about write speed only) */
|
||||
if(is_cd && (flag & 4)) {
|
||||
ret= burn_disc_read_atip(drive);
|
||||
if(ret < 0)
|
||||
goto ex;
|
||||
@ -1692,18 +1711,24 @@ int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
||||
if(high > -1) {
|
||||
Xorriso_choose_speed_factor(xorriso, low, recent_profile,
|
||||
&speed_factor, &speed_unit, 0);
|
||||
sprintf(respt, "Write speed L: ");
|
||||
if(flag & 4)
|
||||
sprintf(respt, "Write speed L: ");
|
||||
else
|
||||
sprintf(respt, "Read speed L : ");
|
||||
sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n",
|
||||
low, ((double) low) * 1000.0 / speed_factor, speed_unit);
|
||||
Xorriso_result(xorriso,0);
|
||||
Xorriso_choose_speed_factor(xorriso, low, recent_profile,
|
||||
&speed_factor, &speed_unit, 0);
|
||||
sprintf(respt, "Write speed H: ");
|
||||
if(flag & 4)
|
||||
sprintf(respt, "Write speed H: ");
|
||||
else
|
||||
sprintf(respt, "Read speed H : ");
|
||||
sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n",
|
||||
high, ((double) high) * 1000.0 / speed_factor, speed_unit);
|
||||
Xorriso_result(xorriso,0);
|
||||
ret= burn_drive_get_best_speed(drive, 0, &item, 2);
|
||||
if(ret > 0 && item != NULL)
|
||||
if(ret > 0 && item != NULL && (flag & 4))
|
||||
if(item->write_speed != high) {
|
||||
sprintf(respt, "Write speed 0: %5dk , %4.1fx%s\n",
|
||||
item->write_speed,
|
||||
@ -1712,7 +1737,8 @@ int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
||||
}
|
||||
} else {
|
||||
sprintf(xorriso->info_text,
|
||||
"Could not get any write speed information from drive");
|
||||
"Could not get any %s speed information from drive",
|
||||
(flag & 4) ? "write" : "read");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
@ -1724,6 +1750,35 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(xorriso->out_drive_handle == NULL && xorriso->in_drive_handle == NULL) {
|
||||
Xorriso_msgs_submit(xorriso, 0,
|
||||
"No drive aquired on attempt to list speeds", 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
if(xorriso->in_drive_handle != NULL) {
|
||||
ret= Xorriso_list_speeds_sub(xorriso, 0);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
}
|
||||
if(xorriso->out_drive_handle != NULL &&
|
||||
xorriso->out_drive_handle != xorriso->in_drive_handle) {
|
||||
ret= Xorriso_list_speeds_sub(xorriso, 2);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
}
|
||||
if(xorriso->out_drive_handle != NULL) {
|
||||
ret= Xorriso_list_speeds_sub(xorriso, 1 | 2 | 4);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= cdrecord style
|
||||
bit1= obtain outdrive, else indrive
|
||||
@return <=0 error, 1 success
|
||||
@ -2088,6 +2143,9 @@ int Xorriso_check_md5_range(struct XorrisO *xorriso, off_t start_lba,
|
||||
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
||||
goto ex;
|
||||
}
|
||||
if(xorriso->read_speed != -2)
|
||||
burn_drive_set_speed(drive, xorriso->read_speed, 0);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
for(pos= start_lba; pos < end_lba; pos+= 32) {
|
||||
to_read= 32;
|
||||
if(pos + to_read > end_lba)
|
||||
@ -2607,6 +2665,9 @@ int Xorriso_check_interval(struct XorrisO *xorriso, struct SpotlisT *spotlist,
|
||||
goto ex;
|
||||
}
|
||||
|
||||
if(xorriso->read_speed != -2)
|
||||
burn_drive_set_speed(drive, xorriso->read_speed, 0);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
start_lba= from_lba;
|
||||
to_read= read_chunk;
|
||||
post_read_time= Sfile_microtime(0);
|
||||
|
Reference in New Issue
Block a user