New struct burn_progress_v2 and API call burn_drive_get_status_v2()

This commit is contained in:
Thomas Schmitt 2024-03-01 19:51:34 +01:00
parent 17a020e9fc
commit d48bbb4b66
10 changed files with 143 additions and 29 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2024.02.27.194737" #define Cdrskin_timestamP "2024.03.01.185046"

View File

@ -152,12 +152,12 @@ LT_RELEASE=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_MICRO_VERSION
dnl dnl
dnl ### This is the release version libburn-1.5.6 dnl ### This is the release version libburn-1.5.6
dnl This is the development version after above release version dnl This is the development version after above release version
dnl LT_CURRENT++, LT_AGE++ has not yet happened. dnl ### LT_CURRENT++, LT_AGE++ has not yet happened.
dnl ### LT_CURRENT++, LT_AGE++ has happened meanwhile. dnl LT_CURRENT++, LT_AGE++ has happened meanwhile.
dnl dnl
dnl SONAME = 113 - 109 = 4 . Linux library name = libburn.so.4.109.0 dnl SONAME = 114 - 110 = 4 . Linux library name = libburn.so.4.110.0
LT_CURRENT=113 LT_CURRENT=114
LT_AGE=109 LT_AGE=110
LT_REVISION=0 LT_REVISION=0
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE` LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`

