cd-read add --mode='any' which is basically a mmc_read_cd with

CDIO_MMC_READ_TYPE_ANY.
This commit is contained in:
rocky
2008-03-06 01:16:49 +00:00
parent aeadea40e4
commit b78955226e
5 changed files with 38 additions and 26 deletions

6
NEWS
View File

@@ -1,4 +1,4 @@
$Id: NEWS,v 1.115 2008/02/29 11:34:15 rocky Exp $ $Id: NEWS,v 1.116 2008/03/06 01:16:49 rocky Exp $
version 0.80 version 0.80
2008-03-15 2008-03-15
@@ -7,6 +7,8 @@ version 0.80
- Add option to log summary output in cd-paranoia - Add option to log summary output in cd-paranoia
- More string bounds checking to eliminate known string overflow conditions, - More string bounds checking to eliminate known string overflow conditions,
e.g. Savannah bug #21910 e.g. Savannah bug #21910
- add --mode="any" on cd-read which uses a mmc_read_sectors with read-type
CDIO_MMC_READ_TYPE_ANY.
version 0.79 version 0.79
2007-10-27 2007-10-27
@@ -395,4 +397,4 @@ version 0.1
Routines split off from VCDImager. Routines split off from VCDImager.
$Id: NEWS,v 1.115 2008/02/29 11:34:15 rocky Exp $ $Id: NEWS,v 1.116 2008/03/06 01:16:49 rocky Exp $

View File

@@ -1,7 +1,7 @@
/* /*
$Id: cd-read.c,v 1.30 2006/03/17 23:37:19 rocky Exp $ $Id: cd-read.c,v 1.31 2008/03/06 01:16:49 rocky Exp $
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -19,9 +19,10 @@
02110-1301 USA. 02110-1301 USA.
*/ */
/* Program to debug read routines audio, mode1, mode2 forms 1 & 2. */ /* Program to debug read routines audio, auto, mode1, mode2 forms 1 & 2. */
#include "util.h" #include "util.h"
#include <cdio/mmc.h>
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
#include <sys/stat.h> #include <sys/stat.h>
@@ -64,10 +65,8 @@ typedef enum
READ_M1F2 = CDIO_READ_MODE_M1F2, READ_M1F2 = CDIO_READ_MODE_M1F2,
READ_M2F1 = CDIO_READ_MODE_M2F1, READ_M2F1 = CDIO_READ_MODE_M2F1,
READ_M2F2 = CDIO_READ_MODE_M2F2, READ_M2F2 = CDIO_READ_MODE_M2F2,
READ_MODE_UNINIT READ_MODE_UNINIT,
#if AUTO_FINISHED READ_ANY
READ_AUTO
#endif
} read_mode_t; } read_mode_t;
/* Structure used so we can binary sort and set the --mode switch. */ /* Structure used so we can binary sort and set the --mode switch. */
@@ -80,6 +79,7 @@ typedef struct
/* Sub-options for --mode. Note: entries must be sorted! */ /* Sub-options for --mode. Note: entries must be sorted! */
subopt_entry_t modes_sublist[] = { subopt_entry_t modes_sublist[] = {
{"any", READ_ANY},
{"audio", READ_AUDIO}, {"audio", READ_AUDIO},
{"m1f1", READ_M1F1}, {"m1f1", READ_M1F1},
{"m1f2", READ_M1F2}, {"m1f2", READ_M1F2},
@@ -243,7 +243,7 @@ parse_options (int argc, char *argv[])
const char* helpText = const char* helpText =
"Usage: %s [OPTION...]\n" "Usage: %s [OPTION...]\n"
" -a, --access-mode=STRING Set CD control access mode\n" " -a, --access-mode=STRING Set CD control access mode\n"
" -m, --mode=MODE-TYPE set CD-ROM read mode (audio, m1f1, m1f2,\n" " -m, --mode=MODE-TYPE set CD-ROM read mode (audio, auto, m1f1, m1f2,\n"
" m2mf1, m2f2)\n" " m2mf1, m2f2)\n"
" -d, --debug=INT Set debugging to LEVEL\n" " -d, --debug=INT Set debugging to LEVEL\n"
" -x, --hexdump Show output as a hex dump. The default is a\n" " -x, --hexdump Show output as a hex dump. The default is a\n"
@@ -392,7 +392,7 @@ parse_options (int argc, char *argv[])
if (opts.read_mode == READ_MODE_UNINIT) { if (opts.read_mode == READ_MODE_UNINIT) {
report( stderr, report( stderr,
"%s: Need to give a read mode " "%s: Need to give a read mode "
"(audio, m1f1, m1f2, m2f1 or m2f2)\n", "(audio, m1f1, m1f2, m2f1, m2f2, or auto)\n",
program_name ); program_name );
free(program_name); free(program_name);
exit(10); exit(10);
@@ -556,16 +556,26 @@ main(int argc, char *argv[])
} }
} }
break; break;
#if AUTO_FINISHED
case READ_AUTO:
/* Find what track lsn is in. Then
switch cdio_get_track_format(p_cdio, i)
and also test using is_green
*/ case READ_ANY:
{
driver_id_t driver_id = cdio_get_driver_id(p_cdio);
if (cdio_is_device(source_name, driver_id)) {
if (DRIVER_OP_SUCCESS !=
mmc_read_sectors(p_cdio, &buffer,
opts.start_lsn, CDIO_MMC_READ_TYPE_ANY, 1)) {
report( stderr, "error reading block %u\n",
(unsigned int) opts.start_lsn );
blocklen = 0;
}
} else {
err_exit(
"%s: mode 'any' must be used with a real CD-ROM, not an image file.\n", program_name);
}
}
break; break;
#endif
case READ_MODE_UNINIT: case READ_MODE_UNINIT:
err_exit("%s: Reading mode not set\n", program_name); err_exit("%s: Reading mode not set\n", program_name);
break; break;
} }

View File

@@ -1,7 +1,7 @@
/* /*
$Id: util.c,v 1.52 2007/10/21 21:57:09 rocky Exp $ $Id: util.c,v 1.53 2008/03/06 01:16:49 rocky Exp $
Copyright (C) 2003, 2004, 2005, 2007 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2003, 2004, 2005, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ print_version (char *program_name, const char *version,
if (no_header == 0) if (no_header == 0)
report( stdout, report( stdout,
"%s version %s\nCopyright (c) 2003, 2004, 2005, 2007 R. Bernstein\n", "%s version %s\nCopyright (c) 2003, 2004, 2005, 2007, 2008 R. Bernstein\n",
program_name, version); program_name, version);
report( stdout, report( stdout,
_("This is free software; see the source for copying conditions.\n\ _("This is free software; see the source for copying conditions.\n\

View File

@@ -1,7 +1,7 @@
/* /*
$Id: util.h,v 1.14 2005/10/06 09:37:11 rocky Exp $ $Id: util.h,v 1.15 2008/03/06 01:16:49 rocky Exp $
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@gnu.org>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
#$Id: check_cd_read.sh,v 1.10 2007/12/28 02:11:01 rocky Exp $ #$Id: check_cd_read.sh,v 1.11 2008/03/06 01:16:49 rocky Exp $
# #
# Copyright (C) 2003, 2005 Rocky Bernstein <rocky@panix.com> # Copyright (C) 2003, 2005, 2008 Rocky Bernstein <rocky@gnu.org>
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by