From 5cd7b09d5cc00720a0b56ea22f1abcec713b0d00 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 11 Jan 2012 12:22:52 +0000 Subject: [PATCH] Interpreting .cue file command PREGAP --- cdrskin/cdrskin.1 | 6 +-- cdrskin/cdrskin_timestamp.h | 2 +- doc/cdtext.txt | 2 +- libburn/structure.c | 98 +++++++++++++++++++++++-------------- 4 files changed, 65 insertions(+), 43 deletions(-) diff --git a/cdrskin/cdrskin.1 b/cdrskin/cdrskin.1 index 851a15b..a7a060b 100644 --- a/cdrskin/cdrskin.1 +++ b/cdrskin/cdrskin.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH CDRSKIN 1 "Jan 08, 2012" +.TH CDRSKIN 1 "Jan 11, 2012" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -508,7 +508,7 @@ To enable CD-TEXT from the cue sheet file, cdrskin option -text has to be present. .br cdrskin currently supports TRACK datatypes AUDIO and MODE1/2048 which may -not be mixed. It ignores commands POSTGAP and PREGAP. +not be mixed. It ignores command POSTGAP. Data source may be of FILE type BINARY, MOTOROLA, or WAVE. .br Non-CDRWIN commands ARRANGER, COMPOSER, MESSAGE are supported. @@ -987,7 +987,7 @@ taken as plain block number with block size 2048 byte. .BI cd_start_tno= number 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. .br diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 3f14599..9760d87 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2012.01.11.122013" +#define Cdrskin_timestamP "2012.01.11.122158" diff --git a/doc/cdtext.txt b/doc/cdtext.txt index 935b8c9..6a95b2e 100644 --- a/doc/cdtext.txt +++ b/doc/cdtext.txt @@ -684,7 +684,7 @@ TITLE "Joyful Nights" Several restrictions apply in the libburn call burn_session_by_cue_file(): -Commands POSTGAP, PREGAP are ignored. +Command POSTGAP gets ignored. Only FILE types BINARY, MOTOROLA, WAVE are allowed. Only TRACK datatypes AUDIO, MODE1/2048 are allowed. They may not be mixed in the same session. diff --git a/libburn/structure.c b/libburn/structure.c index cec9182..cf7052f 100644 --- a/libburn/structure.c +++ b/libburn/structure.c @@ -1420,13 +1420,55 @@ ex:; } +static int cue_read_timepoint_lba(char *apt, char *purpose, int *file_ba, + int flag) +{ + int ret, minute, second, frame; + char *msg = NULL, msf[3], *msf_pt; + + BURN_ALLOC_MEM(msg, char, 4096); + if (strlen(apt) < 8) { +no_time_point:; + sprintf(msg, + "Inappropriate cue sheet file %s '%.4000s'", + purpose, apt); + libdax_msgs_submit(libdax_messenger, -1, 0x00020194, + LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH, + burn_printify(msg), 0, 0); + ret = 0; goto ex; + } + if (apt[2] != ':' || apt[5] != ':' || + (apt[8] != 0 && apt[8] != 32 && apt[8] != 9)) + goto no_time_point; + msf[2] = 0; + msf_pt = msf; + strncpy(msf, apt, 2); + ret = cue_read_number(&msf_pt, &minute, 1); + if (ret <= 0) + goto ex; + strncpy(msf, apt + 3, 2); + ret = cue_read_number(&msf_pt, &second, 1); + if (ret <= 0) + goto ex; + strncpy(msf, apt + 6, 2); + ret = cue_read_number(&msf_pt, &frame, 1); + if (ret <= 0) + goto ex; + + *file_ba = ((minute * 60) + second ) * 75 + frame; + ret = 1; +ex:; + BURN_FREE_MEM(msg); + return ret; +} + static int cue_interpret_line(struct burn_session *session, char *line, struct burn_cue_file_cursor *crs, int flag) { - int ret, mode, index_no, minute, second, frame, file_ba, chunks; + int ret, mode, index_no, file_ba, chunks; int block_size, step, audio_xtr = 0; off_t size; - char *cmd, *apt, *msg = NULL, msf[3], *msf_pt, *cpt, *filetype; + char *cmd, *apt, *msg = NULL, *cpt, *filetype; struct burn_source *src, *inp_src; enum burn_source_status source_status; struct stat stbuf; @@ -1610,37 +1652,10 @@ bad_flags:; ret = cue_read_number(&apt, &index_no, 0); if (ret <= 0) goto ex; - - /* Obtain time point */ - if (strlen(apt) < 8) { -no_time_point:; - sprintf(msg, - "Inappropriate cue sheet file index time point '%.4000s'", - apt); - libdax_msgs_submit(libdax_messenger, -1, 0x00020194, - LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH, - burn_printify(msg), 0, 0); - ret = 0; goto ex; - } - if (apt[2] != ':' || apt[5] != ':' || - (apt[8] != 0 && apt[8] != 32 && apt[8] != 9)) - goto no_time_point; - msf[2] = 0; - msf_pt = msf; - strncpy(msf, apt, 2); - ret = cue_read_number(&msf_pt, &minute, 1); + ret = cue_read_timepoint_lba(apt, "index time point", + &file_ba, 0); if (ret <= 0) goto ex; - strncpy(msf, apt + 3, 2); - ret = cue_read_number(&msf_pt, &second, 1); - if (ret <= 0) - goto ex; - strncpy(msf, apt + 6, 2); - ret = cue_read_number(&msf_pt, &frame, 1); - if (ret <= 0) - goto ex; - - file_ba = ((minute * 60) + second ) * 75 + frame; if (file_ba < crs->prev_file_ba) { overlapping_ba:; libdax_msgs_submit(libdax_messenger, -1, 0x00020192, @@ -1753,13 +1768,20 @@ overlapping_ba:; 0, 0); } else if (strcmp(cmd, "PREGAP") == 0) { - - /* >>> ??? implement ? */; - - libdax_msgs_submit(libdax_messenger, -1, 0x00020195, - LIBDAX_MSGS_SEV_WARNING, LIBDAX_MSGS_PRIO_HIGH, - "In cue sheet file: PREGAP command not supported", - 0, 0); + if (crs->track == NULL) { + libdax_msgs_submit(libdax_messenger, -1, 0x00020192, + LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH, + "In cue sheet file: INDEX found before TRACK", + 0, 0); + ret = 0; goto ex; + } + ret = cue_read_timepoint_lba(apt, "pre-gap duration", + &file_ba, 0); + if (ret <= 0) + goto ex; + ret = burn_track_set_pregap_size(crs->track, file_ba, 0); + if (ret <= 0) + goto ex; } else if (strcmp(cmd, "REM") == 0) { ;