Fill out autoscan devices/images to image drivers. API is probably
closer to more complete.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* -*- c -*-
|
||||
$Id: cdio.h,v 1.25 2003/09/29 02:56:22 rocky Exp $
|
||||
$Id: cdio.h,v 1.26 2003/09/30 03:26:11 rocky Exp $
|
||||
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -346,6 +346,8 @@ extern "C" {
|
||||
|
||||
char * cdio_get_default_device_bincue(void);
|
||||
|
||||
char **cdio_get_devices_bincue(void);
|
||||
|
||||
/*! CD routines. Source is the some sort of device.
|
||||
|
||||
NULL is returned on error.
|
||||
@@ -379,6 +381,8 @@ extern "C" {
|
||||
|
||||
char * cdio_get_default_device_linux(void);
|
||||
|
||||
char **cdio_get_devices_linux(void);
|
||||
|
||||
/*! Solaris CD-reading routines.
|
||||
NULL is returned on error.
|
||||
*/
|
||||
@@ -407,6 +411,8 @@ extern "C" {
|
||||
|
||||
char * cdio_get_default_device_nrg(void);
|
||||
|
||||
char **cdio_get_devices_nrg(void);
|
||||
|
||||
/*! Return corresponding BIN file if cue_name is a cue file or NULL
|
||||
if not a CUE file.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_bincue.c,v 1.32 2003/09/28 01:04:58 rocky Exp $
|
||||
$Id: _cdio_bincue.c,v 1.33 2003/09/30 03:26:11 rocky Exp $
|
||||
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -24,7 +24,7 @@
|
||||
(*.cue).
|
||||
*/
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_bincue.c,v 1.32 2003/09/28 01:04:58 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_bincue.c,v 1.33 2003/09/30 03:26:11 rocky Exp $";
|
||||
|
||||
#include "cdio_assert.h"
|
||||
#include "cdio_private.h"
|
||||
@@ -43,6 +43,9 @@ static const char _rcsid[] = "$Id: _cdio_bincue.c,v 1.32 2003/09/28 01:04:58 roc
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_GLOB_H
|
||||
#include <glob.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
/* FIXME: should put in a common definition somewhere. */
|
||||
@@ -642,12 +645,39 @@ _cdio_get_arg (void *env, const char key[])
|
||||
}
|
||||
|
||||
/*!
|
||||
Return a string containing the default VCD device if none is specified.
|
||||
Return an array of strings giving possible NRG disk images.
|
||||
*/
|
||||
char **
|
||||
cdio_get_devices_bincue (void)
|
||||
{
|
||||
char **drives = NULL;
|
||||
unsigned int num_files=0;
|
||||
#ifdef HAVE_GLOB_H
|
||||
unsigned int i;
|
||||
glob_t globbuf;
|
||||
globbuf.gl_offs = 0;
|
||||
glob("*.cue", GLOB_DOOFFS, NULL, &globbuf);
|
||||
for (i=0; i<globbuf.gl_pathc; i++) {
|
||||
cdio_add_device_list(&drives, globbuf.gl_pathv[i], &num_files);
|
||||
}
|
||||
globfree(&globbuf);
|
||||
#else
|
||||
cdio_add_device_list(&drives, DEFAULT_CDIO_DEVICE, &num_files);
|
||||
#endif /*HAVE_GLOB_H*/
|
||||
cdio_add_device_list(&drives, NULL, &num_files);
|
||||
return drives;
|
||||
}
|
||||
|
||||
/*!
|
||||
Return a string containing the default CD device.
|
||||
*/
|
||||
char *
|
||||
cdio_get_default_device_bincue(void)
|
||||
{
|
||||
return strdup(DEFAULT_CDIO_DEVICE);
|
||||
char **drives = cdio_get_devices_nrg();
|
||||
char *drive = (drives[0] == NULL) ? NULL : strdup(drives[0]);
|
||||
cdio_free_device_list(drives);
|
||||
return drive;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_linux.c,v 1.25 2003/09/29 02:56:22 rocky Exp $
|
||||
$Id: _cdio_linux.c,v 1.26 2003/09/30 03:26:11 rocky Exp $
|
||||
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -27,7 +27,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.25 2003/09/29 02:56:22 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.26 2003/09/30 03:26:11 rocky Exp $";
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -837,12 +837,17 @@ static char checklist2[][40] = {
|
||||
{"?a hd?"}, {"?0 scd?"}, {"?0 sr?"}, {""}
|
||||
};
|
||||
|
||||
#endif /* HAVE_LINUX_CDROM */
|
||||
|
||||
/*!
|
||||
Return a string containing the default VCD device if none is specified.
|
||||
Return an array of strings giving possible CD devices.
|
||||
*/
|
||||
static char **
|
||||
_cdio_get_devices (void)
|
||||
char **
|
||||
cdio_get_devices_linux (void)
|
||||
{
|
||||
#ifndef HAVE_LINUX_CDROM
|
||||
return NULL;
|
||||
#else
|
||||
unsigned int i;
|
||||
char drive[40];
|
||||
char *ret_drive;
|
||||
@@ -889,8 +894,8 @@ _cdio_get_devices (void)
|
||||
}
|
||||
cdio_add_device_list(&drives, NULL, &num_drives);
|
||||
return drives;
|
||||
}
|
||||
#endif /*HAVE_LINUX_CDROM*/
|
||||
}
|
||||
|
||||
/*!
|
||||
Return a string containing the default CD device.
|
||||
@@ -963,7 +968,7 @@ cdio_open_linux (const char *orig_source_name)
|
||||
.eject_media = _cdio_eject_media,
|
||||
.free = cdio_generic_free,
|
||||
.get_arg = _cdio_get_arg,
|
||||
.get_devices = _cdio_get_devices,
|
||||
.get_devices = cdio_get_devices_linux,
|
||||
.get_default_device = cdio_get_default_device_linux,
|
||||
.get_first_track_num= _cdio_get_first_track_num,
|
||||
.get_mcn = _cdio_get_mcn,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_nrg.c,v 1.19 2003/09/29 02:56:22 rocky Exp $
|
||||
$Id: _cdio_nrg.c,v 1.20 2003/09/30 03:26:11 rocky Exp $
|
||||
|
||||
Copyright (C) 2001,2003 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include "cdio_private.h"
|
||||
#include "_cdio_stdio.h"
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_nrg.c,v 1.19 2003/09/29 02:56:22 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_nrg.c,v 1.20 2003/09/30 03:26:11 rocky Exp $";
|
||||
|
||||
/* structures used */
|
||||
|
||||
@@ -763,10 +763,10 @@ _cdio_get_arg (void *env, const char key[])
|
||||
}
|
||||
|
||||
/*!
|
||||
Return a string containing the default VCD device if none is specified.
|
||||
Return an array of strings giving possible NRG disk images.
|
||||
*/
|
||||
static char **
|
||||
_cdio_get_devices (void)
|
||||
char **
|
||||
cdio_get_devices_nrg (void)
|
||||
{
|
||||
char **drives = NULL;
|
||||
unsigned int num_files=0;
|
||||
@@ -792,7 +792,7 @@ _cdio_get_devices (void)
|
||||
char *
|
||||
cdio_get_default_device_nrg(void)
|
||||
{
|
||||
char **drives = _cdio_get_devices();
|
||||
char **drives = cdio_get_devices_nrg();
|
||||
char *drive = (drives[0] == NULL) ? NULL : strdup(drives[0]);
|
||||
cdio_free_device_list(drives);
|
||||
return drive;
|
||||
@@ -888,7 +888,7 @@ cdio_open_nrg (const char *source_name)
|
||||
.eject_media = cdio_generic_bogus_eject_media,
|
||||
.free = cdio_generic_stream_free,
|
||||
.get_arg = _cdio_get_arg,
|
||||
.get_devices = _cdio_get_devices,
|
||||
.get_devices = cdio_get_devices_nrg,
|
||||
.get_default_device = cdio_get_default_device_nrg,
|
||||
.get_first_track_num= _cdio_get_first_track_num,
|
||||
.get_num_tracks = _cdio_get_num_tracks,
|
||||
|
||||
31
lib/cdio.c
31
lib/cdio.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cdio.c,v 1.29 2003/09/29 02:56:22 rocky Exp $
|
||||
$Id: cdio.c,v 1.30 2003/09/30 03:26:11 rocky Exp $
|
||||
|
||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <cdio/logging.h>
|
||||
#include "cdio_private.h"
|
||||
|
||||
static const char _rcsid[] = "$Id: cdio.c,v 1.29 2003/09/29 02:56:22 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: cdio.c,v 1.30 2003/09/30 03:26:11 rocky Exp $";
|
||||
|
||||
|
||||
const char *track_format2str[6] =
|
||||
@@ -76,6 +76,7 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_have_false,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
|
||||
@@ -86,7 +87,8 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_have_bsdi,
|
||||
&cdio_open_bsdi,
|
||||
&cdio_get_default_device_bsdi,
|
||||
&cdio_is_device_generic
|
||||
&cdio_is_device_generic,
|
||||
NULL
|
||||
},
|
||||
|
||||
{DRIVER_FREEBSD,
|
||||
@@ -96,7 +98,8 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_have_freebsd,
|
||||
&cdio_open_freebsd,
|
||||
&cdio_get_default_device_freebsd,
|
||||
&cdio_is_device_generic
|
||||
&cdio_is_device_generic,
|
||||
NULL
|
||||
},
|
||||
|
||||
{DRIVER_LINUX,
|
||||
@@ -106,7 +109,8 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_have_linux,
|
||||
&cdio_open_linux,
|
||||
&cdio_get_default_device_linux,
|
||||
&cdio_is_device_generic
|
||||
&cdio_is_device_generic,
|
||||
&cdio_get_devices_linux
|
||||
},
|
||||
|
||||
{DRIVER_SOLARIS,
|
||||
@@ -116,7 +120,8 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_have_solaris,
|
||||
&cdio_open_solaris,
|
||||
&cdio_get_default_device_solaris,
|
||||
&cdio_is_device_generic
|
||||
&cdio_is_device_generic,
|
||||
NULL
|
||||
},
|
||||
|
||||
{DRIVER_OSX,
|
||||
@@ -126,7 +131,8 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_have_osx,
|
||||
&cdio_open_osx,
|
||||
&cdio_get_default_device_osx,
|
||||
&cdio_is_device_generic
|
||||
&cdio_is_device_generic,
|
||||
NULL
|
||||
},
|
||||
|
||||
{DRIVER_WIN32,
|
||||
@@ -136,7 +142,8 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_have_win32,
|
||||
&cdio_open_win32,
|
||||
&cdio_get_default_device_win32,
|
||||
&cdio_is_device_win32
|
||||
&cdio_is_device_win32,
|
||||
NULL
|
||||
},
|
||||
|
||||
{DRIVER_BINCUE,
|
||||
@@ -146,7 +153,8 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_have_bincue,
|
||||
&cdio_open_bincue,
|
||||
&cdio_get_default_device_bincue,
|
||||
NULL
|
||||
NULL,
|
||||
&cdio_get_devices_bincue
|
||||
},
|
||||
|
||||
{DRIVER_NRG,
|
||||
@@ -156,7 +164,8 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_have_nrg,
|
||||
&cdio_open_nrg,
|
||||
&cdio_get_default_device_nrg,
|
||||
NULL
|
||||
NULL,
|
||||
&cdio_get_devices_nrg
|
||||
}
|
||||
|
||||
};
|
||||
@@ -285,7 +294,7 @@ cdio_get_devices (driver_id_t driver_id)
|
||||
cdio = scan_for_driver(DRIVER_UNKNOWN, CDIO_MAX_DRIVER, NULL);
|
||||
break;
|
||||
default:
|
||||
cdio = scan_for_driver(driver_id, driver_id, NULL);
|
||||
return (*CdIo_all_drivers[driver_id].get_devices)();
|
||||
}
|
||||
|
||||
if (cdio == NULL) return NULL;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cdio_private.h,v 1.16 2003/09/29 02:56:23 rocky Exp $
|
||||
$Id: cdio_private.h,v 1.17 2003/09/30 03:26:11 rocky Exp $
|
||||
|
||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -211,16 +211,15 @@ extern "C" {
|
||||
/* The below structure describes a specific CD Input driver */
|
||||
typedef struct
|
||||
{
|
||||
unsigned int flags;
|
||||
driver_id_t id;
|
||||
unsigned int flags;
|
||||
const char *name;
|
||||
const char *describe;
|
||||
bool (*have_driver) (void);
|
||||
CdIo *(*driver_open) (const char *source_name);
|
||||
char *(*get_default_device) (void);
|
||||
bool (*is_device) (const char *source_name);
|
||||
|
||||
|
||||
char **(*get_devices) (void);
|
||||
} CdIo_driver_t;
|
||||
|
||||
/* The below array gives of the drivers that are currently available for
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
#$Id: check_cue.sh.in,v 1.13 2003/09/29 02:56:23 rocky Exp $
|
||||
#$Id: check_cue.sh.in,v 1.14 2003/09/30 03:26:11 rocky Exp $
|
||||
# Tests to see that BIN/CUE file iamge reading is correct (via cd-info).
|
||||
if test -z "@VCDINFO_LIBS@" ; then
|
||||
if test -n "@VCDINFO_LIBS@" ; then
|
||||
vcd_opt='--no-vcd'
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
#$Id: check_nrg.sh.in,v 1.7 2003/09/20 00:28:32 rocky Exp $
|
||||
#$Id: check_nrg.sh.in,v 1.8 2003/09/30 03:26:11 rocky Exp $
|
||||
|
||||
if test -z "@VCDINFO_LIBS@" ; then
|
||||
if test -n "@VCDINFO_LIBS@" ; then
|
||||
vcd_opt='--no-vcd'
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user