Counting post-gap as part of track with burn_track_get_sectors()

This commit is contained in:
Thomas Schmitt 2012-01-23 09:30:48 +00:00
parent 72c31e89b2
commit 024701c220
5 changed files with 56 additions and 22 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2012.01.18.141954"
#define Cdrskin_timestamP "2012.01.22.194131"

View File

@ -2619,7 +2619,15 @@ struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size);
@param start The byte address where to start reading bytes for the
consumer. inp bytes may get skipped to reach this address.
@param size The number of bytes to be delivered to the consumer.
@param flag Bitfield for control purposes (unused yet, submit 0).
If size is <= 0 then it may be set later by a call of method
set_size(). If it is >= 0, then it can only be changed if
flag bit0 was set with burn_offst_source_new().
@param flag Bitfield for control purposes
bit0 = Prevent set_size() from overriding interval sizes > 0.
If such a size is already set, then the new one will
only affect the reply of get_size().
See also above struct burn_source.
@since 1.2.0
@return Pointer to a burn_source object, later to be freed by
burn_source_free(). NULL indicates failure.
@since 0.8.8
@ -2779,8 +2787,9 @@ int burn_fifo_fill(struct burn_source *fifo, int fill, int flag);
int burn_track_set_size(struct burn_track *t, off_t size);
/** Tells how long a track will be on disc
>>> NOTE: Not reliable with tracks of undefined length
/** Tells how many sectors a track will have on disc, resp. already has on
disc. This includes offset, payload, tail, and post-gap, but not pre-gap.
The result is NOT RELIABLE with tracks of undefined length
*/
int burn_track_get_sectors(struct burn_track *);
@ -3613,12 +3622,17 @@ typedef int (*burn_abort_handler_t)(void *handle, int signum, int flag);
@param handle Opaque handle eventually pointing to an application
provided memory object
@param handler A function to be called on signals. It will get handle as
argument. flag will be 0.
@param handler A function to be called on signals, if the handling bits
in parameter mode are set 0.
It will get parameter handle as argument. flag will be 0.
It should finally call burn_abort(). See there.
@param mode : bit0 - bit3:
Receiving signals:
0 Call handler(handle, signum, 0) on nearly all signals
If the handler function returns 2 or -2, then the wrapping
signal handler of libburn will return and let the program
continue its operations. Any other return value causes
exit(1).
@param mode : bit0 - bit3: Handling of received signals:
0 Install libburn wrapping signal handler, which will call
handler(handle, signum, 0) on nearly all signals
1 Enable system default reaction on all signals
2 Try to ignore nearly all signals
10 like mode 2 but handle SIGABRT like with mode 0

View File

