lib/*.c: create and use get_cdtext_generic.
lib/generic.h: prototypes for _cdio_generic.c (move out of _cdio_private.h) example/sample10.c, src/util.c: small print format improvement
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: sample10.c,v 1.7 2004/08/10 02:29:46 rocky Exp $
|
$Id: sample10.c,v 1.8 2004/08/10 11:58:14 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ main(int argc, const char *argv[])
|
|||||||
" RPC\n");
|
" RPC\n");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_RT_STREAMING:
|
case CDIO_MMC_FEATURE_RT_STREAMING:
|
||||||
printf("\tAbility to read and write using Initiator requested performance parameters\n");
|
printf("Ability to read and write using Initiator requested performance parameters\n");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_LU_SN: {
|
case CDIO_MMC_FEATURE_LU_SN: {
|
||||||
uint8_t i_serial = *(p+3);
|
uint8_t i_serial = *(p+3);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: win32.c,v 1.42 2004/08/10 03:44:55 rocky Exp $
|
$Id: win32.c,v 1.43 2004/08/10 11:58:15 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: win32.c,v 1.42 2004/08/10 03:44:55 rocky Exp $";
|
static const char _rcsid[] = "$Id: win32.c,v 1.43 2004/08/10 11:58:15 rocky Exp $";
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/sector.h>
|
#include <cdio/sector.h>
|
||||||
@@ -482,34 +482,6 @@ _get_arg_win32 (void *user_data, const char key[])
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Return the value associated with the key "arg".
|
|
||||||
*/
|
|
||||||
static const cdtext_t *
|
|
||||||
_get_cdtext_win32 (void *user_data, track_t i_track)
|
|
||||||
{
|
|
||||||
_img_private_t *p_env = user_data;
|
|
||||||
|
|
||||||
if (NULL == p_env) return NULL;
|
|
||||||
|
|
||||||
if ( NULL == p_env ||
|
|
||||||
(0 != i_track
|
|
||||||
&& i_track >= p_env->gen.i_tracks + p_env->gen.i_first_track ) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!p_env->gen.b_cdtext_init)
|
|
||||||
init_cdtext_generic( &(p_env->gen) );
|
|
||||||
|
|
||||||
if (!p_env->gen.b_cdtext_init) return NULL;
|
|
||||||
|
|
||||||
if (0 == i_track)
|
|
||||||
return &(p_env->gen.cdtext);
|
|
||||||
else
|
|
||||||
return &(p_env->gen.cdtext_track[i_track-p_env->gen.i_first_track]);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the media catalog number MCN.
|
Return the media catalog number MCN.
|
||||||
|
|
||||||
@@ -741,7 +713,7 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
|
|||||||
.eject_media = _cdio_eject_media,
|
.eject_media = _cdio_eject_media,
|
||||||
.free = _free_win32,
|
.free = _free_win32,
|
||||||
.get_arg = _get_arg_win32,
|
.get_arg = _get_arg_win32,
|
||||||
.get_cdtext = _get_cdtext_win32,
|
.get_cdtext = _get_cdtext_generic,
|
||||||
.get_default_device = cdio_get_default_device_win32,
|
.get_default_device = cdio_get_default_device_win32,
|
||||||
.get_devices = cdio_get_devices_win32,
|
.get_devices = cdio_get_devices_win32,
|
||||||
.get_discmode = get_discmode_win32,
|
.get_discmode = get_discmode_win32,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile.am,v 1.44 2004/08/08 14:55:35 rocky Exp $
|
# $Id: Makefile.am,v 1.45 2004/08/10 11:58:15 rocky Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
#
|
#
|
||||||
@@ -75,6 +75,7 @@ libcdio_sources = \
|
|||||||
FreeBSD/freebsd.h \
|
FreeBSD/freebsd.h \
|
||||||
FreeBSD/freebsd_cam.c \
|
FreeBSD/freebsd_cam.c \
|
||||||
FreeBSD/freebsd_ioctl.c \
|
FreeBSD/freebsd_ioctl.c \
|
||||||
|
generic.h \
|
||||||
image.h \
|
image.h \
|
||||||
image/bincue.c \
|
image/bincue.c \
|
||||||
image/cdrdao.c \
|
image/cdrdao.c \
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_bsdi.c,v 1.39 2004/08/10 03:37:16 rocky Exp $
|
$Id: _cdio_bsdi.c,v 1.40 2004/08/10 11:58:15 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_bsdi.c,v 1.39 2004/08/10 03:37:16 rocky Exp $";
|
static const char _rcsid[] = "$Id: _cdio_bsdi.c,v 1.40 2004/08/10 11:58:15 rocky Exp $";
|
||||||
|
|
||||||
#include <cdio/sector.h>
|
#include <cdio/sector.h>
|
||||||
#include <cdio/util.h>
|
#include <cdio/util.h>
|
||||||
@@ -513,33 +513,6 @@ read_toc_bsdi (void *p_user_data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Get cdtext information for a CdIo object .
|
|
||||||
|
|
||||||
@param obj the CD object that may contain CD-TEXT information.
|
|
||||||
@return the CD-TEXT object or NULL if obj is NULL
|
|
||||||
or CD-TEXT information does not exist.
|
|
||||||
*/
|
|
||||||
static const cdtext_t *
|
|
||||||
get_cdtext_bsdi (void *p_user_data, track_t i_track)
|
|
||||||
{
|
|
||||||
_img_private_t *p_env = p_user_data;
|
|
||||||
|
|
||||||
if ( NULL == p_env ||
|
|
||||||
(0 != i_track
|
|
||||||
&& i_track >= p_env->gen.i_tracks+p_env->gen.i_first_track ) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!p_env->gen.b_cdtext_init)
|
|
||||||
init_cdtext_generic(&(p_env->gen));
|
|
||||||
if (!p_env->gen.b_cdtext_init) return NULL;
|
|
||||||
|
|
||||||
if (0 == i_track)
|
|
||||||
return &(p_env->gen.cdtext);
|
|
||||||
else
|
|
||||||
return &(p_env->gen.cdtext_track[i_track-p_env->gen.i_first_track]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Eject media in CD drive. If successful, as a side effect we
|
Eject media in CD drive. If successful, as a side effect we
|
||||||
also free obj.
|
also free obj.
|
||||||
@@ -794,7 +767,7 @@ cdio_open_bsdi (const char *psz_orig_source)
|
|||||||
.eject_media = _eject_media_bsdi,
|
.eject_media = _eject_media_bsdi,
|
||||||
.free = cdio_generic_free,
|
.free = cdio_generic_free,
|
||||||
.get_arg = _get_arg_bsdi,
|
.get_arg = _get_arg_bsdi,
|
||||||
.get_cdtext = get_cdtext_bsdi,
|
.get_cdtext = get_cdtext_generic,
|
||||||
.get_default_device = cdio_get_default_device_bsdi,
|
.get_default_device = cdio_get_default_device_bsdi,
|
||||||
.get_devices = cdio_get_devices_bsdi,
|
.get_devices = cdio_get_devices_bsdi,
|
||||||
.get_drive_cap = scsi_mmc_get_drive_cap_generic,
|
.get_drive_cap = scsi_mmc_get_drive_cap_generic,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_generic.c,v 1.22 2004/08/10 03:03:27 rocky Exp $
|
$Id: _cdio_generic.c,v 1.23 2004/08/10 11:58:15 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_generic.c,v 1.22 2004/08/10 03:03:27 rocky Exp $";
|
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.23 2004/08/10 11:58:15 rocky Exp $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -227,6 +227,34 @@ cdio_add_device_list(char **device_list[], const char *drive, int *num_drives)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get cdtext information for a CdIo object .
|
||||||
|
|
||||||
|
@param obj the CD object that may contain CD-TEXT information.
|
||||||
|
@return the CD-TEXT object or NULL if obj is NULL
|
||||||
|
or CD-TEXT information does not exist.
|
||||||
|
*/
|
||||||
|
const cdtext_t *
|
||||||
|
get_cdtext_generic (void *p_user_data, track_t i_track)
|
||||||
|
{
|
||||||
|
generic_img_private_t *p_env = p_user_data;
|
||||||
|
|
||||||
|
if ( NULL == p_env ||
|
||||||
|
(0 != i_track
|
||||||
|
&& i_track >= p_env->i_tracks+p_env->i_first_track ) )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!p_env->b_cdtext_init)
|
||||||
|
init_cdtext_generic(p_env);
|
||||||
|
if (!p_env->b_cdtext_init) return NULL;
|
||||||
|
|
||||||
|
if (0 == i_track)
|
||||||
|
return &(p_env->cdtext);
|
||||||
|
else
|
||||||
|
return &(p_env->cdtext_track[i_track-p_env->i_first_track]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Get disc type associated with cd object.
|
Get disc type associated with cd object.
|
||||||
*/
|
*/
|
||||||
@@ -365,7 +393,7 @@ set_cdtext_field_generic(void *user_data, track_t i_track,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Read cdtext information for a CdIo object .
|
Read CD-Text information for a CdIo object .
|
||||||
|
|
||||||
return true on success, false on error or CD-TEXT information does
|
return true on success, false on error or CD-TEXT information does
|
||||||
not exist.
|
not exist.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_linux.c,v 1.90 2004/08/10 03:03:27 rocky Exp $
|
$Id: _cdio_linux.c,v 1.91 2004/08/10 11:58:15 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.90 2004/08/10 03:03:27 rocky Exp $";
|
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.91 2004/08/10 11:58:15 rocky Exp $";
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -951,34 +951,6 @@ set_arg_linux (void *p_user_data, const char key[], const char value[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Get cdtext information for a CdIo object .
|
|
||||||
|
|
||||||
@param obj the CD object that may contain CD-TEXT information.
|
|
||||||
@return the CD-TEXT object or NULL if obj is NULL
|
|
||||||
or CD-TEXT information does not exist.
|
|
||||||
*/
|
|
||||||
static const cdtext_t *
|
|
||||||
get_cdtext_linux (void *p_user_data, track_t i_track)
|
|
||||||
{
|
|
||||||
_img_private_t *p_env = p_user_data;
|
|
||||||
|
|
||||||
if ( NULL == p_env ||
|
|
||||||
(0 != i_track
|
|
||||||
&& i_track >= p_env->gen.i_tracks+p_env->gen.i_first_track ) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!p_env->gen.b_cdtext_init)
|
|
||||||
init_cdtext_generic(&(p_env->gen));
|
|
||||||
if (!p_env->gen.b_cdtext_init) return NULL;
|
|
||||||
|
|
||||||
if (0 == i_track)
|
|
||||||
return &(p_env->gen.cdtext);
|
|
||||||
else
|
|
||||||
return &(p_env->gen.cdtext_track[i_track-p_env->gen.i_first_track]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* checklist: /dev/cdrom, /dev/dvd /dev/hd?, /dev/scd? /dev/sr? */
|
/* checklist: /dev/cdrom, /dev/dvd /dev/hd?, /dev/scd? /dev/sr? */
|
||||||
static char checklist1[][40] = {
|
static char checklist1[][40] = {
|
||||||
{"cdrom"}, {"dvd"}, {""}
|
{"cdrom"}, {"dvd"}, {""}
|
||||||
@@ -1131,7 +1103,7 @@ cdio_open_am_linux (const char *psz_orig_source, const char *access_mode)
|
|||||||
.eject_media = eject_media_linux,
|
.eject_media = eject_media_linux,
|
||||||
.free = cdio_generic_free,
|
.free = cdio_generic_free,
|
||||||
.get_arg = get_arg_linux,
|
.get_arg = get_arg_linux,
|
||||||
.get_cdtext = get_cdtext_linux,
|
.get_cdtext = get_cdtext_generic,
|
||||||
.get_default_device = cdio_get_default_device_linux,
|
.get_default_device = cdio_get_default_device_linux,
|
||||||
.get_devices = cdio_get_devices_linux,
|
.get_devices = cdio_get_devices_linux,
|
||||||
.get_discmode = get_discmode_linux,
|
.get_discmode = get_discmode_linux,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_sunos.c,v 1.71 2004/08/10 03:10:46 rocky Exp $
|
$Id: _cdio_sunos.c,v 1.72 2004/08/10 11:58:15 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>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#ifdef HAVE_SOLARIS_CDROM
|
#ifdef HAVE_SOLARIS_CDROM
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.71 2004/08/10 03:10:46 rocky Exp $";
|
static const char _rcsid[] = "$Id: _cdio_sunos.c,v 1.72 2004/08/10 11:58:15 rocky Exp $";
|
||||||
|
|
||||||
#ifdef HAVE_GLOB_H
|
#ifdef HAVE_GLOB_H
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
@@ -445,34 +445,6 @@ read_toc_solaris (void *p_user_data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Get cdtext information for a CdIo object .
|
|
||||||
|
|
||||||
@param obj the CD object that may contain CD-TEXT information.
|
|
||||||
@return the CD-TEXT object or NULL if obj is NULL
|
|
||||||
or CD-TEXT information does not exist.
|
|
||||||
*/
|
|
||||||
static const cdtext_t *
|
|
||||||
get_cdtext_solaris (void *p_user_data, track_t i_track)
|
|
||||||
{
|
|
||||||
_img_private_t *p_env = p_user_data;
|
|
||||||
|
|
||||||
if ( NULL == p_env ||
|
|
||||||
(0 != i_track
|
|
||||||
&& i_track >= p_env->gen.i_tracks+p_env->gen.i_first_track ) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!p_env->gen.b_cdtext_init)
|
|
||||||
init_cdtext_generic( (&p_env->gen) );
|
|
||||||
|
|
||||||
if (!p_env->gen.b_cdtext_init) return NULL;
|
|
||||||
|
|
||||||
if (0 == i_track)
|
|
||||||
return &(p_env->gen.cdtext);
|
|
||||||
else
|
|
||||||
return &(p_env->gen.cdtext_track[i_track-p_env->gen.i_first_track]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Eject media in CD drive. If successful, as a side effect we
|
Eject media in CD drive. If successful, as a side effect we
|
||||||
also free obj.
|
also free obj.
|
||||||
@@ -860,7 +832,7 @@ cdio_open_am_solaris (const char *psz_orig_source, const char *access_mode)
|
|||||||
.eject_media = eject_media_solaris,
|
.eject_media = eject_media_solaris,
|
||||||
.free = cdio_generic_free,
|
.free = cdio_generic_free,
|
||||||
.get_arg = get_arg_solaris,
|
.get_arg = get_arg_solaris,
|
||||||
.get_cdtext = get_cdtext_solaris,
|
.get_cdtext = get_cdtext_generic,
|
||||||
.get_default_device = cdio_get_default_device_solaris,
|
.get_default_device = cdio_get_default_device_solaris,
|
||||||
.get_devices = cdio_get_devices_solaris,
|
.get_devices = cdio_get_devices_solaris,
|
||||||
.get_discmode = get_discmode_solaris,
|
.get_discmode = get_discmode_solaris,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdio_private.h,v 1.38 2004/08/10 03:03:27 rocky Exp $
|
$Id: cdio_private.h,v 1.39 2004/08/10 11:58:15 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -39,6 +39,18 @@ extern "C" {
|
|||||||
/* Opaque type */
|
/* Opaque type */
|
||||||
typedef struct _CdioDataSource CdioDataSource;
|
typedef struct _CdioDataSource CdioDataSource;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#include "generic.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -232,41 +244,14 @@ extern "C" {
|
|||||||
} cdio_funcs;
|
} cdio_funcs;
|
||||||
|
|
||||||
|
|
||||||
/* Implementation of CdIo type */
|
/*! Implementation of CdIo type */
|
||||||
struct _CdIo {
|
struct _CdIo {
|
||||||
driver_id_t driver_id; /* Particular driver opened. */
|
driver_id_t driver_id; /**< Particular driver opened. */
|
||||||
cdio_funcs op; /* driver-specific routines handling implimentatin*/
|
cdio_funcs op; /**< driver-specific routines handling
|
||||||
void *env; /* environment. Passed to routine above. */
|
implementation*/
|
||||||
|
void *env; /**< environment. Passed to routine above. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
|
||||||
Things common to private device structures. Even though not all
|
|
||||||
devices may have some of these fields, by listing common ones
|
|
||||||
we facilitate writing generic routines and even cut-and-paste
|
|
||||||
code.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
char *source_name; /**< Name used in open. */
|
|
||||||
bool init; /**< True if structure has been initialized */
|
|
||||||
bool toc_init; /**< True if TOC read in */
|
|
||||||
bool b_cdtext_init; /**< True if CD-Text read in */
|
|
||||||
bool b_cdtext_error; /**< True if trouble reading CD-Text */
|
|
||||||
|
|
||||||
int ioctls_debugged; /**< for debugging */
|
|
||||||
|
|
||||||
/* Only one of the below is used. The first is for CD-ROM devices
|
|
||||||
and the second for stream reading (bincue, nrg, toc, network).
|
|
||||||
*/
|
|
||||||
int fd; /**< File descriptor of device */
|
|
||||||
track_t i_first_track; /**< The starting track number. */
|
|
||||||
track_t i_tracks; /**< The number of tracks. */
|
|
||||||
CdioDataSource *data_source;
|
|
||||||
CdIo *cdio; /**< a way to call general cdio routines. */
|
|
||||||
cdtext_t cdtext; /**< CD-Text for disc. */
|
|
||||||
cdtext_t cdtext_track[CDIO_CD_MAX_TRACKS+1]; /*CD-TEXT for each track*/
|
|
||||||
|
|
||||||
} generic_img_private_t;
|
|
||||||
|
|
||||||
/* This is used in drivers that must keep their own internal
|
/* This is used in drivers that must keep their own internal
|
||||||
position pointer for doing seeks. Stream-based drivers (like bincue,
|
position pointer for doing seeks. Stream-based drivers (like bincue,
|
||||||
nrg, toc, network) would use this.
|
nrg, toc, network) would use this.
|
||||||
@@ -316,94 +301,6 @@ extern "C" {
|
|||||||
void cdio_add_device_list(char **device_list[], const char *drive,
|
void cdio_add_device_list(char **device_list[], const char *drive,
|
||||||
int *num_drives);
|
int *num_drives);
|
||||||
|
|
||||||
/*!
|
|
||||||
Bogus eject media when there is no ejectable media, e.g. a disk image
|
|
||||||
We always return 2. Should we also free resources?
|
|
||||||
*/
|
|
||||||
int cdio_generic_bogus_eject_media (void *env);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Release and free resources associated with cd.
|
|
||||||
*/
|
|
||||||
void cdio_generic_free (void *env);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Initialize CD device.
|
|
||||||
*/
|
|
||||||
bool cdio_generic_init (void *env);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Reads into buf the next size bytes.
|
|
||||||
Returns -1 on error.
|
|
||||||
Is in fact libc's read().
|
|
||||||
*/
|
|
||||||
off_t cdio_generic_lseek (void *env, off_t offset, int whence);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Reads into buf the next size bytes.
|
|
||||||
Returns -1 on error.
|
|
||||||
Is in fact libc's read().
|
|
||||||
*/
|
|
||||||
ssize_t cdio_generic_read (void *env, void *buf, size_t size);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Reads a single form1 sector from cd device into data starting
|
|
||||||
from lsn. Returns 0 if no error.
|
|
||||||
*/
|
|
||||||
int cdio_generic_read_form1_sector (void * user_data, void *data,
|
|
||||||
lsn_t lsn);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Release and free resources associated with stream or disk image.
|
|
||||||
*/
|
|
||||||
void cdio_generic_stdio_free (void *env);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Return true if source_name could be a device containing a CD-ROM on
|
|
||||||
Win32
|
|
||||||
*/
|
|
||||||
bool cdio_is_device_win32(const char *source_name);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Return true if source_name could be a device containing a CD-ROM on
|
|
||||||
most Unix servers with block and character devices.
|
|
||||||
*/
|
|
||||||
bool cdio_is_device_generic(const char *source_name);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Like above, but don't give a warning device doesn't exist.
|
|
||||||
*/
|
|
||||||
bool cdio_is_device_quiet_generic(const char *source_name);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Return the number of of the first track.
|
|
||||||
CDIO_INVALID_TRACK is returned on error.
|
|
||||||
*/
|
|
||||||
track_t get_first_track_num_generic(void *p_user_data);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Return the number of tracks in the current medium.
|
|
||||||
*/
|
|
||||||
track_t get_num_tracks_generic(void *p_user_data);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Get disc type associated with cd object.
|
|
||||||
*/
|
|
||||||
discmode_t get_discmode_generic (void *p_user_data );
|
|
||||||
|
|
||||||
void set_cdtext_field_generic(void *user_data, track_t i_track,
|
|
||||||
track_t i_first_track,
|
|
||||||
cdtext_field_t e_field, const char *psz_value);
|
|
||||||
/*!
|
|
||||||
Read cdtext information for a CdIo object .
|
|
||||||
|
|
||||||
return true on success, false on error or CD-Text information does
|
|
||||||
not exist.
|
|
||||||
*/
|
|
||||||
bool init_cdtext_generic (generic_img_private_t *p_env);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
167
lib/generic.h
Normal file
167
lib/generic.h
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
/*
|
||||||
|
$Id: generic.h,v 1.1 2004/08/10 11:58:15 rocky Exp $
|
||||||
|
|
||||||
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
|
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
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Internal routines for CD I/O drivers. */
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __CDIO_GENERIC_H__
|
||||||
|
#define __CDIO_GENERIC_H__
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cdio/cdio.h>
|
||||||
|
#include <cdio/cdtext.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Things common to private device structures. Even though not all
|
||||||
|
devices may have some of these fields, by listing common ones
|
||||||
|
we facilitate writing generic routines and even cut-and-paste
|
||||||
|
code.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
char *source_name; /**< Name used in open. */
|
||||||
|
bool init; /**< True if structure has been initialized */
|
||||||
|
bool toc_init; /**< True if TOC read in */
|
||||||
|
bool b_cdtext_init; /**< True if CD-Text read in */
|
||||||
|
bool b_cdtext_error; /**< True if trouble reading CD-Text */
|
||||||
|
|
||||||
|
int ioctls_debugged; /**< for debugging */
|
||||||
|
|
||||||
|
/* Only one of the below is used. The first is for CD-ROM devices
|
||||||
|
and the second for stream reading (bincue, nrg, toc, network).
|
||||||
|
*/
|
||||||
|
int fd; /**< File descriptor of device */
|
||||||
|
track_t i_first_track; /**< The starting track number. */
|
||||||
|
track_t i_tracks; /**< The number of tracks. */
|
||||||
|
CdioDataSource *data_source;
|
||||||
|
CdIo *cdio; /**< a way to call general cdio routines. */
|
||||||
|
cdtext_t cdtext; /**< CD-Text for disc. */
|
||||||
|
cdtext_t cdtext_track[CDIO_CD_MAX_TRACKS+1]; /*CD-TEXT for each track*/
|
||||||
|
|
||||||
|
} generic_img_private_t;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Bogus eject media when there is no ejectable media, e.g. a disk image
|
||||||
|
We always return 2. Should we also free resources?
|
||||||
|
*/
|
||||||
|
int cdio_generic_bogus_eject_media (void *env);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Release and free resources associated with cd.
|
||||||
|
*/
|
||||||
|
void cdio_generic_free (void *env);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Initialize CD device.
|
||||||
|
*/
|
||||||
|
bool cdio_generic_init (void *env);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Reads into buf the next size bytes.
|
||||||
|
Returns -1 on error.
|
||||||
|
Is in fact libc's read().
|
||||||
|
*/
|
||||||
|
off_t cdio_generic_lseek (void *env, off_t offset, int whence);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Reads into buf the next size bytes.
|
||||||
|
Returns -1 on error.
|
||||||
|
Is in fact libc's read().
|
||||||
|
*/
|
||||||
|
ssize_t cdio_generic_read (void *env, void *buf, size_t size);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Reads a single form1 sector from cd device into data starting
|
||||||
|
from lsn. Returns 0 if no error.
|
||||||
|
*/
|
||||||
|
int cdio_generic_read_form1_sector (void * user_data, void *data,
|
||||||
|
lsn_t lsn);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Release and free resources associated with stream or disk image.
|
||||||
|
*/
|
||||||
|
void cdio_generic_stdio_free (void *env);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return true if source_name could be a device containing a CD-ROM on
|
||||||
|
Win32
|
||||||
|
*/
|
||||||
|
bool cdio_is_device_win32(const char *source_name);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return true if source_name could be a device containing a CD-ROM on
|
||||||
|
most Unix servers with block and character devices.
|
||||||
|
*/
|
||||||
|
bool cdio_is_device_generic(const char *source_name);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Like above, but don't give a warning device doesn't exist.
|
||||||
|
*/
|
||||||
|
bool cdio_is_device_quiet_generic(const char *source_name);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get cdtext information for a CdIo object .
|
||||||
|
|
||||||
|
@param obj the CD object that may contain CD-TEXT information.
|
||||||
|
@return the CD-TEXT object or NULL if obj is NULL
|
||||||
|
or CD-TEXT information does not exist.
|
||||||
|
*/
|
||||||
|
const cdtext_t *get_cdtext_generic (void *p_user_data, track_t i_track);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return the number of of the first track.
|
||||||
|
CDIO_INVALID_TRACK is returned on error.
|
||||||
|
*/
|
||||||
|
track_t get_first_track_num_generic(void *p_user_data);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return the number of tracks in the current medium.
|
||||||
|
*/
|
||||||
|
track_t get_num_tracks_generic(void *p_user_data);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get disc type associated with cd object.
|
||||||
|
*/
|
||||||
|
discmode_t get_discmode_generic (void *p_user_data );
|
||||||
|
|
||||||
|
void set_cdtext_field_generic(void *user_data, track_t i_track,
|
||||||
|
track_t i_first_track,
|
||||||
|
cdtext_field_t e_field, const char *psz_value);
|
||||||
|
/*!
|
||||||
|
Read cdtext information for a CdIo object .
|
||||||
|
|
||||||
|
return true on success, false on error or CD-Text information does
|
||||||
|
not exist.
|
||||||
|
*/
|
||||||
|
bool init_cdtext_generic (generic_img_private_t *p_env);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* __CDIO_GENERIC_H__ */
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: util.c,v 1.22 2004/08/10 03:47:57 rocky Exp $
|
$Id: util.c,v 1.23 2004/08/10 11:58:15 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ print_mmc_drive_features(CdIo *p_cdio)
|
|||||||
printf("\t\n");
|
printf("\t\n");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_RT_STREAMING:
|
case CDIO_MMC_FEATURE_RT_STREAMING:
|
||||||
printf("\tAbility to read and write using Initiator requested performance parameters\n");
|
printf("Ability to read and write using Initiator requested performance parameters\n");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_LU_SN: {
|
case CDIO_MMC_FEATURE_LU_SN: {
|
||||||
uint8_t i_serial = *(p+3);
|
uint8_t i_serial = *(p+3);
|
||||||
|
|||||||
Reference in New Issue
Block a user