New API call burn_track_set_cdxa_conv()

This commit is contained in:
Thomas Schmitt 2009-09-11 11:53:36 +00:00
parent fdd190b65c
commit 2e6f83b3b3
6 changed files with 50 additions and 6 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2009.09.10.071253"
#define Cdrskin_timestamP "2009.09.11.112528"

View File

@ -1689,6 +1689,22 @@ void burn_track_define_data(struct burn_track *t, int offset, int tail,
int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes);
/* ts A90910 */
/** Activates CD XA compatibility modes.
libburn currently writes data only in CD mode 1. Some programs insist in
sending data with additional management bytes. These bytes have to be
stripped in order to make the input suitable for BURN_MODE1.
@param t The track to manipulate
@param value 0= no conversion
1= strip 8 byte sector headers of CD-ROM XA mode 2 form 1
see MMC-5 4.2.3.8.5.3 Block Format for Mode 2 form 1 Data
all other values are reserved
@return 1=success , 0=unacceptable value
@since 0.7.2
*/
int burn_track_set_cdxa_conv(struct burn_track *t, int value);
/** Set the ISRC details for a track
@param t The track to change
@param country the 2 char country code. Each character must be

View File

@ -208,8 +208,7 @@ static unsigned char *get_sector(struct burn_write_opts *opts,
{
struct burn_drive *d = opts->drive;
struct buffer *out = d->buffer;
int outmode;
int seclen;
int outmode, seclen;
unsigned char *ret;
outmode = get_outmode(opts);
@ -225,6 +224,7 @@ static unsigned char *get_sector(struct burn_write_opts *opts,
seclen += burn_subcode_length(outmode);
/* ts A61219 : opts->obs is eventually a 32k trigger for DVD */
/* (there is enough buffer size reserve for track->cdxa_conversion) */
if (out->bytes + seclen > BUFFER_SIZE ||
(opts->obs > 0 && out->bytes + seclen > opts->obs)) {
int err;
@ -244,7 +244,6 @@ static unsigned char *get_sector(struct burn_write_opts *opts,
out->bytes = 0;
out->sectors = 0;
}
ret = out->data + out->bytes;
out->bytes += seclen;
out->sectors++;
@ -301,7 +300,15 @@ static int convert_data(struct burn_write_opts *o, struct burn_track *track,
return 0;
if ((outmode & BURN_MODE_BITS) == (inmode & BURN_MODE_BITS)) {
/* see MMC-5 4.2.3.8.5.3 Block Format for Mode 2 form 1 Data
Table 24 Mode 2 Formed Sector Sub-header Format */
if (track->cdxa_conversion == 1)
inlen += 8;
get_bytes(track, inlen, data);
if (track->cdxa_conversion == 1)
memmove(data, data + 8, inlen - 8);
return 1;
}

View File

@ -281,13 +281,23 @@ void burn_track_define_data(struct burn_track *t, int offset, int tail,
/* ts A61024 */
int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes)
{
if(swap_source_bytes!=0 && swap_source_bytes!=1)
if (swap_source_bytes != 0 && swap_source_bytes != 1)
return 0;
t->swap_source_bytes = swap_source_bytes;
return 1;
}
/* ts A90911 : API */
int burn_track_set_cdxa_conv(struct burn_track *t, int value)
{
if (value < 0 || value > 1)
return 0;
t->cdxa_conversion = value;
return 1;
}
void burn_track_set_isrc(struct burn_track *t, char *country, char *owner,
unsigned char year, unsigned int serial)
{
@ -358,6 +368,11 @@ int burn_track_get_sectors(struct burn_track *t)
int sectors, seclen;
seclen = burn_sector_length(t->mode);
if (t->cdxa_conversion == 1)
/* ts A90911 : will read blocks of 2056 bytes and write 2048 */
seclen += 8;
if (t->source != NULL) /* ts A80808 : mending sigsegv */
size = t->offset + t->source->get_size(t->source) + t->tail;
else if(t->entry != NULL) {

View File

@ -64,6 +64,10 @@ struct burn_track
/* ts A61024 */
/** Byte swapping on source data stream : 0=none , 1=pairwise */
int swap_source_bytes;
/* ts A90910 : conversions from CD XA prepared input */
int cdxa_conversion; /* 0=none, 1=remove -xa1 headers (first 8 bytes)*/
};
struct burn_session

View File

@ -40,7 +40,9 @@ struct buffer
Added 4096 bytes reserve against possible buffer overflows.
(Changed in sector.c buffer flush test from >= to > BUFFER_SIZE .
This can at most cause a 1 sector overlap. Sometimes an offset
of 16 byte is applied to the output data (in some RAW mode). ) */
of 16 byte is applied to the output data (in some RAW mode). )
burn_write_opts.cdxa_conversion can imply an offset of 8 bytes.
*/
unsigned char data[BUFFER_SIZE + 4096];
int sectors;
int bytes;