@ -496,7 +496,10 @@ int burn_track_set_postgap_size(struct burn_track *t, int size, int flag)
return 1;
}
int burn_track_get_sectors(struct burn_track *t)
/* ts B20119: outsourced from burn_track_get_sectors()
@param flag bit0= do not add post-gap
*/
int burn_track_get_sectors_2(struct burn_track *t, int flag)
{
/* ts A70125 : was int */
off_t size = 0;
@ -508,9 +511,12 @@ int burn_track_get_sectors(struct burn_track *t)
/* ts A90911 : will read blocks of 2056 bytes and write 2048 */
seclen += 8;
if (t->source != NULL) /* ts A80808 : mending sigsegv */
if (t->source != NULL) { /* ts A80808 : mending sigsegv */
size = t->offset + t->source->get_size(t->source) + t->tail;
else if(t->entry != NULL) {
/* ts B20119 : adding post-gap */
if (t->postgap && !(flag & 1))
size += t->postgap_size;
} else if(t->entry != NULL) {
/* ts A80808 : all burn_toc_entry of track starts should now
have (extensions_valid & 1), even those from CD.
*/
@ -524,6 +530,11 @@ int burn_track_get_sectors(struct burn_track *t)
}
int burn_track_get_sectors(struct burn_track *t)
{
return burn_track_get_sectors_2(t, 0);
}
/* ts A70125 */
int burn_track_set_sectors(struct burn_track *t, int sectors)
{
@ -1773,7 +1784,7 @@ overlapping_ba:;
else
inp_src = crs->file_source;
src = burn_offst_source_new(inp_src, crs->offst_source,
(off_t) (file_ba * crs->block_size), (off_t) 0, 0);
(off_t) (file_ba * crs->block_size), (off_t) 0, 1);
if (src == NULL)
goto out_of_mem;
@ -2040,8 +2051,10 @@ cannot_open:;
0, 0);
ret = 0; goto ex;
}
burn_track_set_size(crs->track, crs->source_size -
ret = burn_track_set_size(crs->track, crs->source_size -
(off_t) (crs->current_file_ba * crs->block_size));
if (ret <= 0)
goto ex;
ret = cue_attach_track(session, crs, 0);
if (ret <= 0)

View File

@ -176,5 +176,10 @@ int burn_disc_cd_toc_extensions(struct burn_drive *drive, int flag);
struct burn_cdtext *burn_cdtext_create(void);
void burn_cdtext_free(struct burn_cdtext **cdtext);
/* ts B20119 */
/* @param flag bit0= do not add post-gap
*/
int burn_track_get_sectors_2(struct burn_track *t, int flag);
#endif /* BURN__STRUCTURE_H */

View File

@ -301,6 +301,7 @@ int burn_write_close_session(struct burn_write_opts *o)
This is useful only when changes about CD SAO get tested.
# define Libburn_write_with_function_print_cuE yes
*/
#define Libburn_write_with_function_print_cuE yes
#ifdef Libburn_write_with_function_print_cuE
@ -608,7 +609,7 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
i decided to at least enforce the MMC specs' minimum
track length.
*/
track_length = burn_track_get_sectors(tar[i]);
track_length = burn_track_get_sectors_2(tar[i], 1);
if (track_length < 300 && !burn_track_is_open_ended(tar[i])) {
track_length = 300;
if (!tar[i]->pad)
@ -1151,8 +1152,9 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
/* <<< */
sprintf(msg,
"TAO pre-track %2.2d : get_nwa(%d)=%d, d=%d , demand=%.f , cap=%.f\n",
tnum+1, nwa, ret, d->nwa, (double) burn_track_get_sectors(t) * 2048.0,
(double) d->media_capacity_remaining);
tnum+1, nwa, ret, d->nwa,
(double) burn_track_get_sectors_2(t, 1) * 2048.0,
(double) d->media_capacity_remaining);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
@ -1174,7 +1176,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
/* user data */
sectors = burn_track_get_sectors(t);
sectors = burn_track_get_sectors_2(t, 1);
open_ended = burn_track_is_open_ended(t);
burn_disc_init_track_status(o, s, t, tnum, sectors);
@ -1539,7 +1541,7 @@ int burn_disc_open_track_dvd_minus_r(struct burn_write_opts *o,
#endif
if (o->write_type == BURN_WRITE_SAO) { /* DAO */
size = ((off_t) burn_track_get_sectors(s->track[tnum]))
size = ((off_t) burn_track_get_sectors_2(s->track[tnum], 1))
* (off_t) 2048;
/* Eventually round track size up to write chunk */
@ -1588,7 +1590,7 @@ int burn_disc_open_track_dvd_plus_r(struct burn_write_opts *o,
if (o->write_type == BURN_WRITE_SAO &&
! burn_track_is_open_ended(s->track[tnum])) {
/* Round track size up to write chunk size and reserve track */
size = ((off_t) burn_track_get_sectors(s->track[tnum]))
size = ((off_t) burn_track_get_sectors_2(s->track[tnum], 1))
* (off_t) 2048;
/* o->obs should be 32k or 64k already. But 32k alignment
was once performed in d->reserve_track() */
@ -1862,7 +1864,7 @@ int burn_dvd_write_track(struct burn_write_opts *o,
goto ex;
}
sectors = burn_track_get_sectors(t);
sectors = burn_track_get_sectors_2(t, 1);
open_ended = burn_track_is_open_ended(t);
/* (offset padding is done within sector_data()) */
@ -2705,7 +2707,7 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s,
BURN_ALLOC_MEM(buf, char, bufsize);
sectors = burn_track_get_sectors(t);
sectors = burn_track_get_sectors_2(t, 1);
burn_disc_init_track_status(o, s, t, tnum, sectors);
open_ended = burn_track_is_open_ended(t);