Start to fill in cdio_get_preemphasis, cdio_get_copy_permit, and
cdio_get_channels. Internals reworked a little for this.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile.am,v 1.15 2004/12/18 17:29:32 rocky Exp $
|
# $Id: Makefile.am,v 1.16 2004/12/31 05:47:36 rocky Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
#
|
#
|
||||||
@@ -37,6 +37,7 @@ libcdioinclude_HEADERS = \
|
|||||||
logging.h \
|
logging.h \
|
||||||
sector.h \
|
sector.h \
|
||||||
scsi_mmc.h \
|
scsi_mmc.h \
|
||||||
|
track.h \
|
||||||
types.h \
|
types.h \
|
||||||
util.h \
|
util.h \
|
||||||
version.h \
|
version.h \
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* -*- c -*-
|
/* -*- c -*-
|
||||||
$Id: cdio.h,v 1.69 2004/12/30 11:13:49 rocky Exp $
|
$Id: cdio.h,v 1.70 2004/12/31 05:47:36 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -358,72 +358,6 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
track_t cdio_get_num_tracks (const CdIo *p_cdio);
|
track_t cdio_get_num_tracks (const CdIo *p_cdio);
|
||||||
|
|
||||||
/*!
|
|
||||||
Get the format (audio, mode2, mode1) of track.
|
|
||||||
*/
|
|
||||||
track_format_t cdio_get_track_format(const CdIo *p_cdio, track_t i_track);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
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?
|
|
||||||
*/
|
|
||||||
bool cdio_get_track_green(const CdIo *p_cdio, track_t i_track);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Get the starting LBA for track number
|
|
||||||
i_track in p_cdio. Track numbers usually start at something
|
|
||||||
greater than 0, usually 1.
|
|
||||||
|
|
||||||
The "leadout" track is specified either by
|
|
||||||
using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1.
|
|
||||||
|
|
||||||
@param p_cdio object to get information from
|
|
||||||
@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);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Return the starting MSF (minutes/secs/frames) for track number
|
|
||||||
i_track in p_cdio. Track numbers usually start at something
|
|
||||||
greater than 0, usually 1.
|
|
||||||
|
|
||||||
The "leadout" track is specified either by
|
|
||||||
using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1.
|
|
||||||
|
|
||||||
@param p_cdio object to get information from
|
|
||||||
@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);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Return the starting MSF (minutes/secs/frames) for track number
|
|
||||||
i_track in p_cdio. Track numbers usually start at something
|
|
||||||
greater than 0, usually 1.
|
|
||||||
|
|
||||||
The "leadout" track is specified either by
|
|
||||||
using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1.
|
|
||||||
|
|
||||||
@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,
|
|
||||||
/*out*/ msf_t *msf);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Get the number of sectors between this track an the next. This
|
|
||||||
includes any pregap sectors before the start of the next track.
|
|
||||||
Track numbers usually start at something
|
|
||||||
greater than 0, usually 1.
|
|
||||||
|
|
||||||
@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);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Reposition read offset
|
Reposition read offset
|
||||||
Similar to (if not the same as) libc's lseek()
|
Similar to (if not the same as) libc's lseek()
|
||||||
@@ -1023,20 +957,11 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
bool cdio_is_device(const char *source_name, driver_id_t driver_id);
|
bool cdio_is_device(const char *source_name, driver_id_t driver_id);
|
||||||
|
|
||||||
/*! Return number of channels in track: 2 or 4 or -1 for error.
|
|
||||||
Not meaningful if track is not an audio track.
|
|
||||||
*/
|
|
||||||
int cdio_track_channels(const CdIo *p_cdio, track_t i_track);
|
|
||||||
|
|
||||||
/*! Return 1 if track is copy protected, 0 if not, or -1 for error.
|
|
||||||
Is this meaningful if not an audio track?
|
|
||||||
*/
|
|
||||||
int cdio_track_copy_permit(const CdIo *p_cdio, track_t i_track);
|
|
||||||
|
|
||||||
int cdio_track_preemphasis(const CdIo *p_cdio, track_t i_track);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/* Track-related functions. */
|
||||||
|
#include <cdio/track.h>
|
||||||
|
|
||||||
#endif /* __CDIO_H__ */
|
#endif /* __CDIO_H__ */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_generic.c,v 1.2 2004/12/30 11:13:49 rocky Exp $
|
$Id: _cdio_generic.c,v 1.3 2004/12/31 05:47:36 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.2 2004/12/30 11:13:49 rocky Exp $";
|
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.3 2004/12/31 05:47:36 rocky Exp $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -424,6 +424,39 @@ init_cdtext_generic (generic_img_private_t *p_env)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! 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.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
get_track_channels_generic(const void *p_user_data, track_t i_track)
|
||||||
|
{
|
||||||
|
const generic_img_private_t *p_env = p_user_data;
|
||||||
|
return p_env->track_flags[i_track].channels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! Return 1 if copy is permitted on the track, 0 if not, or -1 for error.
|
||||||
|
Is this meaningful if not an audio track?
|
||||||
|
*/
|
||||||
|
track_flag_t
|
||||||
|
get_track_copy_permit_generic(void *p_user_data, track_t i_track)
|
||||||
|
{
|
||||||
|
const generic_img_private_t *p_env = p_user_data;
|
||||||
|
return p_env->track_flags[i_track].copy_permit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error.
|
||||||
|
Is this meaningful if not an audio track?
|
||||||
|
|
||||||
|
pre-emphasis is a non linear frequency response.
|
||||||
|
*/
|
||||||
|
track_flag_t
|
||||||
|
get_track_preemphasis_generic(const void *p_user_data, track_t i_track)
|
||||||
|
{
|
||||||
|
const generic_img_private_t *p_env = p_user_data;
|
||||||
|
return p_env->track_flags[i_track].preemphasis;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_linux.c,v 1.1 2004/12/18 17:29:32 rocky Exp $
|
$Id: _cdio_linux.c,v 1.2 2004/12/31 05:47:36 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.1 2004/12/18 17:29:32 rocky Exp $";
|
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.2 2004/12/31 05:47:36 rocky Exp $";
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -836,15 +836,28 @@ read_toc_linux (void *p_user_data)
|
|||||||
|
|
||||||
/* read individual tracks */
|
/* read individual tracks */
|
||||||
for (i= p_env->gen.i_first_track; i<=p_env->gen.i_tracks; i++) {
|
for (i= p_env->gen.i_first_track; i<=p_env->gen.i_tracks; i++) {
|
||||||
p_env->tocent[i-p_env->gen.i_first_track].cdte_track = i;
|
struct cdrom_tocentry *p_toc =
|
||||||
p_env->tocent[i-p_env->gen.i_first_track].cdte_format = CDROM_MSF;
|
&(p_env->tocent[i-p_env->gen.i_first_track]);
|
||||||
if ( ioctl(p_env->gen.fd, CDROMREADTOCENTRY,
|
|
||||||
&p_env->tocent[i-p_env->gen.i_first_track]) == -1 ) {
|
p_toc->cdte_track = i;
|
||||||
|
p_toc->cdte_format = CDROM_MSF;
|
||||||
|
if ( ioctl(p_env->gen.fd, CDROMREADTOCENTRY, p_toc) == -1 ) {
|
||||||
cdio_warn("%s %d: %s\n",
|
cdio_warn("%s %d: %s\n",
|
||||||
"error in ioctl CDROMREADTOCENTRY for track",
|
"error in ioctl CDROMREADTOCENTRY for track",
|
||||||
i, strerror(errno));
|
i, strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** FIXME: Move into generic. **/
|
||||||
|
p_env->gen.track_flags[i].preemphasis =
|
||||||
|
p_toc->cdte_ctrl & 0x1 ? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
|
||||||
|
|
||||||
|
p_env->gen.track_flags[i].copy_permit =
|
||||||
|
p_toc->cdte_ctrl & 0x2 ? CDIO_TRACK_FLAG_TRUE : CDIO_TRACK_FLAG_FALSE;
|
||||||
|
|
||||||
|
p_env->gen.track_flags[i].channels =
|
||||||
|
p_toc->cdte_ctrl & 0x8 ? 4 : 2;
|
||||||
|
|
||||||
/****
|
/****
|
||||||
struct cdrom_msf0 *msf= &env->tocent[i-1].cdte_addr.msf;
|
struct cdrom_msf0 *msf= &env->tocent[i-1].cdte_addr.msf;
|
||||||
|
|
||||||
@@ -1120,37 +1133,40 @@ cdio_open_am_linux (const char *psz_orig_source, const char *access_mode)
|
|||||||
char *psz_source;
|
char *psz_source;
|
||||||
|
|
||||||
cdio_funcs _funcs = {
|
cdio_funcs _funcs = {
|
||||||
.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_generic,
|
.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,
|
||||||
#if USE_LINUX_CAP
|
#if USE_LINUX_CAP
|
||||||
.get_drive_cap = get_drive_cap_linux,
|
.get_drive_cap = get_drive_cap_linux,
|
||||||
#else
|
#else
|
||||||
.get_drive_cap = scsi_mmc_get_drive_cap_generic,
|
.get_drive_cap = scsi_mmc_get_drive_cap_generic,
|
||||||
#endif
|
#endif
|
||||||
.get_first_track_num= get_first_track_num_generic,
|
.get_first_track_num = get_first_track_num_generic,
|
||||||
.get_hwinfo = NULL,
|
.get_hwinfo = NULL,
|
||||||
.get_mcn = get_mcn_linux,
|
.get_mcn = get_mcn_linux,
|
||||||
.get_num_tracks = get_num_tracks_generic,
|
.get_num_tracks = get_num_tracks_generic,
|
||||||
.get_track_format = get_track_format_linux,
|
.get_track_channels = get_track_channels_generic,
|
||||||
.get_track_green = get_track_green_linux,
|
.get_track_copy_permit = get_track_copy_permit_generic,
|
||||||
.get_track_lba = NULL, /* This could be implemented if need be. */
|
.get_track_format = get_track_format_linux,
|
||||||
.get_track_msf = get_track_msf_linux,
|
.get_track_green = get_track_green_linux,
|
||||||
.lseek = cdio_generic_lseek,
|
.get_track_lba = NULL, /* This could be implemented if need be. */
|
||||||
.read = cdio_generic_read,
|
.get_track_preemphasis = get_track_preemphasis_generic,
|
||||||
.read_audio_sectors = _read_audio_sectors_linux,
|
.get_track_msf = get_track_msf_linux,
|
||||||
.read_mode1_sector = _read_mode1_sector_linux,
|
.lseek = cdio_generic_lseek,
|
||||||
.read_mode1_sectors = _read_mode1_sectors_linux,
|
.read = cdio_generic_read,
|
||||||
.read_mode2_sector = _read_mode2_sector_linux,
|
.read_audio_sectors = _read_audio_sectors_linux,
|
||||||
.read_mode2_sectors = _read_mode2_sectors_linux,
|
.read_mode1_sector = _read_mode1_sector_linux,
|
||||||
.read_toc = read_toc_linux,
|
.read_mode1_sectors = _read_mode1_sectors_linux,
|
||||||
.run_scsi_mmc_cmd = run_scsi_cmd_linux,
|
.read_mode2_sector = _read_mode2_sector_linux,
|
||||||
.set_arg = set_arg_linux,
|
.read_mode2_sectors = _read_mode2_sectors_linux,
|
||||||
.stat_size = stat_size_linux
|
.read_toc = read_toc_linux,
|
||||||
|
.run_scsi_mmc_cmd = run_scsi_cmd_linux,
|
||||||
|
.set_arg = set_arg_linux,
|
||||||
|
.stat_size = stat_size_linux
|
||||||
};
|
};
|
||||||
|
|
||||||
_data = _cdio_malloc (sizeof (_img_private_t));
|
_data = _cdio_malloc (sizeof (_img_private_t));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdio.c,v 1.2 2004/12/30 11:13:50 rocky Exp $
|
$Id: cdio.c,v 1.3 2004/12/31 05:47:36 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#include <cdio/logging.h>
|
#include <cdio/logging.h>
|
||||||
#include "cdio_private.h"
|
#include "cdio_private.h"
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: cdio.c,v 1.2 2004/12/30 11:13:50 rocky Exp $";
|
static const char _rcsid[] = "$Id: cdio.c,v 1.3 2004/12/31 05:47:36 rocky Exp $";
|
||||||
|
|
||||||
|
|
||||||
const char *track_format2str[6] =
|
const char *track_format2str[6] =
|
||||||
@@ -644,13 +644,40 @@ cdio_get_num_tracks (const CdIo *p_cdio)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! 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.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
cdio_get_track_channels(const CdIo *p_cdio, track_t i_track)
|
||||||
|
{
|
||||||
|
if (p_cdio->op.get_track_channels) {
|
||||||
|
return p_cdio->op.get_track_channels (p_cdio->env, i_track);
|
||||||
|
} else {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! Return copy protection status on a track. Is this meaningful
|
||||||
|
if not an audio track?
|
||||||
|
*/
|
||||||
|
track_flag_t
|
||||||
|
cdio_get_track_copy_permit(const CdIo *p_cdio, track_t i_track)
|
||||||
|
{
|
||||||
|
if (p_cdio->op.get_track_copy_permit) {
|
||||||
|
return p_cdio->op.get_track_copy_permit (p_cdio->env, i_track);
|
||||||
|
} else {
|
||||||
|
return CDIO_TRACK_FLAG_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Get format of track.
|
Get format of track.
|
||||||
*/
|
*/
|
||||||
track_format_t
|
track_format_t
|
||||||
cdio_get_track_format(const CdIo *p_cdio, track_t i_track)
|
cdio_get_track_format(const CdIo *p_cdio, track_t i_track)
|
||||||
{
|
{
|
||||||
cdio_assert (p_cdio != NULL);
|
if (!p_cdio) return TRACK_FORMAT_ERROR;
|
||||||
|
|
||||||
if (p_cdio->op.get_track_format) {
|
if (p_cdio->op.get_track_format) {
|
||||||
return p_cdio->op.get_track_format (p_cdio->env, i_track);
|
return p_cdio->op.get_track_format (p_cdio->env, i_track);
|
||||||
@@ -748,6 +775,19 @@ cdio_get_track_msf(const CdIo *cdio, track_t track_num, /*out*/ msf_t *msf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Return copy protection status on a track. Is this meaningful
|
||||||
|
if not an audio track?
|
||||||
|
*/
|
||||||
|
track_flag_t
|
||||||
|
cdio_get_track_preemphasis(const CdIo *p_cdio, track_t i_track)
|
||||||
|
{
|
||||||
|
if (p_cdio->op.get_track_preemphasis) {
|
||||||
|
return p_cdio->op.get_track_preemphasis (p_cdio->env, i_track);
|
||||||
|
} else {
|
||||||
|
return CDIO_TRACK_FLAG_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the number of sectors between this track an the next. This
|
Return the number of sectors between this track an the next. This
|
||||||
includes any pregap sectors before the start of the next track.
|
includes any pregap sectors before the start of the next track.
|
||||||
@@ -1131,87 +1171,6 @@ cdio_open_am_cd (const char *psz_source, const char *psz_access_mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Returns "set" or "clear" value or -1 (for error) if bit "bit" of
|
|
||||||
the track flag "i_track" is set/clear.
|
|
||||||
|
|
||||||
Taken from cdparanoia.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
cdio_track_bitmap(const generic_img_private_t *p_env, track_t i_track,
|
|
||||||
int bit, int set, int clear)
|
|
||||||
{
|
|
||||||
|
|
||||||
return p_env->toc_init ? p_env->i_first_track : -1;
|
|
||||||
|
|
||||||
if( i_track < p_env->i_first_track
|
|
||||||
|| i_track > p_env->i_first_track + p_env->i_tracks ) {
|
|
||||||
cdio_warn ("invalid track number");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
if (p_env->flags[i_track] & bit)
|
|
||||||
return(set);
|
|
||||||
else
|
|
||||||
return(clear);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Return number of channels in track, 2 or 4 or -1 for error.
|
|
||||||
Not meaningful if track is not an audio track.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
cdio_track_channels(const CdIo *p_cdio, track_t i_track)
|
|
||||||
{
|
|
||||||
if (!p_cdio) return -1;
|
|
||||||
{
|
|
||||||
const generic_img_private_t *p_env
|
|
||||||
= (generic_img_private_t *) (p_cdio->env);
|
|
||||||
return(cdio_track_bitmap(p_env, i_track, 8, 4, 2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Return 1 if copy is permitted on the track, 0 if not, or -1 for error.
|
|
||||||
Is this meaningful if not an audio track?
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
cdio_track_copy_permit(const CdIo *p_cdio, track_t i_track)
|
|
||||||
{
|
|
||||||
if (!p_cdio) return -1;
|
|
||||||
{
|
|
||||||
const generic_img_private_t *p_env
|
|
||||||
= (generic_img_private_t *) (p_cdio->env);
|
|
||||||
return(cdio_track_bitmap(p_env, i_track, 2, 1, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error.
|
|
||||||
Is this meaningful if not an audio track?
|
|
||||||
|
|
||||||
pre-emphasis is a non linear frequency response.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
cdio_track_preemphasis(const CdIo *p_cdio, track_t i_track)
|
|
||||||
{
|
|
||||||
if (!p_cdio) return -1;
|
|
||||||
{
|
|
||||||
const generic_img_private_t *p_env
|
|
||||||
= (generic_img_private_t *) (p_cdio->env);
|
|
||||||
return(cdio_track_bitmap(p_env, i_track, 1, 1, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* Use cdio_get_track_format instead of this. */
|
|
||||||
/*! Return 1 if track is an audio track, 0 if not, or -1 for error. */
|
|
||||||
int
|
|
||||||
cdio_track_audiop(const CdIo *p_cdio, track_t i_track)
|
|
||||||
{
|
|
||||||
if (!p_cdio) return -1;
|
|
||||||
{
|
|
||||||
const generic_img_private_t *p_env
|
|
||||||
= (generic_img_private_t *) (p_cdio->env);
|
|
||||||
return(cdio_track_bitmap(p_env, i_track, 4, 0, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdio_private.h,v 1.2 2004/12/30 11:13:50 rocky Exp $
|
$Id: cdio_private.h,v 1.3 2004/12/31 05:47:36 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -134,6 +134,18 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
track_t (*get_num_tracks) (void *p_env);
|
track_t (*get_num_tracks) (void *p_env);
|
||||||
|
|
||||||
|
/*! 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.
|
||||||
|
*/
|
||||||
|
int (*get_track_channels) (const void *p_env, track_t i_track);
|
||||||
|
|
||||||
|
/*! 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?
|
||||||
|
*/
|
||||||
|
track_flag_t (*get_track_copy_permit) (void *p_env, track_t i_track);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the starting LBA for track number
|
Return the starting LBA for track number
|
||||||
i_track in p_env. Tracks numbers start at 1.
|
i_track in p_env. Tracks numbers start at 1.
|
||||||
@@ -167,6 +179,13 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
bool (*get_track_msf) (void *p_env, track_t i_track, msf_t *p_msf);
|
bool (*get_track_msf) (void *p_env, track_t i_track, msf_t *p_msf);
|
||||||
|
|
||||||
|
/*! 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?
|
||||||
|
*/
|
||||||
|
track_flag_t (*get_track_preemphasis) (const void *p_env,
|
||||||
|
track_t i_track);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
lseek - reposition read/write file offset
|
lseek - reposition read/write file offset
|
||||||
Returns (off_t) -1 on error.
|
Returns (off_t) -1 on error.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: generic.h,v 1.2 2004/12/30 11:13:50 rocky Exp $
|
$Id: generic.h,v 1.3 2004/12/31 05:47:36 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -67,12 +67,7 @@ extern "C" {
|
|||||||
CdIo *cdio; /**< a way to call general cdio routines. */
|
CdIo *cdio; /**< a way to call general cdio routines. */
|
||||||
cdtext_t cdtext; /**< CD-Text for disc. */
|
cdtext_t cdtext; /**< CD-Text for disc. */
|
||||||
cdtext_t cdtext_track[CDIO_CD_MAX_TRACKS+1]; /**< CD-TEXT for each track*/
|
cdtext_t cdtext_track[CDIO_CD_MAX_TRACKS+1]; /**< CD-TEXT for each track*/
|
||||||
uint8_t flags[CDIO_CD_MAX_TRACKS+1]; /**< track flags:
|
track_flags_t track_flags[CDIO_CD_MAX_TRACKS+1];
|
||||||
bit 4: # channels 2 or 4
|
|
||||||
bit 3: audio?
|
|
||||||
bit 2: copy protection
|
|
||||||
bit 1: premphasis
|
|
||||||
*/
|
|
||||||
} generic_img_private_t;
|
} generic_img_private_t;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -166,6 +161,26 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
discmode_t get_discmode_cd_generic (void *p_user_data );
|
discmode_t get_discmode_cd_generic (void *p_user_data );
|
||||||
|
|
||||||
|
/*! 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.
|
||||||
|
*/
|
||||||
|
int get_track_channels_generic(const void *p_user_data, track_t i_track);
|
||||||
|
|
||||||
|
/*! Return 1 if copy is permitted on the track, 0 if not, or -1 for error.
|
||||||
|
Is this meaningful if not an audio track?
|
||||||
|
*/
|
||||||
|
track_flag_t get_track_copy_permit_generic(void *p_user_data,
|
||||||
|
track_t i_track);
|
||||||
|
|
||||||
|
/*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error.
|
||||||
|
Is this meaningful if not an audio track?
|
||||||
|
|
||||||
|
pre-emphasis is a non linear frequency response.
|
||||||
|
*/
|
||||||
|
track_flag_t get_track_preemphasis_generic(const void *p_user_data,
|
||||||
|
track_t i_track);
|
||||||
|
|
||||||
void set_cdtext_field_generic(void *user_data, track_t i_track,
|
void set_cdtext_field_generic(void *user_data, track_t i_track,
|
||||||
track_t i_first_track,
|
track_t i_first_track,
|
||||||
cdtext_field_t e_field, const char *psz_value);
|
cdtext_field_t e_field, const char *psz_value);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: bincue.c,v 1.1 2004/12/18 17:29:32 rocky Exp $
|
$Id: bincue.c,v 1.2 2004/12/31 05:47:36 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
(*.cue).
|
(*.cue).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: bincue.c,v 1.1 2004/12/18 17:29:32 rocky Exp $";
|
static const char _rcsid[] = "$Id: bincue.c,v 1.2 2004/12/31 05:47:36 rocky Exp $";
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
@@ -981,10 +981,12 @@ get_hwinfo_bincue ( const CdIo *p_cdio, /*out*/ cdio_hwinfo_t *hw_info)
|
|||||||
CDIO_INVALID_TRACK is returned on error.
|
CDIO_INVALID_TRACK is returned on error.
|
||||||
*/
|
*/
|
||||||
static track_format_t
|
static track_format_t
|
||||||
_get_track_format_bincue(void *user_data, track_t i_track)
|
_get_track_format_bincue(void *p_user_data, track_t i_track)
|
||||||
{
|
{
|
||||||
_img_private_t *p_env = user_data;
|
const _img_private_t *p_env = p_user_data;
|
||||||
|
|
||||||
|
if (!p_env->gen.init) return TRACK_FORMAT_ERROR;
|
||||||
|
|
||||||
if (i_track > p_env->gen.i_tracks || i_track == 0)
|
if (i_track > p_env->gen.i_tracks || i_track == 0)
|
||||||
return TRACK_FORMAT_ERROR;
|
return TRACK_FORMAT_ERROR;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdrdao.c,v 1.1 2004/12/18 17:29:32 rocky Exp $
|
$Id: cdrdao.c,v 1.2 2004/12/31 05:47:36 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
toc reading routine adapted from cuetools
|
toc reading routine adapted from cuetools
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
(*.cue).
|
(*.cue).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: cdrdao.c,v 1.1 2004/12/18 17:29:32 rocky Exp $";
|
static const char _rcsid[] = "$Id: cdrdao.c,v 1.2 2004/12/31 05:47:36 rocky Exp $";
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
@@ -1026,16 +1026,16 @@ get_hwinfo_cdrdao ( const CdIo *p_cdio, /*out*/ cdio_hwinfo_t *hw_info)
|
|||||||
CDIO_INVALID_TRACK is returned on error.
|
CDIO_INVALID_TRACK is returned on error.
|
||||||
*/
|
*/
|
||||||
static track_format_t
|
static track_format_t
|
||||||
_get_track_format_cdrdao(void *user_data, track_t i_track)
|
_get_track_format_cdrdao(void *p_user_data, track_t i_track)
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = p_user_data;
|
||||||
|
|
||||||
if (!env->gen.init) _init_cdrdao(env);
|
if (!p_env->gen.init) return TRACK_FORMAT_ERROR;
|
||||||
|
|
||||||
if (i_track > env->gen.i_tracks || i_track == 0)
|
if (i_track > p_env->gen.i_tracks || i_track == 0)
|
||||||
return TRACK_FORMAT_ERROR;
|
return TRACK_FORMAT_ERROR;
|
||||||
|
|
||||||
return env->tocent[i_track-env->gen.i_first_track].track_format;
|
return p_env->tocent[i_track-p_env->gen.i_first_track].track_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: image_common.h,v 1.1 2004/12/18 17:29:32 rocky Exp $
|
$Id: image_common.h,v 1.2 2004/12/31 05:47:36 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -143,22 +143,22 @@ _get_track_msf_image(void *user_data, track_t track_num, msf_t *msf)
|
|||||||
CDIO_INVALID_TRACK is returned on error.
|
CDIO_INVALID_TRACK is returned on error.
|
||||||
*/
|
*/
|
||||||
static track_t
|
static track_t
|
||||||
_get_first_track_num_image(void *user_data)
|
_get_first_track_num_image(void *p_user_data)
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = p_user_data;
|
||||||
|
|
||||||
return env->gen.i_first_track;
|
return p_env->gen.i_first_track;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the number of tracks.
|
Return the number of tracks.
|
||||||
*/
|
*/
|
||||||
static track_t
|
static track_t
|
||||||
_get_num_tracks_image(void *user_data)
|
_get_num_tracks_image(void *p_user_data)
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = p_user_data;
|
||||||
|
|
||||||
return env->gen.i_tracks;
|
return p_env->gen.i_tracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -54,11 +54,14 @@ cdio_get_hwinfo
|
|||||||
cdio_get_joliet_level
|
cdio_get_joliet_level
|
||||||
cdio_get_mcn
|
cdio_get_mcn
|
||||||
cdio_get_num_tracks
|
cdio_get_num_tracks
|
||||||
|
cdio_get_track_channels
|
||||||
|
cdio_get_track_copy_permit
|
||||||
cdio_get_track_format
|
cdio_get_track_format
|
||||||
cdio_get_track_green
|
cdio_get_track_green
|
||||||
cdio_get_track_lba
|
cdio_get_track_lba
|
||||||
cdio_get_track_lsn
|
cdio_get_track_lsn
|
||||||
cdio_get_track_msf
|
cdio_get_track_msf
|
||||||
|
cdio_get_track_preemphasis
|
||||||
cdio_get_track_sec_count
|
cdio_get_track_sec_count
|
||||||
cdio_guess_cd_type
|
cdio_guess_cd_type
|
||||||
cdio_have_bincue
|
cdio_have_bincue
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-info.c,v 1.103 2004/12/18 21:24:25 rocky Exp $
|
$Id: cd-info.c,v 1.104 2004/12/31 05:47:36 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
||||||
@@ -1045,18 +1045,24 @@ main(int argc, const char *argv[])
|
|||||||
printf("CD-ROM Track List (%i - %i)\n" NORMAL,
|
printf("CD-ROM Track List (%i - %i)\n" NORMAL,
|
||||||
i_first_track, i_tracks);
|
i_first_track, i_tracks);
|
||||||
|
|
||||||
printf(" #: MSF LSN Type Green?\n");
|
printf(" #: MSF LSN Type Green? Copy?");
|
||||||
|
if ( CDIO_DISC_MODE_CD_DA == discmode
|
||||||
|
|| CDIO_DISC_MODE_CD_MIXED == discmode )
|
||||||
|
printf(" Channels Premphasis?");
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read and possibly print track information. */
|
/* Read and possibly print track information. */
|
||||||
for (i = i_first_track; i <= CDIO_CDROM_LEADOUT_TRACK; i++) {
|
for (i = i_first_track; i <= CDIO_CDROM_LEADOUT_TRACK; i++) {
|
||||||
msf_t msf;
|
msf_t msf;
|
||||||
char *psz_msf;
|
char *psz_msf;
|
||||||
|
track_format_t track_format;
|
||||||
|
|
||||||
if (!cdio_get_track_msf(p_cdio, i, &msf)) {
|
if (!cdio_get_track_msf(p_cdio, i, &msf)) {
|
||||||
err_exit("cdio_track_msf for track %i failed, I give up.\n", i);
|
err_exit("cdio_track_msf for track %i failed, I give up.\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
track_format = cdio_get_track_format(p_cdio, i);
|
||||||
psz_msf = cdio_msf_to_str(&msf);
|
psz_msf = cdio_msf_to_str(&msf);
|
||||||
if (i == CDIO_CDROM_LEADOUT_TRACK) {
|
if (i == CDIO_CDROM_LEADOUT_TRACK) {
|
||||||
if (!opts.no_tracks) {
|
if (!opts.no_tracks) {
|
||||||
@@ -1076,14 +1082,54 @@ main(int argc, const char *argv[])
|
|||||||
free(psz_msf);
|
free(psz_msf);
|
||||||
break;
|
break;
|
||||||
} else if (!opts.no_tracks) {
|
} else if (!opts.no_tracks) {
|
||||||
printf("%3d: %8s %06lu %-5s %s\n", (int) i, psz_msf,
|
const char *psz;
|
||||||
(long unsigned int) cdio_msf_to_lsn(&msf),
|
printf( "%3d: %8s %06lu %-6s %-5s ", (int) i, psz_msf,
|
||||||
track_format2str[cdio_get_track_format(p_cdio, i)],
|
(long unsigned int) cdio_msf_to_lsn(&msf),
|
||||||
cdio_get_track_green(p_cdio, i)? "true" : "false");
|
track_format2str[track_format],
|
||||||
|
cdio_get_track_green(p_cdio, i)? "true " : "false");
|
||||||
|
|
||||||
|
switch (cdio_get_track_copy_permit(p_cdio, i)) {
|
||||||
|
case CDIO_TRACK_FLAG_FALSE:
|
||||||
|
psz="no";
|
||||||
|
break;
|
||||||
|
case CDIO_TRACK_FLAG_TRUE:
|
||||||
|
psz="yes";
|
||||||
|
break;
|
||||||
|
case CDIO_TRACK_FLAG_UNKNOWN:
|
||||||
|
psz="?";
|
||||||
|
break;
|
||||||
|
case CDIO_TRACK_FLAG_ERROR:
|
||||||
|
default:
|
||||||
|
psz="error";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf("%-5s", psz);
|
||||||
|
|
||||||
|
if (TRACK_FORMAT_AUDIO == track_format) {
|
||||||
|
switch (cdio_get_track_preemphasis(p_cdio, i)) {
|
||||||
|
case CDIO_TRACK_FLAG_FALSE:
|
||||||
|
psz="no";
|
||||||
|
break;
|
||||||
|
case CDIO_TRACK_FLAG_TRUE:
|
||||||
|
psz="yes";
|
||||||
|
break;
|
||||||
|
case CDIO_TRACK_FLAG_UNKNOWN:
|
||||||
|
psz="?";
|
||||||
|
break;
|
||||||
|
case CDIO_TRACK_FLAG_ERROR:
|
||||||
|
default:
|
||||||
|
psz="error";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf( " %-8d %s", cdio_get_track_channels(p_cdio, i), psz);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "\n" );
|
||||||
|
|
||||||
}
|
}
|
||||||
free(psz_msf);
|
free(psz_msf);
|
||||||
|
|
||||||
if (TRACK_FORMAT_AUDIO == cdio_get_track_format(p_cdio, i)) {
|
if (TRACK_FORMAT_AUDIO == track_format) {
|
||||||
num_audio++;
|
num_audio++;
|
||||||
if (-1 == first_audio) first_audio = i;
|
if (-1 == first_audio) first_audio = i;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user