From 0c3fa9b341b210ab7ffc98bb84b06f16a97a5dd7 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 1 Jan 2012 12:46:50 +0000 Subject: [PATCH] Interpreting CDRWIN command FLAGS --- cdrskin/cdrskin_timestamp.h | 2 +- doc/cdtext.txt | 9 ++++--- libburn/libburn.h | 13 ++++++---- libburn/structure.c | 52 ++++++++++++++++++++++++++++++++++--- 4 files changed, 63 insertions(+), 13 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index c7a77f7..0209053 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2012.01.01.124424" +#define Cdrskin_timestamP "2012.01.01.124645" diff --git a/doc/cdtext.txt b/doc/cdtext.txt index 8c887a6..8bf0249 100644 --- a/doc/cdtext.txt +++ b/doc/cdtext.txt @@ -643,18 +643,21 @@ CATALOG 1234567890123 FILE "cdtext.bin" BINARY TITLE "Joyful Nights" TRACK 01 AUDIO + FLAGS DCP 4CH PRE TITLE "Song of Joy" PERFORMER "Felix and The Purrs" SONGWRITER "Friedrich Schiller" ISRC XYBLG1101234 INDEX 01 00:00:00 TRACK 02 AUDIO + FLAGS DCP TITLE "Humpty Dumpty" PERFORMER "Catwalk Beauties" SONGWRITER "Mother Goose" ISRC XYBLG1100005 INDEX 01 08:20:12 TRACK 03 AUDIO + FLAGS DCP TITLE "Mee Owwww" PERFORMER "Mia Kitten" SONGWRITER "Mia Kitten" @@ -665,13 +668,13 @@ TITLE "Joyful Nights" Several restrictions apply in the libburn call burn_session_by_cue_file(): -Commands FLAGS, POSTGAP, PREGAP are ignored. Only FILE types BINARY, MOTOROLA -are allowed. Only TRACK datatypes AUDIO, MODE1/2048 are allowed. They may not +Commands POSTGAP, PREGAP are ignored. Only FILE types BINARY, MOTOROLA are +allowed. Only TRACK datatypes AUDIO, MODE1/2048 are allowed. They may not be mixed in the same session. INDEX numbers 00, 02 to 99 are ignored. ------------------------------------------------------------------------------- -This text is copyright 2011 Thomas Schmitt . +This text is copyright 2011 - 2012 Thomas Schmitt . Permission is granted to copy, modify, and distribute it, as long as the references to the original information sources are maintained. There is NO WARRANTY, to the extent permitted by law. diff --git a/libburn/libburn.h b/libburn/libburn.h index 3831df2..0ebfcf8 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2011 Thomas Schmitt + Copyright (c) 2006 - 2012 Thomas Schmitt Provided under GPL version 2 or later. This is the official API definition of libburn. @@ -123,6 +123,8 @@ struct burn_write_opts; /* ts B11230 */ /** Track mode modifier - Serial Copy Management System, SAO only + If this is set and BURN_COPY is not set, then copying the emerging + track will be forbidden. @since 1.2.0 */ #define BURN_SCMS (1 << 13) @@ -1862,18 +1864,19 @@ int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s); CD-TEXT according to the content of the file. For a description of CDRWIN file format see http://digitalx.org/cue-sheet/syntax/ ->>> supported commands: CATALOG CDTEXTFILE ISRC PERFORMER REM SONGWRITER TITLE +>>> fully supported commands: CATALOG CDTEXTFILE FLAGS ISRC PERFORMER REM +>>> SONGWRITER TITLE >>> partly supported commands: FILE INDEX TRACK >>> supported FILE types: BINARY MOTOROLA ->>> supported FLAGS: >>> supported TRACK datatypes: AUDIO MODE1/2048 ->>> ignored commands: POSTGAP PREGAP FLAGS +>>> ignored commands: POSTGAP PREGAP >>> ignored INDEX numbers: 00, 02 to 99 ->>> ignored FLAGS: DCP 4CH PRE SCMS >>> not allowed: mixing of ADUIO and MODE1/2048 >>> not allowed: unsupported FILE types >>> not allowed: unsupported TRACK datatypes >>> +>>> man cdrecord documents further commands: +>>> ARRANGER COMPOSER MESSAGE >>> @param session Session where to attach tracks. It must not yet have tracks or else this call will fail. diff --git a/libburn/structure.c b/libburn/structure.c index f651e8b..cb4a121 100644 --- a/libburn/structure.c +++ b/libburn/structure.c @@ -1,6 +1,6 @@ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2011 Thomas Schmitt + Copyright (c) 2006 - 2012 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -1028,6 +1028,7 @@ struct burn_cue_file_cursor { int track_has_source; int block_size; int block_size_locked; + int track_mode; int flags; }; @@ -1058,6 +1059,7 @@ static int cue_crs_new(struct burn_cue_file_cursor **reply, int flag) crs->track_has_source = 0; crs->block_size = 0; crs->block_size_locked = 0; + crs->track_mode = 0; crs->flags = 0; *reply = crs; @@ -1266,7 +1268,7 @@ 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 block_size; + int block_size, step; off_t size; char *cmd, *apt, *msg = NULL, msf[3], *msf_pt, *cpt, *filetype; struct burn_source *src, *inp_src; @@ -1388,8 +1390,49 @@ not_usable_file:; goto ex; } else if (strcmp(cmd, "FLAGS") == 0) { + if (crs->track == NULL) { + libdax_msgs_submit(libdax_messenger, -1, 0x00020192, + LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH, + "In cue sheet file: FLAGS found before TRACK", + 0, 0); + ret = 0; goto ex; + } + while (*apt) { + if (strncmp(apt, "DCP", 3) == 0) { + crs->track_mode |= BURN_COPY; + step = 3; + } else if (strncmp(apt, "4CH", 3) == 0) { + crs->track_mode |= BURN_4CH; + step = 3; + } else if (strncmp(apt, "PRE", 3) == 0) { + crs->track_mode |= BURN_PREEMPHASIS; + step = 3; + } else if (strncmp(apt, "SCMS", 4) == 0) { + crs->track_mode |= BURN_SCMS; + step = 4; + } else { +bad_flags:; + for (cpt = apt; + *cpt != 32 && *cpt != 9 && *cpt != 0; cpt++); + *cpt = 0; + sprintf(msg, + "In cue sheet file: Unknown FLAGS option '%.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; + } - /* >>> Interpret DCP 4CH PRE SCMS into crs->flags */; + /* Look for start of next word */ + if (apt[step] != 0 && apt[step] != 32 && + apt[step] != 9) + goto bad_flags; + for (apt += step; *apt == 32 || *apt == 9; apt++); + } + burn_track_define_data(crs->track, 0, 0, 1, crs->track_mode); } else if (strcmp(cmd, "INDEX") == 0) { if (crs->track == NULL) { @@ -1608,8 +1651,9 @@ overlapping_ba:; if (crs->track == NULL) goto out_of_mem; crs->track_has_source = 0; + crs->track_mode = mode; burn_track_define_data(crs->track, 0, 0, 1, mode); - if (mode == BURN_AUDIO) + if (mode & BURN_AUDIO) burn_track_set_byte_swap(crs->track, !!crs->swap_audio_bytes);