View File

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2017 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2024 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -279,7 +279,7 @@ static void *scan_worker_func(struct w_list *w)
} }
static void reset_progress(struct burn_drive *d, int sessions, int tracks, static void reset_progress(struct burn_drive *d, int sessions, int tracks,
int indices, int sectors, int flag) int indices, off_t sectors, int flag)
{ {
/* reset the progress indicator */ /* reset the progress indicator */
d->progress.session = 0; d->progress.session = 0;
@ -412,7 +412,7 @@ void burn_disc_erase(struct burn_drive *drive, int fast)
return; return;
} }
reset_progress(drive, 1, 1, 1, 0x10000, 0); reset_progress(drive, 1, 1, 1, (off_t) 0x10000, 0);
/* A70103 : will be set to 0 by burn_disc_erase_sync() */ /* A70103 : will be set to 0 by burn_disc_erase_sync() */
drive->cancel = 1; drive->cancel = 1;
@ -494,7 +494,7 @@ void burn_disc_format(struct burn_drive *drive, off_t size, int flag)
int ok = 0, ret; int ok = 0, ret;
char msg[40]; char msg[40];
reset_progress(drive, 1, 1, 1, 0x10000, 0); reset_progress(drive, 1, 1, 1, (off_t) 0x10000, 0);
if ((SCAN_GOING()) || find_worker(drive) != NULL) { if ((SCAN_GOING()) || find_worker(drive) != NULL) {
libdax_msgs_submit(libdax_messenger, drive->global_index, libdax_msgs_submit(libdax_messenger, drive->global_index,
@ -652,7 +652,7 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
} }
reset_progress(d, disc->sessions, disc->session[0]->tracks, reset_progress(d, disc->sessions, disc->session[0]->tracks,
disc->session[0]->track[0]->indices, 0, 0); disc->session[0]->track[0]->indices, (off_t) 0, 0);
/* For the next lines any return indicates failure */ /* For the next lines any return indicates failure */
d->cancel = 1; d->cancel = 1;

View File

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2021 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2024 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -1136,12 +1136,13 @@ int burn_disc_erasable(struct burn_drive *d)
{ {
return d->erasable; return d->erasable;
} }
enum burn_drive_status burn_drive_get_status(struct burn_drive *d,
struct burn_progress *p)
void burn_drive_get_status_sig_handling(void)
{ {
/* --- Part of asynchronous signal handling --- */ /* --- Part of asynchronous signal handling --- */
/* This frequently used call may be used to react on messages from /* The frequently used callx burn_drive_get_status*() may be used
the libburn built-in signal handler. to react on messages from the libburn built-in signal handler.
*/ */
/* ts B00225 : /* ts B00225 :
@ -1165,11 +1166,61 @@ enum burn_drive_status burn_drive_get_status(struct burn_drive *d,
} }
/* --- End of asynchronous signal handling --- */ /* --- End of asynchronous signal handling --- */
}
enum burn_drive_status burn_drive_get_status(struct burn_drive *d,
struct burn_progress *p)
{
burn_drive_get_status_sig_handling();
if (p != NULL) { if (p != NULL) {
memcpy(p, &(d->progress), sizeof(struct burn_progress));
/* TODO: add mutex */ /* TODO: add mutex */
p->sessions = d->progress.sessions;
p->session = d->progress.session;
p->tracks = d->progress.tracks;
p->track = d->progress.track;
p->indices = d->progress.indices;
p->index = d->progress.index;
if(d->progress.start_sector < 0x80000000)
p->start_sector = d->progress.start_sector;
else
p->start_sector = 0x7fffffff;
if(d->progress.sectors < 0x80000000)
p->sectors = d->progress.sectors;
else
p->sectors = 0x7fffffff;
if(d->progress.sector < 0x80000000)
p->sector = d->progress.sector;
else
p->sector = 0x7fffffff;
if(d->progress.buffer_capacity < 0x100000000)
p->buffer_capacity = d->progress.buffer_capacity;
else
p->buffer_capacity = 0xffffffff;
if(d->progress.buffer_available < 0x100000000)
p->buffer_available = d->progress.buffer_available;
else
p->buffer_available = 0xffffffff;
p->buffered_bytes = d->progress.buffered_bytes;
if(d->progress.buffer_min_fill < 0x100000000)
p->buffer_min_fill = d->progress.buffer_min_fill;
else
p->buffer_min_fill = 0xffffffff;
}
return d->busy;
}
enum burn_drive_status burn_drive_get_status_v2(struct burn_drive *d,
struct burn_progress_v2 *p)
{
burn_drive_get_status_sig_handling();
if (p != NULL) {
/* TODO: add mutex */
memcpy(p, &(d->progress), sizeof(struct burn_progress_v2));
} }
return d->busy; return d->busy;
} }

View File

@ -680,7 +680,8 @@ struct burn_drive_info
/** Operation progress report. All values are 0 based indices. /** Operation progress report. All values are 0 based indices.
* */ Handed out by burn_drive_get_status().
**/
struct burn_progress { struct burn_progress {
/** The total number of sessions */ /** The total number of sessions */
int sessions; int sessions;
@ -722,6 +723,52 @@ struct burn_progress {
}; };
/** Operation progress report with long block numbers.
All values are 0 based indices.
Handed out by burn_drive_get_status_v2().
@since 1.5.8
**/
struct burn_progress_v2 {
/** Revision of the struct format.
0= Elements up to .buffer_min_fill */
int revision;
/** The total number of sessions */
int sessions;
/** Current session.*/
int session;
/** The total number of tracks */
int tracks;
/** Current track. */
int track;
/** The total number of indices */
int indices;
/** Current index. */
int index;
/** The starting logical block address */
off_t start_sector;
/** On write: The number of sectors.
On blank: 0x10000 as upper limit for relative progress steps */
off_t sectors;
/** On write: The current sector being processed.
On blank: Relative progress steps 0 to 0x10000 */
off_t sector;
/** The capacity of the drive buffer */
off_t buffer_capacity;
/** The free space in the drive buffer (might be slightly outdated) */
off_t buffer_available;
/** The number of bytes sent to the drive buffer */
off_t buffered_bytes;
/** The minimum number of bytes stored in buffer during write.
(Caution: Before surely one buffer size of bytes was processed,
this value is 0xffffffffffffffff.)
*/
off_t buffer_min_fill;
};
/* ts A61226 */ /* ts A61226 */
/* @since 0.3.0 */ /* @since 0.3.0 */
/** Description of a speed capability as reported by the drive in conjunction /** Description of a speed capability as reported by the drive in conjunction
@ -1667,6 +1714,15 @@ int burn_disc_erasable(struct burn_drive *d);
enum burn_drive_status burn_drive_get_status(struct burn_drive *drive, enum burn_drive_status burn_drive_get_status(struct burn_drive *drive,
struct burn_progress *p); struct burn_progress *p);
/** Returns the progress with long block numbers and the status of the drive.
@param drive The drive to query busy state for.
@param p Returns the progress of the operation, NULL if you don't care
@return the current status of the drive. See also burn_drive_status.
@since 1.5.8
*/
enum burn_drive_status burn_drive_get_status_v2(struct burn_drive *drive,
struct burn_progress_v2 *p);
/** Creates a write_opts struct for burning to the specified drive. /** Creates a write_opts struct for burning to the specified drive.
The returned object must later be freed with burn_write_opts_free(). The returned object must later be freed with burn_write_opts_free().
@param drive The drive to write with @param drive The drive to write with

View File

@ -213,3 +213,8 @@ libdax_audioxtr_new;
libdax_audioxtr_read; libdax_audioxtr_read;
local: *; local: *;
}; };
LIBBURN4_1.5.8 {
burn_drive_get_status_v2;
} LIBBURN4;

View File

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2016 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2024 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -766,7 +766,8 @@ ex:;
*/ */
static int mmc_wait_for_buffer_free(struct burn_drive *d, struct buffer *buf) static int mmc_wait_for_buffer_free(struct burn_drive *d, struct buffer *buf)
{ {
int usec= 0, need, reported_3s = 0, first_wait = 1; int usec= 0, reported_3s = 0, first_wait = 1;
off_t need;
struct timeval t0,tnow; struct timeval t0,tnow;
double max_fac, min_fac, waiting; double max_fac, min_fac, waiting;
@ -1065,7 +1066,7 @@ fprintf(stderr, "libburn_DEBUG: buffer sectors= %d bytes= %d\n",
*/ */
if (d->current_profile == 0x14 && d->write_opts != NULL && if (d->current_profile == 0x14 && d->write_opts != NULL &&
(d->progress.buffer_capacity == 0 || (d->progress.buffer_capacity == 0 ||
start < (int) d->progress.buffer_capacity / 2048) && start < (off_t) d->progress.buffer_capacity / 2048) &&
key == 5 && asc == 0x64 && ascq == 0) { key == 5 && asc == 0x64 && ascq == 0) {
if (d->write_opts->write_type == BURN_WRITE_TAO) { if (d->write_opts->write_type == BURN_WRITE_TAO) {
d->was_feat21h_failure = 1 + (start == 0); d->was_feat21h_failure = 1 + (start == 0);
@ -3706,7 +3707,7 @@ int mmc_read_buffer_capacity(struct burn_drive *d)
d->pessimistic_buffer_free = d->progress.buffer_available; d->pessimistic_buffer_free = d->progress.buffer_available;
d->pbf_altered = 0; d->pbf_altered = 0;
if (d->progress.buffered_bytes >= d->progress.buffer_capacity){ if (d->progress.buffered_bytes >= d->progress.buffer_capacity){
double fill; off_t fill;
fill = d->progress.buffer_capacity fill = d->progress.buffer_capacity
- d->progress.buffer_available; - d->progress.buffer_available;

View File

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2014 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2024 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */

View File

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2020 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2024 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -394,7 +394,7 @@ struct burn_drive
struct burn_disc *disc; /* disc structure */ struct burn_disc *disc; /* disc structure */
int block_types[4]; int block_types[4];
struct buffer *buffer; struct buffer *buffer;
struct burn_progress progress; struct burn_progress_v2 progress;
/* To be used by mmc.c, sbc.c, spc.c for SCSI commands where the struct /* To be used by mmc.c, sbc.c, spc.c for SCSI commands where the struct
content surely does not have to persist while another command gets content surely does not have to persist while another command gets

View File

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2021 Thomas Schmitt <scdbackup@gmx.net> Copyright (c) 2006 - 2024 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
*/ */
@ -1358,7 +1358,7 @@ int burn_disc_init_write_status(struct burn_write_opts *o,
d->progress.buffer_capacity = 0; d->progress.buffer_capacity = 0;
d->progress.buffer_available = 0; d->progress.buffer_available = 0;
d->progress.buffered_bytes = 0; d->progress.buffered_bytes = 0;
d->progress.buffer_min_fill = 0xffffffff; d->progress.buffer_min_fill = 0x7fffffffffffffff;
/* ts A70711 */ /* ts A70711 */
d->pessimistic_buffer_free = 0; d->pessimistic_buffer_free = 0;
@ -1897,7 +1897,7 @@ int burn_dvd_write_track(struct burn_write_opts *o,
struct buffer *out = d->buffer; struct buffer *out = d->buffer;
int sectors; int sectors;
int i, open_ended = 0, ret= 0, is_flushed = 0, track_open = 0; int i, open_ended = 0, ret= 0, is_flushed = 0, track_open = 0;
int first_buf_cap = 0, further_cap = 0, buf_cap_step = 1024; off_t first_buf_cap = 0, further_cap = 0, buf_cap_step = 1024;
/* ts A70213 : eventually expand size of track to max */ /* ts A70213 : eventually expand size of track to max */
burn_track_apply_fillup(t, d->media_capacity_remaining, 0); burn_track_apply_fillup(t, d->media_capacity_remaining, 0);
@ -2836,7 +2836,8 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s,
struct burn_track *t = s->track[tnum]; struct burn_track *t = s->track[tnum];
struct burn_drive *d = o->drive; struct burn_drive *d = o->drive;
char *buf = NULL; char *buf = NULL;
int i, prev_sync_sector = 0, us_corr = 0, max_corr = 250000; int i, us_corr = 0, max_corr = 250000;
off_t prev_sync_sector = 0;
struct buffer *out = d->buffer; struct buffer *out = d->buffer;
struct timeval prev_time; struct timeval prev_time;