More regularization of names. Warning: untested on freebsd and osx.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
$Id: _cdio_freebsd.c,v 1.19 2003/10/03 07:55:01 rocky Exp $
|
||||
$Id: _cdio_freebsd.c,v 1.20 2004/04/25 15:41:26 rocky Exp $
|
||||
|
||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) 2003, 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
|
||||
@@ -18,16 +18,16 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* This file contains FreeBSD-specific code and implements low-level
|
||||
control of the CD drive. Culled I think from xine's or mplayer's
|
||||
FreeBSD code.
|
||||
/* This file contains FreeBSD-specific code and implements low-level
|
||||
control of the CD drive. Culled initially I think from xine's or
|
||||
mplayer's FreeBSD code with lots of modifications.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_freebsd.c,v 1.19 2003/10/03 07:55:01 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_freebsd.c,v 1.20 2004/04/25 15:41:26 rocky Exp $";
|
||||
|
||||
#include <cdio/sector.h>
|
||||
#include <cdio/util.h>
|
||||
@@ -146,7 +146,7 @@ _read_mode2 (int fd, void *buf, lba_t lba, unsigned int nblocks,
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_audio_sectors (void *env, void *data, lsn_t lsn,
|
||||
_read_audio_sectors_freebsd (void *env, void *data, lsn_t lsn,
|
||||
unsigned int nblocks)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
@@ -173,16 +173,16 @@ _cdio_read_audio_sectors (void *env, void *data, lsn_t lsn,
|
||||
from lsn. Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode2_sector (void *env, void *data, lsn_t lsn,
|
||||
bool mode2_form2)
|
||||
_read_mode2_sector_freebsd (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2)
|
||||
{
|
||||
char buf[M2RAW_SECTOR_SIZE] = { 0, };
|
||||
int retval;
|
||||
|
||||
if ( (retval = _cdio_read_audio_sectors (env, buf, lsn, 1)) )
|
||||
if ( (retval = _read_audio_sectors_freebsd (env, buf, lsn, 1)) )
|
||||
return retval;
|
||||
|
||||
if (mode2_form2)
|
||||
if (b_form2)
|
||||
memcpy (data, buf + CDIO_CD_XA_SYNC_HEADER, M2RAW_SECTOR_SIZE);
|
||||
else
|
||||
memcpy (data, buf + CDIO_CD_XA_SYNC_HEADER, CDIO_CD_FRAMESIZE);
|
||||
@@ -196,22 +196,22 @@ _cdio_read_mode2_sector (void *env, void *data, lsn_t lsn,
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode2_sectors (void *env, void *data, lsn_t lsn,
|
||||
bool mode2_form2, unsigned int nblocks)
|
||||
_read_mode2_sectors_freebsd (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2, unsigned int nblocks)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
int i;
|
||||
int retval;
|
||||
|
||||
for (i = 0; i < nblocks; i++) {
|
||||
if (mode2_form2) {
|
||||
if ( (retval = _cdio_read_mode2_sector (_obj,
|
||||
if (b_form2) {
|
||||
if ( (retval = _read_mode2_sector_freebsd (_obj,
|
||||
((char *)data) + (M2RAW_SECTOR_SIZE * i),
|
||||
lsn + i, true)) )
|
||||
return retval;
|
||||
} else {
|
||||
char buf[M2RAW_SECTOR_SIZE] = { 0, };
|
||||
if ( (retval = _cdio_read_mode2_sector (_obj, buf, lsn + i, true)) )
|
||||
if ( (retval = _read_mode2_sector_freebsd (_obj, buf, lsn + i, true)) )
|
||||
return retval;
|
||||
|
||||
memcpy (((char *)data) + (CDIO_CD_FRAMESIZE * i),
|
||||
@@ -225,7 +225,7 @@ _cdio_read_mode2_sectors (void *env, void *data, lsn_t lsn,
|
||||
Return the size of the CD in logical block address (LBA) units.
|
||||
*/
|
||||
static uint32_t
|
||||
_cdio_stat_size (void *env)
|
||||
_stat_size_freebsd (void *env)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -249,7 +249,7 @@ _cdio_stat_size (void *env)
|
||||
Set the key "arg" to "value" in source device.
|
||||
*/
|
||||
static int
|
||||
_cdio_set_arg (void *env, const char key[], const char value[])
|
||||
_set_arg_freebsd (void *env, const char key[], const char value[])
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -311,7 +311,7 @@ _cdio_read_toc (_img_private_t *_obj)
|
||||
Eject media. Return 1 if successful, 0 otherwise.
|
||||
*/
|
||||
static int
|
||||
_cdio_eject_media (void *env) {
|
||||
_eject_media_freebsd (void *env) {
|
||||
|
||||
_img_private_t *_obj = env;
|
||||
int ret=2;
|
||||
@@ -336,7 +336,7 @@ _cdio_eject_media (void *env) {
|
||||
Return the value associated with the key "arg".
|
||||
*/
|
||||
static const char *
|
||||
_cdio_get_arg (void *env, const char key[])
|
||||
_get_arg_freebsd (void *env, const char key[])
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -358,7 +358,7 @@ _cdio_get_arg (void *env, const char key[])
|
||||
CDIO_INVALID_TRACK is returned on error.
|
||||
*/
|
||||
static track_t
|
||||
_cdio_get_first_track_num(void *env)
|
||||
_get_first_track_num_freebsd(void *env)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -377,7 +377,7 @@ _cdio_get_first_track_num(void *env)
|
||||
|
||||
*/
|
||||
static char *
|
||||
_cdio_get_mcn (void *env) {
|
||||
_get_mcn_freebsd (void *env) {
|
||||
|
||||
_img_private_t *_obj = env;
|
||||
struct ioc_read_subchannel subchannel;
|
||||
@@ -408,7 +408,7 @@ _cdio_get_mcn (void *env) {
|
||||
CDIO_INVALID_TRACK is returned on error.
|
||||
*/
|
||||
static track_t
|
||||
_cdio_get_num_tracks(void *env)
|
||||
_get_num_tracks_freebsd(void *env)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -424,7 +424,7 @@ _cdio_get_num_tracks(void *env)
|
||||
|
||||
*/
|
||||
static track_format_t
|
||||
_cdio_get_track_format(void *env, track_t track_num)
|
||||
_get_track_format_freebsd(void *env, track_t track_num)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
struct ioc_read_subchannel subchannel;
|
||||
@@ -461,7 +461,7 @@ _cdio_get_track_format(void *env, track_t track_num)
|
||||
FIXME: there's gotta be a better design for this and get_track_format?
|
||||
*/
|
||||
static bool
|
||||
_cdio_get_track_green(void *env, track_t track_num)
|
||||
_get_track_green_freebsd(void *env, track_t track_num)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
struct ioc_read_subchannel subchannel;
|
||||
@@ -492,7 +492,7 @@ _cdio_get_track_green(void *env, track_t track_num)
|
||||
False is returned if there is no track entry.
|
||||
*/
|
||||
static lba_t
|
||||
_cdio_get_track_lba(void *env, track_t track_num)
|
||||
_get_track_lba_freebsd(void *env, track_t track_num)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -579,25 +579,25 @@ cdio_open_freebsd (const char *source_name)
|
||||
_img_private_t *_data;
|
||||
|
||||
cdio_funcs _funcs = {
|
||||
.eject_media = _cdio_eject_media,
|
||||
.eject_media = _eject_media_freebsd,
|
||||
.free = cdio_generic_free,
|
||||
.get_arg = _cdio_get_arg,
|
||||
.get_arg = _get_arg_freebsd,
|
||||
.get_default_device = cdio_get_default_device_freebsd,
|
||||
.get_devices = cdio_get_devices_freebsd,
|
||||
.get_first_track_num= _cdio_get_first_track_num,
|
||||
.get_mcn = _cdio_get_mcn,
|
||||
.get_num_tracks = _cdio_get_num_tracks,
|
||||
.get_track_format = _cdio_get_track_format,
|
||||
.get_track_green = _cdio_get_track_green,
|
||||
.get_track_lba = _cdio_get_track_lba,
|
||||
.get_first_track_num= _get_first_track_num_freebsd,
|
||||
.get_mcn = _get_mcn_freebsd,
|
||||
.get_num_tracks = _get_num_tracks_freebsd,
|
||||
.get_track_format = _get_track_format_freebsd,
|
||||
.get_track_green = _get_track_green_freebsd,
|
||||
.get_track_lba = _get_track_lba_freebsd,
|
||||
.get_track_msf = NULL,
|
||||
.lseek = cdio_generic_lseek,
|
||||
.read = cdio_generic_read,
|
||||
.read_audio_sectors = _cdio_read_audio_sectors,
|
||||
.read_mode2_sector = _cdio_read_mode2_sector,
|
||||
.read_mode2_sectors = _cdio_read_mode2_sectors,
|
||||
.set_arg = _cdio_set_arg,
|
||||
.stat_size = _cdio_stat_size
|
||||
.read_audio_sectors = _read_audio_sectors_freebsd,
|
||||
.read_mode2_sector = _read_mode2_sector_freebsd,
|
||||
.read_mode2_sectors = _read_mode2_sectors_freebsd,
|
||||
.set_arg = _set_arg_freebsd,
|
||||
.stat_size = _stat_size_freebsd
|
||||
};
|
||||
|
||||
_data = _cdio_malloc (sizeof (_img_private_t));
|
||||
@@ -605,8 +605,8 @@ cdio_open_freebsd (const char *source_name)
|
||||
_data->gen.init = false;
|
||||
_data->gen.fd = -1;
|
||||
|
||||
_cdio_set_arg(_data, "source", (NULL == source_name)
|
||||
? DEFAULT_CDIO_DEVICE: source_name);
|
||||
_set_arg_freebsd(_data, "source", (NULL == source_name)
|
||||
? DEFAULT_CDIO_DEVICE: source_name);
|
||||
|
||||
ret = cdio_new (_data, &_funcs);
|
||||
if (ret == NULL) return NULL;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_linux.c,v 1.37 2004/04/25 14:07:23 rocky Exp $
|
||||
$Id: _cdio_linux.c,v 1.38 2004/04/25 15:41:26 rocky Exp $
|
||||
|
||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -27,7 +27,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.37 2004/04/25 14:07:23 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.38 2004/04/25 15:41:26 rocky Exp $";
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -266,8 +266,8 @@ _cdio_mmc_read_sectors (int fd, void *buf, lba_t lba, int sector_type,
|
||||
Can read only up to 25 blocks.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_audio_sectors (void *env, void *buf, lsn_t lsn,
|
||||
unsigned int nblocks)
|
||||
_read_audio_sectors_linux (void *env, void *buf, lsn_t lsn,
|
||||
unsigned int nblocks)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
return _cdio_mmc_read_sectors( _obj->gen.fd, buf, lsn,
|
||||
@@ -357,7 +357,7 @@ _read_packet_mode2_sectors (int fd, void *buf, lba_t lba,
|
||||
from lsn. Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode1_sector (void *env, void *data, lsn_t lsn,
|
||||
_read_mode1_sector_linux (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2)
|
||||
{
|
||||
|
||||
@@ -432,7 +432,7 @@ _cdio_read_mode1_sector (void *env, void *data, lsn_t lsn,
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode1_sectors (void *env, void *data, lsn_t lsn,
|
||||
_read_mode1_sectors_linux (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2, unsigned int nblocks)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
@@ -441,7 +441,7 @@ _cdio_read_mode1_sectors (void *env, void *data, lsn_t lsn,
|
||||
unsigned int blocksize = b_form2 ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE;
|
||||
|
||||
for (i = 0; i < nblocks; i++) {
|
||||
if ( (retval = _cdio_read_mode1_sector (_obj,
|
||||
if ( (retval = _read_mode1_sector_linux (_obj,
|
||||
((char *)data) + (blocksize * i),
|
||||
lsn + i, b_form2)) )
|
||||
return retval;
|
||||
@@ -454,7 +454,7 @@ _cdio_read_mode1_sectors (void *env, void *data, lsn_t lsn,
|
||||
from lsn. Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode2_sector (void *env, void *data, lsn_t lsn,
|
||||
_read_mode2_sector_linux (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2)
|
||||
{
|
||||
char buf[M2RAW_SECTOR_SIZE] = { 0, };
|
||||
@@ -522,7 +522,7 @@ _cdio_read_mode2_sector (void *env, void *data, lsn_t lsn,
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode2_sectors (void *env, void *data, lsn_t lsn,
|
||||
_read_mode2_sectors_linux (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2, unsigned int nblocks)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
@@ -531,7 +531,7 @@ _cdio_read_mode2_sectors (void *env, void *data, lsn_t lsn,
|
||||
unsigned int blocksize = b_form2 ? M2RAW_SECTOR_SIZE : CDIO_CD_FRAMESIZE;
|
||||
|
||||
for (i = 0; i < nblocks; i++) {
|
||||
if ( (retval = _cdio_read_mode2_sector (_obj,
|
||||
if ( (retval = _read_mode2_sector_linux (_obj,
|
||||
((char *)data) + (blocksize * i),
|
||||
lsn + i, b_form2)) )
|
||||
return retval;
|
||||
@@ -543,7 +543,7 @@ _cdio_read_mode2_sectors (void *env, void *data, lsn_t lsn,
|
||||
Return the size of the CD in logical block address (LBA) units.
|
||||
*/
|
||||
static uint32_t
|
||||
_cdio_stat_size (void *env)
|
||||
_stat_size_linux (void *env)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -572,7 +572,7 @@ _cdio_stat_size (void *env)
|
||||
0 is returned if no error was found, and nonzero if there as an error.
|
||||
*/
|
||||
static int
|
||||
_cdio_set_arg (void *env, const char key[], const char value[])
|
||||
_set_arg_linux (void *env, const char key[], const char value[])
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -720,7 +720,7 @@ _cdio_eject_scsi(int fd)
|
||||
Return 0 if success and 1 for failure, and 2 if no routine.
|
||||
*/
|
||||
static int
|
||||
_cdio_eject_media (void *env) {
|
||||
_eject_media_linux (void *env) {
|
||||
|
||||
_img_private_t *_obj = env;
|
||||
int ret=2;
|
||||
@@ -767,7 +767,7 @@ _cdio_eject_media (void *env) {
|
||||
Return the value associated with the key "arg".
|
||||
*/
|
||||
static const char *
|
||||
_cdio_get_arg (void *env, const char key[])
|
||||
_get_arg_linux (void *env, const char key[])
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -793,7 +793,7 @@ _cdio_get_arg (void *env, const char key[])
|
||||
CDIO_INVALID_TRACK is returned on error.
|
||||
*/
|
||||
static track_t
|
||||
_cdio_get_first_track_num(void *env)
|
||||
_get_first_track_num_linux(void *env)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -810,7 +810,7 @@ _cdio_get_first_track_num(void *env)
|
||||
|
||||
*/
|
||||
static char *
|
||||
_cdio_get_mcn_linux (const void *env) {
|
||||
_get_mcn_linux (const void *env) {
|
||||
|
||||
struct cdrom_mcn mcn;
|
||||
const _img_private_t *_obj = env;
|
||||
@@ -828,7 +828,7 @@ _cdio_get_mcn_linux (const void *env) {
|
||||
|
||||
*/
|
||||
static cdio_drive_cap_t
|
||||
_cdio_get_drive_cap_linux (const void *env) {
|
||||
_get_drive_cap_linux (const void *env) {
|
||||
const _img_private_t *_obj = env;
|
||||
int32_t i_drivetype;
|
||||
|
||||
@@ -845,7 +845,7 @@ _cdio_get_drive_cap_linux (const void *env) {
|
||||
CDIO_INVALID_TRACK is returned on error.
|
||||
*/
|
||||
static track_t
|
||||
_cdio_get_num_tracks(void *env)
|
||||
_get_num_tracks_linux(void *env)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -858,7 +858,7 @@ _cdio_get_num_tracks(void *env)
|
||||
Get format of track.
|
||||
*/
|
||||
static track_format_t
|
||||
_cdio_get_track_format(void *env, track_t track_num)
|
||||
_get_track_format_linux(void *env, track_t track_num)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -891,7 +891,7 @@ _cdio_get_track_format(void *env, track_t track_num)
|
||||
FIXME: there's gotta be a better design for this and get_track_format?
|
||||
*/
|
||||
static bool
|
||||
_cdio_get_track_green(void *env, track_t track_num)
|
||||
_get_track_green_linux(void *env, track_t track_num)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -916,7 +916,7 @@ _cdio_get_track_green(void *env, track_t track_num)
|
||||
False is returned if there is no track entry.
|
||||
*/
|
||||
static bool
|
||||
_cdio_get_track_msf(void *env, track_t track_num, msf_t *msf)
|
||||
_get_track_msf_linux(void *env, track_t track_num, msf_t *msf)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -1075,28 +1075,28 @@ cdio_open_linux (const char *orig_source_name)
|
||||
char *source_name;
|
||||
|
||||
cdio_funcs _funcs = {
|
||||
.eject_media = _cdio_eject_media,
|
||||
.eject_media = _eject_media_linux,
|
||||
.free = cdio_generic_free,
|
||||
.get_arg = _cdio_get_arg,
|
||||
.get_arg = _get_arg_linux,
|
||||
.get_devices = cdio_get_devices_linux,
|
||||
.get_default_device = cdio_get_default_device_linux,
|
||||
.get_drive_cap = _cdio_get_drive_cap_linux,
|
||||
.get_first_track_num= _cdio_get_first_track_num,
|
||||
.get_mcn = _cdio_get_mcn_linux,
|
||||
.get_num_tracks = _cdio_get_num_tracks,
|
||||
.get_track_format = _cdio_get_track_format,
|
||||
.get_track_green = _cdio_get_track_green,
|
||||
.get_drive_cap = _get_drive_cap_linux,
|
||||
.get_first_track_num= _get_first_track_num_linux,
|
||||
.get_mcn = _get_mcn_linux,
|
||||
.get_num_tracks = _get_num_tracks_linux,
|
||||
.get_track_format = _get_track_format_linux,
|
||||
.get_track_green = _get_track_green_linux,
|
||||
.get_track_lba = NULL, /* This could be implemented if need be. */
|
||||
.get_track_msf = _cdio_get_track_msf,
|
||||
.get_track_msf = _get_track_msf_linux,
|
||||
.lseek = cdio_generic_lseek,
|
||||
.read = cdio_generic_read,
|
||||
.read_audio_sectors = _cdio_read_audio_sectors,
|
||||
.read_mode1_sector = _cdio_read_mode1_sector,
|
||||
.read_mode1_sectors = _cdio_read_mode1_sectors,
|
||||
.read_mode2_sector = _cdio_read_mode2_sector,
|
||||
.read_mode2_sectors = _cdio_read_mode2_sectors,
|
||||
.set_arg = _cdio_set_arg,
|
||||
.stat_size = _cdio_stat_size
|
||||
.read_audio_sectors = _read_audio_sectors_linux,
|
||||
.read_mode1_sector = _read_mode1_sector_linux,
|
||||
.read_mode1_sectors = _read_mode1_sectors_linux,
|
||||
.read_mode2_sector = _read_mode2_sector_linux,
|
||||
.read_mode2_sectors = _read_mode2_sectors_linux,
|
||||
.set_arg = _set_arg_linux,
|
||||
.stat_size = _stat_size_linux
|
||||
};
|
||||
|
||||
_data = _cdio_malloc (sizeof (_img_private_t));
|
||||
@@ -1107,11 +1107,11 @@ cdio_open_linux (const char *orig_source_name)
|
||||
if (NULL == orig_source_name) {
|
||||
source_name=cdio_get_default_device_linux();
|
||||
if (NULL == source_name) return NULL;
|
||||
_cdio_set_arg(_data, "source", source_name);
|
||||
_set_arg_linux(_data, "source", source_name);
|
||||
free(source_name);
|
||||
} else {
|
||||
if (cdio_is_device_generic(orig_source_name))
|
||||
_cdio_set_arg(_data, "source", orig_source_name);
|
||||
_set_arg_linux(_data, "source", orig_source_name);
|
||||
else {
|
||||
cdio_info ("source %s is a not a device", orig_source_name);
|
||||
return NULL;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: _cdio_osx.c,v 1.15 2004/03/20 04:16:59 rocky Exp $
|
||||
$Id: _cdio_osx.c,v 1.16 2004/04/25 15:41:26 rocky Exp $
|
||||
|
||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||
from vcdimager code:
|
||||
@@ -33,7 +33,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.15 2004/03/20 04:16:59 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.16 2004/04/25 15:41:26 rocky Exp $";
|
||||
|
||||
#include <cdio/sector.h>
|
||||
#include <cdio/util.h>
|
||||
@@ -87,7 +87,7 @@ typedef struct {
|
||||
} _img_private_t;
|
||||
|
||||
static void
|
||||
_cdio_osx_free (void *env) {
|
||||
_free_osx (void *env) {
|
||||
_img_private_t *_obj = env;
|
||||
if (NULL == _obj) return;
|
||||
cdio_generic_free(_obj);
|
||||
@@ -128,8 +128,8 @@ _cdio_getNumberOfTracks( CDTOC *pTOC, int i_descriptors )
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode1_sectors (void *env, void *data, lsn_t lsn,
|
||||
bool is_form2, unsigned int nblocks)
|
||||
_get_read_mode1_sectors_osx (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2, unsigned int nblocks)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
dk_cd_read_t cd_read;
|
||||
@@ -140,7 +140,7 @@ _cdio_read_mode1_sectors (void *env, void *data, lsn_t lsn,
|
||||
cd_read.buffer = data;
|
||||
cd_read.sectorType = kCDSectorTypeMode1;
|
||||
|
||||
if (is_form2) {
|
||||
if (b_form2) {
|
||||
cd_read.offset = lsn * kCDSectorSizeMode2;
|
||||
cd_read.bufferLength = kCDSectorSizeMode2 * nblocks;
|
||||
} else {
|
||||
@@ -163,8 +163,8 @@ _cdio_read_mode1_sectors (void *env, void *data, lsn_t lsn,
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode2_sectors (void *env, void *data, lsn_t lsn,
|
||||
bool is_form2, unsigned int nblocks)
|
||||
_get_read_mode2_sectors_osx (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2, unsigned int nblocks)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
dk_cd_read_t cd_read;
|
||||
@@ -174,7 +174,7 @@ _cdio_read_mode2_sectors (void *env, void *data, lsn_t lsn,
|
||||
cd_read.sectorArea = kCDSectorAreaUser;
|
||||
cd_read.buffer = data;
|
||||
|
||||
if (is_form2) {
|
||||
if (b_form2) {
|
||||
cd_read.offset = lsn * kCDSectorSizeMode2Form2;
|
||||
cd_read.sectorType = kCDSectorTypeMode2Form2;
|
||||
cd_read.bufferLength = kCDSectorSizeMode2Form2 * nblocks;
|
||||
@@ -198,7 +198,7 @@ _cdio_read_mode2_sectors (void *env, void *data, lsn_t lsn,
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_audio_sectors (void *env, void *data, lsn_t lsn,
|
||||
_get_read_audio_sectors_osx (void *env, void *data, lsn_t lsn,
|
||||
unsigned int nblocks)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
@@ -226,10 +226,10 @@ _cdio_read_audio_sectors (void *env, void *data, lsn_t lsn,
|
||||
from lsn. Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode1_sector (void *env, void *data, lsn_t lsn,
|
||||
bool is_form2)
|
||||
_get_read_mode1_sector_osx (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2)
|
||||
{
|
||||
return _cdio_read_mode1_sectors(env, data, lsn, is_form2, 1);
|
||||
return _get_read_mode1_sectors_osx(env, data, lsn, b_form2, 1);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -237,17 +237,17 @@ _cdio_read_mode1_sector (void *env, void *data, lsn_t lsn,
|
||||
from lsn. Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
_cdio_read_mode2_sector (void *env, void *data, lsn_t lsn,
|
||||
bool is_form2)
|
||||
_get_read_mode2_sector_osx (void *env, void *data, lsn_t lsn,
|
||||
bool b_form2)
|
||||
{
|
||||
return _cdio_read_mode2_sectors(env, data, lsn, is_form2, 1);
|
||||
return _get_read_mode2_sectors_osx(env, data, lsn, b_form2, 1);
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the key "arg" to "value" in source device.
|
||||
*/
|
||||
static int
|
||||
_cdio_set_arg (void *env, const char key[], const char value[])
|
||||
_set_arg_osx (void *env, const char key[], const char value[])
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -448,7 +448,7 @@ _cdio_read_toc (_img_private_t *_obj)
|
||||
False is returned if there is no track entry.
|
||||
*/
|
||||
static lsn_t
|
||||
_cdio_get_track_lba(void *env, track_t track_num)
|
||||
_get_track_lba_osx(void *env, track_t track_num)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -474,7 +474,7 @@ _cdio_get_track_lba(void *env, track_t track_num)
|
||||
*/
|
||||
|
||||
static int
|
||||
_cdio_eject_media (void *env) {
|
||||
_eject_media_osx (void *env) {
|
||||
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -518,16 +518,16 @@ _cdio_eject_media (void *env) {
|
||||
Return the size of the CD in logical block address (LBA) units.
|
||||
*/
|
||||
static uint32_t
|
||||
_cdio_stat_size (void *env)
|
||||
_stat_size_osx (void *env)
|
||||
{
|
||||
return _cdio_get_track_lba(env, CDIO_CDROM_LEADOUT_TRACK);
|
||||
return _get_track_lba_osx(env, CDIO_CDROM_LEADOUT_TRACK);
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the value associated with the key "arg".
|
||||
*/
|
||||
static const char *
|
||||
_cdio_get_arg (void *env, const char key[])
|
||||
_get_arg_osx (void *env, const char key[])
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -549,7 +549,7 @@ _cdio_get_arg (void *env, const char key[])
|
||||
CDIO_INVALID_TRACK is returned on error.
|
||||
*/
|
||||
static track_t
|
||||
_cdio_get_first_track_num(void *env)
|
||||
_get_first_track_num_osx(void *env)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -579,7 +579,7 @@ _cdio_get_first_track_num(void *env)
|
||||
Return the media catalog number MCN.
|
||||
*/
|
||||
static char *
|
||||
_cdio_get_mcn (void *env) {
|
||||
_get_mcn_osx (void *env) {
|
||||
_img_private_t *_obj = env;
|
||||
dk_cd_read_mcn_t cd_read;
|
||||
|
||||
@@ -600,7 +600,7 @@ _cdio_get_mcn (void *env) {
|
||||
This is the externally called interface.
|
||||
*/
|
||||
static track_t
|
||||
_cdio_get_num_tracks(void *env)
|
||||
_get_num_tracks_osx(void *env)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
|
||||
@@ -612,7 +612,7 @@ _cdio_get_num_tracks(void *env)
|
||||
Get format of track.
|
||||
*/
|
||||
static track_format_t
|
||||
_cdio_get_track_format(void *env, track_t track_num)
|
||||
_get_track_format_osx(void *env, track_t track_num)
|
||||
{
|
||||
_img_private_t *_obj = env;
|
||||
CDTrackInfo a_track;
|
||||
@@ -651,7 +651,7 @@ _cdio_get_track_format(void *env, track_t track_num)
|
||||
FIXME: there's gotta be a better design for this and get_track_format?
|
||||
*/
|
||||
static bool
|
||||
_cdio_get_track_green(void *env, track_t track_num)
|
||||
_get_track_green_osx(void *env, track_t track_num)
|
||||
{
|
||||
|
||||
#if 0
|
||||
@@ -854,27 +854,27 @@ cdio_open_osx (const char *orig_source_name)
|
||||
char *source_name;
|
||||
|
||||
cdio_funcs _funcs = {
|
||||
.eject_media = _cdio_eject_media,
|
||||
.free = _cdio_osx_free,
|
||||
.get_arg = _cdio_get_arg,
|
||||
.eject_media = _eject_media_osx,
|
||||
.free = _free_osx,
|
||||
.get_arg = _get_arg_osx,
|
||||
.get_default_device = cdio_get_default_device_osx,
|
||||
.get_devices = cdio_get_devices_osx,
|
||||
.get_first_track_num= _cdio_get_first_track_num,
|
||||
.get_mcn = _cdio_get_mcn,
|
||||
.get_num_tracks = _cdio_get_num_tracks,
|
||||
.get_track_format = _cdio_get_track_format,
|
||||
.get_track_green = _cdio_get_track_green,
|
||||
.get_track_lba = _cdio_get_track_lba,
|
||||
.get_first_track_num= _get_first_track_num_osx,
|
||||
.get_mcn = _get_mcn_osx,
|
||||
.get_num_tracks = _get_num_tracks_osx,
|
||||
.get_track_format = _get_track_format_osx,
|
||||
.get_track_green = _get_track_green_osx,
|
||||
.get_track_lba = _get_track_lba_osx,
|
||||
.get_track_msf = NULL,
|
||||
.lseek = cdio_generic_lseek,
|
||||
.read = cdio_generic_read,
|
||||
.read_audio_sectors = _cdio_read_audio_sectors,
|
||||
.read_mode1_sector = _cdio_read_mode1_sector,
|
||||
.read_mode1_sectors = _cdio_read_mode1_sectors,
|
||||
.read_mode2_sector = _cdio_read_mode2_sector,
|
||||
.read_mode2_sectors = _cdio_read_mode2_sectors,
|
||||
.set_arg = _cdio_set_arg,
|
||||
.stat_size = _cdio_stat_size
|
||||
.read_audio_sectors = _get_read_audio_sectors_osx,
|
||||
.read_mode1_sector = _get_read_mode1_sector_osx,
|
||||
.read_mode1_sectors = _get_read_mode1_sectors_osx,
|
||||
.read_mode2_sector = _get_read_mode2_sector_osx,
|
||||
.read_mode2_sectors = _get_read_mode2_sectors_osx,
|
||||
.set_arg = _set_arg_osx,
|
||||
.stat_size = _stat_size_osx
|
||||
};
|
||||
|
||||
_data = _cdio_malloc (sizeof (_img_private_t));
|
||||
@@ -885,10 +885,10 @@ cdio_open_osx (const char *orig_source_name)
|
||||
if (NULL == orig_source_name) {
|
||||
source_name=cdio_get_default_device_linux();
|
||||
if (NULL == source_name) return NULL;
|
||||
_cdio_set_arg(_data, "source", source_name);
|
||||
_set_arg_osx(_data, "source", source_name);
|
||||
free(source_name);
|
||||
} else
|
||||
_cdio_set_arg(_data, "source", orig_source_name);
|
||||
_set_arg_osx(_data, "source", orig_source_name);
|
||||
|
||||
ret = cdio_new (_data, &_funcs);
|
||||
if (ret == NULL) return NULL;
|
||||
|
||||
Reference in New Issue
Block a user