Interpreting .cue file command PREGAP

This commit is contained in:
Thomas Schmitt 2012-01-11 12:22:52 +00:00
parent 890b3a6953
commit 0d83999614
4 changed files with 65 additions and 43 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" 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. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" 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. present.
.br .br
cdrskin currently supports TRACK datatypes AUDIO and MODE1/2048 which may 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. Data source may be of FILE type BINARY, MOTOROLA, or WAVE.
.br .br
Non-CDRWIN commands ARRANGER, COMPOSER, MESSAGE are supported. 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 .BI cd_start_tno= number
Set the number which shall be written as CD track number with the first 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 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 must not exceed 99. The lowest possible start number is 1, which is also
the default. the default.
.br .br

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2012.01.11.122013" #define Cdrskin_timestamP "2012.01.11.122158"

View File

@ -684,7 +684,7 @@ TITLE "Joyful Nights"
Several restrictions apply in the libburn call burn_session_by_cue_file(): 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 FILE types BINARY, MOTOROLA, WAVE are allowed.
Only TRACK datatypes AUDIO, MODE1/2048 are allowed. They may not be mixed in Only TRACK datatypes AUDIO, MODE1/2048 are allowed. They may not be mixed in
the same session. the same session.

View File

@ -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, static int cue_interpret_line(struct burn_session *session, char *line,
struct burn_cue_file_cursor *crs, int flag) 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; int block_size, step, audio_xtr = 0;
off_t size; 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; struct burn_source *src, *inp_src;
enum burn_source_status source_status; enum burn_source_status source_status;
struct stat stbuf; struct stat stbuf;
@ -1610,37 +1652,10 @@ bad_flags:;
ret = cue_read_number(&apt, &index_no, 0); ret = cue_read_number(&apt, &index_no, 0);
if (ret <= 0) if (ret <= 0)
goto ex; goto ex;
ret = cue_read_timepoint_lba(apt, "index time point",
/* Obtain time point */ &file_ba, 0);
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);
if (ret <= 0) if (ret <= 0)
goto ex; 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) { if (file_ba < crs->prev_file_ba) {
overlapping_ba:; overlapping_ba:;
libdax_msgs_submit(libdax_messenger, -1, 0x00020192, libdax_msgs_submit(libdax_messenger, -1, 0x00020192,
@ -1753,13 +1768,20 @@ overlapping_ba:;
0, 0); 0, 0);
} else if (strcmp(cmd, "PREGAP") == 0) { } else if (strcmp(cmd, "PREGAP") == 0) {
if (crs->track == NULL) {
/* >>> ??? implement ? */; libdax_msgs_submit(libdax_messenger, -1, 0x00020192,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
libdax_msgs_submit(libdax_messenger, -1, 0x00020195, "In cue sheet file: INDEX found before TRACK",
LIBDAX_MSGS_SEV_WARNING, LIBDAX_MSGS_PRIO_HIGH, 0, 0);
"In cue sheet file: PREGAP command not supported", ret = 0; goto ex;
0, 0); }
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) { } else if (strcmp(cmd, "REM") == 0) {
; ;