Disabled code using libburn/lec.c, removed lec.c from libburn

This commit is contained in:
Thomas Schmitt 2009-09-01 09:56:51 +00:00
parent cf9a2031a4
commit 407471898c
7 changed files with 88 additions and 32 deletions

View File

@ -1,5 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
#ifndef Libburn_disable_lec_C
/* borrowed HEAVILY from cdrdao */
#include <string.h>
@ -449,3 +451,5 @@ void parity_q(unsigned char *sector)
q_msb_start += 2 * 43;
}
}
#endif /* ! Libburn_disable_lec_C */

View File

@ -3,10 +3,14 @@
#ifndef __LEC
#define __LEC
#ifndef Libburn_disable_lec_C
#define RS_L12_BITS 8
void scramble(unsigned char *);
void parity_p(unsigned char *in);
void parity_q(unsigned char *in);
#endif /* ! Libburn_disable_lec_C */
#endif /* __LEC */

View File

@ -119,7 +119,8 @@ enum burn_write_types
2s gaps between tracks, no fonky lead-ins
With sequential DVD-R[W]: Incremental Streaming
With DVD-RAM/+RW: Random Writeable (used sequentially)
With DVD+R and BD-R: Track of open size
With DVD-RAM, DVD+RW, BD-RE: Random Writeable (used sequentially)
With overwriteable DVD-RW: Rigid Restricted Overwrite
*/
BURN_WRITE_TAO,
@ -130,12 +131,22 @@ enum burn_write_types
With sequential DVD-R[W]: Disc-at-once, DAO
Single session, single track, fixed size mandatory, (-dvd-compat)
With other DVD or BD media: same as BURN_WRITE_TAO but may demand
that track size is known in advance.
*/
BURN_WRITE_SAO,
/** With CD: Raw disc at once recording.
all subcodes must be provided by lib or user
only raw block types are supported
With DVD and BD media: not supported.
ts A90901: THIS HAS BEEN DISABLED because its implementation
relied on code from cdrdao which is not understood
currently.
A burn run will abort with "FATAL" error message
if this mode is attempted.
@since 0.7.2
*/
BURN_WRITE_RAW,
@ -2596,6 +2607,15 @@ int burn_drive_get_drive_role(struct burn_drive *d);
int burn_drive_equals_adr(struct burn_drive *d1, char *adr2, int drive_role2);
/* ts A90830:
Give up lec.c which is copied from cdrdao and not understood.
This implies giving up all raw write modes for now.
This is an intermediate test state:
Finally the code of lec.c shall be removed completely.
*/
#define Libburn_disable_lec_C yes
#ifndef DOXYGEN

View File

@ -27,7 +27,6 @@
#include "crc.h"
#include "debug.h"
#include "init.h"
#include "lec.h"
#include "toc.h"
#include "util.h"
#include "sg.h"

View File

