From d4c4430a401b1089633186697c7096dc983aaeed Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 10 Jan 2012 12:20:23 +0000 Subject: [PATCH] New API call burn_track_set_pregap_size() --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/libburn.h | 43 ++++++++++++++++++++++++++----------- libburn/libburn.ver | 1 + libburn/structure.c | 8 +++++++ libburn/structure.h | 5 +++++ libburn/write.c | 27 ++++++++++++----------- 6 files changed, 61 insertions(+), 25 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 149d75c..488d356 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2012.01.08.191443" +#define Cdrskin_timestamP "2012.01.10.122000" diff --git a/libburn/libburn.h b/libburn/libburn.h index 26a0791..41aed5f 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -1935,7 +1935,7 @@ int burn_session_remove_track(struct burn_session *s, struct burn_track *t); /* ts B20107 */ /** Set the number which shall be written as CD track number with the first track of the session. The following tracks will then get written with - consequtive CD track numbers. The resulting number of the last track + consecutive CD track numbers. The resulting number of the last track must not exceed 99. The lowest possible start number is 1, which is also the default. This setting applies only to CD SAO writing. @param session The session to be manipulated @@ -2270,16 +2270,6 @@ void burn_track_define_data(struct burn_track *t, int offset, int tail, int pad, int mode); -/* ts A61024 */ -/** Define whether a track shall swap bytes of its input stream. - @param t The track to change - @param swap_source_bytes 0=do not swap, 1=swap byte pairs - @return 1=success , 0=unacceptable value - @since 0.2.6 -*/ -int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes); - - /* ts B11206 */ /** Attach text or binary data as CD-TEXT attributes to a track. The payload will be used to generate CD-TEXT packs by @@ -2427,12 +2417,41 @@ int burn_track_set_index(struct burn_track *t, int index_number, after the end of their predecessor. @param t The track to be manipulated @param flag Bitfield for control purposes. Unused yet. Submit 0. - @return i > 0 indicates success, <= 0 means failure + @return > 0 indicates success, <= 0 means failure @since 1.2.0 */ int burn_track_clear_indice(struct burn_track *t, int flag); +/* ts B20110 */ +/** 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 + index 0 and contains zeros resp. silence. No bytes from the track source + will be read for writing the pre-gap. + This setting affects only CD SAO write runs. + Track 1 always has a pre-gap of at least 150 sectors. Further pre-gaps + are not mandatory for MMC compliance as long as track modes are not mixed. + Mode mixing is currently not supported by libburn. + @param t The track to change + @param size Number of sectors in the pre-gap. + 0 disables pre-gap, except for the first track. + @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_pregap_size(struct burn_track *t, int size, int flag); + + +/* ts A61024 */ +/** Define whether a track shall swap bytes of its input stream. + @param t The track to change + @param swap_source_bytes 0=do not swap, 1=swap byte pairs + @return 1=success , 0=unacceptable value + @since 0.2.6 +*/ +int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes); + + /** Hide the first track in the "pre gap" of the disc @param s session to change @param onoff 1 to enable hiding, 0 to disable diff --git a/libburn/libburn.ver b/libburn/libburn.ver index 26e438b..9ea9601 100644 --- a/libburn/libburn.ver +++ b/libburn/libburn.ver @@ -159,6 +159,7 @@ burn_track_set_default_size; burn_track_set_index; burn_track_set_isrc; burn_track_set_isrc_string; +burn_track_set_pregap_size; burn_track_set_size; burn_track_set_source; burn_version; diff --git a/libburn/structure.c b/libburn/structure.c index f4bedf7..cec9182 100644 --- a/libburn/structure.c +++ b/libburn/structure.c @@ -203,6 +203,7 @@ struct burn_track *burn_track_create(void) t->postgap = 0; t->pregap1 = 0; t->pregap2 = 0; + t->pregap2_size = 150; /* ts A61024 */ t->swap_source_bytes = 0; @@ -475,6 +476,13 @@ int burn_track_clear_indice(struct burn_track *t, int flag) return 1; } +/* ts B20110 API */ +int burn_track_set_pregap_size(struct burn_track *t, int size, int flag) +{ + t->pregap2 = (size > 0); + t->pregap2_size = size; + return 1; +} int burn_track_get_sectors(struct burn_track *t) { diff --git a/libburn/structure.h b/libburn/structure.h index d3ad151..3da99b0 100644 --- a/libburn/structure.h +++ b/libburn/structure.h @@ -90,6 +90,11 @@ struct burn_track int pregap1; /** The track contains interval two of a pregap */ int pregap2; + + /* ts B20110 */ + /** The number of sectors in pre-gap 2, if .pregap2 is set */ + int pregap2_size; + /** The track contains a postgap */ int postgap; struct isrc isrc; diff --git a/libburn/write.c b/libburn/write.c index 113111f..8a9227a 100644 --- a/libburn/write.c +++ b/libburn/write.c @@ -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 #ifdef Libburn_write_with_function_print_cuE @@ -333,14 +334,20 @@ static void print_cue(struct cue_sheet *sheet) unit[7] == 0 ? ' ' : cue_printify(unit[7])); } else if ((unit[0] & 0xf) == 3) { printf( - " %1X %1X | %02X | | | | | %c%c%c%c%c%c\n", + " %1X %1X | %2d | | | | | %c%c%c%c%c%c\n", (unit[0] & 0xf0) >> 4, unit[0] & 0xf, unit[1], cue_printify(unit[2]), cue_printify(unit[3]), cue_printify(unit[4]), cue_printify(unit[5]), cue_printify(unit[6]), cue_printify(unit[7])); + } else if (unit[1] > 99) { + printf(" %1X %1X |0x%02X| %02X | %02X | %02X |", + (unit[0] & 0xf0) >> 4, unit[0] & 0xf, + unit[1], unit[2], unit[3], unit[4]); + printf(" %02d:%02d:%02d |\n", + unit[5], unit[6], unit[7]); } else { - printf(" %1X %1X | %02X | %02X | %02X | %02X |", + printf(" %1X %1X | %2d | %02X | %02X | %02X |", (unit[0] & 0xf0) >> 4, unit[0] & 0xf, unit[1], unit[2], unit[3], unit[4]); printf(" %02d:%02d:%02d |\n", @@ -585,14 +592,10 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o, e[2].control = e[1].control; e[2].adr = 1; - /* ts A70121 : The pause before the first track is not really Pre-gap. - To count it as part 2 of a Pre-gap is a dirty hack. It also seems - to have caused confusion in dealing with part 1 of an eventual - real Pre-gap. mmc5r03c.pdf 6.33.3.2, 6.33.3.18 . - ts B20103 : It is not really Pre-gap with audio tracks. - */ tar[0]->pregap2 = 1; - pregap = 150; + if (tar[0]->pregap2_size < 150) + tar[0]->pregap2_size = 150; + pregap = tar[0]->pregap2_size; pform = form; for (i = 0; i < ntr; i++) { @@ -1057,7 +1060,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s, if (t->pregap1) d->rlba += 75; if (t->pregap2) - d->rlba += 150; + d->rlba += t->pregap2_size; if (t->pregap1) { @@ -1087,7 +1090,7 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s, { ret = 0; goto ex; } } if (t->pregap2) - for (i = 0; i < 150; i++) + for (i = 0; i < t->pregap2_size; i++) if (!sector_pregap(o, t->entry->point, t->entry->control, t->mode)) { ret = 0; goto ex; } @@ -2890,7 +2893,7 @@ return crap. so we send the command, then ignore the result. #ifdef Libburn_write_with_function_print_cuE print_cue(sheet); - /* goto fail_wo_sync; */ + goto fail_wo_sync; #endif /* Libburn_write_with_function_print_cuE */ ret = 1;