*.{c,h}: add cdio_get_drive_cap to determine what kind of CDROM device
we've got. README.libcdio: suggest stonger making a separate package for cd-info configure.ac: we are in 0.69cvs now
This commit is contained in:
@@ -22,6 +22,12 @@ the VCD reporting portion and you don't already have vcdimager
|
|||||||
installed, build and install libcdio, then vcdimager, then configure
|
installed, build and install libcdio, then vcdimager, then configure
|
||||||
libcdio again and it should find libvcdinfo.
|
libcdio again and it should find libvcdinfo.
|
||||||
|
|
||||||
|
People who make packages might consider making two packages, a libcdio
|
||||||
|
package with just the libraries (and no dependency on libvcdinfo) and
|
||||||
|
a libcdio-utils which contains cd-info and iso-info, cd-read,
|
||||||
|
iso-read. Should you want cd-info with VCD support then you'd add a
|
||||||
|
depedency in that package to libvcdinfo.
|
||||||
|
|
||||||
BSD
|
BSD
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -56,4 +62,4 @@ spent far more time on this platform than I care for. If someone is
|
|||||||
interested in fixing the Microsoft OS support great.
|
interested in fixing the Microsoft OS support great.
|
||||||
|
|
||||||
|
|
||||||
$Id: README.libcdio,v 1.4 2004/03/01 01:34:37 rocky Exp $
|
$Id: README.libcdio,v 1.5 2004/04/22 03:24:38 rocky Exp $
|
||||||
@@ -15,11 +15,11 @@ dnl along with this program; if not, write to the Free Software
|
|||||||
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
dnl 02111-1307, USA.
|
dnl 02111-1307, USA.
|
||||||
|
|
||||||
define(RELEASE_NUM, 68)
|
define(RELEASE_NUM, 69)
|
||||||
define(CDIO_VERSION_STR, 0.$1)
|
define(CDIO_VERSION_STR, 0.$1cvs)
|
||||||
|
|
||||||
AC_PREREQ(2.52)
|
AC_PREREQ(2.52)
|
||||||
AC_REVISION([$Id: configure.ac,v 1.73 2004/03/24 00:06:12 rocky Exp $])dnl
|
AC_REVISION([$Id: configure.ac,v 1.74 2004/04/22 03:24:38 rocky Exp $])dnl
|
||||||
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
||||||
AC_CONFIG_SRCDIR(src/cd-info.c)
|
AC_CONFIG_SRCDIR(src/cd-info.c)
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: sample2.c,v 1.4 2004/03/20 13:12:22 rocky Exp $
|
$Id: sample2.c,v 1.5 2004/04/22 03:24:38 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -41,10 +41,36 @@ main(int argc, const char *argv[])
|
|||||||
|
|
||||||
if (NULL != cdio) {
|
if (NULL != cdio) {
|
||||||
char *default_device = cdio_get_default_device(cdio);
|
char *default_device = cdio_get_default_device(cdio);
|
||||||
|
|
||||||
printf("The driver selected is %s\n", cdio_get_driver_name(cdio));
|
printf("The driver selected is %s\n", cdio_get_driver_name(cdio));
|
||||||
printf("The default device for this driver is %s\n\n", default_device);
|
|
||||||
|
if (default_device) {
|
||||||
|
cdio_drive_cap_t i_drive_cap = cdio_get_drive_cap(default_device);
|
||||||
|
printf("The default device for this driver is %s\n", default_device);
|
||||||
|
printf("drive capability in hex: %x\n", i_drive_cap);
|
||||||
|
if (CDIO_DRIVE_ERROR == i_drive_cap) {
|
||||||
|
printf("Error in getting drive properties\n");
|
||||||
|
} else if (CDIO_DRIVE_UNKNOWN == i_drive_cap) {
|
||||||
|
printf("Can't determine drive properties\n");
|
||||||
|
} else if (CDIO_DRIVE_FILE == i_drive_cap) {
|
||||||
|
printf("Can't determine drive properties\n");
|
||||||
|
} else {
|
||||||
|
if (i_drive_cap & CDIO_DRIVE_CD_R)
|
||||||
|
printf("Drive can read CD-ROM\n");
|
||||||
|
if (i_drive_cap & CDIO_DRIVE_CD_RW)
|
||||||
|
printf("Drive can write CD-ROM\n");
|
||||||
|
if (i_drive_cap & CDIO_DRIVE_DVD)
|
||||||
|
printf("Drive can read DVD\n");
|
||||||
|
if (i_drive_cap & CDIO_DRIVE_DVD_R)
|
||||||
|
printf("Drive can write DVD-R\n");
|
||||||
|
if (i_drive_cap & CDIO_DRIVE_DVD_RAM)
|
||||||
|
printf("Drive can write DVD-RAM\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(default_device);
|
free(default_device);
|
||||||
cdio_destroy(cdio);
|
cdio_destroy(cdio);
|
||||||
|
printf("\n");
|
||||||
} else {
|
} else {
|
||||||
printf("Problem in trying to find a driver.\n\n");
|
printf("Problem in trying to find a driver.\n\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* -*- c -*-
|
/* -*- c -*-
|
||||||
$Id: cdio.h,v 1.37 2004/03/20 22:46:57 rocky Exp $
|
$Id: cdio.h,v 1.38 2004/04/22 03:24:38 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -44,13 +44,26 @@
|
|||||||
#include <cdio/types.h>
|
#include <cdio/types.h>
|
||||||
#include <cdio/sector.h>
|
#include <cdio/sector.h>
|
||||||
|
|
||||||
/* Flags specifying the category of device to open or is opened. */
|
/**! Flags specifying the category of device to open or is opened. */
|
||||||
|
|
||||||
#define CDIO_SRC_IS_DISK_IMAGE_MASK 0x0001 /**< Read source is a CD image. */
|
#define CDIO_SRC_IS_DISK_IMAGE_MASK 0x0001 /**< Read source is a CD image. */
|
||||||
#define CDIO_SRC_IS_DEVICE_MASK 0x0002 /**< Read source is a CD device. */
|
#define CDIO_SRC_IS_DEVICE_MASK 0x0002 /**< Read source is a CD device. */
|
||||||
#define CDIO_SRC_IS_SCSI_MASK 0x0004
|
#define CDIO_SRC_IS_SCSI_MASK 0x0004 /**< Read source SCSI device. */
|
||||||
#define CDIO_SRC_IS_NATIVE_MASK 0x0008
|
#define CDIO_SRC_IS_NATIVE_MASK 0x0008
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Drive types returned by cdio_get_drive_cap()
|
||||||
|
*/
|
||||||
|
#define CDIO_DRIVE_ERROR 0x0000 /**< Error */
|
||||||
|
#define CDIO_DRIVE_UNKNOWN 0x0001 /**< Dunno */
|
||||||
|
#define CDIO_DRIVE_FILE 0x1000 /**< drive is really a file, i.e a
|
||||||
|
CD file image */
|
||||||
|
#define CDIO_DRIVE_CD_R 0x2000 /**< drive is a CD-R */
|
||||||
|
#define CDIO_DRIVE_CD_RW 0x4000 /**< drive is a CD-RW */
|
||||||
|
#define CDIO_DRIVE_DVD 0x8000 /**< drive is a DVD */
|
||||||
|
#define CDIO_DRIVE_DVD_R 0x10000 /**< drive can write DVD-R */
|
||||||
|
#define CDIO_DRIVE_DVD_RAM 0x20000 /**< drive can write DVD-RAM */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
@@ -170,6 +183,13 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
char * cdio_get_default_device (const CdIo *obj);
|
char * cdio_get_default_device (const CdIo *obj);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return the what kind of device we've got.
|
||||||
|
|
||||||
|
See above for a list of bitmasks for the drive type;
|
||||||
|
*/
|
||||||
|
cdio_drive_cap_t cdio_get_drive_cap (const char *device);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the media catalog number (MCN) from the CD or NULL if there
|
Return the media catalog number (MCN) from the CD or NULL if there
|
||||||
is none or we don't have the ability to get it.
|
is none or we don't have the ability to get it.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: types.h,v 1.10 2004/03/13 03:32:49 rocky Exp $
|
$Id: types.h,v 1.11 2004/04/22 03:24:38 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -216,6 +216,9 @@ extern "C" {
|
|||||||
/*! The type of an track number 0..99. */
|
/*! The type of an track number 0..99. */
|
||||||
typedef uint8_t track_t;
|
typedef uint8_t track_t;
|
||||||
|
|
||||||
|
/*! The type of an Logical Sector Number. */
|
||||||
|
typedef uint32_t cdio_drive_cap_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constant for invalid track number
|
Constant for invalid track number
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_linux.c,v 1.32 2004/03/07 02:42:22 rocky Exp $
|
$Id: _cdio_linux.c,v 1.33 2004/04/22 03:24:38 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.32 2004/03/07 02:42:22 rocky Exp $";
|
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.33 2004/04/22 03:24:38 rocky Exp $";
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -813,13 +813,33 @@ static char *
|
|||||||
_cdio_get_mcn (void *env) {
|
_cdio_get_mcn (void *env) {
|
||||||
|
|
||||||
struct cdrom_mcn mcn;
|
struct cdrom_mcn mcn;
|
||||||
_img_private_t *_obj = env;
|
const _img_private_t *_obj = env;
|
||||||
memset(&mcn, 0, sizeof(mcn));
|
memset(&mcn, 0, sizeof(mcn));
|
||||||
if (ioctl(_obj->gen.fd, CDROM_GET_MCN, &mcn) != 0)
|
if (ioctl(_obj->gen.fd, CDROM_GET_MCN, &mcn) != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
return strdup(mcn.medium_catalog_number);
|
return strdup(mcn.medium_catalog_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return the the kind of drive capabilities of device.
|
||||||
|
|
||||||
|
Note: string is malloc'd so caller should free() then returned
|
||||||
|
string when done with it.
|
||||||
|
|
||||||
|
*/
|
||||||
|
static cdio_drive_cap_t
|
||||||
|
_cdio_get_drive_cap (const void *env) {
|
||||||
|
const _img_private_t *_obj = env;
|
||||||
|
int32_t i_drivetype;
|
||||||
|
|
||||||
|
i_drivetype = ioctl (_obj->gen.fd, CDROM_GET_CAPABILITY, CDSL_CURRENT);
|
||||||
|
|
||||||
|
if (i_drivetype < 0) return CDIO_DRIVE_ERROR;
|
||||||
|
|
||||||
|
/* If >= 0 we can safely cast as cdio_drive_cap_t and return */
|
||||||
|
return (cdio_drive_cap_t) i_drivetype;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the number of tracks in the current medium.
|
Return the number of tracks in the current medium.
|
||||||
CDIO_INVALID_TRACK is returned on error.
|
CDIO_INVALID_TRACK is returned on error.
|
||||||
@@ -1060,6 +1080,7 @@ cdio_open_linux (const char *orig_source_name)
|
|||||||
.get_arg = _cdio_get_arg,
|
.get_arg = _cdio_get_arg,
|
||||||
.get_devices = cdio_get_devices_linux,
|
.get_devices = cdio_get_devices_linux,
|
||||||
.get_default_device = cdio_get_default_device_linux,
|
.get_default_device = cdio_get_default_device_linux,
|
||||||
|
.get_drive_cap = _cdio_get_drive_cap,
|
||||||
.get_first_track_num= _cdio_get_first_track_num,
|
.get_first_track_num= _cdio_get_first_track_num,
|
||||||
.get_mcn = _cdio_get_mcn,
|
.get_mcn = _cdio_get_mcn,
|
||||||
.get_num_tracks = _cdio_get_num_tracks,
|
.get_num_tracks = _cdio_get_num_tracks,
|
||||||
|
|||||||
27
lib/cdio.c
27
lib/cdio.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdio.c,v 1.43 2004/03/21 03:43:06 rocky Exp $
|
$Id: cdio.c,v 1.44 2004/04/22 03:24:38 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <cdio/logging.h>
|
#include <cdio/logging.h>
|
||||||
#include "cdio_private.h"
|
#include "cdio_private.h"
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: cdio.c,v 1.43 2004/03/21 03:43:06 rocky Exp $";
|
static const char _rcsid[] = "$Id: cdio.c,v 1.44 2004/04/22 03:24:38 rocky Exp $";
|
||||||
|
|
||||||
|
|
||||||
const char *track_format2str[6] =
|
const char *track_format2str[6] =
|
||||||
@@ -376,6 +376,29 @@ cdio_get_devices_with_cap (char* search_devices[],
|
|||||||
return drives_ret;
|
return drives_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return the the kind of drive capabilities of device.
|
||||||
|
|
||||||
|
Note: string is malloc'd so caller should free() then returned
|
||||||
|
string when done with it.
|
||||||
|
|
||||||
|
*/
|
||||||
|
unsigned int
|
||||||
|
cdio_get_drive_cap (const char *device)
|
||||||
|
{
|
||||||
|
cdio_drive_cap_t i_drivetype = CDIO_DRIVE_UNKNOWN;
|
||||||
|
|
||||||
|
CdIo *cdio=scan_for_driver(CDIO_MIN_DRIVER, CDIO_MAX_DRIVER,
|
||||||
|
device);
|
||||||
|
|
||||||
|
if (cdio && cdio->op.get_drive_cap) {
|
||||||
|
i_drivetype=cdio->op.get_drive_cap(cdio->env);
|
||||||
|
cdio_destroy(cdio);
|
||||||
|
}
|
||||||
|
return i_drivetype;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return a string containing the name of the driver in use.
|
Return a string containing the name of the driver in use.
|
||||||
if CdIo is NULL (we haven't initialized a specific device driver),
|
if CdIo is NULL (we haven't initialized a specific device driver),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdio_private.h,v 1.19 2004/03/05 04:23:52 rocky Exp $
|
$Id: cdio_private.h,v 1.20 2004/04/22 03:24:38 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -69,6 +69,13 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
char * (*get_default_device)(void);
|
char * (*get_default_device)(void);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return the what kind of device we've got.
|
||||||
|
|
||||||
|
See cd_types.h for a list of bitmasks for the drive type;
|
||||||
|
*/
|
||||||
|
unsigned int (*get_drive_cap) (const void *env);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the media catalog number MCN from the CD or NULL if
|
Return the media catalog number MCN from the CD or NULL if
|
||||||
there is none or we don't have the ability to get it.
|
there is none or we don't have the ability to get it.
|
||||||
|
|||||||
Reference in New Issue
Block a user