diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index 7a9a3b0d..be893a4c 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" 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. .\" .\" Some roff macros, for reference: @@ -1637,6 +1637,10 @@ MMC format codes are manifold. Most important are: .br Smaller format size with DVD-RAM, BD-RE, or BD-R means more reserve space. .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: .TP \fB\-file_size_limit\fR value [value [...]] -- diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index ee78a1f7..825a8212 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -15626,6 +15626,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) "", " -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.", "", " -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 */ /* @param flag bit0= with adr_mode sbsector: adr_value is possibly 16 too high @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", "dev","dialog","disk_dev_ino","disk_pattern","dummy","eject", "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", "options_from_file","osirrox","outdev","out_charset","overwrite", "pacifier","padding","path_list","pathspecs","pkt_output","print","prompt", @@ -19273,6 +19303,10 @@ next_command:; } else if(strcmp(cmd,"list_formats")==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) { (*idx)+= 2; ret= Xorriso_option_load(xorriso, arg1, arg2, 0); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index bae17eb2..482fe4f9 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.08.27.175806" +#define Xorriso_timestamP "2009.08.28.100829" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index f119e9a7..78670843 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -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, struct burn_drive_info **dinfo, struct burn_drive **drive, char *attempt, int flag) { + int ret; + if(flag&2) *dinfo= (struct burn_drive_info *) xorriso->out_drive_handle; else *dinfo= (struct burn_drive_info *) xorriso->in_drive_handle; - if(*dinfo==NULL) { + if(*dinfo==NULL && !(flag & 16)) { Xorriso_process_msg_queues(xorriso,0); sprintf(xorriso->info_text, "No %s drive aquired %s", (flag&2 ? "output" : "input"), attempt); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); - return(0); } + if(*dinfo==NULL) + return(0); *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); } @@ -5137,6 +5153,8 @@ no_boot:; bit1=report about output drive bit2=do not try to read ISO heads 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) { @@ -5161,7 +5179,8 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag) struct burn_toc_entry next_toc_entry; 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) return(0); @@ -5179,8 +5198,10 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag) Xorriso_toc_line(xorriso, flag & 8); sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n", dinfo[0].vendor, dinfo[0].product, dinfo[0].revision); - if(!(flag&1)) + if((flag & 32) | !(flag & 1)) Xorriso_toc_line(xorriso, flag & 8); + if(flag & 32) + return(1); sprintf(respt, "Media current: "); 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; 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) return(0); + if(ret == 2) + goto ex; +#ifdef NIX + /* <<< obsoleted by bit0 of Xorriso_get_drive_handles */ ret= burn_drive_get_drive_role(drive); if(ret!=1) { 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); ret= 2; goto ex; } +#endif /* NIX */ ret = burn_disc_get_formats(drive, &status, &size, &dummy, &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) { Xorriso_process_msg_queues(xorriso,0); @@ -8465,6 +8524,7 @@ int Xorriso_atip(struct XorrisO *xorriso, int flag) } else sprintf(respt, "Current: %s\n",profile_name); Xorriso_result(xorriso,1); + Xorriso_list_profiles(xorriso, 1 | 2); if(strstr(profile_name,"DVD")==profile_name) { sprintf(respt, "book type: %s (emulated booktype)\n", profile_name); Xorriso_result(xorriso,1); diff --git a/xorriso/xorrisoburn.h b/xorriso/xorrisoburn.h index 376d7f19..37153cf5 100644 --- a/xorriso/xorrisoburn.h +++ b/xorriso/xorrisoburn.h @@ -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); +/* @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 @return 0=failure, did not touch media , -1=failure, altered media 1=success, altered media , 2=success, did not touch media