cdparanoia: add ability to disable byte swapping

configure.ac: remove AIX driver for now - it doesn't really work
remove some (but not all) of the valgrind errors in cd-text
Some stylistic things, doxygen comment improvements typos, etc.
This commit is contained in:
rocky
2005-01-27 03:10:06 +00:00
parent e30c3a3eb8
commit 9e2eaf7546
15 changed files with 97 additions and 71 deletions

View File

@@ -19,7 +19,7 @@ define(RELEASE_NUM, 72)
define(CDIO_VERSION_STR, 0.$1cvs)
AC_PREREQ(2.52)
AC_REVISION([$Id: configure.ac,v 1.130 2005/01/25 11:04:45 rocky Exp $])dnl
AC_REVISION([$Id: configure.ac,v 1.131 2005/01/27 03:10:06 rocky Exp $])dnl
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
AC_CONFIG_SRCDIR(src/cd-info.c)
AM_INIT_AUTOMAKE
@@ -321,9 +321,10 @@ AC_SUBST(LIBISO9660_LIBS)
case $host_os in
aix*)
AC_DEFINE([HAVE_AIX_CDROM], [1],
[Define 1 if you have AIX CD-ROM support])
cd_drivers="${cd_drivers}, AIX"
## Don't use AIX driver until starts to really work
## cd_drivers="${cd_drivers}, AIX"
## AC_DEFINE([HAVE_AIX_CDROM], [1],
## [Define 1 if you have AIX CD-ROM support])
;;
darwin6*|darwin7*)
AC_CHECK_HEADERS(IOKit/IOKitLib.h CoreFoundation/CFBase.h,

View File

@@ -1,5 +1,5 @@
/*
$Id: cd_types.h,v 1.11 2004/06/23 09:28:02 rocky Exp $
$Id: cd_types.h,v 1.12 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org>
@@ -136,7 +136,7 @@ typedef struct
* have at track track_num. Return information about the CD image
* is returned in iso_analysis and the return value.
*/
cdio_fs_anal_t cdio_guess_cd_type(const CdIo *cdio, int start_session,
cdio_fs_anal_t cdio_guess_cd_type(const CdIo_t *cdio, int start_session,
track_t track_num,
/*out*/ cdio_iso_analysis_t *iso_analysis);

View File

@@ -1,5 +1,5 @@
/*
$Id: cdda.h,v 1.12 2005/01/26 01:21:29 rocky Exp $
$Id: cdda.h,v 1.13 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001 Xiph.org
@@ -76,7 +76,15 @@ struct cdrom_drive_s {
*/
int nsectors;
int cd_extra;
int cd_extra; /**< -1 if we can't get multisession info, 0 if
there is one session only or the multi-session
LBA is less than or 100 (don't ask me why -- I
don't know), and 1 if the multi-session lba is
greater than 100. */
bool b_swap_bytes; /**< Swap bytes if Endian-ness of drive
mismatches the endian-ness of the
computer? */
track_t tracks;
TOC_t disc_toc[MAXTRK]; /**< info here starts origin 0 rather than the
first track number (usually 1). So to take

View File

@@ -1,5 +1,5 @@
/*
$Id: cdtext.h,v 1.8 2004/09/05 13:03:46 rocky Exp $
$Id: cdtext.h,v 1.9 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
adapted from cuetools
@@ -74,13 +74,15 @@ extern "C" {
/*! Free memory assocated with cdtext*/
void cdtext_destroy (cdtext_t *cdtext);
/*! returns the string associated with the given field. NULL is
/*! returns an allocated string associated with the given field. NULL is
returned if key is CDTEXT_INVALID or the field is not set.
The user needs to free the string when done with it.
@see cdio_get_cdtext to retrieve the cdtext structure used as
input here.
*/
const char *cdtext_get (cdtext_field_t key, const cdtext_t *cdtext);
char *cdtext_get (cdtext_field_t key, const cdtext_t *cdtext);
/*!
returns enum of keyword if key is a CD-Text keyword,

View File

@@ -1,5 +1,5 @@
/*
$Id: paranoia.h,v 1.6 2005/01/26 01:21:29 rocky Exp $
$Id: paranoia.h,v 1.7 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1998 Monty xiphmont@mit.edu
@@ -29,6 +29,10 @@
#include <cdio/cdio.h>
/*! Paranoia likes to work with 16-bit numbers rather than
(possibly byte-swapped) bytes. So there are this many
16-bit numbers block (frame, or sector) read.
*/
#define CD_FRAMEWORDS (CDIO_CD_FRAMESIZE_RAW/2)
/**! Flags used in paranoia_modeset. */

View File

@@ -1,5 +1,5 @@
/* -*- c -*-
$Id: track.h,v 1.4 2005/01/04 10:58:03 rocky Exp $
$Id: track.h,v 1.5 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -84,7 +84,7 @@ extern "C" {
If i_track is 0 or CDIO_CDROM_LEADOUT_TRACK the track returned
is the information assocated with the CD.
*/
const cdtext_t *cdio_get_cdtext (CdIo_t *p_cdio, track_t i_track);
cdtext_t *cdio_get_cdtext (CdIo_t *p_cdio, track_t i_track);
/*!
Get the number of the first track.

View File

@@ -1,5 +1,5 @@
/*
$Id: common_interface.c,v 1.11 2005/01/23 00:27:11 rocky Exp $
$Id: common_interface.c,v 1.12 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1998, 2002 Monty monty@xiph.org
@@ -185,6 +185,11 @@ data_bigendianp(cdrom_drive_t *d)
rocky OMITTED FOR NOW:
The multisession stuff is from Hannu's code; it assumes it knows
the leadout/leadin size.
@return -1 if we can't get multisession info, 0 if there is one
session only or the multi-session LBA is less than or 100 (don't
ask me why -- I don't know), and 1 if the multi-session lba is
greater than 100.
*/
int
FixupTOC(cdrom_drive_t *d, track_t i_tracks)

View File

@@ -1,5 +1,5 @@
/*
$Id: interface.c,v 1.17 2005/01/26 01:03:16 rocky Exp $
$Id: interface.c,v 1.18 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1998 Monty xiphmont@mit.edu
@@ -155,17 +155,17 @@ cdio_cddap_read(cdrom_drive_t *d, void *buffer, lsn_t beginsector,
if (sectors>0) {
sectors=d->read_audio(d, buffer, beginsector, sectors);
if (sectors > 0){
if (sectors > 0) {
/* byteswap? */
if(d->bigendianp==-1) /* not determined yet */
if ( d->bigendianp == -1 ) /* not determined yet */
d->bigendianp = data_bigendianp(d);
if(d->bigendianp!=bigendianp()){
if ( d->b_swap_bytes && d->bigendianp != bigendianp() ) {
int i;
uint16_t *p=(uint16_t *)buffer;
long els=sectors*CDIO_CD_FRAMESIZE_RAW/2;
/* Note: Something perhaps in the original cdparanioa code might
/* Note: Something perhaps in the original cdparanoia code might
cause the code to access outside of the allocated range of
buffer. This comment is just to serve as a marker for
the loop where the data got clobbered. I don't think this

View File

@@ -1,5 +1,5 @@
/*
$Id: scan_devices.c,v 1.17 2005/01/25 11:04:45 rocky Exp $
$Id: scan_devices.c,v 1.18 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1998 Monty xiphmont@mit.edu
@@ -262,6 +262,7 @@ cdda_identify_device_cdio(CdIo_t *p_cdio, const char *psz_device,
d->interface = COOKED_IOCTL;
d->bigendianp = -1; /* We don't know yet... */
d->nsectors = -1;
d->b_swap_bytes = true;
{
cdio_hwinfo_t hw_info;

View File

@@ -1,5 +1,5 @@
/*
$Id: _cdio_generic.c,v 1.12 2005/01/26 01:03:16 rocky Exp $
$Id: _cdio_generic.c,v 1.13 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -25,7 +25,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.12 2005/01/26 01:03:16 rocky Exp $";
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.13 2005/01/27 03:10:06 rocky Exp $";
#include <stdio.h>
#include <stdlib.h>
@@ -256,7 +256,7 @@ cdio_add_device_list(char **device_list[], const char *drive,
@return the CD-TEXT object or NULL if obj is NULL
or CD-TEXT information does not exist.
*/
const cdtext_t *
cdtext_t *
get_cdtext_generic (void *p_user_data, track_t i_track)
{
generic_img_private_t *p_env = p_user_data;
@@ -409,26 +409,27 @@ get_num_tracks_generic(void *p_user_data)
}
void
set_cdtext_field_generic(void *user_data, track_t i_track,
set_cdtext_field_generic(void *p_user_data, track_t i_track,
track_t i_first_track,
cdtext_field_t e_field, const char *psz_value)
{
char **pp_field;
generic_img_private_t *env = user_data;
generic_img_private_t *p_env = p_user_data;
if( i_track == 0 )
pp_field = &(env->cdtext.field[e_field]);
pp_field = &(p_env->cdtext.field[e_field]);
else
pp_field = &(env->cdtext_track[i_track-i_first_track].field[e_field]);
pp_field = &(p_env->cdtext_track[i_track-i_first_track].field[e_field]);
*pp_field = strdup(psz_value);
if (*pp_field) free(*pp_field);
*pp_field = (psz_value) ? strdup(psz_value) : NULL;
}
/*!
Read CD-Text information for a CdIo_t object .
return true on success, false on error or CD-TEXT information does
return true on success, false on error or CD-Text information does
not exist.
*/
bool

View File

@@ -1,5 +1,5 @@
/*
$Id: cdio.c,v 1.11 2005/01/20 00:36:38 rocky Exp $
$Id: cdio.c,v 1.12 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
@@ -35,7 +35,7 @@
#include <cdio/util.h>
#include "cdio_private.h"
static const char _rcsid[] = "$Id: cdio.c,v 1.11 2005/01/20 00:36:38 rocky Exp $";
static const char _rcsid[] = "$Id: cdio.c,v 1.12 2005/01/27 03:10:06 rocky Exp $";
/*!
@@ -61,7 +61,7 @@ cdio_get_arg (const CdIo *obj, const char key[])
@return the CD-TEXT object or NULL if obj is NULL
or CD-TEXT information does not exist.
*/
const cdtext_t *
cdtext_t *
cdio_get_cdtext (CdIo *obj, track_t i_track)
{
if (obj == NULL) return NULL;

View File

@@ -1,5 +1,5 @@
/*
$Id: cdio_private.h,v 1.10 2005/01/24 00:06:31 rocky Exp $
$Id: cdio_private.h,v 1.11 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -85,7 +85,7 @@ extern "C" {
If i_track is 0 or CDIO_CDROM_LEADOUT_TRACK the track returned
is the information assocated with the CD.
*/
const cdtext_t * (*get_cdtext) (void *p_env, track_t i_track);
cdtext_t * (*get_cdtext) (void *p_env, track_t i_track);
/*!
Return an array of device names. if CdIo is NULL (we haven't

View File

@@ -1,7 +1,7 @@
/*
$Id: cdtext.c,v 1.1 2004/12/18 17:29:32 rocky Exp $
$Id: cdtext.c,v 1.2 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
toc reading routine adapted from cuetools
Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm>
@@ -66,15 +66,18 @@ cdtext_field2str (cdtext_field_t i)
return cdtext_keywords[i];
}
/*! Free memory assocated with cdtext*/
void
cdtext_destroy (cdtext_t *cdtext)
cdtext_destroy (cdtext_t *p_cdtext)
{
cdtext_field_t i;
for (i=0; i < MAX_CDTEXT_FIELDS; i++) {
if (cdtext->field[i]) free(cdtext->field[i]);
if (p_cdtext->field[i]) {
free(p_cdtext->field[i]);
p_cdtext->field[i] = NULL;
}
}
}
@@ -82,11 +85,11 @@ cdtext_destroy (cdtext_t *cdtext)
returns the CDTEXT value associated with key. NULL is returned
if key is CDTEXT_INVALID or the field is not set.
*/
const char *
cdtext_get (cdtext_field_t key, const cdtext_t *cdtext)
char *
cdtext_get (cdtext_field_t key, const cdtext_t *p_cdtext)
{
if (key == CDTEXT_INVALID) return NULL;
return cdtext->field[key];
return strdup(p_cdtext->field[key]);
}
/*! Initialize a new cdtext structure.
@@ -94,12 +97,12 @@ cdtext_get (cdtext_field_t key, const cdtext_t *cdtext)
resources using cdtext_delete.
*/
void
cdtext_init (cdtext_t *cdtext)
cdtext_init (cdtext_t *p_cdtext)
{
cdtext_field_t i;
for (i=0; i < MAX_CDTEXT_FIELDS; i++) {
cdtext->field[i] = NULL;
p_cdtext->field[i] = NULL;
}
}
@@ -132,27 +135,27 @@ cdtext_is_keyword (const char *key)
/*! sets cdtext's keyword entry to field.
*/
void
cdtext_set (cdtext_field_t key, const char *value, cdtext_t *cdtext)
cdtext_set (cdtext_field_t key, const char *p_value, cdtext_t *p_cdtext)
{
if (NULL == value || key == CDTEXT_INVALID) return;
if (NULL == p_value || key == CDTEXT_INVALID) return;
if (cdtext->field[key]) free (cdtext->field[key]);
cdtext->field[key] = strdup (value);
if (p_cdtext->field[key]) free (p_cdtext->field[key]);
p_cdtext->field[key] = strdup (p_value);
}
#define SET_CDTEXT_FIELD(FIELD) \
(*set_cdtext_field_fn)(user_data, i_track, i_first_track, FIELD, buffer);
(*set_cdtext_field_fn)(p_user_data, i_track, i_first_track, FIELD, buffer);
/*
parse all CD-TEXT data retrieved.
*/
bool
cdtext_data_init(void *user_data, track_t i_first_track,
cdtext_data_init(void *p_user_data, track_t i_first_track,
unsigned char *wdata,
set_cdtext_field_fn_t set_cdtext_field_fn)
{
CDText_data_t *pdata;
CDText_data_t *p_data;
int i;
int j;
char buffer[256];
@@ -163,27 +166,27 @@ cdtext_data_init(void *user_data, track_t i_first_track,
memset( buffer, 0x00, sizeof(buffer) );
idx = 0;
pdata = (CDText_data_t *) (&wdata[4]);
p_data = (CDText_data_t *) (&wdata[4]);
for( i=0; i < CDIO_CDTEXT_MAX_PACK_DATA; i++ ) {
#if TESTED
if ( pdata->bDBC ) {
if ( p_data->bDBC ) {
cdio_warn("Double-byte characters not supported");
return false;
}
#endif
if( pdata->seq != i )
if( p_data->seq != i )
break;
if( (pdata->type >= 0x80)
&& (pdata->type <= 0x85) && (pdata->block == 0) ) {
i_track = pdata->i_track;
if( (p_data->type >= 0x80)
&& (p_data->type <= 0x85) && (p_data->block == 0) ) {
i_track = p_data->i_track;
for( j=0; j < CDIO_CDTEXT_MAX_TEXT_DATA; j++ ) {
if( pdata->text[j] == 0x00 ) {
if( p_data->text[j] == 0x00 ) {
bool b_field_set=true;
switch( pdata->type) {
switch( p_data->type) {
case CDIO_CDTEXT_TITLE:
SET_CDTEXT_FIELD(CDTEXT_TITLE);
break;
@@ -216,12 +219,12 @@ cdtext_data_init(void *user_data, track_t i_first_track,
idx = 0;
}
} else {
buffer[idx++] = pdata->text[j];
buffer[idx++] = p_data->text[j];
}
buffer[idx] = 0x00;
}
}
pdata++;
p_data++;
}
return b_ret;
}

View File

@@ -1,5 +1,5 @@
/*
$Id: generic.h,v 1.10 2005/01/21 02:59:32 rocky Exp $
$Id: generic.h,v 1.11 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -155,7 +155,7 @@ extern "C" {
@return the CD-TEXT object or NULL if obj is NULL
or CD-TEXT information does not exist.
*/
const cdtext_t *get_cdtext_generic (void *p_user_data, track_t i_track);
cdtext_t *get_cdtext_generic (void *p_user_data, track_t i_track);
/*!
Return the number of of the first track.

View File

@@ -1,5 +1,5 @@
/*
$Id: cd-info.c,v 1.110 2005/01/22 22:21:36 rocky Exp $
$Id: cd-info.c,v 1.111 2005/01/27 03:10:06 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
@@ -393,20 +393,21 @@ _log_handler (cdio_log_level_t level, const char message[])
}
static void
print_cdtext_track_info(CdIo_t *p_cdio, track_t i_track, const char *message) {
const cdtext_t *cdtext = cdio_get_cdtext(p_cdio, i_track);
print_cdtext_track_info(CdIo_t *p_cdio, track_t i_track, const char *psz_msg) {
cdtext_t *p_cdtext = cdio_get_cdtext(p_cdio, i_track);
if (NULL != cdtext) {
if (NULL != p_cdtext) {
cdtext_field_t i;
printf("%s\n", message);
printf("%s\n", psz_msg);
for (i=0; i < MAX_CDTEXT_FIELDS; i++) {
if (cdtext->field[i]) {
printf("\t%s: %s\n", cdtext_field2str(i), cdtext->field[i]);
if (p_cdtext->field[i]) {
printf("\t%s: %s\n", cdtext_field2str(i), p_cdtext->field[i]);
}
}
}
cdtext_destroy(p_cdtext);
}
static void