New API call burn_track_set_postgap_size()

This commit is contained in:
Thomas Schmitt 2012-01-12 08:44:34 +00:00
parent cb8c85579d
commit ef7999342b
7 changed files with 97 additions and 29 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2012.01.11.132946" #define Cdrskin_timestamP "2012.01.12.084429"

View File

@ -2428,22 +2428,43 @@ int burn_track_clear_indice(struct burn_track *t, int flag);
/* ts B20110 */ /* ts B20110 */
/** Define whether a pre-gap shall be written before the track and how many /** Define whether a pre-gap shall be written before the track and how many
sectors this pregap shall have. A pre-gap is written in the range of track sectors this pre-gap shall have. A pre-gap is written in the range of track
index 0 and contains zeros resp. silence. No bytes from the track source index 0 and contains zeros resp. silence. No bytes from the track source
will be read for writing the pre-gap. will be read for writing the pre-gap.
This setting affects only CD SAO write runs. This setting affects only CD SAO write runs.
Track 1 always has a pre-gap of at least 150 sectors. Further pre-gaps The first track automatically gets a pre-gap of at least 150 sectors. Its
are not mandatory for MMC compliance as long as track modes are not mixed. size may be enlarged by this call. Further pre-gaps are demanded by MMC
Mode mixing is currently not supported by libburn. for tracks which follow tracks of a different mode. (But Mode mixing in
CD SAO sessions is currently not supported by libburn.)
@param t The track to change @param t The track to change
@param size Number of sectors in the pre-gap. @param size Number of sectors in the pre-gap.
0 disables pre-gap, except for the first track. -1 disables pre-gap, except for the first track.
libburn allows 0, but MMC does not propose this.
@param flag Bitfield for control purposes. Unused yet. Submit 0. @param flag Bitfield for control purposes. Unused yet. Submit 0.
@return > 0 indicates success, <= 0 means failure @return > 0 indicates success, <= 0 means failure
@since 1.2.0 @since 1.2.0
*/ */
int burn_track_set_pregap_size(struct burn_track *t, int size, int flag); int burn_track_set_pregap_size(struct burn_track *t, int size, int flag);
/* ts B20111 */
/** Define whether a post-gap shall be written at the end of the track and
how many sectors this gap shall have. A post-gap occupies the range of
an additional index of the track. It contains zeros. No bytes from the
track source will be read for writing the post-gap.
This setting affects only CD SAO write runs.
MMC prescribes to add a post-gap to a data track which is followed by
a non-data track. (But libburn does not yet support mixed mode CD SAO
sessions.)
@param t The track to change
@param size Number of sectors in the post-gap.
-1 disables post-gap.
libburn allows 0, but MMC does not propose this.
@param flag Bitfield for control purposes. Unused yet. Submit 0.
@return > 0 indicates success, <= 0 means failure
@since 1.2.0
*/
int burn_track_set_postgap_size(struct burn_track *t, int size, int flag);
/* ts A61024 */ /* ts A61024 */
/** Define whether a track shall swap bytes of its input stream. /** Define whether a track shall swap bytes of its input stream.

View File

@ -159,6 +159,7 @@ burn_track_set_default_size;
burn_track_set_index; burn_track_set_index;
burn_track_set_isrc; burn_track_set_isrc;
burn_track_set_isrc_string; burn_track_set_isrc_string;
burn_track_set_postgap_size;
burn_track_set_pregap_size; burn_track_set_pregap_size;
burn_track_set_size; burn_track_set_size;
burn_track_set_source; burn_track_set_source;

View File

@ -594,6 +594,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x00020199 (SORRY,HIGH) = Text input file reading aborted 0x00020199 (SORRY,HIGH) = Text input file reading aborted
0x0002019a (SORRY,HIGH) = Bad track index number 0x0002019a (SORRY,HIGH) = Bad track index number
0x0002019b (SORRY,HIGH) = CD track number exceeds range of 1 to 99 0x0002019b (SORRY,HIGH) = CD track number exceeds range of 1 to 99
0x0002019c (FAILURE,HIGH) = Session has no defined tracks
libdax_audioxtr: libdax_audioxtr:

View File

@ -202,11 +202,13 @@ struct burn_track *burn_track_create(void)
/* ts B10103 */ /* ts B10103 */
t->end_on_premature_eoi = 0; t->end_on_premature_eoi = 0;
t->postgap = 0;
t->pregap1 = 0; t->pregap1 = 0;
t->pregap2 = 0; t->pregap2 = 0;
t->pregap2_size = 150; t->pregap2_size = 150;
t->postgap = 0;
t->postgap_size = 150;
/* ts A61024 */ /* ts A61024 */
t->swap_source_bytes = 0; t->swap_source_bytes = 0;
@ -481,11 +483,19 @@ int burn_track_clear_indice(struct burn_track *t, int flag)
/* ts B20110 API */ /* ts B20110 API */
int burn_track_set_pregap_size(struct burn_track *t, int size, int flag) int burn_track_set_pregap_size(struct burn_track *t, int size, int flag)
{ {
t->pregap2 = (size > 0); t->pregap2 = (size >= 0);
t->pregap2_size = size; t->pregap2_size = size;
return 1; return 1;
} }
/* ts B20111 API */
int burn_track_set_postgap_size(struct burn_track *t, int size, int flag)
{
t->postgap = (size >= 0);
t->postgap_size = size;
return 1;
}
int burn_track_get_sectors(struct burn_track *t) int burn_track_get_sectors(struct burn_track *t)
{ {
/* ts A70125 : was int */ /* ts A70125 : was int */

View File

@ -97,6 +97,11 @@ struct burn_track
/** The track contains a postgap */ /** The track contains a postgap */
int postgap; int postgap;
/* ts B20111 */
/** The number of sectors in post-gap, if .postgap is set */
int postgap_size;
struct isrc isrc; struct isrc isrc;
/* ts A61024 */ /* ts A61024 */

View File

@ -456,7 +456,7 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
int nwa) int nwa)
{ {
int i, m, s, f, form, pform, runtime = -150, ret, track_length; int i, m, s, f, form, pform, runtime = -150, ret, track_length;
int leadin_form, leadin_start, pregap = 150; int leadin_form, leadin_start, pregap = 150, postgap;
unsigned char ctladr, scms; unsigned char ctladr, scms;
struct burn_drive *d; struct burn_drive *d;
struct burn_toc_entry *e; struct burn_toc_entry *e;
@ -471,7 +471,12 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
int j; int j;
#endif #endif
if (ntr < 1) {
libdax_msgs_submit(libdax_messenger, -1, 0x0002019c,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Session has no defined tracks", 0, 0);
return NULL;
}
d = o->drive; d = o->drive;
@ -597,6 +602,20 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
pform = form; pform = form;
for (i = 0; i < ntr; i++) { for (i = 0; i < ntr; i++) {
/* ts A70125 :
Still not understanding the sense behind linking tracks,
i decided to at least enforce the MMC specs' minimum
track length.
*/
track_length = burn_track_get_sectors(tar[i]);
if (track_length < 300 && !burn_track_is_open_ended(tar[i])) {
track_length = 300;
if (!tar[i]->pad)
tar[i]->pad = 1;
burn_track_set_sectors(tar[i], track_length);
}
type_to_form(tar[i]->mode, &ctladr, &form); type_to_form(tar[i]->mode, &ctladr, &form);
if (tar[i]->mode & BURN_SCMS) if (tar[i]->mode & BURN_SCMS)
scms = 0x80; scms = 0x80;
@ -609,16 +628,33 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
if (ret <= 0) if (ret <= 0)
goto failed; goto failed;
} }
pregap = 0;
if (tar[i]->pregap2) if (tar[i]->pregap2)
pregap = tar[i]->pregap2_size; pregap = tar[i]->pregap2_size;
postgap = 0;
if (tar[i]->postgap) {
if (tar[i]->indices >= 99) {
libdax_msgs_submit(libdax_messenger, -1,
0x0002019a, LIBDAX_MSGS_SEV_SORRY,
LIBDAX_MSGS_PRIO_HIGH,
"Post-gap index number exceeds 99",
0, 0);
goto failed;
}
if (tar[i]->indices < 2)
tar[i]->indices = 2;
tar[i]->index[tar[i]->indices] = track_length;
postgap = tar[i]->postgap_size;
}
#ifdef Libburn_track_multi_indeX #ifdef Libburn_track_multi_indeX
for(j = 0; j < tar[i]->indices || j < 2; j++) { for(j = 0; j < (tar[i]->indices + !!tar[i]->postgap) || j < 2;
j++) {
if(tar[i]->index[j] == 0x7fffffff) { if(tar[i]->index[j] == 0x7fffffff) {
if (j > 1) if (j > 1)
break; break;
if (pregap <= 0) if (j == 0 && pregap <= 0)
continue; continue;
/* force existence of mandatory index */ /* force existence of mandatory index */
tar[i]->index[j] = 0; tar[i]->index[j] = 0;
@ -654,6 +690,8 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
pregap = 0; pregap = 0;
} }
runtime += track_length + postgap;
#else /* Libburn_track_multi_indeX */ #else /* Libburn_track_multi_indeX */
if (i == 0) { if (i == 0) {
@ -691,6 +729,10 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
Next one has to care for Post-gap: table 555 in mmc5r03c.pdf does not Next one has to care for Post-gap: table 555 in mmc5r03c.pdf does not
show any although 6.33.3.19 would prescribe some. show any although 6.33.3.19 would prescribe some.
ts B20111: Table 1 of MMC-1 shows two post-gaps. The first matches the
precriptions with SEND CUE SHEET. The second one is riddling.
Both are part of a track and occupy the range of the last index
of the track. Length is 2 seconds for each.
Nobody seems to have ever tested this situation, up to now. Nobody seems to have ever tested this situation, up to now.
It is banned for now in burn_disc_write(). It is banned for now in burn_disc_write().
@ -715,23 +757,11 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
if (ret <= 0) if (ret <= 0)
goto failed; goto failed;
runtime += track_length;
#endif /* ! Libburn_track_multi_indeX */ #endif /* ! Libburn_track_multi_indeX */
/* ts A70125 :
Still not understanding the sense behind linking tracks,
i decided to at least enforce the MMC specs' minimum
track length.
*/
track_length = burn_track_get_sectors(tar[i]);
if (track_length < 300 && !burn_track_is_open_ended(tar[i])) {
track_length = 300;
if (!tar[i]->pad)
tar[i]->pad = 1;
burn_track_set_sectors(tar[i], track_length);
}
runtime += track_length;
/* if we're padding, we'll clear any current shortage. /* if we're padding, we'll clear any current shortage.
if we're not, we'll slip toc entries by a sector every time our if we're not, we'll slip toc entries by a sector every time our
shortage is more than a sector shortage is more than a sector
@ -1174,9 +1204,9 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
} }
if (t->postgap) if (t->postgap)
for (i = 0; i < 150; i++) for (i = 0; i < t->postgap_size; i++)
if (!sector_postgap(o, t->entry->point, t->entry->control, if (!sector_postgap(o, t->entry->point,
t->mode)) t->entry->control, t->mode))
{ ret = 0; goto ex; } { ret = 0; goto ex; }
i = t->offset; i = t->offset;
if (o->write_type == BURN_WRITE_SAO) { if (o->write_type == BURN_WRITE_SAO) {