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:
@@ -19,7 +19,7 @@ define(RELEASE_NUM, 72)
|
|||||||
define(CDIO_VERSION_STR, 0.$1cvs)
|
define(CDIO_VERSION_STR, 0.$1cvs)
|
||||||
|
|
||||||
AC_PREREQ(2.52)
|
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_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
||||||
AC_CONFIG_SRCDIR(src/cd-info.c)
|
AC_CONFIG_SRCDIR(src/cd-info.c)
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
@@ -321,9 +321,10 @@ AC_SUBST(LIBISO9660_LIBS)
|
|||||||
|
|
||||||
case $host_os in
|
case $host_os in
|
||||||
aix*)
|
aix*)
|
||||||
AC_DEFINE([HAVE_AIX_CDROM], [1],
|
## Don't use AIX driver until starts to really work
|
||||||
[Define 1 if you have AIX CD-ROM support])
|
## cd_drivers="${cd_drivers}, AIX"
|
||||||
cd_drivers="${cd_drivers}, AIX"
|
## AC_DEFINE([HAVE_AIX_CDROM], [1],
|
||||||
|
## [Define 1 if you have AIX CD-ROM support])
|
||||||
;;
|
;;
|
||||||
darwin6*|darwin7*)
|
darwin6*|darwin7*)
|
||||||
AC_CHECK_HEADERS(IOKit/IOKitLib.h CoreFoundation/CFBase.h,
|
AC_CHECK_HEADERS(IOKit/IOKitLib.h CoreFoundation/CFBase.h,
|
||||||
|
|||||||
@@ -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) 2003 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org>
|
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
|
* have at track track_num. Return information about the CD image
|
||||||
* is returned in iso_analysis and the return value.
|
* 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,
|
track_t track_num,
|
||||||
/*out*/ cdio_iso_analysis_t *iso_analysis);
|
/*out*/ cdio_iso_analysis_t *iso_analysis);
|
||||||
|
|
||||||
|
|||||||
@@ -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) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 2001 Xiph.org
|
Copyright (C) 2001 Xiph.org
|
||||||
@@ -76,7 +76,15 @@ struct cdrom_drive_s {
|
|||||||
*/
|
*/
|
||||||
int nsectors;
|
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;
|
track_t tracks;
|
||||||
TOC_t disc_toc[MAXTRK]; /**< info here starts origin 0 rather than the
|
TOC_t disc_toc[MAXTRK]; /**< info here starts origin 0 rather than the
|
||||||
first track number (usually 1). So to take
|
first track number (usually 1). So to take
|
||||||
|
|||||||
@@ -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>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
adapted from cuetools
|
adapted from cuetools
|
||||||
@@ -74,13 +74,15 @@ extern "C" {
|
|||||||
/*! Free memory assocated with cdtext*/
|
/*! Free memory assocated with cdtext*/
|
||||||
void cdtext_destroy (cdtext_t *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.
|
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
|
@see cdio_get_cdtext to retrieve the cdtext structure used as
|
||||||
input here.
|
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,
|
returns enum of keyword if key is a CD-Text keyword,
|
||||||
|
|||||||
@@ -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) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
@@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
#include <cdio/cdio.h>
|
#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)
|
#define CD_FRAMEWORDS (CDIO_CD_FRAMESIZE_RAW/2)
|
||||||
|
|
||||||
/**! Flags used in paranoia_modeset. */
|
/**! Flags used in paranoia_modeset. */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* -*- c -*-
|
/* -*- 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>
|
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
|
If i_track is 0 or CDIO_CDROM_LEADOUT_TRACK the track returned
|
||||||
is the information assocated with the CD.
|
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.
|
Get the number of the first track.
|
||||||
|
|||||||
@@ -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) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998, 2002 Monty monty@xiph.org
|
Copyright (C) 1998, 2002 Monty monty@xiph.org
|
||||||
@@ -185,6 +185,11 @@ data_bigendianp(cdrom_drive_t *d)
|
|||||||
rocky OMITTED FOR NOW:
|
rocky OMITTED FOR NOW:
|
||||||
The multisession stuff is from Hannu's code; it assumes it knows
|
The multisession stuff is from Hannu's code; it assumes it knows
|
||||||
the leadout/leadin size.
|
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
|
int
|
||||||
FixupTOC(cdrom_drive_t *d, track_t i_tracks)
|
FixupTOC(cdrom_drive_t *d, track_t i_tracks)
|
||||||
|
|||||||
@@ -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) 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
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) {
|
if (sectors>0) {
|
||||||
sectors=d->read_audio(d, buffer, beginsector, sectors);
|
sectors=d->read_audio(d, buffer, beginsector, sectors);
|
||||||
|
|
||||||
if (sectors > 0){
|
if (sectors > 0) {
|
||||||
/* byteswap? */
|
/* byteswap? */
|
||||||
if(d->bigendianp==-1) /* not determined yet */
|
if ( d->bigendianp == -1 ) /* not determined yet */
|
||||||
d->bigendianp = data_bigendianp(d);
|
d->bigendianp = data_bigendianp(d);
|
||||||
|
|
||||||
if(d->bigendianp!=bigendianp()){
|
if ( d->b_swap_bytes && d->bigendianp != bigendianp() ) {
|
||||||
int i;
|
int i;
|
||||||
uint16_t *p=(uint16_t *)buffer;
|
uint16_t *p=(uint16_t *)buffer;
|
||||||
long els=sectors*CDIO_CD_FRAMESIZE_RAW/2;
|
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
|
cause the code to access outside of the allocated range of
|
||||||
buffer. This comment is just to serve as a marker for
|
buffer. This comment is just to serve as a marker for
|
||||||
the loop where the data got clobbered. I don't think this
|
the loop where the data got clobbered. I don't think this
|
||||||
|
|||||||
@@ -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) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
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->interface = COOKED_IOCTL;
|
||||||
d->bigendianp = -1; /* We don't know yet... */
|
d->bigendianp = -1; /* We don't know yet... */
|
||||||
d->nsectors = -1;
|
d->nsectors = -1;
|
||||||
|
d->b_swap_bytes = true;
|
||||||
|
|
||||||
{
|
{
|
||||||
cdio_hwinfo_t hw_info;
|
cdio_hwinfo_t hw_info;
|
||||||
|
|||||||
@@ -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>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#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 <stdio.h>
|
||||||
#include <stdlib.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
|
@return the CD-TEXT object or NULL if obj is NULL
|
||||||
or CD-TEXT information does not exist.
|
or CD-TEXT information does not exist.
|
||||||
*/
|
*/
|
||||||
const cdtext_t *
|
cdtext_t *
|
||||||
get_cdtext_generic (void *p_user_data, track_t i_track)
|
get_cdtext_generic (void *p_user_data, track_t i_track)
|
||||||
{
|
{
|
||||||
generic_img_private_t *p_env = p_user_data;
|
generic_img_private_t *p_env = p_user_data;
|
||||||
@@ -409,26 +409,27 @@ get_num_tracks_generic(void *p_user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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,
|
track_t i_first_track,
|
||||||
cdtext_field_t e_field, const char *psz_value)
|
cdtext_field_t e_field, const char *psz_value)
|
||||||
{
|
{
|
||||||
char **pp_field;
|
char **pp_field;
|
||||||
generic_img_private_t *env = user_data;
|
generic_img_private_t *p_env = p_user_data;
|
||||||
|
|
||||||
if( i_track == 0 )
|
if( i_track == 0 )
|
||||||
pp_field = &(env->cdtext.field[e_field]);
|
pp_field = &(p_env->cdtext.field[e_field]);
|
||||||
|
|
||||||
else
|
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 .
|
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.
|
not exist.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -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) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
#include <cdio/util.h>
|
#include <cdio/util.h>
|
||||||
#include "cdio_private.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
|
@return the CD-TEXT object or NULL if obj is NULL
|
||||||
or CD-TEXT information does not exist.
|
or CD-TEXT information does not exist.
|
||||||
*/
|
*/
|
||||||
const cdtext_t *
|
cdtext_t *
|
||||||
cdio_get_cdtext (CdIo *obj, track_t i_track)
|
cdio_get_cdtext (CdIo *obj, track_t i_track)
|
||||||
{
|
{
|
||||||
if (obj == NULL) return NULL;
|
if (obj == NULL) return NULL;
|
||||||
|
|||||||
@@ -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>
|
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
|
If i_track is 0 or CDIO_CDROM_LEADOUT_TRACK the track returned
|
||||||
is the information assocated with the CD.
|
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
|
Return an array of device names. if CdIo is NULL (we haven't
|
||||||
|
|||||||
@@ -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
|
toc reading routine adapted from cuetools
|
||||||
Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm>
|
Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm>
|
||||||
|
|
||||||
@@ -66,15 +66,18 @@ cdtext_field2str (cdtext_field_t i)
|
|||||||
return cdtext_keywords[i];
|
return cdtext_keywords[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Free memory assocated with cdtext*/
|
/*! Free memory assocated with cdtext*/
|
||||||
void
|
void
|
||||||
cdtext_destroy (cdtext_t *cdtext)
|
cdtext_destroy (cdtext_t *p_cdtext)
|
||||||
{
|
{
|
||||||
cdtext_field_t i;
|
cdtext_field_t i;
|
||||||
|
|
||||||
for (i=0; i < MAX_CDTEXT_FIELDS; 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
|
returns the CDTEXT value associated with key. NULL is returned
|
||||||
if key is CDTEXT_INVALID or the field is not set.
|
if key is CDTEXT_INVALID or the field is not set.
|
||||||
*/
|
*/
|
||||||
const char *
|
char *
|
||||||
cdtext_get (cdtext_field_t key, const cdtext_t *cdtext)
|
cdtext_get (cdtext_field_t key, const cdtext_t *p_cdtext)
|
||||||
{
|
{
|
||||||
if (key == CDTEXT_INVALID) return NULL;
|
if (key == CDTEXT_INVALID) return NULL;
|
||||||
return cdtext->field[key];
|
return strdup(p_cdtext->field[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Initialize a new cdtext structure.
|
/*! Initialize a new cdtext structure.
|
||||||
@@ -94,12 +97,12 @@ cdtext_get (cdtext_field_t key, const cdtext_t *cdtext)
|
|||||||
resources using cdtext_delete.
|
resources using cdtext_delete.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
cdtext_init (cdtext_t *cdtext)
|
cdtext_init (cdtext_t *p_cdtext)
|
||||||
{
|
{
|
||||||
cdtext_field_t i;
|
cdtext_field_t i;
|
||||||
|
|
||||||
for (i=0; i < MAX_CDTEXT_FIELDS; 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.
|
/*! sets cdtext's keyword entry to field.
|
||||||
*/
|
*/
|
||||||
void
|
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]);
|
if (p_cdtext->field[key]) free (p_cdtext->field[key]);
|
||||||
cdtext->field[key] = strdup (value);
|
p_cdtext->field[key] = strdup (p_value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SET_CDTEXT_FIELD(FIELD) \
|
#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.
|
parse all CD-TEXT data retrieved.
|
||||||
*/
|
*/
|
||||||
bool
|
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,
|
unsigned char *wdata,
|
||||||
set_cdtext_field_fn_t set_cdtext_field_fn)
|
set_cdtext_field_fn_t set_cdtext_field_fn)
|
||||||
{
|
{
|
||||||
CDText_data_t *pdata;
|
CDText_data_t *p_data;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
@@ -163,27 +166,27 @@ cdtext_data_init(void *user_data, track_t i_first_track,
|
|||||||
memset( buffer, 0x00, sizeof(buffer) );
|
memset( buffer, 0x00, sizeof(buffer) );
|
||||||
idx = 0;
|
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++ ) {
|
for( i=0; i < CDIO_CDTEXT_MAX_PACK_DATA; i++ ) {
|
||||||
|
|
||||||
#if TESTED
|
#if TESTED
|
||||||
if ( pdata->bDBC ) {
|
if ( p_data->bDBC ) {
|
||||||
cdio_warn("Double-byte characters not supported");
|
cdio_warn("Double-byte characters not supported");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( pdata->seq != i )
|
if( p_data->seq != i )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( (pdata->type >= 0x80)
|
if( (p_data->type >= 0x80)
|
||||||
&& (pdata->type <= 0x85) && (pdata->block == 0) ) {
|
&& (p_data->type <= 0x85) && (p_data->block == 0) ) {
|
||||||
i_track = pdata->i_track;
|
i_track = p_data->i_track;
|
||||||
|
|
||||||
for( j=0; j < CDIO_CDTEXT_MAX_TEXT_DATA; j++ ) {
|
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;
|
bool b_field_set=true;
|
||||||
switch( pdata->type) {
|
switch( p_data->type) {
|
||||||
case CDIO_CDTEXT_TITLE:
|
case CDIO_CDTEXT_TITLE:
|
||||||
SET_CDTEXT_FIELD(CDTEXT_TITLE);
|
SET_CDTEXT_FIELD(CDTEXT_TITLE);
|
||||||
break;
|
break;
|
||||||
@@ -216,12 +219,12 @@ cdtext_data_init(void *user_data, track_t i_first_track,
|
|||||||
idx = 0;
|
idx = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
buffer[idx++] = pdata->text[j];
|
buffer[idx++] = p_data->text[j];
|
||||||
}
|
}
|
||||||
buffer[idx] = 0x00;
|
buffer[idx] = 0x00;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pdata++;
|
p_data++;
|
||||||
}
|
}
|
||||||
return b_ret;
|
return b_ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
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
|
@return the CD-TEXT object or NULL if obj is NULL
|
||||||
or CD-TEXT information does not exist.
|
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.
|
Return the number of of the first track.
|
||||||
|
|||||||
@@ -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) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
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
|
static void
|
||||||
print_cdtext_track_info(CdIo_t *p_cdio, track_t i_track, const char *message) {
|
print_cdtext_track_info(CdIo_t *p_cdio, track_t i_track, const char *psz_msg) {
|
||||||
const cdtext_t *cdtext = cdio_get_cdtext(p_cdio, i_track);
|
cdtext_t *p_cdtext = cdio_get_cdtext(p_cdio, i_track);
|
||||||
|
|
||||||
if (NULL != cdtext) {
|
if (NULL != p_cdtext) {
|
||||||
cdtext_field_t i;
|
cdtext_field_t i;
|
||||||
|
|
||||||
printf("%s\n", message);
|
printf("%s\n", psz_msg);
|
||||||
|
|
||||||
for (i=0; i < MAX_CDTEXT_FIELDS; i++) {
|
for (i=0; i < MAX_CDTEXT_FIELDS; i++) {
|
||||||
if (cdtext->field[i]) {
|
if (p_cdtext->field[i]) {
|
||||||
printf("\t%s: %s\n", cdtext_field2str(i), cdtext->field[i]);
|
printf("\t%s: %s\n", cdtext_field2str(i), p_cdtext->field[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cdtext_destroy(p_cdtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user