New option -list_profiles

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

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,
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);