New API function isoburn_disc_available_space() fixes bug with DVD+RW capacity
This commit is contained in:
parent
30c30bd286
commit
5a24e5b708
@ -399,6 +399,22 @@ void isoburn_disc_erase(struct burn_drive *drive, int fast)
|
||||
}
|
||||
|
||||
|
||||
off_t isoburn_disc_available_space(struct burn_drive *d,
|
||||
struct burn_write_opts *opts)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
off_t avail;
|
||||
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret>0 && o!=NULL)
|
||||
if(o->emulation_mode!=0)
|
||||
burn_write_opts_set_start_byte(opts, ((off_t) o->nwa) * (off_t) 2048);
|
||||
avail= burn_disc_available_space(d, opts);
|
||||
return(avail);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba)
|
||||
{
|
||||
int ret;
|
||||
|
@ -654,6 +654,21 @@ int isoburn_set_read_pacifier(struct burn_drive *drive,
|
||||
int isoburn_attach_image(struct burn_drive *d, IsoImage *image);
|
||||
|
||||
|
||||
/** Return the best possible estimation of the currently available capacity of
|
||||
the media. This might depend on particular write option settings and on
|
||||
drive state.
|
||||
An eventual start address for emulated multi-session will be subtracted
|
||||
from the capacity estimation given by burn_disc_available_space().
|
||||
Negative results get defaulted to 0.
|
||||
Wrapper for: burn_disc_available_space()
|
||||
@param d The drive to query.
|
||||
@param o If not NULL: write parameters to be set on drive before query
|
||||
@return number of most probably available free bytes
|
||||
*/
|
||||
off_t isoburn_disc_available_space(struct burn_drive *d,
|
||||
struct burn_write_opts *o);
|
||||
|
||||
|
||||
/** Obtain the start block number of the most recent session on media. In
|
||||
case of random access media this will always be 0. Succesfull return is
|
||||
not a guarantee that there is a ISO-9660 image at all. The call will fail,
|
||||
|
@ -6711,6 +6711,7 @@ int Xorriso_option_end(struct XorrisO *xorriso, int flag)
|
||||
xorriso->volset_change_pending= 0;
|
||||
} else {
|
||||
ret= Xorriso_option_commit(xorriso, 1);
|
||||
xorriso->volset_change_pending= 0; /* no further tries to commit */
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
}
|
||||
@ -7871,7 +7872,7 @@ int Xorriso_option_print_size(struct XorrisO *xorriso, int flag)
|
||||
if(!xorriso->volset_change_pending) {
|
||||
sprintf(xorriso->info_text,"-print-size: No image modifications pending");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
sprintf(xorriso->result_line,"Image size : 0\n");
|
||||
sprintf(xorriso->result_line,"Image size : 0s\n");
|
||||
Xorriso_result(xorriso,0);
|
||||
return(2);
|
||||
}
|
||||
@ -7881,7 +7882,7 @@ int Xorriso_option_print_size(struct XorrisO *xorriso, int flag)
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
return(0);
|
||||
}
|
||||
sprintf(xorriso->result_line,"Image size : %d\n", ret);
|
||||
sprintf(xorriso->result_line,"Image size : %ds\n", ret);
|
||||
Xorriso_result(xorriso,0);
|
||||
return(1);
|
||||
}
|
||||
@ -8175,9 +8176,9 @@ int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag)
|
||||
"Pending image size larger than free space on media");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
}
|
||||
sprintf(xorriso->result_line, "Media space : %d\n", media_space);
|
||||
sprintf(xorriso->result_line, "Media space : %ds\n", media_space);
|
||||
Xorriso_result(xorriso, 0);
|
||||
sprintf(xorriso->result_line, "Free space : %d\n", free_space);
|
||||
sprintf(xorriso->result_line, "After commit : %ds\n", free_space);
|
||||
Xorriso_result(xorriso, 0);
|
||||
return(1);
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2008.02.09.092805"
|
||||
#define Xorriso_timestamP "2008.02.09.100750"
|
||||
|
@ -813,7 +813,7 @@ no_track:;
|
||||
burn_track_define_data(tracks[0], 0, padding * 2048, 0, BURN_MODE1);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
|
||||
media_space= burn_disc_available_space(drive, burn_options) / (off_t) 2048;
|
||||
media_space= isoburn_disc_available_space(drive, burn_options) / (off_t) 2048;
|
||||
if(media_space < img_sectors + padding) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
sprintf(xorriso->info_text,"Image size %ds exceeds free space on media %ds",
|
||||
@ -1900,7 +1900,7 @@ int Xorriso_tell_media_space(struct XorrisO *xorriso,
|
||||
if(ret<=0)
|
||||
return(-1);
|
||||
(*free_space)= (*media_space)=
|
||||
burn_disc_available_space(drive, burn_options) / (off_t) 2048;
|
||||
isoburn_disc_available_space(drive, burn_options) / (off_t) 2048;
|
||||
burn_write_opts_free(burn_options);
|
||||
|
||||
if(xorriso->volset_change_pending) {
|
||||
|
Loading…
Reference in New Issue
Block a user