Add get_mcn, although it really only works on GNU/Linux right now.

This commit is contained in:
rocky
2003-09-25 09:38:15 +00:00
parent bc84344a3d
commit 6450be398b
26 changed files with 281 additions and 210 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: cdio_private.h,v 1.13 2003/09/20 12:34:02 rocky Exp $
$Id: cdio_private.h,v 1.14 2003/09/25 09:38:16 rocky Exp $
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -43,34 +43,40 @@ extern "C" {
Eject media in CD drive. If successful, as a side effect we
also free obj. Return 0 if success and 1 for failure.
*/
int (*eject_media) (void *user_data);
int (*eject_media) (void *env);
/*!
Release and free resources associated with cd.
*/
void (*free) (void *user_data);
void (*free) (void *env);
/*!
Return the value associated with the key "arg".
*/
const char * (*get_arg) (void *user_data, const char key[]);
const char * (*get_arg) (void *env, const char key[]);
/*!
Return a string containing the default CD device if none is specified.
*/
char * (*get_default_device)(void);
/*!
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.
*/
char * (*get_mcn) (void *env);
/*!
Return the number of of the first track.
CDIO_INVALID_TRACK is returned on error.
*/
track_t (*get_first_track_num) (void *user_data);
track_t (*get_first_track_num) (void *env);
/*!
Return the number of tracks in the current medium.
CDIO_INVALID_TRACK is returned on error.
*/
track_t (*get_num_tracks) (void *user_data);
track_t (*get_num_tracks) (void *env);
/*!
Return the starting LBA for track number
@@ -79,12 +85,12 @@ extern "C" {
using track_num LEADOUT_TRACK or the total tracks+1.
CDIO_INVALID_LBA is returned on error.
*/
lba_t (*get_track_lba) (void *user_data, track_t track_num);
lba_t (*get_track_lba) (void *env, track_t track_num);
/*!
Get format of track.
*/
track_format_t (*get_track_format) (void *user_data, track_t track_num);
track_format_t (*get_track_format) (void *env, track_t track_num);
/*!
Return true if we have XA data (green, mode2 form1) or
@@ -94,7 +100,7 @@ extern "C" {
FIXME: there's gotta be a better design for this and get_track_format?
*/
bool (*get_track_green) (void *user_data, track_t track_num);
bool (*get_track_green) (void *env, track_t track_num);
/*!
Return the starting MSF (minutes/secs/frames) for track number
@@ -103,34 +109,34 @@ extern "C" {
using track_num LEADOUT_TRACK or the total tracks+1.
False is returned on error.
*/
bool (*get_track_msf) (void *user_data, track_t track_num, msf_t *msf);
bool (*get_track_msf) (void *env, track_t track_num, msf_t *msf);
/*!
lseek - reposition read/write file offset
Returns (off_t) -1 on error.
Similar to libc's lseek()
*/
off_t (*lseek) (void *user_data, off_t offset, int whence);
off_t (*lseek) (void *env, off_t offset, int whence);
/*!
Reads into buf the next size bytes.
Returns -1 on error.
Similar to libc's read()
*/
ssize_t (*read) (void *user_data, void *buf, size_t size);
ssize_t (*read) (void *env, void *buf, size_t size);
/*!
Reads a single mode2 sector from cd device into buf starting
from lsn. Returns 0 if no error.
*/
int (*read_audio_sectors) (void *user_data, void *buf, lsn_t lsn,
int (*read_audio_sectors) (void *env, void *buf, lsn_t lsn,
unsigned int nblocks);
/*!
Reads a single mode2 sector from cd device into buf starting
from lsn. Returns 0 if no error.
*/
int (*read_mode2_sector) (void *user_data, void *buf, lsn_t lsn,
int (*read_mode2_sector) (void *env, void *buf, lsn_t lsn,
bool mode2raw);
/*!
@@ -138,18 +144,18 @@ extern "C" {
from lsn.
Returns 0 if no error.
*/
int (*read_mode2_sectors) (void *user_data, void *buf, lsn_t lsn,
int (*read_mode2_sectors) (void *env, void *buf, lsn_t lsn,
bool mode2raw, unsigned int nblocks);
/*!
Set the arg "key" with "value" in the source device.
*/
int (*set_arg) (void *user_data, const char key[], const char value[]);
int (*set_arg) (void *env, const char key[], const char value[]);
/*!
Return the size of the CD in logical block address (LBA) units.
*/
uint32_t (*stat_size) (void *user_data);
uint32_t (*stat_size) (void *env);
} cdio_funcs;
@@ -158,7 +164,7 @@ extern "C" {
struct _CdIo {
driver_id_t driver_id; /* Particular driver opened. */
cdio_funcs op; /* driver-specific routines handling implimentatin*/
void *user_data; /* environment. Passed to routine above. */
void *env; /* environment. Passed to routine above. */
};
/*!
@@ -191,7 +197,7 @@ extern "C" {
lba_t lba; /* Current LBA */
} internal_position_t;
CdIo * cdio_new (void *user_data, const cdio_funcs *funcs);
CdIo * cdio_new (void *env, const cdio_funcs *funcs);
/* The below structure describes a specific CD Input driver */
typedef struct
@@ -225,36 +231,36 @@ extern "C" {
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 *user_data);
int cdio_generic_bogus_eject_media (void *env);
/*!
Release and free resources associated with cd.
*/
void cdio_generic_free (void *user_data);
void cdio_generic_free (void *env);
/*!
Initialize CD device.
*/
bool cdio_generic_init (void *user_data);
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 *user_data, off_t offset, int whence);
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 *user_data, void *buf, size_t size);
ssize_t cdio_generic_read (void *env, void *buf, size_t size);
/*!
Release and free resources associated with stream or disk image.
*/
void cdio_generic_stream_free (void *user_data);
void cdio_generic_stream_free (void *env);
/*!
Return true if source_name could be a device containing a CD-ROM on