API call burn_session_input_sheet_v07t(): read multiple blocks from same file

This commit is contained in:
Thomas Schmitt 2013-05-20 10:48:40 +00:00
parent a252038113
commit eb03488f52
4 changed files with 95 additions and 28 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2013.05.19.154838"
#define Cdrskin_timestamP "2013.05.20.104814"

View File

@ -615,17 +615,65 @@ static int v07t_cdtext_to_track(struct burn_track *track, int block,
}
static int v07t_apply_to_session(struct burn_session *session, int block,
int char_codes[8], int copyrights[8], int languages[8],
int session_attr_seen[16], int track_attr_seen[16],
int genre_code, char *genre_text, int flag)
{
int i, ret, length;
char *line = NULL;
BURN_ALLOC_MEM(line, char, 4096);
for (i= 0x80; i <= 0x8e; i++) {
if (i > 0x85 && i != 0x8e)
continue;
if (session_attr_seen[i - 0x80] || !track_attr_seen[i - 0x80])
continue;
ret = v07t_cdtext_to_session(session, block, "",
char_codes + block, i, NULL, 0);
if (ret <= 0)
goto ex;
}
if (genre_code >= 0 && genre_text[0]) {
line[0] = (genre_code >> 8) & 0xff;
line[1] = genre_code & 0xff;
strcpy(line + 2, genre_text);
length = 2 + strlen(line + 2) + 1;
ret = burn_session_set_cdtext(session, block, 0, "GENRE",
(unsigned char *) line, length, 0);
if (ret <= 0)
goto ex;
}
ret = burn_session_set_cdtext_par(session, char_codes, copyrights,
languages, 0);
if (ret <= 0)
goto ex;
for (i = 0; i < 8; i++)
char_codes[i] = copyrights[i] = languages[i]= -1;
for (i = 0; i < 16; i++)
session_attr_seen[i] = track_attr_seen[i] = 0;
genre_text[0] = 0;
ret = 1;
ex:
BURN_FREE_MEM(line);
return ret;
}
/* ts B11215 API */
/* @param flag bit1= do not attach CATALOG to session or ISRC to track for
/* @param flag bit0= permission to read multiple blocks from the same sheet
bit1= do not attach CATALOG to session or ISRC to track for
writing to Q sub-channel
*/
int burn_session_input_sheet_v07t(struct burn_session *session,
char *path, int block, int flag)
{
int ret = 0, num_tracks, char_codes[8], copyrights[8], languages[8], i;
int genre_code = -1, track_offset = 1, length, pack_type, tno, tnum;
int genre_code = -1, track_offset = 1, pack_type, tno, tnum;
int session_attr_seen[16], track_attr_seen[16];
int int0x00 = 0x00, int0x01 = 0x01;
int additional_blocks = -1, line_count = 0, enable_multi_block = 0;
struct stat stbuf;
FILE *fp = NULL;
char *line = NULL, *eq_pos, *payload, *genre_text = NULL, track_txt[3];
@ -678,6 +726,7 @@ cannot_open:;
burn_printify(msg), 0, 0);
ret = 0; goto ex;
}
line_count++;
if (strlen(line) == 0)
continue;
eq_pos = strchr(line, '=');
@ -822,6 +871,31 @@ cannot_open:;
burn_printify(msg), 0, 0);
ret = 0; goto ex;
}
if (flag & 1)
if (line_count == 1)
enable_multi_block = 1;
if (enable_multi_block) {
if (additional_blocks >= 0) {
if (block == 7) {
libdax_msgs_submit(
libdax_messenger, -1, 0x000201a0,
LIBDAX_MSGS_SEV_WARNING, LIBDAX_MSGS_PRIO_HIGH,
"Maximum number of CD-TEXT blocks exceeded",
0, 0);
break;
}
ret = v07t_apply_to_session(
session, block, char_codes,
copyrights, languages,
session_attr_seen,
track_attr_seen,
genre_code, genre_text, 0);
if (ret <= 0)
goto ex;
block++;
}
additional_blocks++;
}
} else if (strcmp(line, "Remarks") == 0) {
;
@ -979,33 +1053,16 @@ bad_track_no:;
ret = 0; goto ex;
}
}
for (i= 0x80; i <= 0x8e; i++) {
if (i > 0x85 && i != 0x8e)
continue;
if (session_attr_seen[i - 0x80] || !track_attr_seen[i - 0x80])
continue;
ret = v07t_cdtext_to_session(session, block, "",
char_codes + block, i, NULL, 0);
if (ret <= 0)
goto ex;
}
if (genre_code >= 0 && genre_text[0]) {
line[0] = (genre_code >> 8) & 0xff;
line[1] = genre_code & 0xff;
strcpy(line + 2, genre_text);
length = 2 + strlen(line + 2) + 1;
ret = burn_session_set_cdtext(session, block, 0, "GENRE",
(unsigned char *) line, length, 0);
if (ret <= 0)
goto ex;
}
ret = burn_session_set_cdtext_par(session, char_codes, copyrights,
languages, 0);
ret = v07t_apply_to_session(session, block,
char_codes, copyrights, languages,
session_attr_seen, track_attr_seen,
genre_code, genre_text, 0);
if (ret <= 0)
goto ex;
ret = 1;
if (additional_blocks > 0)
ret += additional_blocks;;
ex:;
if(fp != NULL)
fclose(fp);

View File

@ -2214,9 +2214,18 @@ int burn_session_get_cdtext(struct burn_session *s, int block,
@param block Number of the language block in which the attributes
shall appear. Possible values: 0 to 7.
@param flag Bitfield for control purposes.
bit0= Permission to read multiple blocks from the
given sheet file. Each block is supposed to begin
by a line "Input Sheet Version = 0.7T". Therefore
this permission is only valid if the input file
begins by such a line.
@since 1.3.2
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
@return > 0 indicates success and the number of interpreted
blocks (1 if not flag bit0 is set).
<= 0 indicates failure
@since 1.2.0
*/
int burn_session_input_sheet_v07t(struct burn_session *session,

View File

@ -598,7 +598,8 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x0002019c (SORRY,HIGH) = Session has no defined tracks
0x0002019d (SORRY,HIGH) = Audio read size not properly aligned
0x0002019e (NOTE,HIGH) = Drive does not support media certification
0x0002019f (FAILURE,HIGH) = CD-TEXT with unknown character code
0x0002019f (FAILURE,HIGH) = CD-TEXT binary pack array faulty
0x000201a0 (WARNING,HIGH) = Maximum number of CD-TEXT blocks exceeded
libdax_audioxtr: