Break out track and disc routines. (Disc needs more work)
Add more convenience track routines. Set access-mode for image routines to be the image drivers - for uniformity. Some name regularization. And we're in 2005 now.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.am,v 1.16 2004/12/31 05:47:36 rocky Exp $
|
||||
# $Id: Makefile.am,v 1.17 2005/01/04 04:33:36 rocky Exp $
|
||||
#
|
||||
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||
#
|
||||
@@ -31,6 +31,7 @@ libcdioinclude_HEADERS = \
|
||||
cdtext.h \
|
||||
cdtext.h \
|
||||
cd_types.h \
|
||||
disc.h \
|
||||
ds.h \
|
||||
dvd.h \
|
||||
iso9660.h \
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* -*- c -*-
|
||||
$Id: cdio.h,v 1.71 2005/01/02 22:43:41 rocky Exp $
|
||||
$Id: cdio.h,v 1.72 2005/01/04 04:33:36 rocky Exp $
|
||||
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) 2003, 2004, 2005 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
|
||||
@@ -129,8 +129,6 @@ extern "C" {
|
||||
#define CDIO_MAX_DRIVER DRIVER_NRG
|
||||
#define CDIO_MAX_DEVICE_DRIVER DRIVER_WIN32
|
||||
|
||||
extern const char *discmode2str[];
|
||||
|
||||
/*! Printable tags for track_format_t enumeration. */
|
||||
extern const char *track_format2str[6];
|
||||
|
||||
@@ -254,13 +252,6 @@ extern "C" {
|
||||
|
||||
char ** cdio_get_devices_ret (/*in/out*/ driver_id_t *p_driver_id);
|
||||
|
||||
/*!
|
||||
Get disc mode - the kind of CD (CD-DA, CD-ROM mode 1, CD-MIXED, etc.
|
||||
that we've got. The notion of "CD" is extended a little to include
|
||||
DVD's.
|
||||
*/
|
||||
discmode_t cdio_get_discmode (CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Get the what kind of device we've got.
|
||||
|
||||
@@ -309,14 +300,6 @@ extern "C" {
|
||||
*/
|
||||
driver_id_t cdio_get_driver_id (const CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Get the number of the first track.
|
||||
|
||||
@return the track number or CDIO_INVALID_TRACK
|
||||
on error.
|
||||
*/
|
||||
track_t cdio_get_first_track_num(const CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Get the CD-ROM hardware info via a SCSI MMC INQUIRY command.
|
||||
False is returned if we had an error getting the information.
|
||||
@@ -325,41 +308,6 @@ extern "C" {
|
||||
/* out*/ cdio_hwinfo_t *p_hw_info );
|
||||
|
||||
|
||||
/*!
|
||||
Return the Joliet level recognized for p_cdio.
|
||||
*/
|
||||
uint8_t cdio_get_joliet_level(const CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Get the media catalog number (MCN) from the CD.
|
||||
|
||||
@return the media catalog number r NULL if there is none or we
|
||||
don't have the ability to get it.
|
||||
|
||||
Note: string is malloc'd so caller has to free() the returned
|
||||
string when done with it.
|
||||
|
||||
*/
|
||||
char * cdio_get_mcn (const CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Get the number of tracks on the CD.
|
||||
|
||||
@return the number of tracks, or CDIO_INVALID_TRACK if there is
|
||||
an error.
|
||||
*/
|
||||
track_t cdio_get_num_tracks (const CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Reposition read offset
|
||||
Similar to (if not the same as) libc's lseek()
|
||||
|
||||
@param p_cdio object to get information from
|
||||
@param offset amount to seek
|
||||
@param whence like corresponding parameter in libc's lseek, e.g.
|
||||
SEEK_SET or SEEK_END.
|
||||
@return (off_t) -1 on error.
|
||||
*/
|
||||
off_t cdio_lseek(const CdIo_t *p_cdio, off_t offset, int whence);
|
||||
|
||||
/*!
|
||||
@@ -955,5 +903,7 @@ extern "C" {
|
||||
|
||||
/* Track-related functions. */
|
||||
#include <cdio/track.h>
|
||||
/* Disc-related functions. */
|
||||
#include <cdio/disc.h>
|
||||
|
||||
#endif /* __CDIO_H__ */
|
||||
|
||||
95
include/cdio/disc.h
Normal file
95
include/cdio/disc.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/* -*- c -*-
|
||||
$Id: disc.h,v 1.1 2005/01/04 04:33:36 rocky Exp $
|
||||
|
||||
Copyright (C) 2004, 2005 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
|
||||
*/
|
||||
|
||||
/** \file dic.h
|
||||
* \brief The top-level header for disc-related libcdio calls
|
||||
*/
|
||||
#ifndef __CDIO_DISC_H__
|
||||
#define __CDIO_DISC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern const char *discmode2str[];
|
||||
|
||||
/*!
|
||||
Get the lsn of the end of the CD
|
||||
|
||||
@return the leadout LSN or CDIO_INVALID_LSN if there is an error.
|
||||
*/
|
||||
unsigned int cdio_get_disc_last_lsn(const CdIo *p_cdio);
|
||||
|
||||
/*!
|
||||
Get disc mode - the kind of CD (CD-DA, CD-ROM mode 1, CD-MIXED, etc.
|
||||
that we've got. The notion of "CD" is extended a little to include
|
||||
DVD's.
|
||||
*/
|
||||
discmode_t cdio_get_discmode (CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Get the lsn of the end of the CD
|
||||
|
||||
@return the leadout LSN or CDIO_INVALID_LSN if there is an error.
|
||||
*/
|
||||
unsigned int cdio_get_disc_last_lsn(const CdIo *p_cdio);
|
||||
|
||||
|
||||
/*!
|
||||
Return the Joliet level recognized for p_cdio.
|
||||
*/
|
||||
uint8_t cdio_get_joliet_level(const CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Get the media catalog number (MCN) from the CD.
|
||||
|
||||
@return the media catalog number r NULL if there is none or we
|
||||
don't have the ability to get it.
|
||||
|
||||
Note: string is malloc'd so caller has to free() the returned
|
||||
string when done with it.
|
||||
|
||||
*/
|
||||
char * cdio_get_mcn (const CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Get the number of tracks on the CD.
|
||||
|
||||
@return the number of tracks, or CDIO_INVALID_TRACK if there is
|
||||
an error.
|
||||
*/
|
||||
track_t cdio_get_num_tracks (const CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Reposition read offset
|
||||
Similar to (if not the same as) libc's lseek()
|
||||
|
||||
@param p_cdio object to get information from
|
||||
@param offset amount to seek
|
||||
@param whence like corresponding parameter in libc's lseek, e.g.
|
||||
SEEK_SET or SEEK_END.
|
||||
@return (off_t) -1 on error.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __CDIO_DISC_H__ */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: sector.h,v 1.30 2005/01/01 14:19:19 rocky Exp $
|
||||
$Id: sector.h,v 1.31 2005/01/04 04:33:36 rocky Exp $
|
||||
|
||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -173,23 +173,10 @@ typedef enum {
|
||||
#define CDIO_CDROM_CDI_TRACK 0x10
|
||||
#define CDIO_CDROM_XA_TRACK 0x20
|
||||
|
||||
/*! The leadout track is always 0xAA, regardless of # of tracks on
|
||||
disc, or what value may be used internally. For example although
|
||||
OS X uses a different value for the lead-out track internally than
|
||||
given below, programmers should use CDIO_CDROM_LEADOUT_TRACK and
|
||||
not worry about this.
|
||||
*/
|
||||
#define CDIO_CDROM_LEADOUT_TRACK 0xAA
|
||||
|
||||
#define M2F2_SECTOR_SIZE 2324
|
||||
#define M2SUB_SECTOR_SIZE 2332
|
||||
#define M2RAW_SECTOR_SIZE 2336
|
||||
|
||||
/*! Largest CD track number */
|
||||
#define CDIO_CD_MAX_TRACKS 99
|
||||
/*! Smallest CD track number */
|
||||
#define CDIO_CD_MIN_TRACK_NO 1
|
||||
|
||||
/*! Largest CD session number */
|
||||
#define CDIO_CD_MAX_SESSIONS 99
|
||||
/*! Smallest CD session number */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- c -*-
|
||||
$Id: track.h,v 1.2 2005/01/02 22:43:41 rocky Exp $
|
||||
$Id: track.h,v 1.3 2005/01/04 04:33:36 rocky Exp $
|
||||
|
||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -24,6 +24,24 @@
|
||||
#ifndef __CDIO_TRACK_H__
|
||||
#define __CDIO_TRACK_H__
|
||||
|
||||
/*! The leadout track is always 0xAA, regardless of # of tracks on
|
||||
disc, or what value may be used internally. For example although
|
||||
OS X uses a different value for the lead-out track internally than
|
||||
given below, programmers should use CDIO_CDROM_LEADOUT_TRACK and
|
||||
not worry about this.
|
||||
*/
|
||||
#define CDIO_CDROM_LEADOUT_TRACK 0xAA
|
||||
|
||||
/*! Largest CD track number */
|
||||
#define CDIO_CD_MAX_TRACKS 99
|
||||
/*! Smallest CD track number */
|
||||
#define CDIO_CD_MIN_TRACK_NO 1
|
||||
|
||||
/*!
|
||||
Constant for invalid track number
|
||||
*/
|
||||
#define CDIO_INVALID_TRACK 0xFF
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
@@ -52,6 +70,30 @@ extern "C" {
|
||||
int channels;
|
||||
} track_flags_t;
|
||||
|
||||
/*!
|
||||
Get the number of the first track.
|
||||
|
||||
@return the track number or CDIO_INVALID_TRACK
|
||||
on error.
|
||||
*/
|
||||
track_t cdio_get_first_track_num(const CdIo_t *p_cdio);
|
||||
|
||||
/*!
|
||||
Return the last track number.
|
||||
CDIO_INVALID_TRACK is returned on error.
|
||||
*/
|
||||
track_t cdio_get_last_track_num (const CdIo_t *p_cdio);
|
||||
|
||||
|
||||
/*! Find the track which contans lsn.
|
||||
CDIO_INVALID_TRACK is returned if the lsn outside of the CD or
|
||||
if there was some error.
|
||||
|
||||
If the lsn is before the pregap of the first track 0 is returned.
|
||||
Otherwise we return the track that spans the lsn.
|
||||
*/
|
||||
track_t cdio_get_track(const CdIo_t *p_cdio, lsn_t lsn);
|
||||
|
||||
/*! Return number of channels in track: 2 or 4; -2 if not
|
||||
implemented or -1 for error.
|
||||
Not meaningful if track is not an audio track.
|
||||
@@ -76,8 +118,14 @@ extern "C" {
|
||||
|
||||
FIXME: there's gotta be a better design for this and get_track_format?
|
||||
*/
|
||||
bool cdio_get_track_green(const CdIo *p_cdio, track_t i_track);
|
||||
bool cdio_get_track_green(const CdIo_t *p_cdio, track_t i_track);
|
||||
|
||||
/*!
|
||||
Return the ending LSN for track number
|
||||
i_track in cdio. CDIO_INVALID_LSN is returned on error.
|
||||
*/
|
||||
lsn_t cdio_get_track_last_lsn(const CdIo_t *p_cdio, track_t i_track);
|
||||
|
||||
/*!
|
||||
Get the starting LBA for track number
|
||||
i_track in p_cdio. Track numbers usually start at something
|
||||
@@ -90,7 +138,7 @@ extern "C" {
|
||||
@param i_track the track number we want the LSN for
|
||||
@return the starting LBA or CDIO_INVALID_LBA on error.
|
||||
*/
|
||||
lba_t cdio_get_track_lba(const CdIo *p_cdio, track_t i_track);
|
||||
lba_t cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track);
|
||||
|
||||
/*!
|
||||
Return the starting MSF (minutes/secs/frames) for track number
|
||||
@@ -104,7 +152,7 @@ extern "C" {
|
||||
@param i_track the track number we want the LSN for
|
||||
@return the starting LSN or CDIO_INVALID_LSN on error.
|
||||
*/
|
||||
lsn_t cdio_get_track_lsn(const CdIo *p_cdio, track_t i_track);
|
||||
lsn_t cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track);
|
||||
|
||||
/*!
|
||||
Return the starting MSF (minutes/secs/frames) for track number
|
||||
@@ -116,13 +164,14 @@ extern "C" {
|
||||
|
||||
@return true if things worked or false if there is no track entry.
|
||||
*/
|
||||
bool cdio_get_track_msf(const CdIo *p_cdio, track_t i_track,
|
||||
bool cdio_get_track_msf(const CdIo_t *p_cdio, track_t i_track,
|
||||
/*out*/ msf_t *msf);
|
||||
|
||||
/*! Get linear preemphasis status on an audio track
|
||||
This is not meaningful if not an audio track?
|
||||
*/
|
||||
track_flag_t cdio_get_track_preemphasis(const CdIo *p_cdio, track_t i_track);
|
||||
track_flag_t cdio_get_track_preemphasis(const CdIo_t *p_cdio,
|
||||
track_t i_track);
|
||||
|
||||
/*!
|
||||
Get the number of sectors between this track an the next. This
|
||||
@@ -132,11 +181,11 @@ extern "C" {
|
||||
|
||||
@return the number of sectors or 0 if there is an error.
|
||||
*/
|
||||
unsigned int cdio_get_track_sec_count(const CdIo *p_cdio, track_t i_track);
|
||||
unsigned int cdio_get_track_sec_count(const CdIo_t *p_cdio, track_t i_track);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __CDIO_H__ */
|
||||
#endif /* __CDIO_TRACK_H__ */
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: types.h,v 1.24 2004/12/18 17:29:32 rocky Exp $
|
||||
$Id: types.h,v 1.25 2005/01/04 04:33:36 rocky Exp $
|
||||
|
||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -221,11 +221,6 @@ extern "C" {
|
||||
/*! The type of a track number 0..99. */
|
||||
typedef uint8_t track_t;
|
||||
|
||||
/*!
|
||||
Constant for invalid track number
|
||||
*/
|
||||
#define CDIO_INVALID_TRACK 0xFF
|
||||
|
||||
/*! The type of a session number 0..99. */
|
||||
typedef uint8_t session_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user