Move a little bit forward in implementing SILENCE in cdrdao.

cdrdao tests now work while being a little more strict.
This commit is contained in:
R. Bernstein
2011-11-27 10:53:50 -05:00
parent 92a8bcb8c8
commit 4aa1a16dd1
3 changed files with 32 additions and 16 deletions

View File

@@ -229,6 +229,9 @@ _read_cdrdao (void *user_data, void *data, size_t size)
/*!
Return the size of the CD in logical block address (LBA) units.
FIXME: this assumes there is only one source for data or
one track of silence.
*/
static lsn_t
get_disc_last_lsn_cdrdao (void *p_user_data)
@@ -241,15 +244,22 @@ get_disc_last_lsn_cdrdao (void *p_user_data)
if (p_env->tocent[i_leadout-1].sec_count) {
i_size = p_env->tocent[i_leadout-1].sec_count;
} else {
if (NULL == p_env->tocent[i_leadout-1].data_source) {
cdio_warn ("Data source for image %s is null",
p_env->gen.source_name);
return -1;
}
i_size = cdio_stream_stat(p_env->tocent[i_leadout-1].data_source)
- p_env->tocent[i_leadout-1].offset;
if (NULL == p_env->tocent[i_leadout-1].data_source) {
if (!p_env->tocent[i_leadout-1].silence) {
cdio_warn ("Data source for image %s is null",
p_env->gen.source_name);
return -1;
}
/* FIXME: this is only correct if there is one
track of silence. */
i_size = p_env->tocent[i_leadout-1].silence;
} else {
/* FIXME: this is only correct if there is one data source. */
i_size = cdio_stream_stat(p_env->tocent[i_leadout-1].data_source)
- p_env->tocent[i_leadout-1].offset;
}
if (i_size < 0) {
cdio_error ("Can't get file information for data souce for image %s",
cdio_error ("Disc data size too small for track specification in image %s",
p_env->gen.source_name);
return i_size;
}
@@ -650,7 +660,14 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
/* SILENCE <length> */
} else if (0 == strcmp ("SILENCE", psz_keyword)) {
UNIMPLIMENTED_MSG;
if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) {
if (NULL != cd)
cd->tocent[i].silence = cdio_mmssff_to_lba (psz_field);
} else {
goto format_error;
}
cdio_log(log_level, "%s line %d: SILENCE not fully implimented",
psz_cue_name, i_line);
/* ZERO <length> */
} else if (0 == strcmp ("ZERO", psz_keyword)) {
@@ -847,7 +864,7 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
if (0 <= i) {
if (NULL != (psz_field = strtok (NULL, " \t\n\r"))) {
if (NULL != cd)
cd->tocent[i].silence = cdio_mmssff_to_lba (psz_field);
cd->tocent[i].pregap = cdio_mmssff_to_lba (psz_field);
} else {
goto format_error;
}

View File

@@ -1,7 +1,7 @@
TITLE "Join us now we have the software"
CATALOG 0000010271955
PERFORMER "Richard Stallman"
FILE "BOING.BIN" BINARY
FILE "CDDA.BIN" BINARY
TRACK 01 AUDIO
FLAGS DCP
INDEX 01 00:00:00

View File

@@ -1,23 +1,22 @@
// $Id: vcd2.toc,v 1.1 2005/01/16 04:34:20 rocky Exp $
// Taken from one of Steve Schultz's VCD collection.
// The .bin has been changed and is wrong.
// The .bin and offsets have been changed and are wrong.
CD_ROM_XA
// Track 1
TRACK MODE2_FORM_MIX
COPY
DATAFILE "cdda.bin" 00:05:00 // length in bytes: 1051200
DATAFILE "../cdda.bin" 00:00:00 // comment
// Track 2
TRACK MODE2_FORM_MIX
COPY
DATAFILE "cdda.bin" #1051200 34:31:23 // length in bytes: 362892928
DATAFILE "cdda.bin" #100 00:00:03
// Track 3
TRACK MODE2_FORM_MIX
COPY
DATAFILE "cdda.bin" #363944128 39:04:26 // length in bytes: 410729536
DATAFILE "cdda.bin" #200 00:00:25