From 67ae1413e3ffe5378ab7f263f8f544959069ab7c Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 27 Dec 2011 11:56:54 +0000 Subject: [PATCH] New API call burn_track_set_isrc_string() --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/libburn.h | 59 +++++++++++++++++++++++++++++-------- libburn/libburn.ver | 1 + libburn/structure.c | 54 ++++++++++++++++++++++++++++----- libburn/structure.h | 2 ++ 5 files changed, 98 insertions(+), 20 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 4e9e8eb..b3d48b6 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2011.12.25.110440" +#define Cdrskin_timestamP "2011.12.27.115645" diff --git a/libburn/libburn.h b/libburn/libburn.h index 1678f50..b0e2394 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -1862,7 +1862,8 @@ int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s); >>> supported TRACK datatypes: AUDIO MODE1/2048 >>> ignored commands: POSTGAP PREGAP FLAGS >>> ignored INDEX numbers: 00, 02 to 99 ->>> ignored CUE SHEET features: CATALOG and ISRC (but supported as CD-TEXT) +>>> ignored CUE SHEET features: CATALOG and ISRC +>>> (not yet transmitted by mode page 5) >>> ignored FLAGS: DCP 4CH PRE SCMS >>> not allowed: mixing of ADUIO and MODE1/2048 >>> not allowed: unsupported FILE types @@ -1891,6 +1892,8 @@ int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s); @param flag Bitfield for control purposes. bit0= Do not attach CD-TEXT information to session and tracks. Do not load text_packs. + bit1= Do not use media catalog string of session or ISRC + strings of tracks for writing to Q sub-channel. @return > 0 indicates success, <= 0 indicates failure @since 1.2.0 */ @@ -2144,13 +2147,15 @@ int burn_session_get_cdtext(struct burn_session *s, int block, burn_session_set_cdtext() and burn_track_set_cdtext(). It can later be overridden by said function calls. The format of a v07t sheet file is documented in doc/cdtext.txt. - @param s Session where to attach CD-TEXT attributes - @param path Local filesystem address of the sheet file which - shall be read and interpreted. - @param block Number of the language block in which the attributes - shall appear. Possible values: 0 to 7. - @param flag Bitfield for control purposes. Unused yet. Submit 0. - @return > 0 indicates success , <= 0 is failure + @param s Session where to attach CD-TEXT attributes + @param path Local filesystem address of the sheet file which + shall be read and interpreted. + @param block Number of the language block in which the attributes + shall appear. Possible values: 0 to 7. + @param flag Bitfield for control purposes. + bit1= Do not use media catalog string of session or ISRC + strings of tracks for writing to Q sub-channel. + @return > 0 indicates success , <= 0 is failure @since 1.2.0 */ int burn_session_input_sheet_v07t(struct burn_session *session, @@ -2214,7 +2219,7 @@ int burn_session_dispose_cdtext(struct burn_session *s, int block); @since 1.2.0 */ int burn_cdtext_from_packfile(char *path, unsigned char **text_packs, - int *num_packs, int flag); + int *num_packs, int flag); /** Define the data in a track @@ -2328,7 +2333,8 @@ int burn_track_dispose_cdtext(struct burn_track *t, int block); int burn_track_set_cdxa_conv(struct burn_track *t, int value); -/** Set the ISRC details for a track +/** Set the ISRC details for a track. When writing to CD media, ISRC will get + written into the Q sub-channel. @param t The track to change @param country the 2 char country code. Each character must be only numbers or letters. @@ -2340,11 +2346,25 @@ int burn_track_set_cdxa_conv(struct burn_track *t, int value); void burn_track_set_isrc(struct burn_track *t, char *country, char *owner, unsigned char year, unsigned int serial); +/* ts B11226 */ +/** Set the composed ISRC string for a track. This is an alternative to + burn_track_set_isrc(). + @param t The track to be manipulated + @param isrc 12 characters which are composed from ISRC details. + Format is CCOOOYYSSSSS, terminated by a 0-byte: + Country, Owner, Year(decimal digits), Serial(decimal digits). + @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_isrc_string(struct burn_track *t, char isrc[13], int flag); + /** Disable ISRC parameters for a track @param t The track to change */ void burn_track_clear_isrc(struct burn_track *t); + /** 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 @@ -2801,9 +2821,24 @@ int burn_write_opts_set_underrun_proof(struct burn_write_opts *opts, */ void burn_write_opts_set_perform_opc(struct burn_write_opts *opts, int opc); -void burn_write_opts_set_has_mediacatalog(struct burn_write_opts *opts, int has_mediacatalog); -void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts, unsigned char mediacatalog[13]); +/** The Q sub-channel of a CD may contain a Media Catalog Number of 13 decimal + digits. This call sets the string of digits, but does not yet activate it + for writing. + @param opts The write opts to change + @param mediacatalog The 13 decimal digits as ASCII bytes. I.e. '0' = 0x30. +*/ +void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts, + unsigned char mediacatalog[13]); + +/** This call activates the Media Catalog Number for writing. The digits of + that number have to be set by call burn_write_opts_set_mediacatalog(). + @param opts The write opts to change + @param has_mediacatalog 1= activate writing of catalog to Q sub-channel + 0= deactivate it +*/ +void burn_write_opts_set_has_mediacatalog(struct burn_write_opts *opts, + int has_mediacatalog); /* ts A61106 */ diff --git a/libburn/libburn.ver b/libburn/libburn.ver index 9f8abb6..a486569 100644 --- a/libburn/libburn.ver +++ b/libburn/libburn.ver @@ -154,6 +154,7 @@ burn_track_set_cdxa_conv; burn_track_set_cdtext; burn_track_set_default_size; burn_track_set_isrc; +burn_track_set_isrc_string; burn_track_set_size; burn_track_set_source; burn_version; diff --git a/libburn/structure.c b/libburn/structure.c index fffec6a..f651e8b 100644 --- a/libburn/structure.c +++ b/libburn/structure.c @@ -99,6 +99,7 @@ struct burn_session *burn_session_create(void) s->cdtext_copyright[i] = 0x00; } s->cdtext_language[0] = 0x09; /* Single-block default is English */ + s->mediacatalog[0] = 0; return s; } @@ -359,6 +360,9 @@ void burn_track_set_isrc(struct burn_track *t, char *country, char *owner, { int i; + /* ts B11226 */ + t->isrc.has_isrc = 0; + for (i = 0; i < 2; ++i) { /* ts A61008 : This is always true */ @@ -412,6 +416,26 @@ is_not_allowed:; return; } +/* ts B11226 API */ +int burn_track_set_isrc_string(struct burn_track *t, char isrc[13], int flag) +{ + unsigned char year; + unsigned int serial = 2000000000; + + if (strlen(isrc) != 12 || + isrc[5] < '0' || isrc[5] > '9' || isrc[6] < '0' || isrc[6] > '9') { + libdax_msgs_submit(libdax_messenger, -1, 0x00020114, + LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, + "Attempt to set ISRC with bad data", 0, 0); + return 0; + } + year = (isrc[5] - '0') * 10 + (isrc[6] - '0'); + isrc[12] = 0; + sscanf(isrc + 7, "%u", &serial); + burn_track_set_isrc(t, isrc, isrc + 2, year, serial); + return t->isrc.has_isrc; +} + void burn_track_clear_isrc(struct burn_track *t) { t->isrc.has_isrc = 0; @@ -992,6 +1016,7 @@ struct burn_cue_file_cursor { struct burn_source *fifo; int swap_audio_bytes; int no_cdtext; + int no_catalog_isrc; struct burn_source *offst_source; int current_file_ba; struct burn_track *prev_track; @@ -1021,6 +1046,7 @@ static int cue_crs_new(struct burn_cue_file_cursor **reply, int flag) crs->fifo = NULL; crs->swap_audio_bytes = 0; crs->no_cdtext = 0; + crs->no_catalog_isrc = 0; crs->offst_source = NULL; crs->current_file_ba = -1000000000; crs->prev_track = NULL; @@ -1261,13 +1287,22 @@ static int cue_interpret_line(struct burn_session *session, char *line, } if (strcmp(cmd, "CATALOG") == 0) { + for (cpt = apt; (cpt - apt) < 13 && *cpt == (*cpt & 0x7f); + cpt++); + if ((cpt - apt) < 13) { + libdax_msgs_submit(libdax_messenger, -1, 0x00020194, + LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH, + "In cue sheet file: Inappropriate content of CATALOG", + 0, 0); + ret = 0; goto ex; + } ret = cue_set_cdtext(session, NULL, 0x8e, apt, crs, 0); if (ret <= 0) goto ex; - - /* >>> ??? data for burn_write_opts_set_mediacatalog ? - (not implemented yet in SAO) */ - + if (!crs->no_catalog_isrc) { + memcpy(session->mediacatalog, apt, 13); + session->mediacatalog[13] = 0; + } } else if (strcmp(cmd, "CDTEXTFILE") == 0) { if (crs->no_cdtext) { @@ -1477,9 +1512,11 @@ overlapping_ba:; 1 | 2); if (ret <= 0) goto ex; - - /* >>> ??? burn_track_set_isrc ? - (not implemented yet in SAO) */ + if (!crs->no_catalog_isrc) { + ret = burn_track_set_isrc_string(crs->track, apt, 0); + if (ret <= 0) + goto ex; + } } else if (strcmp(cmd, "PERFORMER") == 0) { ret = cue_set_cdtext(session, crs->track, 0x81, apt, crs, 2); @@ -1593,6 +1630,8 @@ ex:; /* ts B11216 API */ /* @param flag bit0= do not attach CD-TEXT information to session and tracks + bit1= do not attach CATALOG to session or ISRC to track for + writing to Q sub-channel */ int burn_session_by_cue_file(struct burn_session *session, char *path, int fifo_size, struct burn_source **fifo, @@ -1620,6 +1659,7 @@ int burn_session_by_cue_file(struct burn_session *session, char *path, if (ret <= 0) goto ex; crs->no_cdtext = (flag & 1); + crs->no_catalog_isrc = !!(flag & 2); crs->fifo_size = fifo_size; crs->block_size_locked = 1; /* No mixed sessions for now */ diff --git a/libburn/structure.h b/libburn/structure.h index 95a1a11..b5dee22 100644 --- a/libburn/structure.h +++ b/libburn/structure.h @@ -123,6 +123,8 @@ struct burn_session unsigned char cdtext_copyright[8]; unsigned char cdtext_language[8]; + /* ts B11226 */ + unsigned char mediacatalog[14]; /* overrideable by burn_write_opts */ }; struct burn_disc