New API calls burn_disc_get_sectors_v2(), burn_session_get_sectors_v2(), burn_track_get_sectors_v2()

This commit is contained in:
Thomas Schmitt 2024-03-03 11:52:15 +01:00
parent 29bfd7e5e7
commit f0d9795cd1
6 changed files with 45 additions and 10 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2024.03.02.131145"
#define Cdrskin_timestamP "2024.03.03.105146"

View File

@ -3063,6 +3063,11 @@ int burn_track_set_size(struct burn_track *t, off_t size);
*/
int burn_track_get_sectors(struct burn_track *);
/* ts C40302 */
/** Like burn_track_get_sectors(), but with return type off_t.
@since 1.5.8
*/
off_t burn_track_get_sectors_v2(struct burn_track *);
/* ts A61101 */
/** Tells how many source bytes have been read and how many data bytes have
@ -3856,8 +3861,19 @@ struct burn_session **burn_disc_get_sessions(struct burn_disc *d,
int burn_disc_get_incomplete_sessions(struct burn_disc *d);
/** Tells how many sectors a disc will have, or already has.
This is the sum of all burn_session_get_sectors() results of the disc.
The result is NOT RELIABLE with tracks of undefined length
*/
int burn_disc_get_sectors(struct burn_disc *d);
/* ts C40302 */
/** Like burn_disc_get_sectors(), but with return type off_t.
@since 1.5.8
*/
off_t burn_disc_get_sectors_v2(struct burn_disc *d);
/** Gets an array of all the tracks for a session
THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A TRACK
@param s session to get track array for
@ -3867,8 +3883,19 @@ int burn_disc_get_sectors(struct burn_disc *d);
struct burn_track **burn_session_get_tracks(struct burn_session *s,
int *num);
/** Tells how many sectors a session will have, or already has on disc.
This is the sum of all burn_track_get_sectors() results of the session.
The result is NOT RELIABLE with tracks of undefined length
*/
int burn_session_get_sectors(struct burn_session *s);
/* ts C40302 */
/** Like burn_session_get_sectors(), but with return type off_t.
@since 1.5.8
*/
off_t burn_session_get_sectors_v2(struct burn_session *s);
/** Gets the mode of a track
@param track the track to query
@return the track's mode

View File

@ -215,7 +215,10 @@ local: *;
};
LIBBURN4_1.5.8 {
burn_drive_get_status_v2;
burn_disc_get_sectors_v2;
burn_disc_track_lba_nwa_v2;
burn_drive_get_status_v2;
burn_session_get_sectors_v2;
burn_track_get_sectors_v2;
} LIBBURN4;

View File

@ -193,7 +193,7 @@ static void get_bytes(struct burn_track *track, int count, unsigned char *data)
off_t missing, inp_block_size, track_blocks;
inp_block_size = burn_sector_length(track->mode);
track_blocks = burn_track_get_sectors_2(track, 1);
track_blocks = burn_track_get_sectors_2_v2(track, 1);
if (track_blocks < 0)
track_blocks = 0;
missing = track_blocks * inp_block_size - track->sourcecount;

View File

@ -160,7 +160,7 @@ int burn_track_is_open_ended(struct burn_track *t);
int burn_track_is_data_done(struct burn_track *t);
/* ts A70125 : sets overall sectors of a track: offset+payload+padding */
int burn_track_set_sectors(struct burn_track *t, int sectors);
int burn_track_set_sectors(struct burn_track *t, off_t sectors);
/* ts A70218 : sets the payload size alone */
int burn_track_set_size(struct burn_track *t, off_t size);
@ -185,6 +185,7 @@ void burn_cdtext_free(struct burn_cdtext **cdtext);
/* @param flag bit0= do not add post-gap
*/
int burn_track_get_sectors_2(struct burn_track *t, int flag);
off_t burn_track_get_sectors_2_v2(struct burn_track *t, int flag);
#endif /* BURN__STRUCTURE_H */

View File

@ -636,7 +636,7 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
track_length = 300;
if (!tar[i]->pad)
tar[i]->pad = 1;
burn_track_set_sectors(tar[i], track_length);
burn_track_set_sectors(tar[i], (off_t) track_length);
}
type_to_form(tar[i]->mode, &ctladr, &form);
@ -2832,21 +2832,25 @@ int burn_nominal_slowdown(int kb_per_second, int max_corr,
int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s,
int tnum, int flag)
{
int open_ended, bufsize = 16 * 2048, ret, sectors;
int open_ended, bufsize = 16 * 2048, ret;
struct burn_track *t = s->track[tnum];
struct burn_drive *d = o->drive;
char *buf = NULL;
int i, us_corr = 0, max_corr = 250000;
off_t prev_sync_sector = 0;
int us_corr = 0, max_corr = 250000;
off_t prev_sync_sector = 0, sectors, i;
struct buffer *out = d->buffer;
struct timeval prev_time;
BURN_ALLOC_MEM(buf, char, bufsize);
sectors = burn_track_get_sectors_2(t, 1);
sectors = burn_track_get_sectors_2_v2(t, 1);
if (sectors < 0)
{ret = 0; goto ex;}
burn_disc_init_track_status(o, s, t, tnum, sectors);
/* >>> (int) cast will be removed when burn_disc_init_track_status()
>>> gets off_t sectors */;
burn_disc_init_track_status(o, s, t, tnum, (int) sectors);
open_ended = burn_track_is_open_ended(t);
t->end_on_premature_eoi = (o->write_type == BURN_WRITE_TAO);