From 9623a04ce9a824e14ceeb3f6cde11dfd4cc709ab Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 12 Jan 2012 12:03:47 +0000 Subject: [PATCH] Interpreting .cue file command POSTGAP --- cdrskin/cdrskin.1 | 4 +- cdrskin/cdrskin_timestamp.h | 2 +- doc/cdtext.txt | 5 +-- libburn/libburn.h | 23 ++++++------ libburn/structure.c | 73 ++++++++++++++++++++++--------------- 5 files changed, 61 insertions(+), 46 deletions(-) diff --git a/cdrskin/cdrskin.1 b/cdrskin/cdrskin.1 index a7a060b..44119cc 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 11, 2012" +.TH CDRSKIN 1 "Jan 12, 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 command POSTGAP. +not be mixed. Data source may be of FILE type BINARY, MOTOROLA, or WAVE. .br Non-CDRWIN commands ARRANGER, COMPOSER, MESSAGE are supported. diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 6dcab80..b155923 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2012.01.12.084429" +#define Cdrskin_timestamP "2012.01.12.120316" diff --git a/doc/cdtext.txt b/doc/cdtext.txt index 6a95b2e..258c083 100644 --- a/doc/cdtext.txt +++ b/doc/cdtext.txt @@ -112,7 +112,7 @@ The two binary bytes form a big-endian index to the following list. Sony documents the cleartext part as "Genre information that would supplement the Genre Code, such as 'USA Rock music in the 60s'". Always ASCII encoded. -Pack type 0x88 records information from the CDs Table of Content, as of +Pack type 0x88 records information from the CD's Table of Content, as of READ PMA/TOC/ATIP Format 0010b (mmc5r03c.pdf, table 490 TOC Track Descriptor Format, Q Sub-channel). See below, Format of CD-TEXT packs, for more details about the content of @@ -682,9 +682,8 @@ TITLE "Joyful Nights" -------------------------------------- -Several restrictions apply in the libburn call burn_session_by_cue_file(): +Some restrictions apply in the libburn call burn_session_by_cue_file(): -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/libburn.h b/libburn/libburn.h index 1a7b7e7..028f0c7 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -1867,17 +1867,18 @@ 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/ ->>> fully supported commands: CATALOG CDTEXTFILE FLAGS INDEX ISRC PERFORMER REM ->>> SONGWRITER TITLE ->>> supported commands introduced by cdrecord: ARRANGER COMPOSER MESSAGE ->>> partly supported commands: FILE TRACK ->>> supported FILE types: BINARY MOTOROLA WAVE ->>> supported TRACK datatypes: AUDIO MODE1/2048 ->>> ignored commands: POSTGAP PREGAP ->>> not allowed: mixing of AUDIO and MODE1/2048 ->>> not allowed: unsupported FILE types ->>> not allowed: unsupported TRACK datatypes ->>> + Fully supported commands are: + CATALOG , CDTEXTFILE , FLAGS , INDEX , ISRC , PERFORMER , + POSTGAP , PREGAP , REM , SONGWRITER , TITLE + Further supported commands introduced by cdrecord (usage like PERFORMER): + ARRANGER , COMPOSER , MESSAGE + Partly supported commands are: + FILE which supports only types BINARY , MOTOROLA , WAVE + TRACK which supports only datatypes AUDIO , MODE1/2048 + Unsupported types of FILE or TRACK lead to failure of the call. + libburn does not yet support mixing of AUDIO and MODE1/2048. So this call + will fail if such a mix is found. + Empty lines and lines which start by '#' are ignored. @param session Session where to attach tracks. It must not yet have tracks or else this call will fail. @param path Filesystem address of the CDRWIN cue sheet file. diff --git a/libburn/structure.c b/libburn/structure.c index 9c13560..9c25335 100644 --- a/libburn/structure.c +++ b/libburn/structure.c @@ -1500,6 +1500,28 @@ ex:; return ret; } +static int cue_check_for_track(struct burn_cue_file_cursor *crs, char *cmd, + int flag) +{ + int ret; + char *msg = NULL; + + if (crs->track == NULL) { + BURN_ALLOC_MEM(msg, char, 4096); + sprintf(msg, "In cue sheet file: %s found before TRACK", + cmd); + libdax_msgs_submit(libdax_messenger, -1, 0x00020192, + LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH, + msg, 0, 0); + ret = 0; goto ex; + } + 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) { @@ -1634,13 +1656,9 @@ 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; - } + ret = cue_check_for_track(crs, cmd, 0); + if (ret <= 0) + goto ex; while (*apt) { if (strncmp(apt, "DCP", 3) == 0) { crs->track_mode |= BURN_COPY; @@ -1679,14 +1697,9 @@ bad_flags:; burn_track_define_data(crs->track, 0, 0, 1, crs->track_mode); } else if (strcmp(cmd, "INDEX") == 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_check_for_track(crs, cmd, 0); + if (ret <= 0) + goto ex; ret = cue_read_number(&apt, &index_no, 0); if (ret <= 0) goto ex; @@ -1776,6 +1789,9 @@ overlapping_ba:; crs->track_has_source = 1; } else if (strcmp(cmd, "ISRC") == 0) { + ret = cue_check_for_track(crs, cmd, 0); + if (ret <= 0) + goto ex; ret = cue_set_cdtext(session, crs->track, 0x8e, apt, crs, 1 | 2); if (ret <= 0) @@ -1797,22 +1813,21 @@ overlapping_ba:; goto ex; } else if (strcmp(cmd, "POSTGAP") == 0) { - - /* >>> ??? implement ? */; - - libdax_msgs_submit(libdax_messenger, -1, 0x00020195, - LIBDAX_MSGS_SEV_WARNING, LIBDAX_MSGS_PRIO_HIGH, - "In cue sheet file: POSTGAP command not supported", - 0, 0); + ret = cue_check_for_track(crs, cmd, 0); + if (ret <= 0) + goto ex; + ret = cue_read_timepoint_lba(apt, "post-gap duration", + &file_ba, 0); + if (ret <= 0) + goto ex; + ret = burn_track_set_postgap_size(crs->track, file_ba, 0); + if (ret <= 0) + goto ex; } else if (strcmp(cmd, "PREGAP") == 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_check_for_track(crs, cmd, 0); + if (ret <= 0) + goto ex; ret = cue_read_timepoint_lba(apt, "pre-gap duration", &file_ba, 0); if (ret <= 0)