New -format types by_index and fast_by_index
This commit is contained in:
@ -2753,12 +2753,15 @@ int Xorriso_blank_media(struct XorrisO *xorriso, int flag)
|
||||
|
||||
|
||||
/* @param flag bit0= try to achieve faster formatting
|
||||
bit7= by_index mode:
|
||||
bit8 to bit15 contain the index of the format to use.
|
||||
@return 0=failure, did not touch media , -1=failure, altered media
|
||||
1=success, altered media , 2=success, did not touch media
|
||||
*/
|
||||
int Xorriso_format_media(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret, mode_flag= 0;
|
||||
int ret, mode_flag= 0, index, status, num_formats;
|
||||
unsigned dummy;
|
||||
struct burn_drive_info *dinfo;
|
||||
struct burn_drive *drive;
|
||||
struct burn_progress p;
|
||||
@ -2776,7 +2779,27 @@ int Xorriso_format_media(struct XorrisO *xorriso, int flag)
|
||||
mode_flag= 4; /* format to full size */
|
||||
burn_disc_get_profile(drive, ¤t_profile, current_profile_name);
|
||||
|
||||
if(current_profile == 0x12) { /* DVD+RAM */
|
||||
if(flag&128) { /* by_index */
|
||||
index= (flag>>8) & 0xff;
|
||||
ret= burn_disc_get_formats(drive, &status, &size, &dummy, &num_formats);
|
||||
if(ret<=0)
|
||||
num_formats= 0;
|
||||
if(ret<=0 || index<0 || index>=num_formats) {
|
||||
if(num_formats>0)
|
||||
sprintf(xorriso->info_text,
|
||||
"-format by_index_%d: format descriptors range from index 0 to %d",
|
||||
index, num_formats-1);
|
||||
else
|
||||
sprintf(xorriso->info_text,
|
||||
"-format by_index_%d: no format descriptors available", index);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
mode_flag= (flag & 0xff80) | 4; /* with size taken from descriptor */
|
||||
if(flag&1)
|
||||
mode_flag|= (1<<6);
|
||||
|
||||
} else if(current_profile == 0x12) { /* DVD+RAM */
|
||||
mode_flag= 6; /* format to default payload size */
|
||||
if(flag&1)
|
||||
mode_flag|= (1<<6);
|
||||
@ -2815,7 +2838,7 @@ int Xorriso_format_media(struct XorrisO *xorriso, int flag)
|
||||
sprintf(xorriso->info_text,"Media current: %s (%4.4xh)",
|
||||
current_profile_name, current_profile);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
return 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(xorriso->do_dummy) {
|
||||
|
Reference in New Issue
Block a user