@ -15,10 +15,17 @@
#include "sector.h"
#include "crc.h"
#include "debug.h"
#ifndef Libburn_disable_lec_C
#include "lec.h"
#endif /* ! Libburn_disable_lec_C */
#include "toc.h"
#include "write.h"
#include "libdax_msgs.h"
extern struct libdax_msgs *libdax_messenger;
#ifdef Libburn_log_in_and_out_streaM
/* <<< ts A61031 */
@ -413,7 +420,8 @@ int sector_toc(struct burn_write_opts *o, int mode)
return 0;
subcode_toc(d, mode, subs);
convert_subs(o, mode, subs, data);
sector_headers(o, data, mode, 1);
if (sector_headers(o, data, mode, 1) <= 0)
return 0;
sector_common(++)
return 1;
}
@ -433,7 +441,8 @@ int sector_pregap(struct burn_write_opts *o,
return 0;
subcode_user(o, subs, tno, control, 0, NULL, 1);
convert_subs(o, mode, subs, data);
sector_headers(o, data, mode, 0);
if (sector_headers(o, data, mode, 0) <= 0)
return 0;
sector_common(--)
return 1;
}
@ -450,11 +459,12 @@ int sector_postgap(struct burn_write_opts *o,
return 0;
/* ts A61010 */
if (convert_data(o, NULL, mode, data) <= 0)
return 0;;
return 0;
/* use last index in track */
subcode_user(o, subs, tno, control, 1, NULL, 1);
convert_subs(o, mode, subs, data);
sector_headers(o, data, mode, 0);
if (sector_headers(o, data, mode, 0) <= 0)
return 0;
sector_common(++)
return 1;
}
@ -625,7 +635,8 @@ int sector_lout(struct burn_write_opts *o, unsigned char control, int mode)
return 0;
subcode_lout(o, control, subs);
convert_subs(o, mode, subs, data);
sector_headers(o, data, mode, 0);
if (sector_headers(o, data, mode, 0) <= 0)
return 0;
sector_common(++)
return 1;
}
@ -660,7 +671,8 @@ int sector_data(struct burn_write_opts *o, struct burn_track *t, int psub)
t->entry->control, 1, &t->isrc, psub);
convert_subs(o, t->mode, subs, data);
sector_headers(o, data, t->mode, 0);
if (sector_headers(o, data, t->mode, 0) <= 0)
return 0;
sector_common(++)
return 1;
}
@ -711,39 +723,45 @@ int sector_headers_is_ok(struct burn_write_opts *o, int mode)
return 0;
}
void sector_headers(struct burn_write_opts *o, unsigned char *out,
/* ts A90830 : changed return type to int
@return 0= failure
1= success
*/
int sector_headers(struct burn_write_opts *o, unsigned char *out,
int mode, int leadin)
{
int ret;
#ifdef Libburn_disable_lec_C
/* ts A90830 : lec.c is copied from cdrdao.
I have no idea yet how lec.c implements the Reed-Solomon encoding
which is described in ECMA-130 for CD-ROM.
So this gets disabled for now.
*/
ret = sector_headers_is_ok(o, mode);
if (ret != 2)
return (!! ret);
libdax_msgs_submit(libdax_messenger, o->drive->global_index,
0x0002010a,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Raw CD write modes are not supported", 0, 0);
return 0;
#else /* Libburn_disable_lec_C */
struct burn_drive *d = o->drive;
unsigned int crc;
int min, sec, frame;
int modebyte = -1;
/* ts A61009 */
#if 1
int ret;
ret = sector_headers_is_ok(o, mode);
if (ret != 2)
return;
modebyte = 1;
#else
if (mode & BURN_AUDIO) /* no headers for "audio" */
return;
if (o->write_type == BURN_WRITE_SAO)
return;
/* ts A61031 */
if (o->write_type == BURN_WRITE_TAO)
return;
if (mode & BURN_MODE1)
modebyte = 1;
#endif
/* ts A61009 : now ensured by burn_disc_write_is_ok() */
/* a ssert(modebyte == 1); */
@ -774,12 +792,17 @@ void sector_headers(struct burn_write_opts *o, unsigned char *out,
crc >>= 8;
out[2067] = crc & 0xFF;
}
if (mode & BURN_MODE1) {
memset(out + 2068, 0, 8);
parity_p(out);
parity_q(out);
}
scramble(out);
return 1;
#endif /* ! Libburn_disable_lec_C */
}
#if 0
@ -835,12 +858,19 @@ void process_q(struct burn_drive *d, unsigned char *q)
*/
int sector_identify(unsigned char *data)
{
#ifndef Libburn_disable_lec_C
scramble(data);
/*
check mode byte for 1 or 2
test parity to see if it's a valid sector
if invalid, return BURN_MODE_AUDIO;
else return mode byte (what about mode 2 formless? heh)
*/
#endif /* ! Libburn_disable_lec_C */
return BURN_MODE1;
}

View File

@ -22,7 +22,7 @@ int sector_data(struct burn_write_opts *, struct burn_track *t, int psub);
/* ts A61009 */
int sector_headers_is_ok(struct burn_write_opts *o, int mode);
void sector_headers(struct burn_write_opts *, unsigned char *,
int sector_headers(struct burn_write_opts *, unsigned char *,
int mode, int leadin);
void subcode_user(struct burn_write_opts *, unsigned char *s,
unsigned char tno, unsigned char control,

View File

@ -36,7 +36,6 @@
#include "crc.h"
#include "debug.h"
#include "init.h"
#include "lec.h"
#include "toc.h"
#include "util.h"
#include "sg.h"
@ -884,8 +883,8 @@ int burn_disc_write_is_ok(struct burn_write_opts *o, struct burn_disc *disc,
for (i = 0; i < disc->sessions; i++)
for (t = 0; t < disc->session[i]->tracks; t++)
if (!sector_headers_is_ok(
o, disc->session[i]->track[t]->mode))
if (sector_headers_is_ok(
o, disc->session[i]->track[t]->mode) != 1)
goto bad_track_mode_found;
return 1;
bad_track_mode_found:;