New option -list_profiles

This commit is contained in:
Thomas Schmitt 2009-08-28 10:07:30 +00:00
parent 2493976f6b
commit 76738cd16b
5 changed files with 112 additions and 9 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Aug 24, 2009" .TH XORRISO 1 "Aug 28, 2009"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -1637,6 +1637,10 @@ MMC format codes are manifold. Most important are:
.br .br
Smaller format size with DVD-RAM, BD-RE, or BD-R means more reserve space. Smaller format size with DVD-RAM, BD-RE, or BD-R means more reserve space.
.TP .TP
\fB\-list_profiles\fR "in"|"out"|"all"
Put out a list of media types supported by -indev, resp. -outdev, resp. both.
The currently recognized type is marked by text "(current)".
.TP
.B Settings for data insertion: .B Settings for data insertion:
.TP .TP
\fB\-file_size_limit\fR value [value [...]] -- \fB\-file_size_limit\fR value [value [...]] --

View File

@ -15626,6 +15626,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
"", "",
" -list_formats Show media specific list of format descriptors.", " -list_formats Show media specific list of format descriptors.",
"", "",
" -list_profiles "in"|"out"|"all",
" Show list of media types supported by indev resp. outdev.",
" -print_size Print the foreseeable consumption by next -commit.", " -print_size Print the foreseeable consumption by next -commit.",
"", "",
" -tell_media_space", " -tell_media_space",
@ -16171,6 +16173,33 @@ int Xorriso_option_list_formats(struct XorrisO *xorriso, int flag)
} }
/* Option -list_profiles */
int Xorriso_option_list_profiles(struct XorrisO *xorriso, char *which,
int flag)
{
int ret;
int mode= 0;
if(strncmp(which,"in",2)==0)
mode|= 1;
else if(strncmp(which,"out",3)==0)
mode|= 2;
else
mode|= 3;
if(mode & 1) {
ret= Xorriso_toc(xorriso, 1 | 16 | 32);
if(ret > 0)
Xorriso_list_profiles(xorriso, 0);
}
if((mode & 2) && xorriso->in_drive_handle != xorriso->out_drive_handle) {
ret= Xorriso_toc(xorriso, 1 | 2 | 16 | 32);
if(ret > 0)
Xorriso_list_profiles(xorriso, 2);
}
return(1);
}
/* Option -load session|track|sbsector value */ /* Option -load session|track|sbsector value */
/* @param flag bit0= with adr_mode sbsector: adr_value is possibly 16 too high /* @param flag bit0= with adr_mode sbsector: adr_value is possibly 16 too high
@return <=0 error , 1 success, 2 revoked by -reassure @return <=0 error , 1 success, 2 revoked by -reassure
@ -18797,7 +18826,8 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
"commit_eject","compliance", "commit_eject","compliance",
"dev","dialog","disk_dev_ino","disk_pattern","dummy","eject", "dev","dialog","disk_dev_ino","disk_pattern","dummy","eject",
"iso_rr_pattern","follow","format","fs","gid","grow_blindly","hardlinks", "iso_rr_pattern","follow","format","fs","gid","grow_blindly","hardlinks",
"history","indev","in_charset","joliet","list_delimiter","local_charset", "history","indev","in_charset","joliet",
"list_delimiter","list_profiles","local_charset",
"mark","md5","not_leaf","not_list","not_mgt", "mark","md5","not_leaf","not_list","not_mgt",
"options_from_file","osirrox","outdev","out_charset","overwrite", "options_from_file","osirrox","outdev","out_charset","overwrite",
"pacifier","padding","path_list","pathspecs","pkt_output","print","prompt", "pacifier","padding","path_list","pathspecs","pkt_output","print","prompt",
@ -19273,6 +19303,10 @@ next_command:;
} else if(strcmp(cmd,"list_formats")==0) { } else if(strcmp(cmd,"list_formats")==0) {
ret= Xorriso_option_list_formats(xorriso, 0); ret= Xorriso_option_list_formats(xorriso, 0);
} else if(strcmp(cmd,"list_profiles")==0) {
(*idx)++;
ret= Xorriso_option_list_profiles(xorriso, arg1, 0);
} else if(strcmp(cmd,"load")==0) { } else if(strcmp(cmd,"load")==0) {
(*idx)+= 2; (*idx)+= 2;
ret= Xorriso_option_load(xorriso, arg1, arg2, 0); ret= Xorriso_option_load(xorriso, arg1, arg2, 0);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.08.27.175806" #define Xorriso_timestamP "2009.08.28.100829"

View File

@ -673,24 +673,40 @@ int Xorriso_detach_libraries(struct XorrisO *xorriso, int flag)
} }
/* @param flag bit1= obtain outdrive, else indrive */ /* @param flag
bit0= if not MMC drive print NOTE and return 2
bit1= obtain outdrive, else indrive
bit4= do not report failure
*/
int Xorriso_get_drive_handles(struct XorrisO *xorriso, int Xorriso_get_drive_handles(struct XorrisO *xorriso,
struct burn_drive_info **dinfo, struct burn_drive_info **dinfo,
struct burn_drive **drive, struct burn_drive **drive,
char *attempt, int flag) char *attempt, int flag)
{ {
int ret;
if(flag&2) if(flag&2)
*dinfo= (struct burn_drive_info *) xorriso->out_drive_handle; *dinfo= (struct burn_drive_info *) xorriso->out_drive_handle;
else else
*dinfo= (struct burn_drive_info *) xorriso->in_drive_handle; *dinfo= (struct burn_drive_info *) xorriso->in_drive_handle;
if(*dinfo==NULL) { if(*dinfo==NULL && !(flag & 16)) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, "No %s drive aquired %s", sprintf(xorriso->info_text, "No %s drive aquired %s",
(flag&2 ? "output" : "input"), attempt); (flag&2 ? "output" : "input"), attempt);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
} }
if(*dinfo==NULL)
return(0);
*drive= (*dinfo)[0].drive; *drive= (*dinfo)[0].drive;
if(flag & 1) {
ret= burn_drive_get_drive_role(*drive);
if(ret != 1) {
sprintf(xorriso->info_text,
"Output device is not an MMC drive. Desired operation does not apply");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
return(2);
}
}
return((*drive)!=NULL); return((*drive)!=NULL);
} }
@ -5137,6 +5153,8 @@ no_boot:;
bit1=report about output drive bit1=report about output drive
bit2=do not try to read ISO heads bit2=do not try to read ISO heads
bit3=report to info channel (else to result channel) bit3=report to info channel (else to result channel)
bit4=do no report failure if no drive aquired
bit5=only report "Drive current" and "Drive type"
*/ */
int Xorriso_toc(struct XorrisO *xorriso, int flag) int Xorriso_toc(struct XorrisO *xorriso, int flag)
{ {
@ -5161,7 +5179,8 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
struct burn_toc_entry next_toc_entry; struct burn_toc_entry next_toc_entry;
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to print Table Of Content", flag&2); "on attempt to print Table Of Content",
flag & (2 | 16));
if(ret<=0) if(ret<=0)
return(0); return(0);
@ -5179,8 +5198,10 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n", sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n",
dinfo[0].vendor, dinfo[0].product, dinfo[0].revision); dinfo[0].vendor, dinfo[0].product, dinfo[0].revision);
if(!(flag&1)) if((flag & 32) | !(flag & 1))
Xorriso_toc_line(xorriso, flag & 8); Xorriso_toc_line(xorriso, flag & 8);
if(flag & 32)
return(1);
sprintf(respt, "Media current: "); sprintf(respt, "Media current: ");
ret= burn_disc_get_profile(drive, &profile_no, profile_name); ret= burn_disc_get_profile(drive, &profile_no, profile_name);
@ -5842,10 +5863,14 @@ int Xorriso_list_formats(struct XorrisO *xorriso, int flag)
respt= xorriso->result_line; respt= xorriso->result_line;
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to obtain format descriptor list", 2); "on attempt to obtain format descriptor list", 1 | 2);
if(ret<=0) if(ret<=0)
return(0); return(0);
if(ret == 2)
goto ex;
#ifdef NIX
/* <<< obsoleted by bit0 of Xorriso_get_drive_handles */
ret= burn_drive_get_drive_role(drive); ret= burn_drive_get_drive_role(drive);
if(ret!=1) { if(ret!=1) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
@ -5853,6 +5878,7 @@ int Xorriso_list_formats(struct XorrisO *xorriso, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
ret= 2; goto ex; ret= 2; goto ex;
} }
#endif /* NIX */
ret = burn_disc_get_formats(drive, &status, &size, &dummy, ret = burn_disc_get_formats(drive, &status, &size, &dummy,
&num_formats); &num_formats);
@ -5903,6 +5929,39 @@ ex:;
} }
/* @param flag bit0= cdrecord style
bit1= obtain outdrive, else indrive
@return <=0 error, 1 success
*/
int Xorriso_list_profiles(struct XorrisO *xorriso, int flag)
{
int ret, i;
struct burn_drive_info *dinfo;
struct burn_drive *drive;
int num_profiles, profiles[64];
char is_current[64], profile_name[90], *respt;
respt= xorriso->result_line;
ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to obtain profile list", 1 | (flag & 2));
if(ret<=0)
return(0);
burn_drive_get_all_profiles(drive, &num_profiles, profiles, is_current);
for(i= 0; i < num_profiles; i++) {
ret= burn_obtain_profile_name(profiles[i], profile_name);
if(ret <= 0)
strcpy(profile_name, "unknown");
sprintf(respt, "%s 0x%4.4X (%s)%s\n",
flag & 1 ? "Profile:" : "Profile :",
(unsigned int) profiles[i],
profile_name, is_current[i] ? " (current)" : "");
Xorriso_result(xorriso,0);
}
return(1);
}
int Xorriso_cannot_create_iter(struct XorrisO *xorriso, int iso_error,int flag) int Xorriso_cannot_create_iter(struct XorrisO *xorriso, int iso_error,int flag)
{ {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
@ -8465,6 +8524,7 @@ int Xorriso_atip(struct XorrisO *xorriso, int flag)
} else } else
sprintf(respt, "Current: %s\n",profile_name); sprintf(respt, "Current: %s\n",profile_name);
Xorriso_result(xorriso,1); Xorriso_result(xorriso,1);
Xorriso_list_profiles(xorriso, 1 | 2);
if(strstr(profile_name,"DVD")==profile_name) { if(strstr(profile_name,"DVD")==profile_name) {
sprintf(respt, "book type: %s (emulated booktype)\n", profile_name); sprintf(respt, "book type: %s (emulated booktype)\n", profile_name);
Xorriso_result(xorriso,1); Xorriso_result(xorriso,1);

View File

@ -92,6 +92,11 @@ int Xorriso_format_media(struct XorrisO *xorriso, off_t size, int flag);
*/ */
int Xorriso_list_formats(struct XorrisO *xorriso, int flag); int Xorriso_list_formats(struct XorrisO *xorriso, int flag);
/* @param flag bit1= obtain outdrive, else indrive
@return <=0 error, 1 success
*/
int Xorriso_list_profiles(struct XorrisO *xorriso, int flag);
/* @param flag bit2= formatting rather than blanking /* @param flag bit2= formatting rather than blanking
@return 0=failure, did not touch media , -1=failure, altered media @return 0=failure, did not touch media , -1=failure, altered media
1=success, altered media , 2=success, did not touch media 1=success, altered media , 2=success, did not touch media