Closer to autoscan working better. globbing for *.nrg in NRG.
Will probably do likewise in bin/cue when NRG is working.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_linux.c,v 1.24 2003/09/28 17:14:20 rocky Exp $
|
||||
$Id: _cdio_linux.c,v 1.25 2003/09/29 02:56:22 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.24 2003/09/28 17:14:20 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.25 2003/09/29 02:56:22 rocky Exp $";
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -841,7 +841,7 @@ static char checklist2[][40] = {
|
||||
Return a string containing the default VCD device if none is specified.
|
||||
*/
|
||||
static char **
|
||||
_cdio_get_devices (const CdIo *obj)
|
||||
_cdio_get_devices (void)
|
||||
{
|
||||
unsigned int i;
|
||||
char drive[40];
|
||||
@@ -893,7 +893,7 @@ _cdio_get_devices (const CdIo *obj)
|
||||
#endif /* HAVE_LINUX_CDROM */
|
||||
|
||||
/*!
|
||||
Return a string containing the default VCD device if none is specified.
|
||||
Return a string containing the default CD device.
|
||||
*/
|
||||
char *
|
||||
cdio_get_default_device_linux(void)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_nrg.c,v 1.18 2003/09/25 09:38:16 rocky Exp $
|
||||
$Id: _cdio_nrg.c,v 1.19 2003/09/29 02:56:22 rocky Exp $
|
||||
|
||||
Copyright (C) 2001,2003 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
|
||||
@@ -25,9 +25,18 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_GLOB_H
|
||||
#include <glob.h>
|
||||
#endif
|
||||
|
||||
#include <cdio/logging.h>
|
||||
#include <cdio/sector.h>
|
||||
@@ -38,7 +47,7 @@
|
||||
#include "cdio_private.h"
|
||||
#include "_cdio_stdio.h"
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_nrg.c,v 1.18 2003/09/25 09:38:16 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_nrg.c,v 1.19 2003/09/29 02:56:22 rocky Exp $";
|
||||
|
||||
/* structures used */
|
||||
|
||||
@@ -756,10 +765,37 @@ _cdio_get_arg (void *env, const char key[])
|
||||
/*!
|
||||
Return a string containing the default VCD device if none is specified.
|
||||
*/
|
||||
char *
|
||||
cdio_get_default_device_nrg()
|
||||
static char **
|
||||
_cdio_get_devices (void)
|
||||
{
|
||||
return strdup(DEFAULT_CDIO_DEVICE);
|
||||
char **drives = NULL;
|
||||
unsigned int num_files=0;
|
||||
#ifdef HAVE_GLOB_H
|
||||
unsigned int i;
|
||||
glob_t globbuf;
|
||||
globbuf.gl_offs = 0;
|
||||
glob("*.nrg", 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_nrg(void)
|
||||
{
|
||||
char **drives = _cdio_get_devices();
|
||||
char *drive = (drives[0] == NULL) ? NULL : strdup(drives[0]);
|
||||
cdio_free_device_list(drives);
|
||||
return drive;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -852,6 +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_default_device = cdio_get_default_device_nrg,
|
||||
.get_first_track_num= _cdio_get_first_track_num,
|
||||
.get_num_tracks = _cdio_get_num_tracks,
|
||||
|
||||
40
lib/cdio.c
40
lib/cdio.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cdio.c,v 1.28 2003/09/28 17:14:20 rocky Exp $
|
||||
$Id: cdio.c,v 1.29 2003/09/29 02:56:22 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.28 2003/09/28 17:14:20 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: cdio.c,v 1.29 2003/09/29 02:56:22 rocky Exp $";
|
||||
|
||||
|
||||
const char *track_format2str[6] =
|
||||
@@ -266,23 +266,31 @@ cdio_get_default_device (const CdIo *obj)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Return an array of device names. if CdIo is NULL (we haven't
|
||||
initialized a specific device driver), then find a suitable device
|
||||
driver.
|
||||
/*!Return an array of device names. If you want a specific
|
||||
devices, dor a driver give that device, if you want hardware
|
||||
devices, give DRIVER_DEVICE and if you want all possible devices,
|
||||
image drivers and hardware drivers give DRIVER_UNKNOWN.
|
||||
|
||||
NULL is returned if we couldn't return a list of devices.
|
||||
*/
|
||||
char **
|
||||
cdio_get_devices (const CdIo *cdio)
|
||||
cdio_get_devices (driver_id_t driver_id)
|
||||
{
|
||||
const CdIo *c = (cdio == NULL)
|
||||
? scan_for_driver(DRIVER_UNKNOWN, CDIO_MAX_DRIVER, NULL)
|
||||
: cdio;
|
||||
CdIo *cdio;
|
||||
|
||||
switch (driver_id) {
|
||||
/* FIXME: spit out unknown to give image drivers as well. */
|
||||
case DRIVER_UNKNOWN:
|
||||
case DRIVER_DEVICE:
|
||||
cdio = scan_for_driver(DRIVER_UNKNOWN, CDIO_MAX_DRIVER, NULL);
|
||||
break;
|
||||
default:
|
||||
cdio = scan_for_driver(driver_id, driver_id, NULL);
|
||||
}
|
||||
|
||||
if (c == NULL) return NULL;
|
||||
if (c->op.get_devices) {
|
||||
return c->op.get_devices (c->env);
|
||||
if (cdio == NULL) return NULL;
|
||||
if (cdio->op.get_devices) {
|
||||
return cdio->op.get_devices ();
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
@@ -310,7 +318,7 @@ cdio_get_devices_with_cap (char* search_devices[],
|
||||
char **drives_ret=NULL;
|
||||
int num_drives=0;
|
||||
|
||||
if (NULL == drives) drives=cdio_get_devices(NULL);
|
||||
if (NULL == drives) drives=cdio_get_devices(DRIVER_DEVICE);
|
||||
|
||||
if (capabilities == CDIO_FS_MATCH_ALL) {
|
||||
/* Duplicate drives into drives_ret. */
|
||||
@@ -321,9 +329,7 @@ cdio_get_devices_with_cap (char* search_devices[],
|
||||
cdio_fs_anal_t got_fs=0;
|
||||
cdio_fs_anal_t need_fs = CDIO_FSTYPE(capabilities);
|
||||
cdio_fs_anal_t need_fs_ext;
|
||||
need_fs_ext = any
|
||||
? capabilities | CDIO_FS_MASK
|
||||
: capabilities & ~CDIO_FS_MASK;
|
||||
need_fs_ext = capabilities & ~CDIO_FS_MASK;
|
||||
|
||||
for( ; *drives != NULL; drives++ ) {
|
||||
CdIo *cdio = cdio_open(*drives, DRIVER_UNKNOWN);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: cdio_private.h,v 1.15 2003/09/28 17:14:21 rocky Exp $
|
||||
$Id: cdio_private.h,v 1.16 2003/09/29 02:56:23 rocky Exp $
|
||||
|
||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -62,7 +62,7 @@ extern "C" {
|
||||
|
||||
NULL is returned if we couldn't return a list of devices.
|
||||
*/
|
||||
char ** (*get_devices) (const CdIo *obj);
|
||||
char ** (*get_devices) (void);
|
||||
|
||||
/*!
|
||||
Return a string containing the default CD device if none is specified.
|
||||
|
||||
Reference in New Issue
Block a user