From 7b5040af1720c3bb209e37e15d4399f4d0ccbd5f Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 28 Dec 2011 10:45:38 +0000 Subject: [PATCH] Implemented options mcn= and isrc= --- cdrskin/cdrskin.1 | 14 ++++++- cdrskin/cdrskin.c | 83 ++++++++++++++++++++++++++++++------- cdrskin/cdrskin_timestamp.h | 2 +- 3 files changed, 81 insertions(+), 18 deletions(-) diff --git a/cdrskin/cdrskin.1 b/cdrskin/cdrskin.1 index 186c929..65aa65f 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 "Dec 27, 2011" +.TH CDRSKIN 1 "Dec 28, 2011" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -625,6 +625,14 @@ This option can be performed on track sources which are regular files or block devices. For the first track of the session it can be performed on any type of source if there is a fifo of at least 64 kiB. See option fs= . .TP +.BI isrc= text +Set the ISRC for the next track source to the given text, which must be exactly +13 characters long. It must comply to the format CCOOOYYSSSSS. +.br +CC is the country code. OOO is the owner code. Both may consist of capital +letters A to Z and of decimal digits 0 to 9. YY depicts the year (00 to 99). +SSSSS is the serial number (00000 to 99999). +.TP .BI -load Load the media and exit. Exit value is 0 if any kind of media was found, non zero else. Note: Option -eject will unload the media even if -load is given. @@ -644,6 +652,10 @@ modesty_on_drive=1:min_percent=:max_percent=95 .br Percentage is permissible between 25 and 95. .TP +.BI mcn= text +Set the CD Media Catalog Number to text, which must be exactly 13 characters +long and should consist of decimal digits. +.TP .BI -minfo Print information about the loaded media. This includes media type, writability state, and a quite readable table of content. diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 913b7a2..a5443c4 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -868,6 +868,7 @@ struct CdrtracK { int cdxa_conversion; /* bit0-30: for burn_track_set_cdxa_conv() bit31 : ignore bits 0 to 30 */ + char isrc[13]; /** Eventually detected data image size */ double data_image_size; @@ -950,6 +951,7 @@ int Cdrtrack_new(struct CdrtracK **track, struct CdrskiN *boss, o->track_type_by_default= 1; o->swap_audio_bytes= 0; o->cdxa_conversion= 0; + o->isrc[0]= 0; o->data_image_size= -1.0; o->iso_fs_descr= NULL; o->use_data_image_size= 0; @@ -1675,6 +1677,11 @@ int Cdrtrack_add_to_session(struct CdrtracK *track, int trackno, (track->track_type==BURN_AUDIO && track->swap_audio_bytes)); if(!(track->cdxa_conversion & (1 << 31))) burn_track_set_cdxa_conv(tr, track->cdxa_conversion & 0x7fffffff); + if(track->isrc[0]) { + ret= burn_track_set_isrc_string(tr, track->isrc, 0); + if(ret <= 0) + goto ex; + } fixed_size= track->fixed_size; if((flag&2) && track->padding>0) { @@ -2904,6 +2911,10 @@ see_cdrskin_eng_html:; fprintf(stderr,"\ttsize=#\t\tannounces exact size of source data\n"); fprintf(stderr,"\tpadsize=#\tAmount of padding\n"); + fprintf(stderr, + "\tmcn=text\tSet the media catalog number for this CD to 'text'\n"); + fprintf(stderr, + "\tisrc=text\tSet the ISRC number for the next track to 'text'\n"); fprintf(stderr, "\t-text\t\tWrite CD-Text from information from *.cue files\n"); fprintf(stderr, @@ -3344,6 +3355,10 @@ struct CdrskiN { int cdtext_test; + /* Media Catalog Number and ISRC */ + char mcn[14]; + char next_isrc[13]; + /** The list of tracks with their data sources and parameters */ struct CdrtracK *tracklist[Cdrskin_track_maX]; @@ -3504,6 +3519,8 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag) for(i= 0; i < 8; i++) memset(o->sheet_v07t_paths, 0, Cdrskin_adrleN); o->cdtext_test= 0; + o->mcn[0]= 0; + o->next_isrc[0]= 0; o->track_type_by_default= 1; for(i=0;itracklist[i]= NULL; @@ -6783,6 +6800,10 @@ burn_failed:; if(ret <= 0) goto burn_failed; } + if(skin->mcn[0]) { + burn_write_opts_set_mediacatalog(o, (unsigned char *) skin->mcn); + burn_write_opts_set_has_mediacatalog(o, 1); + } ret= Cdrskin_activate_write_mode(skin,o,disc,0); if(ret<=0) goto burn_failed; @@ -7266,7 +7287,7 @@ int Cdrskin_setup(struct CdrskiN *skin, int argc, char **argv, int flag) /* cdrecord 2.01 options which are not scheduled for implementation, yet */ static char ignored_partial_options[][41]= { "timeout=", "debug=", "kdebug=", "kd=", "driver=", "ts=", - "pregap=", "defpregap=", "mcn=", "isrc=", "index=", + "pregap=", "defpregap=", "index=", "pktsize=", "" }; @@ -7517,6 +7538,21 @@ unsupported_blank_option:; } else if(strcmp(argv[i],"-checkdrive")==0) { skin->do_checkdrive= 1; + } else if(strncmp(argv[i],"-cuefile=", 9)==0) { + value_pt= argv[i] + 9; + goto set_cuefile; + } else if(strncmp(argv[i],"cuefile=", 8)==0) { + value_pt= argv[i] + 8; +set_cuefile:; + if(strlen(value_pt) >= sizeof(skin->cuefile)) { + fprintf(stderr, + "cdrskin: FATAL : cuefile=... too long. (max: %d, given: %d)\n", + (int) sizeof(skin->cuefile) - 1, (int) strlen(value_pt)); + return(0); + } + strcpy(skin->cuefile, value_pt); + skin->do_burn= 1; + } else if(strcmp(argv[i],"-data")==0) { option_data:; /* All Subsequent Tracks Option */ @@ -7787,24 +7823,22 @@ gracetime_equals:; } else if(strcmp(argv[i],"-inq")==0) { skin->do_checkdrive= 2; - } else if(strncmp(argv[i],"-cuefile=", 9)==0) { - value_pt= argv[i] + 10; - goto set_cuefile; - } else if(strncmp(argv[i],"cuefile=", 8)==0) { - value_pt= argv[i] + 8; -set_cuefile:; - if(strlen(value_pt) >= sizeof(skin->cuefile)) { - fprintf(stderr, - "cdrskin: FATAL : cuefile=... too long. (max: %d, given: %d)\n", - (int) sizeof(skin->cuefile) - 1, (int) strlen(value_pt)); - return(0); - } - strcpy(skin->cuefile, value_pt); - skin->do_burn= 1; - } else if(strcmp(argv[i],"-isosize")==0) { skin->use_data_image_size= 1; + } else if(strncmp(argv[i],"-isrc=", 6) == 0) { + value_pt= argv[i] + 6; + goto set_isrc; + } else if(strncmp(argv[i],"isrc=", 5) == 0) { + value_pt= argv[i] + 5; +set_isrc:; + if(strlen(value_pt) != 12) { + fprintf(stderr, + "cdrskin: SORRY : isrc=... is not exactly 12 characters long.\n"); + return(0); + } + memcpy(skin->next_isrc, value_pt, 13); + } else if(strcmp(argv[i],"--list_formats")==0) { skin->do_list_formats= 1; skin->preskin->demands_cdrskin_caps= 1; @@ -7833,6 +7867,19 @@ set_cuefile:; if(skin->verbosity>=Cdrskin_verbose_cmD) ClN(printf("cdrskin: will put out some -atip style lines plus -toc\n")); + } else if(strncmp(argv[i],"-mcn=", 5) == 0) { + value_pt= argv[i] + 5; + goto set_mcn; + } else if(strncmp(argv[i],"mcn=", 4) == 0) { + value_pt= argv[i] + 4; +set_mcn:; + if(strlen(value_pt) != 13) { + fprintf(stderr, + "cdrskin: SORRY : mcn=... is not exactly 13 characters long.\n"); + return(0); + } + memcpy(skin->mcn, value_pt, 14); + } else if(strncmp(argv[i],"-minbuf=",8)==0) { value_pt= argv[i]+8; goto minbuf_equals; @@ -8199,6 +8246,9 @@ track_too_large:; "cdrskin: FATAL : Creation of track control object failed.\n"); return(ret); } + if(skin->next_isrc[0]) + memcpy(skin->tracklist[skin->track_counter]->isrc, skin->next_isrc, 13); + skin->track_counter++; skin->use_data_image_size= 0; if(skin->verbosity>=Cdrskin_verbose_cmD) { @@ -8215,6 +8265,7 @@ track_too_large:; the man page says padsize= is reset to 0 Joerg Schilling will change in 2.01.01 to 0 */ skin->fixed_size= 0; + skin->next_isrc[0]= 0; } else { ignore_unknown:; if(skin->preskin->fallback_program[0]) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 6018fe1..06f6200 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2011.12.28.104044" +#define Cdrskin_timestamP "2011.12.28.104536"