Improve cdrdao to handle MSF-length.
Remove vcd_demo_toc.right since the cd-info output is now the same as vcd_demo.right vcd_demo.toc adjusted accordingly.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: image.h,v 1.5 2005/01/21 10:11:24 rocky Exp $
|
||||
$Id: image.h,v 1.6 2005/01/22 23:57:10 rocky Exp $
|
||||
|
||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -48,7 +48,6 @@ typedef struct {
|
||||
msf_t start_msf;
|
||||
lba_t start_lba;
|
||||
int start_index;
|
||||
lba_t length;
|
||||
lba_t pregap; /**< pre-gap with zero audio data */
|
||||
int sec_count; /**< Number of sectors in this track. Does not
|
||||
include pregap */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cdrdao.c,v 1.8 2005/01/21 10:11:24 rocky Exp $
|
||||
$Id: cdrdao.c,v 1.9 2005/01/22 23:57:10 rocky Exp $
|
||||
|
||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
toc reading routine adapted from cuetools
|
||||
@@ -25,7 +25,7 @@
|
||||
(*.cue).
|
||||
*/
|
||||
|
||||
static const char _rcsid[] = "$Id: cdrdao.c,v 1.8 2005/01/21 10:11:24 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: cdrdao.c,v 1.9 2005/01/22 23:57:10 rocky Exp $";
|
||||
|
||||
#include "image.h"
|
||||
#include "cdio_assert.h"
|
||||
@@ -237,15 +237,20 @@ _stat_size_cdrdao (void *p_user_data)
|
||||
_img_private_t *p_env = p_user_data;
|
||||
track_t i_leadout = p_env->gen.i_tracks;
|
||||
long i_blocksize = p_env->tocent[i_leadout-1].blocksize;
|
||||
long i_size = cdio_stream_stat(p_env->tocent[i_leadout-1].data_source)
|
||||
- p_env->tocent[i_leadout-1].offset;
|
||||
long i_size;
|
||||
|
||||
if (check_track_is_blocksize_multiple(p_env->tocent[i_leadout-1].filename,
|
||||
i_leadout-1, i_size, i_blocksize)) {
|
||||
i_size /= i_blocksize;
|
||||
if (p_env->tocent[i_leadout-1].sec_count) {
|
||||
i_size = p_env->tocent[i_leadout-1].sec_count;
|
||||
} else {
|
||||
/* Round up */
|
||||
i_size = (i_size / i_blocksize) + 1;
|
||||
i_size = cdio_stream_stat(p_env->tocent[i_leadout-1].data_source)
|
||||
- p_env->tocent[i_leadout-1].offset;
|
||||
if (check_track_is_blocksize_multiple(p_env->tocent[i_leadout-1].filename,
|
||||
i_leadout-1, i_size, i_blocksize)) {
|
||||
i_size /= i_blocksize;
|
||||
} else {
|
||||
/* Round up */
|
||||
i_size = (i_size / i_blocksize) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
i_size += p_env->tocent[i_leadout-1].start_lba;
|
||||
@@ -270,7 +275,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
|
||||
int i = -1; /* Position in tocent. Same as
|
||||
cd->gen.i_tracks - 1 */
|
||||
char *psz_keyword, *psz_field;
|
||||
cdio_log_level_t log_level = (NULL == cd) ? CDIO_LOG_INFO : CDIO_LOG_WARN;
|
||||
cdio_log_level_t log_level = (cd) ? CDIO_LOG_WARN : CDIO_LOG_INFO ;
|
||||
cdtext_field_t cdtext_key;
|
||||
|
||||
/* The below declaration(s) may be unique to this image-parse routine. */
|
||||
@@ -291,17 +296,17 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
|
||||
cd->gen.b_cdtext_error = false;
|
||||
}
|
||||
|
||||
while ((fgets(psz_line, MAXLINE, fp)) != NULL) {
|
||||
while (fgets(psz_line, MAXLINE, fp)) {
|
||||
|
||||
i_line++;
|
||||
|
||||
/* strip comment from line */
|
||||
/* todo: // in quoted strings? */
|
||||
/* //comment */
|
||||
if (NULL != (psz_field = strstr (psz_line, "//")))
|
||||
if ((psz_field = strstr (psz_line, "//")))
|
||||
*psz_field = '\0';
|
||||
|
||||
if (NULL != (psz_keyword = strtok (psz_line, " \t\n\r"))) {
|
||||
if ((psz_keyword = strtok (psz_line, " \t\n\r"))) {
|
||||
/* CATALOG "ddddddddddddd" */
|
||||
if (0 == strcmp ("CATALOG", psz_keyword)) {
|
||||
if (-1 == i) {
|
||||
@@ -648,37 +653,70 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
|
||||
|| 0 == strcmp ("AUDIOFILE", psz_keyword)) {
|
||||
if (0 <= i) {
|
||||
if (NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) {
|
||||
long i_size;
|
||||
|
||||
/* Handle "<filename>" */
|
||||
if (NULL != cd) {
|
||||
if (cd) {
|
||||
cd->tocent[i].filename = strdup (psz_field);
|
||||
/* Todo: do something about reusing existing files. */
|
||||
/* To do: do something about reusing existing files. */
|
||||
if (!(cd->tocent[i].data_source = cdio_stdio_new (psz_field))) {
|
||||
cdio_log (log_level,
|
||||
"%s line %d: can't open file `%s' for reading",
|
||||
psz_cue_name, i_line, psz_field);
|
||||
goto err_exit;
|
||||
}
|
||||
i_size = cdio_stream_stat(cd->tocent[i].data_source);
|
||||
} else {
|
||||
CdioDataSource_t *s = cdio_stdio_new (psz_field);
|
||||
if (!s) {
|
||||
cdio_log (log_level,
|
||||
"%s line %d: can't open file `%s' for reading",
|
||||
psz_cue_name, i_line, psz_field);
|
||||
goto err_exit;
|
||||
}
|
||||
i_size = cdio_stream_stat(s);
|
||||
cdio_stdio_destroy (s);
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) {
|
||||
/* Handle <start-msf> */
|
||||
lba_t lba = cdio_lsn_to_lba(cdio_mmssff_to_lba (psz_field));
|
||||
if (CDIO_INVALID_LBA == lba) {
|
||||
lba_t i_start_lba =
|
||||
cdio_lsn_to_lba(cdio_mmssff_to_lba (psz_field));
|
||||
if (CDIO_INVALID_LBA == i_start_lba) {
|
||||
cdio_log(log_level, "%s line %d: invalid MSF string %s",
|
||||
psz_cue_name, i_line, psz_field);
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
if (NULL != cd) {
|
||||
cd->tocent[i].start_lba = lba;
|
||||
cdio_lba_to_msf(lba, &(cd->tocent[i].start_msf));
|
||||
cd->tocent[i].start_lba = i_start_lba;
|
||||
cdio_lba_to_msf(i_start_lba, &(cd->tocent[i].start_msf));
|
||||
}
|
||||
}
|
||||
if (NULL != (psz_field = strtok (NULL, " \t\n\r")))
|
||||
if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) {
|
||||
/* Handle <length-msf> */
|
||||
if (NULL != cd)
|
||||
cd->tocent[i].length = cdio_mmssff_to_lba (psz_field);
|
||||
lba_t lba = cdio_mmssff_to_lba (psz_field);
|
||||
if (CDIO_INVALID_LBA == lba) {
|
||||
cdio_log(log_level, "%s line %d: invalid MSF string %s",
|
||||
psz_cue_name, i_line, psz_field);
|
||||
goto err_exit;
|
||||
}
|
||||
if (cd) {
|
||||
long i_size = cdio_stream_stat(cd->tocent[i].data_source);
|
||||
if (lba) {
|
||||
if ( (lba * cd->tocent[i].datasize) > i_size) {
|
||||
cdio_log(log_level,
|
||||
"%s line %d: MSF length %s exceeds end of file",
|
||||
psz_cue_name, i_line, psz_field);
|
||||
goto err_exit;
|
||||
}
|
||||
} else {
|
||||
lba = i_size / cd->tocent[i].blocksize;
|
||||
}
|
||||
cd->tocent[i].sec_count = lba;
|
||||
}
|
||||
}
|
||||
if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) {
|
||||
goto format_error;
|
||||
}
|
||||
@@ -691,15 +729,24 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
|
||||
if (0 <= i) {
|
||||
if (NULL != (psz_field = strtok (NULL, "\"\t\n\r"))) {
|
||||
/* Handle <filename> */
|
||||
if (NULL != cd) {
|
||||
if (cd) {
|
||||
cd->tocent[i].filename = strdup (psz_field);
|
||||
/* Todo: do something about reusing existing files. */
|
||||
/* To do: do something about reusing existing files. */
|
||||
if (!(cd->tocent[i].data_source = cdio_stdio_new (psz_field))) {
|
||||
cdio_log (log_level,
|
||||
"%s line %d: can't open file `%s' for reading",
|
||||
psz_cue_name, i_line, psz_field);
|
||||
goto err_exit;
|
||||
}
|
||||
} else {
|
||||
CdioDataSource_t *s = cdio_stdio_new (psz_field);
|
||||
if (!s) {
|
||||
cdio_log (log_level,
|
||||
"%s line %d: can't open file `%s' for reading",
|
||||
psz_cue_name, i_line, psz_field);
|
||||
goto err_exit;
|
||||
}
|
||||
cdio_stdio_destroy (s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.am,v 1.43 2005/01/18 03:46:40 rocky Exp $
|
||||
# $Id: Makefile.am,v 1.44 2005/01/22 23:57:10 rocky Exp $
|
||||
#
|
||||
# Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
#
|
||||
@@ -56,7 +56,7 @@ check_SCRIPTS = check_nrg.sh check_cue.sh check_cd_read.sh \
|
||||
|
||||
check_PROGRAMS = $(hack)
|
||||
|
||||
check_DATA = vcd_demo.right vcd_demo_vcdinfo.right vcd_demo_vcdinfo_toc.right \
|
||||
check_DATA = vcd_demo.right vcd_demo_vcdinfo.right \
|
||||
videocd.right videocd.nrg \
|
||||
cdda.right cdda.toc cdda.cue cdda.bin \
|
||||
isofs-m1.right isofs-m1.toc isofs-m1.cue isofs-m1.bin \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
#$Id: check_cue.sh.in,v 1.23 2004/12/31 08:27:49 rocky Exp $
|
||||
#$Id: check_cue.sh.in,v 1.24 2005/01/22 23:57:11 rocky Exp $
|
||||
# Tests to see that BIN/CUE and cdrdao TOC file iamge reading is correct
|
||||
# (via cd-info).
|
||||
|
||||
@@ -72,9 +72,9 @@ if test -f ${srcdir}/${fname}.bin ; then
|
||||
check_result $RC "cd-info CUE test $testnum" "${CD_INFO} $opts"
|
||||
|
||||
if test -z "@VCDINFO_LIBS@" ; then
|
||||
right=${srcdir}/${fname}_toc.right
|
||||
right=${srcdir}/${fname}.right
|
||||
else
|
||||
right=${srcdir}/${fname}_vcdinfo_toc.right
|
||||
right=${srcdir}/${fname}_vcdinfo.right
|
||||
fi
|
||||
opts="-q --no-device-info --no-disc-mode -t ${srcdir}/${fname}.toc --iso9660"
|
||||
if test -f ${srcdir}/${fname}.toc ; then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CD_DA
|
||||
CD_ROM_XA
|
||||
|
||||
TRACK MODE2_RAW
|
||||
COPY
|
||||
@@ -11,5 +11,5 @@ START 00:02:00
|
||||
|
||||
TRACK MODE2_RAW
|
||||
COPY
|
||||
FILE "vcd_demo.bin" 00:20:71 00:00:00
|
||||
FILE "vcd_demo.bin" 00:20:71 00:05:14
|
||||
START 00:02:00
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
This is free software; see the source for copying conditions.
|
||||
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
__________________________________
|
||||
|
||||
CD-ROM Track List (1 - 3)
|
||||
#: MSF LSN Type Green? Copy? Channels Premphasis?
|
||||
1: 00:02:00 000000 XA true yes
|
||||
2: 00:17:57 001182 XA true yes
|
||||
3: 00:24:71 001721 XA true yes
|
||||
170: 00:53:06 003831 leadout (8 MB raw, 8 MB formatted)
|
||||
Media Catalog Number (MCN): not available
|
||||
__________________________________
|
||||
CD Analysis Report
|
||||
CD-ROM with CD-RTOS and ISO 9660 filesystem
|
||||
ISO 9660: 1032 blocks, label `V0469 '
|
||||
Application:
|
||||
Preparer : LKVCDIMAGER 5.0.7.10(WIN32)
|
||||
Publisher : LAURENS KOEHOORN
|
||||
System : CD-RTOS CD-BRIDGE
|
||||
Volume : V0469
|
||||
Volume Set :
|
||||
ISO9660 filesystem
|
||||
/:
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 .
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 ..
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Jul 14 1978 00:00 ext
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Jul 14 1978 00:00 mpegav
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Jul 14 1978 00:00 segment
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Jul 14 1978 00:00 sources
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 25] 2048 Jul 14 1978 00:00 vcd
|
||||
|
||||
/EXT/:
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Jul 14 1978 00:00 .
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 ..
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 375] 65536 Jul 14 1978 00:00 lot_x.vcd
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 407] 144 Jul 14 1978 00:00 psd_x.vcd
|
||||
|
||||
/MPEGAV/:
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Jul 14 1978 00:00 .
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 ..
|
||||
- ---2-xrxrxr 0 0 [fn 01] [LSN 1182] 904036 ( 796672) Jul 14 1978 00:00 avseq01.dat
|
||||
- ---2-xrxrxr 0 0 [fn 02] [LSN 1721] 904036 ( 796672) Jul 14 1978 00:00 avseq02.dat
|
||||
|
||||
/SEGMENT/:
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Jul 14 1978 00:00 .
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 ..
|
||||
- ---2-xrxrxr 0 0 [fn 01] [LSN 225] 220780 ( 194560) Jul 14 1978 00:00 item0001.dat
|
||||
|
||||
/Sources/:
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Jul 14 1978 00:00 .
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 ..
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Jul 14 1978 00:00 html
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 434] 842 Dec 11 2002 10:33 index.htm
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 435] 1216557 Jan 07 2003 18:01 menu.ppm
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 1030] 2793 Jan 07 2003 18:08 source.xml
|
||||
|
||||
/Sources/HTML/:
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Jul 14 1978 00:00 .
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Jul 14 1978 00:00 ..
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 425] 1067 Jan 07 2003 17:51 0.xml
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 426] 1067 Jan 07 2003 17:51 1.xml
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 24] 2048 Jul 14 1978 00:00 img
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 427] 1327 Jan 07 2003 17:51 movies.css
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 428] 12024 Jan 07 2003 17:51 toc.xsl
|
||||
|
||||
/Sources/HTML/img/:
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 24] 2048 Jul 14 1978 00:00 .
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Jul 14 1978 00:00 ..
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 408] 1999 Nov 13 2002 07:27 al.gif
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 409] 7626 Jan 07 2003 17:42 loeki_groep_01.gif
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 413] 9986 Jan 07 2003 17:42 loeki_groep_02.gif
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 418] 207 Nov 14 2002 19:33 a_left.gif
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 419] 207 Nov 14 2002 19:33 a_right.gif
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 420] 441 Nov 13 2002 10:54 animatie.gif
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 421] 250 Nov 14 2002 11:44 face_up2.gif
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 422] 259 Nov 13 2002 11:09 familie.gif
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 423] 1010 Nov 14 2002 11:52 goldstar2.gif
|
||||
- ----1xrxrxr 0 0 [fn 01] [LSN 424] 1783 Nov 13 2002 07:15 vcd.gif
|
||||
|
||||
/VCD/:
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 25] 2048 Jul 14 1978 00:00 .
|
||||
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 ..
|
||||
- ----1xrxrxr 0 0 [fn 00] [LSN 151] 2048 Jul 14 1978 00:00 entries.vcd
|
||||
- ----1xrxrxr 0 0 [fn 00] [LSN 150] 2048 Jul 14 1978 00:00 info.vcd
|
||||
- ----1xrxrxr 0 0 [fn 00] [LSN 152] 65536 Jul 14 1978 00:00 lot.vcd
|
||||
- ----1xrxrxr 0 0 [fn 00] [LSN 184] 72 Jul 14 1978 00:00 psd.vcd
|
||||
|
||||
XA sectors Video CD
|
||||
session #2 starts at track 2, LSN: 1182, ISO 9660 blocks: 1032
|
||||
ISO 9660: 1032 blocks, label `V0469 '
|
||||
Reference in New Issue
Block a user