2003-03-24 19:01:09 +00:00
|
|
|
|
/*
|
2005-03-08 04:10:36 +00:00
|
|
|
|
$Id: cdio_private.h,v 1.25 2005/03/08 04:10:36 rocky Exp $
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2005-01-04 04:33:36 +00:00
|
|
|
|
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
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_PRIVATE_H__
|
|
|
|
|
|
#define __CDIO_PRIVATE_H__
|
|
|
|
|
|
|
2003-09-18 13:40:54 +00:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
|
# include "config.h"
|
2003-03-29 17:32:00 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2003-04-22 12:09:08 +00:00
|
|
|
|
#include <cdio/cdio.h>
|
2005-03-01 00:41:34 +00:00
|
|
|
|
#include <cdio/audio.h>
|
2004-07-08 01:27:57 +00:00
|
|
|
|
#include <cdio/cdtext.h>
|
2005-02-05 13:07:02 +00:00
|
|
|
|
#include "mmc_private.h"
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
2003-05-24 15:43:06 +00:00
|
|
|
|
/* Opaque type */
|
2005-01-20 01:00:52 +00:00
|
|
|
|
typedef struct _CdioDataSource CdioDataSource_t;
|
2003-04-07 11:31:19 +00:00
|
|
|
|
|
2004-08-10 11:58:14 +00:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
|
|
|
#include "generic.h"
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
|
|
2005-03-01 00:41:34 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Get volume of an audio CD.
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t (*audio_get_volume)
|
|
|
|
|
|
(void *p_env, /*out*/ cdio_audio_volume_t *p_volume);
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Pause playing CD through analog output
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t (*audio_pause) (void *p_env);
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Playing CD through analog output
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
*/
|
2005-03-05 09:26:52 +00:00
|
|
|
|
driver_return_code_t (*audio_play_msf) ( void *p_env,
|
|
|
|
|
|
msf_t *p_start_msf,
|
|
|
|
|
|
msf_t *p_end_msf );
|
2005-03-01 00:41:34 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Playing CD through analog output
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t (*audio_play_track_index)
|
|
|
|
|
|
( void *p_env, cdio_track_index_t *p_track_index );
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Get subchannel information.
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t (*audio_read_subchannel)
|
|
|
|
|
|
( void *p_env, cdio_subchannel_t *subchannel );
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Resume playing an audio CD.
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t (*audio_resume) ( void *p_env );
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Set volume of an audio CD.
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t (*audio_set_volume)
|
2005-03-05 09:11:44 +00:00
|
|
|
|
( void *p_env, cdio_audio_volume_t *p_volume );
|
2005-03-06 11:21:52 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Stop playing an audio CD.
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t (*audio_stop) ( void *p_env );
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Close media tray in CD drive if there is a routine to do so.
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t (*close_tray) ( void *p_env );
|
|
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Eject media in CD drive. If successful, as a side effect we
|
2005-03-06 11:21:52 +00:00
|
|
|
|
also free p_env.
|
2005-02-06 11:13:37 +00:00
|
|
|
|
|
2005-03-01 00:41:34 +00:00
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
If the CD is ejected *p_env is freed and p_env set to NULL.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
driver_return_code_t (*eject_media) ( void *p_env );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Release and free resources associated with cd.
|
|
|
|
|
|
*/
|
2004-12-30 11:13:49 +00:00
|
|
|
|
void (*free) (void *p_env);
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Return the value associated with the key "arg".
|
|
|
|
|
|
*/
|
2004-12-30 11:13:49 +00:00
|
|
|
|
const char * (*get_arg) (void *p_env, const char key[]);
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2005-01-20 05:07:00 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Get the block size for subsequest read requests, via a SCSI MMC
|
|
|
|
|
|
MODE_SENSE 6 command.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
int (*get_blocksize) ( void *p_env );
|
2005-01-20 05:07:00 +00:00
|
|
|
|
|
2004-07-17 02:18:26 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
If i_track is 0 or CDIO_CDROM_LEADOUT_TRACK the track returned
|
|
|
|
|
|
is the information assocated with the CD.
|
2004-07-11 14:25:07 +00:00
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
cdtext_t * (*get_cdtext) ( void *p_env, track_t i_track );
|
2004-07-11 14:25:07 +00:00
|
|
|
|
|
2003-09-28 17:14:20 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Return an array of device names. if CdIo is NULL (we haven't
|
|
|
|
|
|
initialized a specific device driver), then find a suitable device
|
|
|
|
|
|
driver.
|
|
|
|
|
|
|
|
|
|
|
|
NULL is returned if we couldn't return a list of devices.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
char ** (*get_devices) ( void );
|
2003-09-28 17:14:20 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
2005-02-06 11:13:37 +00:00
|
|
|
|
Get the default CD device.
|
|
|
|
|
|
|
|
|
|
|
|
@return a string containing the default CD device or NULL is
|
|
|
|
|
|
if we couldn't get a default device.
|
|
|
|
|
|
|
|
|
|
|
|
In some situations of drivers or OS's we can't find a CD device if
|
|
|
|
|
|
there is no media in it and it is possible for this routine to return
|
|
|
|
|
|
NULL even though there may be a hardware CD-ROM.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
char * (*get_default_device) ( void );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2005-01-24 00:06:31 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Return the size of the CD in logical block address (LBA) units.
|
|
|
|
|
|
@return the lsn. On error 0 or CDIO_INVALD_LSN.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
lsn_t (*get_disc_last_lsn) ( void *p_env );
|
2005-01-24 00:06:31 +00:00
|
|
|
|
|
2004-07-21 10:19:20 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Get disc mode associated with cd_obj.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
discmode_t (*get_discmode) ( void *p_env );
|
2004-07-21 10:19:20 +00:00
|
|
|
|
|
2004-04-22 03:24:38 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Return the what kind of device we've got.
|
|
|
|
|
|
|
|
|
|
|
|
See cd_types.h for a list of bitmasks for the drive type;
|
|
|
|
|
|
*/
|
2004-12-30 11:13:49 +00:00
|
|
|
|
void (*get_drive_cap) (const void *p_env,
|
2004-07-17 22:16:46 +00:00
|
|
|
|
cdio_drive_read_cap_t *p_read_cap,
|
|
|
|
|
|
cdio_drive_write_cap_t *p_write_cap,
|
|
|
|
|
|
cdio_drive_misc_cap_t *p_misc_cap);
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Return the number of of the first track.
|
|
|
|
|
|
CDIO_INVALID_TRACK is returned on error.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
track_t (*get_first_track_num) ( void *p_env );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2004-08-27 02:50:13 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Get the CD-ROM hardware info via a SCSI MMC INQUIRY command.
|
|
|
|
|
|
False is returned if we had an error getting the information.
|
|
|
|
|
|
*/
|
2005-03-01 00:41:34 +00:00
|
|
|
|
bool (*get_hwinfo)
|
|
|
|
|
|
( const CdIo_t *p_cdio, /* out*/ cdio_hwinfo_t *p_hw_info );
|
2004-08-27 02:50:13 +00:00
|
|
|
|
|
2005-03-05 10:48:41 +00:00
|
|
|
|
/*! Get the LSN of the first track of the last session of
|
|
|
|
|
|
on the CD.
|
2005-03-05 10:10:16 +00:00
|
|
|
|
|
|
|
|
|
|
@param p_cdio the CD object to be acted upon.
|
|
|
|
|
|
@param i_last_session pointer to the session number to be returned.
|
|
|
|
|
|
*/
|
|
|
|
|
|
driver_return_code_t (*get_last_session)
|
2005-03-06 11:21:52 +00:00
|
|
|
|
( void *p_env, /*out*/ lsn_t *i_last_session );
|
2005-03-05 10:10:16 +00:00
|
|
|
|
|
2005-02-06 11:13:37 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Find out if media has changed since the last call.
|
|
|
|
|
|
@param p_env the CD object to be acted upon.
|
|
|
|
|
|
@return 1 if media has changed since last call, 0 if not. Error
|
|
|
|
|
|
return codes are the same as driver_return_code_t
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
int (*get_media_changed) ( const void *p_env );
|
2005-02-06 11:13:37 +00:00
|
|
|
|
|
2004-08-27 02:50:13 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
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.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
char * (*get_mcn) ( const void *p_env );
|
2004-08-27 02:50:13 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Return the number of tracks in the current medium.
|
|
|
|
|
|
CDIO_INVALID_TRACK is returned on error.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
track_t (*get_num_tracks) ( void *p_env );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2004-12-31 05:47:36 +00:00
|
|
|
|
/*! 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.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
int (*get_track_channels) ( const void *p_env, track_t i_track );
|
2004-12-31 05:47:36 +00:00
|
|
|
|
|
|
|
|
|
|
/*! Return 0 if track is copy protected, 1 if not, or -1 for error
|
|
|
|
|
|
or -2 if not implimented (yet). Is this meaningful if not an
|
|
|
|
|
|
audio track?
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
track_flag_t (*get_track_copy_permit) ( void *p_env, track_t i_track );
|
2004-12-31 05:47:36 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
2003-03-29 17:32:00 +00:00
|
|
|
|
Return the starting LBA for track number
|
2004-12-30 11:13:49 +00:00
|
|
|
|
i_track in p_env. Tracks numbers start at 1.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
The "leadout" track is specified either by
|
|
|
|
|
|
using track_num LEADOUT_TRACK or the total tracks+1.
|
2003-03-29 17:32:00 +00:00
|
|
|
|
CDIO_INVALID_LBA is returned on error.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
lba_t (*get_track_lba) ( void *p_env, track_t i_track );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Get format of track.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
track_format_t (*get_track_format) ( void *p_env, track_t i_track );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Return true if we have XA data (green, mode2 form1) or
|
|
|
|
|
|
XA data (green, mode2 form2). That is track begins:
|
|
|
|
|
|
sync - header - subheader
|
|
|
|
|
|
12 4 - 8
|
|
|
|
|
|
|
|
|
|
|
|
FIXME: there's gotta be a better design for this and get_track_format?
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
bool (*get_track_green) ( void *p_env, track_t i_track );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Return the starting MSF (minutes/secs/frames) for track number
|
2004-12-30 11:13:49 +00:00
|
|
|
|
i_track in p_env. Tracks numbers start at 1.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
The "leadout" track is specified either by
|
2004-12-30 11:13:49 +00:00
|
|
|
|
using i_track LEADOUT_TRACK or the total tracks+1.
|
2003-03-29 17:32:00 +00:00
|
|
|
|
False is returned on error.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
bool (*get_track_msf) ( void *p_env, track_t i_track, msf_t *p_msf );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2004-12-31 05:47:36 +00:00
|
|
|
|
/*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error
|
|
|
|
|
|
or -2 if not implimented (yet). Is this meaningful if not an
|
|
|
|
|
|
audio track?
|
|
|
|
|
|
*/
|
2005-03-01 00:41:34 +00:00
|
|
|
|
track_flag_t (*get_track_preemphasis)
|
|
|
|
|
|
( const void *p_env, track_t i_track );
|
2004-12-31 05:47:36 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
2003-03-29 17:32:00 +00:00
|
|
|
|
lseek - reposition read/write file offset
|
|
|
|
|
|
Returns (off_t) -1 on error.
|
|
|
|
|
|
Similar to libc's lseek()
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
off_t (*lseek) ( void *p_env, off_t offset, int whence );
|
2003-03-29 17:32:00 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Reads into buf the next size bytes.
|
|
|
|
|
|
Returns -1 on error.
|
|
|
|
|
|
Similar to libc's read()
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
ssize_t (*read) ( void *p_env, void *p_buf, size_t i_size );
|
2003-03-29 17:32:00 +00:00
|
|
|
|
|
2003-04-10 04:13:41 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Reads a single mode2 sector from cd device into buf starting
|
|
|
|
|
|
from lsn. Returns 0 if no error.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
int (*read_audio_sectors) ( void *p_env, void *p_buf, lsn_t i_lsn,
|
|
|
|
|
|
unsigned int i_blocks );
|
2003-04-10 04:13:41 +00:00
|
|
|
|
|
2005-02-17 04:57:21 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Read a data sector
|
|
|
|
|
|
|
|
|
|
|
|
@param p_env environment to read from
|
|
|
|
|
|
|
|
|
|
|
|
@param p_buf place to read data into. The caller should make sure
|
|
|
|
|
|
this location can store at least CDIO_CD_FRAMESIZE,
|
|
|
|
|
|
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending
|
|
|
|
|
|
on the kind of sector getting read. If you don't
|
|
|
|
|
|
know whether you have a Mode 1/2, Form 1/ Form 2/Formless
|
|
|
|
|
|
sector best to reserve space for the maximum,
|
|
|
|
|
|
M2RAW_SECTOR_SIZE.
|
|
|
|
|
|
|
|
|
|
|
|
@param i_lsn sector to read
|
|
|
|
|
|
@param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE,
|
|
|
|
|
|
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf.
|
|
|
|
|
|
*/
|
2005-03-01 00:41:34 +00:00
|
|
|
|
driver_return_code_t (*read_data_sectors)
|
|
|
|
|
|
( void *p_env, void *p_buf, lsn_t i_lsn, uint16_t i_blocksize,
|
|
|
|
|
|
uint32_t i_blocks );
|
2005-02-17 04:57:21 +00:00
|
|
|
|
|
2003-03-29 17:32:00 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Reads a single mode2 sector from cd device into buf starting
|
2003-03-24 19:01:09 +00:00
|
|
|
|
from lsn. Returns 0 if no error.
|
|
|
|
|
|
*/
|
2005-03-01 00:41:34 +00:00
|
|
|
|
int (*read_mode2_sector)
|
|
|
|
|
|
( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2 );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
2004-12-30 11:13:49 +00:00
|
|
|
|
Reads i_blocks of mode2 sectors from cd device into data starting
|
2003-03-24 19:01:09 +00:00
|
|
|
|
from lsn.
|
|
|
|
|
|
Returns 0 if no error.
|
|
|
|
|
|
*/
|
2005-03-01 00:41:34 +00:00
|
|
|
|
int (*read_mode2_sectors)
|
|
|
|
|
|
( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2,
|
|
|
|
|
|
unsigned int i_blocks );
|
2004-03-05 04:23:52 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Reads a single mode1 sector from cd device into buf starting
|
|
|
|
|
|
from lsn. Returns 0 if no error.
|
|
|
|
|
|
*/
|
2005-03-01 00:41:34 +00:00
|
|
|
|
int (*read_mode1_sector)
|
|
|
|
|
|
( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2 );
|
2004-03-05 04:23:52 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
2004-12-30 11:13:49 +00:00
|
|
|
|
Reads i_blocks of mode1 sectors from cd device into data starting
|
2004-03-05 04:23:52 +00:00
|
|
|
|
from lsn.
|
|
|
|
|
|
Returns 0 if no error.
|
|
|
|
|
|
*/
|
2005-03-01 00:41:34 +00:00
|
|
|
|
int (*read_mode1_sectors)
|
|
|
|
|
|
( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2,
|
|
|
|
|
|
unsigned int i_blocks );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2004-07-29 02:16:20 +00:00
|
|
|
|
bool (*read_toc) ( void *p_env ) ;
|
|
|
|
|
|
|
2004-07-22 09:52:17 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Run a SCSI MMC command.
|
|
|
|
|
|
|
|
|
|
|
|
cdio CD structure set by cdio_open().
|
2004-07-29 02:16:20 +00:00
|
|
|
|
i_timeout_ms time in milliseconds we will wait for the command
|
|
|
|
|
|
to complete.
|
2004-07-22 09:52:17 +00:00
|
|
|
|
cdb_len number of bytes in cdb (6, 10, or 12).
|
|
|
|
|
|
cdb CDB bytes. All values that are needed should be set on
|
|
|
|
|
|
input.
|
|
|
|
|
|
b_return_data TRUE if the command expects data to be returned in
|
|
|
|
|
|
the buffer
|
|
|
|
|
|
len Size of buffer
|
|
|
|
|
|
buf Buffer for data, both sending and receiving
|
|
|
|
|
|
|
|
|
|
|
|
Returns 0 if command completed successfully.
|
|
|
|
|
|
*/
|
2005-02-06 11:13:37 +00:00
|
|
|
|
mmc_run_cmd_fn_t run_mmc_cmd;
|
2004-07-22 09:52:17 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Set the arg "key" with "value" in the source device.
|
|
|
|
|
|
*/
|
2005-03-06 11:21:52 +00:00
|
|
|
|
int (*set_arg) ( void *p_env, const char key[], const char value[] );
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2005-01-18 00:57:19 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Set the blocksize for subsequent reads.
|
|
|
|
|
|
*/
|
2005-02-17 04:57:21 +00:00
|
|
|
|
driver_return_code_t (*set_blocksize) ( void *p_env,
|
|
|
|
|
|
uint16_t i_blocksize );
|
2005-01-18 00:57:19 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Set the drive speed.
|
|
|
|
|
|
|
|
|
|
|
|
@return 0 if everything went okay, -1 if we had an error. is -2
|
|
|
|
|
|
returned if this is not implemented for the current driver.
|
|
|
|
|
|
*/
|
|
|
|
|
|
int (*set_speed) ( void *p_env, int i_speed );
|
|
|
|
|
|
|
2005-01-17 17:20:09 +00:00
|
|
|
|
} cdio_funcs_t;
|
2003-03-29 17:32:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
2004-08-10 11:58:14 +00:00
|
|
|
|
/*! Implementation of CdIo type */
|
2003-05-24 15:43:06 +00:00
|
|
|
|
struct _CdIo {
|
2004-08-10 11:58:14 +00:00
|
|
|
|
driver_id_t driver_id; /**< Particular driver opened. */
|
2005-01-17 17:20:09 +00:00
|
|
|
|
cdio_funcs_t op; /**< driver-specific routines handling
|
2004-12-30 11:13:49 +00:00
|
|
|
|
implementation*/
|
2004-08-10 11:58:14 +00:00
|
|
|
|
void *env; /**< environment. Passed to routine above. */
|
2003-05-24 15:43:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
2003-04-07 11:31:19 +00:00
|
|
|
|
/* This is used in drivers that must keep their own internal
|
|
|
|
|
|
position pointer for doing seeks. Stream-based drivers (like bincue,
|
|
|
|
|
|
nrg, toc, network) would use this.
|
|
|
|
|
|
*/
|
|
|
|
|
|
typedef struct
|
|
|
|
|
|
{
|
|
|
|
|
|
off_t buff_offset; /* buffer offset in disk-image seeks. */
|
|
|
|
|
|
track_t index; /* Current track index in tocent. */
|
|
|
|
|
|
lba_t lba; /* Current LBA */
|
|
|
|
|
|
} internal_position_t;
|
|
|
|
|
|
|
2005-01-17 17:20:09 +00:00
|
|
|
|
CdIo_t * cdio_new (generic_img_private_t *p_env, cdio_funcs_t *p_funcs);
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/* The below structure describes a specific CD Input driver */
|
|
|
|
|
|
typedef struct
|
|
|
|
|
|
{
|
|
|
|
|
|
driver_id_t id;
|
2003-09-30 03:26:11 +00:00
|
|
|
|
unsigned int flags;
|
2003-03-24 19:01:09 +00:00
|
|
|
|
const char *name;
|
|
|
|
|
|
const char *describe;
|
|
|
|
|
|
bool (*have_driver) (void);
|
2005-03-07 07:23:52 +00:00
|
|
|
|
CdIo_t *(*driver_open) (const char *psz_source_name);
|
|
|
|
|
|
CdIo_t *(*driver_open_am) (const char *psz_source_name,
|
2004-04-30 06:54:15 +00:00
|
|
|
|
const char *psz_access_mode);
|
2003-04-10 04:13:41 +00:00
|
|
|
|
char *(*get_default_device) (void);
|
2004-04-30 06:54:15 +00:00
|
|
|
|
bool (*is_device) (const char *psz_source_name);
|
2003-09-30 03:26:11 +00:00
|
|
|
|
char **(*get_devices) (void);
|
2005-03-07 07:23:52 +00:00
|
|
|
|
driver_return_code_t (*close_tray) (const char *psz_device);
|
2003-03-24 19:01:09 +00:00
|
|
|
|
} CdIo_driver_t;
|
|
|
|
|
|
|
|
|
|
|
|
/* The below array gives of the drivers that are currently available for
|
|
|
|
|
|
on a particular host. */
|
2003-06-22 22:41:29 +00:00
|
|
|
|
extern CdIo_driver_t CdIo_driver[CDIO_MAX_DRIVER];
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/* The last valid entry of Cdio_driver. -1 means uninitialzed. -2
|
|
|
|
|
|
means some sort of error.
|
|
|
|
|
|
*/
|
|
|
|
|
|
extern int CdIo_last_driver;
|
|
|
|
|
|
|
|
|
|
|
|
/* The below array gives all drivers that can possibly appear.
|
|
|
|
|
|
on a particular host. */
|
2003-06-22 22:41:29 +00:00
|
|
|
|
extern CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1];
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2003-09-28 17:14:20 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Add/allocate a drive to the end of drives.
|
|
|
|
|
|
Use cdio_free_device_list() to free this device_list.
|
|
|
|
|
|
*/
|
2005-02-17 04:57:21 +00:00
|
|
|
|
void cdio_add_device_list(char **device_list[], const char *psz_drive,
|
2004-09-03 23:20:11 +00:00
|
|
|
|
unsigned int *i_drives);
|
2003-09-28 17:14:20 +00:00
|
|
|
|
|
2005-03-07 07:23:52 +00:00
|
|
|
|
driver_return_code_t close_tray_linux (const char *psz_device);
|
2005-03-08 04:10:36 +00:00
|
|
|
|
driver_return_code_t close_tray_solaris(const char *psz_device);
|
2005-03-08 03:11:19 +00:00
|
|
|
|
driver_return_code_t close_tray_win32 (const char *psz_win32_drive);
|
2005-03-07 07:23:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __CDIO_PRIVATE_H__ */
|