From 0ddeb01502308d59cd11072400d08617b8d8cf6c Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 22 Feb 2007 11:30:12 +0000 Subject: [PATCH] Made burn_disc_available_space() take into respect burn_write_opts_set_start_byte() --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 10 ++++++++-- libburn/libburn.h | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 61cd620..56ec551 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.02.22.094939" +#define Cdrskin_timestamP "2007.02.22.113016" diff --git a/libburn/drive.c b/libburn/drive.c index 8ef0cae..9c7619e 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -1445,12 +1445,18 @@ off_t burn_disc_available_space(struct burn_drive *d, int lba, nwa; if (burn_drive_is_released(d)) - return d->media_capacity_remaining; + goto ex; if (d->busy != BURN_DRIVE_IDLE) - return d->media_capacity_remaining; + goto ex; if (o != NULL) d->send_write_parameters(d, o); d->get_nwa(d, -1, &lba, &nwa); +ex:; + if (o->start_byte > 0) { + if (o->start_byte > d->media_capacity_remaining) + return 0; + return d->media_capacity_remaining - o->start_byte; + } return d->media_capacity_remaining; } diff --git a/libburn/libburn.h b/libburn/libburn.h index 06cdf45..8e273a0 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -847,6 +847,9 @@ int burn_disc_get_msc1(struct burn_drive *d, int *start_lba); inquiring the space with such a set of options, the drive has to be grabbed and BURN_DRIVE_IDLE. If not, then one will only get a canned value from the most recent automatic inquiry (e.g. during last drive grabbing). + An eventual start address from burn_write_opts_set_start_byte() will be + subtracted from the obtained capacity estimation. Negative results get + defaulted to 0. @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