From cccaa2a0361ed34d475d823f97e1acd1c5e134fb Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 31 Aug 2003 08:32:40 +0000 Subject: [PATCH] I think I have the XA encapsulation down so that it will work in vcdimager (and others). --- include/cdio/iso9660.h | 8 ++- include/cdio/xa.h | 11 +++- lib/Makefile.am | 5 +- lib/iso9660_fs.c | 9 ++-- lib/xa.c | 59 +++++++++++++++++++++ lib/xa.h | 114 ----------------------------------------- src/cd-info.c | 5 +- test/cdda.right | 17 ++++++ test/check_cue.sh.in | 6 +-- test/check_nrg.sh.in | 4 +- test/monvoisin.right | 11 ++++ test/vcd_demo.right | 11 ++++ 12 files changed, 130 insertions(+), 130 deletions(-) create mode 100644 lib/xa.c delete mode 100644 lib/xa.h diff --git a/include/cdio/iso9660.h b/include/cdio/iso9660.h index a8e470ce..a843fc35 100644 --- a/include/cdio/iso9660.h +++ b/include/cdio/iso9660.h @@ -1,5 +1,5 @@ /* - $Id: iso9660.h,v 1.9 2003/08/31 07:39:45 rocky Exp $ + $Id: iso9660.h,v 1.10 2003/08/31 08:32:40 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003 Rocky Bernstein @@ -23,7 +23,6 @@ #define __CDIO_ISO9660_H__ /* Will eventually need/use glib.h */ -#include #include #include @@ -256,6 +255,11 @@ iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent, const char * iso9660_get_xa_attr_str (uint16_t xa_attr); +iso9660_xa_t * +iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr, + uint8_t filenum); + + #endif /* __CDIO_ISO9660_H__ */ diff --git a/include/cdio/xa.h b/include/cdio/xa.h index d885f08f..71744c10 100644 --- a/include/cdio/xa.h +++ b/include/cdio/xa.h @@ -1,5 +1,5 @@ /* - $Id: xa.h,v 1.1 2003/08/31 07:39:45 rocky Exp $ + $Id: xa.h,v 1.2 2003/08/31 08:32:40 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003 Rocky Bernstein @@ -43,6 +43,10 @@ #define XA_PERM_ALL_EXEC (XA_ATTR_U_EXEC | XA_ATTR_G_EXEC | XA_ATTR_O_EXEC) #define XA_PERM_ALL_ALL (XA_PERM_ALL_READ | XA_PERM_ALL_EXEC) +#define XA_FORM1_DIR (XA_ATTR_DIRECTORY | XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL) +#define XA_FORM1_FILE (XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL) +#define XA_FORM2_FILE (XA_ATTR_MODE2FORM2 | XA_PERM_ALL_ALL) + typedef struct iso9660_xa iso9660_xa_t; struct iso9660_xa /* big endian!! */ @@ -55,3 +59,8 @@ struct iso9660_xa /* big endian!! */ uint8_t reserved[5]; /* zero */ } GNUC_PACKED; + +iso9660_xa_t * +iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr, + uint8_t filenum); + diff --git a/lib/Makefile.am b/lib/Makefile.am index ad1b19a8..f03173b6 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.10 2003/08/31 06:59:23 rocky Exp $ +# $Id: Makefile.am,v 1.11 2003/08/31 08:32:40 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -52,7 +52,6 @@ libiso9660_la_SOURCES = \ iso9660.c \ iso9660_private.h \ iso9660_fs.c \ - iso9660_fs.h \ - xa.h + xa.c INCLUDES = -I$(LIBCDIO_CFLAGS) diff --git a/lib/iso9660_fs.c b/lib/iso9660_fs.c index 23d2dec7..fdf1e9bb 100644 --- a/lib/iso9660_fs.c +++ b/lib/iso9660_fs.c @@ -1,5 +1,5 @@ /* - $Id: iso9660_fs.c,v 1.1 2003/08/31 06:59:23 rocky Exp $ + $Id: iso9660_fs.c,v 1.2 2003/08/31 08:32:40 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2003 Rocky Bernstein @@ -27,11 +27,14 @@ #include #include +#include /* Private headers */ -#include "iso9660_fs.h" +#include "cdio_assert.h" +#include "bytesex.h" +#include "ds.h" -static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.1 2003/08/31 06:59:23 rocky Exp $"; +static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.2 2003/08/31 08:32:40 rocky Exp $"; #define BUF_COUNT 16 #define BUF_SIZE 80 diff --git a/lib/xa.c b/lib/xa.c new file mode 100644 index 00000000..daddbd44 --- /dev/null +++ b/lib/xa.c @@ -0,0 +1,59 @@ +/* + $Id: xa.c,v 1.1 2003/08/31 08:32:40 rocky Exp $ + + Copyright (C) 2000 Herbert Valerio Riedel + Copyright (C) 2003 Rocky Bernstein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* Public headers */ +#include +#include + +/* Private headers */ +#include "cdio_assert.h" +#include "bytesex.h" + +#define iso9660_xa_t_SIZEOF 14 + +iso9660_xa_t * +iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr, + uint8_t filenum) +{ + cdio_assert (_xa != NULL); + + _xa->user_id = uint16_to_be (uid); + _xa->group_id = uint16_to_be (gid); + _xa->attributes = uint16_to_be (attr); + + _xa->signature[0] = 'X'; + _xa->signature[1] = 'A'; + + _xa->filenum = filenum; + + _xa->reserved[0] + = _xa->reserved[1] + = _xa->reserved[2] + = _xa->reserved[3] + = _xa->reserved[4] = 0x00; + + return _xa; +} diff --git a/lib/xa.h b/lib/xa.h deleted file mode 100644 index 2dcf3787..00000000 --- a/lib/xa.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - $Id: xa.h,v 1.1 2003/08/31 06:59:23 rocky Exp $ - - Copyright (C) 2000 Herbert Valerio Riedel - Copyright (C) 2003 Rocky Bernstein - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef __CDIO_XA_H__ -#define __CDIO_XA_H__ - -/* Public headers */ -#include -#include -#include - -/* Private headers */ -#include "cdio_assert.h" -#include "bytesex.h" - -/* XA attribute definitions */ -#define XA_ATTR_U_READ (1 << 0) -/* reserved */ -#define XA_ATTR_U_EXEC (1 << 2) -/* reserved */ -#define XA_ATTR_G_READ (1 << 4) -/* reserved */ -#define XA_ATTR_G_EXEC (1 << 6) -/* reserved */ -#define XA_ATTR_O_READ (1 << 8) -/* reserved */ -#define XA_ATTR_O_EXEC (1 << 10) - -#define XA_ATTR_MODE2FORM1 (1 << 11) -#define XA_ATTR_MODE2FORM2 (1 << 12) -#define XA_ATTR_INTERLEAVED (1 << 13) -#define XA_ATTR_CDDA (1 << 14) -#define XA_ATTR_DIRECTORY (1 << 15) - -/* some aggregations */ -#define XA_PERM_ALL_READ (XA_ATTR_U_READ | XA_ATTR_G_READ | XA_ATTR_O_READ) -#define XA_PERM_ALL_EXEC (XA_ATTR_U_EXEC | XA_ATTR_G_EXEC | XA_ATTR_O_EXEC) -#define XA_PERM_ALL_ALL (XA_PERM_ALL_READ | XA_PERM_ALL_EXEC) - -/* the struct */ - -PRAGMA_BEGIN_PACKED -typedef struct /* big endian!! */ -{ - uint16_t user_id; /* 0 */ - uint16_t group_id; /* 0 */ - uint16_t attributes; /* XA_ATTR_ */ - uint8_t signature[2]; /* { 'X', 'A' } */ - uint8_t filenum; /* file number, see also XA subheader */ - uint8_t reserved[5]; /* zero */ -} GNUC_PACKED iso9660_xa_t; - -PRAGMA_END_PACKED - -struct iso9660_stat { - enum { _STAT_FILE = 1, _STAT_DIR = 2 } type; - lsn_t lsn; /* start logical sector number */ - uint32_t size; /* total size in bytes */ - uint32_t secsize; /* number of sectors allocated */ - iso9660_xa_t xa; /* XA attributes */ -}; - -#define iso9660_xa_t_SIZEOF 14 - -static inline iso9660_xa_t * -iso9660_xa_new (void) -{ - return _cdio_malloc (sizeof (iso9660_xa_t)); -} - -static inline iso9660_xa_t * -iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr, - uint8_t filenum) -{ - cdio_assert (_xa != NULL); - - - _xa->user_id = uint16_to_be (uid); - _xa->group_id = uint16_to_be (gid); - _xa->attributes = uint16_to_be (attr); - - _xa->signature[0] = 'X'; - _xa->signature[1] = 'A'; - - _xa->filenum = filenum; - - _xa->reserved[0] - = _xa->reserved[1] - = _xa->reserved[2] - = _xa->reserved[3] - = _xa->reserved[4] = 0x00; - - return _xa; -} - -#endif /* __VCD_XA_H__ */ diff --git a/src/cd-info.c b/src/cd-info.c index 4bc29f39..ccd19f8b 100644 --- a/src/cd-info.c +++ b/src/cd-info.c @@ -1,5 +1,5 @@ /* - $Id: cd-info.c,v 1.25 2003/08/31 06:59:23 rocky Exp $ + $Id: cd-info.c,v 1.26 2003/08/31 08:32:40 rocky Exp $ Copyright (C) 2003 Rocky Bernstein Copyright (C) 1996,1997,1998 Gerd Knorr @@ -55,8 +55,9 @@ #include #include +#include "cdio_assert.h" +#include "bytesex.h" #include "ds.h" -#include "xa.h" #include "iso9660_private.h" #include diff --git a/test/cdda.right b/test/cdda.right index cef76802..66aa7f3e 100644 --- a/test/cdda.right +++ b/test/cdda.right @@ -9,3 +9,20 @@ CD-ROM Track List (1 - 1) __________________________________ CD Analysis Report Audio CD, CDDB disc ID is 02000401 +lt-cd-info: Found 1 matches in CDDB +Disc ID: 02000401 +CDDB category: blues (6) +Music genre: 'Rock' +Year: 0 +Artist: 'White Zombie' +Title: 'Living Dead Girl' +Extended data: ' ID3G: 17' +Length: 6 seconds +Number of tracks: 1 + Track 1 + number: 1 + frame offset: 150 + length: 4 seconds + artist: 'White Zombie' + title: 'hit mania dance champions 2001' + extended data: '' diff --git a/test/check_cue.sh.in b/test/check_cue.sh.in index c7bca4d6..71f98319 100644 --- a/test/check_cue.sh.in +++ b/test/check_cue.sh.in @@ -1,10 +1,10 @@ #!/bin/sh -#$Id: check_cue.sh.in,v 1.5 2003/08/31 06:59:23 rocky Exp $ -if test -n "@CDDB_LIB@" ; then +#$Id: check_cue.sh.in,v 1.6 2003/08/31 08:32:40 rocky Exp $ +if test -z "@CDDB_LIB@" ; then cddb_opt='--no-cddb' fi -if test -n "@VCDINFO_LIBS@" ; then +if test -z "@VCDINFO_LIBS@" ; then vcd_opt='--no-vcd' else vcd_opt='--iso9660' diff --git a/test/check_nrg.sh.in b/test/check_nrg.sh.in index 596e6012..fcdf2f31 100755 --- a/test/check_nrg.sh.in +++ b/test/check_nrg.sh.in @@ -1,7 +1,7 @@ #!/bin/sh -#$Id: check_nrg.sh.in,v 1.4 2003/08/31 06:59:23 rocky Exp $ +#$Id: check_nrg.sh.in,v 1.5 2003/08/31 08:32:40 rocky Exp $ -if test -n "@VCDINFO_LIBS@" ; then +if test -z "@VCDINFO_LIBS@" ; then vcd_opt='--no-vcd' else vcd_opt='--iso9660' diff --git a/test/monvoisin.right b/test/monvoisin.right index a9015f0e..58affedd 100644 --- a/test/monvoisin.right +++ b/test/monvoisin.right @@ -56,5 +56,16 @@ ISO9660 filesystem - ----1xrxrxr 0 0 [fn 00] [LSN 184] 24 PSD.VCD;1 XA sectors Video CD +format: VCD 2.0 +album id: `' +volume count: 1 +volume number: 1 +system id: `CD-RTOS CD-BRIDGE' +volume id: `MONVOISIN' +volumeset id: `' +publisher id: `' +preparer id: `' +application id: `CDI/CDI_VCD.APP;1' + session #2 starts at track 2, LSN: 1251, ISO 9660 blocks: 1101 ISO 9660: 1101 blocks, label `MONVOISIN ' diff --git a/test/vcd_demo.right b/test/vcd_demo.right index 587e7ffa..48921971 100644 --- a/test/vcd_demo.right +++ b/test/vcd_demo.right @@ -81,5 +81,16 @@ ISO9660 filesystem - ----1xrxrxr 0 0 [fn 00] [LSN 184] 72 PSD.VCD;1 XA sectors Video CD +format: VCD 2.0 +album id: `LOEKI' +volume count: 1 +volume number: 1 +system id: `CD-RTOS CD-BRIDGE' +volume id: `V0469' +volumeset id: `' +publisher id: `LAURENS KOEHOORN' +preparer id: `LKVCDIMAGER 5.0.7.10(WIN32)' +application id: `' + session #2 starts at track 2, LSN: 1182, ISO 9660 blocks: 1032 ISO 9660: 1032 blocks, label `V0469 '