Improved output of -list_speeds with ROM media and ROM drives.
This commit is contained in:
parent
cbc1a9723a
commit
12a24b169a
@ -800,7 +800,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
int track_count= 0, session_no, track_no, profile_no= -1, track_size;
|
int track_count= 0, session_no, track_no, profile_no= -1, track_size;
|
||||||
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0;
|
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0;
|
||||||
int is_inout_drive= 0, drive_role, status, num_formats, emul_lba;
|
int is_inout_drive= 0, drive_role, status, num_formats, emul_lba;
|
||||||
int not_reconizable= 0;
|
int not_recognizable= 0;
|
||||||
char profile_name[80],*respt,*devadr, *typetext= "";
|
char profile_name[80],*respt,*devadr, *typetext= "";
|
||||||
struct burn_toc_entry toc_entry;
|
struct burn_toc_entry toc_entry;
|
||||||
struct burn_drive_info *dinfo;
|
struct burn_drive_info *dinfo;
|
||||||
@ -869,7 +869,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
strcat(respt, "\n");
|
strcat(respt, "\n");
|
||||||
} else {
|
} else {
|
||||||
sprintf(respt+strlen(respt), "is not recognizable\n");
|
sprintf(respt+strlen(respt), "is not recognizable\n");
|
||||||
not_reconizable= 1;
|
not_recognizable= 1;
|
||||||
}
|
}
|
||||||
Xorriso_toc_line(xorriso, flag & 8);
|
Xorriso_toc_line(xorriso, flag & 8);
|
||||||
|
|
||||||
@ -881,7 +881,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
|
|
||||||
sprintf(respt, "Media status : ");
|
sprintf(respt, "Media status : ");
|
||||||
if (s == BURN_DISC_FULL) {
|
if (s == BURN_DISC_FULL) {
|
||||||
if(not_reconizable)
|
if(not_recognizable)
|
||||||
sprintf(respt+strlen(respt), "is not recognizable\n");
|
sprintf(respt+strlen(respt), "is not recognizable\n");
|
||||||
else
|
else
|
||||||
sprintf(respt+strlen(respt), "is written , is closed");
|
sprintf(respt+strlen(respt), "is written , is closed");
|
||||||
@ -949,7 +949,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
|
|||||||
if(ret<=0) {
|
if(ret<=0) {
|
||||||
Xorriso_process_msg_queues(xorriso,0);
|
Xorriso_process_msg_queues(xorriso,0);
|
||||||
if(flag&1)
|
if(flag&1)
|
||||||
{ret= 0; goto ex;}
|
{ret= 1; goto ex;}
|
||||||
sprintf(xorriso->info_text, "Cannot obtain Table Of Content");
|
sprintf(xorriso->info_text, "Cannot obtain Table Of Content");
|
||||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||||
{ret= 0; goto ex;}
|
{ret= 0; goto ex;}
|
||||||
@ -1291,11 +1291,55 @@ ex:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Xorriso_choose_speed_factor(struct XorrisO *xorriso,
|
||||||
|
int speed, int profile,
|
||||||
|
double *speed_factor, char **speed_unit,
|
||||||
|
int flag)
|
||||||
|
{
|
||||||
|
double cd_factor = 75.0 * 2352;
|
||||||
|
double cd_speed_tolerance= 1.5, cd_speed_add;
|
||||||
|
int int_cd_speed, i;
|
||||||
|
static int cd_speed_list[]= {8, 10, 12, 16, 24, 32, 40, 48, 52, 0};
|
||||||
|
|
||||||
|
*speed_unit= "D";
|
||||||
|
*speed_factor= 1385000.0;
|
||||||
|
|
||||||
|
/* Does this look like an integer CD speed ? */
|
||||||
|
int_cd_speed= ((double) speed) * 1000.0 / cd_factor;
|
||||||
|
cd_speed_add= cd_speed_tolerance * (double) int_cd_speed;
|
||||||
|
int_cd_speed= (((double) speed) + cd_speed_add)
|
||||||
|
* 1000.0 / cd_factor;
|
||||||
|
if(abs((int) ((double) int_cd_speed) * cd_factor / 1000.0 -
|
||||||
|
((double) speed)) > 2 * cd_speed_add ||
|
||||||
|
int_cd_speed > 64)
|
||||||
|
int_cd_speed= 0;
|
||||||
|
if(int_cd_speed > 7) {
|
||||||
|
for(i= 0; cd_speed_list[i]; i++)
|
||||||
|
if(int_cd_speed == cd_speed_list[i])
|
||||||
|
break;
|
||||||
|
if(cd_speed_list[i] == 0)
|
||||||
|
int_cd_speed= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(((profile < 0x08 || profile >= 0x100 || profile == 0x10 || profile == 0x40)
|
||||||
|
&& int_cd_speed) ||
|
||||||
|
(profile >= 0x08 && profile <= 0x0a)) {
|
||||||
|
*speed_unit= "C";
|
||||||
|
*speed_factor= cd_factor;
|
||||||
|
} else if(profile >= 0x40 && profile <= 0x43) {
|
||||||
|
*speed_unit= "B";
|
||||||
|
*speed_factor= 4495625.0;
|
||||||
|
}
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* @return <=0 error, 1 success
|
/* @return <=0 error, 1 success
|
||||||
*/
|
*/
|
||||||
int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
||||||
{
|
{
|
||||||
int ret, high= -1, low= 0x7fffffff, int_cd_speed, is_cd= 0, i;
|
int ret, high= -1, low= 0x7fffffff, is_cd= 0, i;
|
||||||
|
int recent_profile= 0;
|
||||||
char *respt, *speed_unit= "D";
|
char *respt, *speed_unit= "D";
|
||||||
double speed_factor= 1385000.0, cd_factor= 75.0 * 2352;
|
double speed_factor= 1385000.0, cd_factor= 75.0 * 2352;
|
||||||
struct burn_drive_info *dinfo;
|
struct burn_drive_info *dinfo;
|
||||||
@ -1317,12 +1361,18 @@ int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
|||||||
ret= 0; goto ex;
|
ret= 0; goto ex;
|
||||||
}
|
}
|
||||||
ret= Xorriso_toc(xorriso, 3);
|
ret= Xorriso_toc(xorriso, 3);
|
||||||
if(ret<=0)
|
if(ret<=0) {
|
||||||
goto ex;
|
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) {
|
for (item= speed_list; item != NULL; item= item->next) {
|
||||||
if(item->profile_loaded >= 0x08 && item->profile_loaded <= 0x0a)
|
if(item->profile_loaded >= 0x08 && item->profile_loaded <= 0x0a)
|
||||||
is_cd= 1;
|
is_cd= item->profile_loaded;
|
||||||
|
if(item->profile_loaded > 0)
|
||||||
|
recent_profile= item->profile_loaded;
|
||||||
if(item->source == 1) {
|
if(item->source == 1) {
|
||||||
/* CD mode page 2Ah : report only if not same speed by GET PERFORMANCE */
|
/* CD mode page 2Ah : report only if not same speed by GET PERFORMANCE */
|
||||||
for(other= speed_list; other != NULL; other= other->next)
|
for(other= speed_list; other != NULL; other= other->next)
|
||||||
@ -1331,25 +1381,9 @@ int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
|||||||
if(other != NULL)
|
if(other != NULL)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
speed_unit= "D";
|
Xorriso_choose_speed_factor(xorriso, item->write_speed,
|
||||||
speed_factor= 1385000.0;
|
item->profile_loaded,
|
||||||
|
&speed_factor, &speed_unit, 0);
|
||||||
/* Does this look like an integer CD speed ? */
|
|
||||||
int_cd_speed= ((double) item->write_speed) * 1000.0 / cd_factor;
|
|
||||||
if(abs((int) ((double) int_cd_speed) * cd_factor / 1000.0 -
|
|
||||||
((double) item->write_speed)) > 5 ||
|
|
||||||
int_cd_speed > 64)
|
|
||||||
int_cd_speed= 0;
|
|
||||||
|
|
||||||
if(((item->profile_loaded < 0x08 || item->profile_loaded >= 0x100) &&
|
|
||||||
int_cd_speed) ||
|
|
||||||
(item->profile_loaded >= 0x08 && item->profile_loaded <= 0x0a)) {
|
|
||||||
speed_unit= "C";
|
|
||||||
speed_factor= 75.0 * 2352.0;
|
|
||||||
} else if(item->profile_loaded >= 0x40 && item->profile_loaded <= 0x43) {
|
|
||||||
speed_unit= "B";
|
|
||||||
speed_factor= 4495625.0;
|
|
||||||
}
|
|
||||||
sprintf(respt, "Write speed : ");
|
sprintf(respt, "Write speed : ");
|
||||||
sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n",
|
sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n",
|
||||||
item->write_speed,
|
item->write_speed,
|
||||||
@ -1393,10 +1427,14 @@ int Xorriso_list_speeds(struct XorrisO *xorriso, int flag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(high > -1) {
|
if(high > -1) {
|
||||||
|
Xorriso_choose_speed_factor(xorriso, low, recent_profile,
|
||||||
|
&speed_factor, &speed_unit, 0);
|
||||||
sprintf(respt, "Write speed L: ");
|
sprintf(respt, "Write speed L: ");
|
||||||
sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n",
|
sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n",
|
||||||
low, ((double) low) * 1000.0 / speed_factor, speed_unit);
|
low, ((double) low) * 1000.0 / speed_factor, speed_unit);
|
||||||
Xorriso_result(xorriso,0);
|
Xorriso_result(xorriso,0);
|
||||||
|
Xorriso_choose_speed_factor(xorriso, low, recent_profile,
|
||||||
|
&speed_factor, &speed_unit, 0);
|
||||||
sprintf(respt, "Write speed H: ");
|
sprintf(respt, "Write speed H: ");
|
||||||
sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n",
|
sprintf(respt + strlen(respt), " %5dk , %4.1fx%s\n",
|
||||||
high, ((double) high) * 1000.0 / speed_factor, speed_unit);
|
high, ((double) high) * 1000.0 / speed_factor, speed_unit);
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
@c man .\" First parameter, NAME, should be all caps
|
@c man .\" First parameter, NAME, should be all caps
|
||||||
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
@c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||||
@c man .\" other parameters are allowed: see man(7), man(1)
|
@c man .\" other parameters are allowed: see man(7), man(1)
|
||||||
@c man .TH XORRISO 1 "Version 1.1.3, Jul 08, 2011"
|
@c man .TH XORRISO 1 "Version 1.1.3, Jul 12, 2011"
|
||||||
@c man .\" Please adjust this date whenever revising the manpage.
|
@c man .\" Please adjust this date whenever revising the manpage.
|
||||||
@c man .\"
|
@c man .\"
|
||||||
@c man .\" Some roff macros, for reference:
|
@c man .\" Some roff macros, for reference:
|
||||||
@ -2469,16 +2469,20 @@ Smaller format size with DVD-RAM, BD-RE, or BD-R means more reserve space.
|
|||||||
@item -list_speeds
|
@item -list_speeds
|
||||||
@kindex -list_speeds lists available write speeds
|
@kindex -list_speeds lists available write speeds
|
||||||
@cindex Media, list write speeds, -list_speeds
|
@cindex Media, list write speeds, -list_speeds
|
||||||
Put out a list of speed values as reported by the output drive for
|
Put out a list of speed values as reported by the output drive with
|
||||||
the loaded media. At the end of the list, "Write speed L" and "Write speed H"
|
the loaded media. This does not necessarily mean that the media is writable
|
||||||
are the best guesses for lower and upper speed limit.
|
or that these speeds are actually achievable. Especially the
|
||||||
@*
|
lists reported with empty drive or with ROM media obviously advertise
|
||||||
"Write speed l" and "Write speed h" may appear only with CD
|
speeds for other media.
|
||||||
and eventually override the list of other speed offers.
|
|
||||||
@*
|
@*
|
||||||
It is not mandatory to use speed values out of the listed range.
|
It is not mandatory to use speed values out of the listed range.
|
||||||
The drive is supposed to choose a safe speed that is as near to the desired
|
The drive is supposed to choose a safe speed that is as near to the desired
|
||||||
speed as possible.
|
speed as possible.
|
||||||
|
@*
|
||||||
|
At the end of the list, "Write speed L" and "Write speed H"
|
||||||
|
are the best guesses for lower and upper speed limit.
|
||||||
|
"Write speed l" and "Write speed h" may appear only with CD
|
||||||
|
and eventually override the list of other speed offers.
|
||||||
@c man .TP
|
@c man .TP
|
||||||
@item -close_damaged "as_needed"|"force"
|
@item -close_damaged "as_needed"|"force"
|
||||||
@kindex -close_damaged closes damaged track and session
|
@kindex -close_damaged closes damaged track and session
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2011.07.12.092010"
|
#define Xorriso_timestamP "2011.07.12.135452"
|
||||||
|
Loading…
Reference in New Issue
Block a user