track.c, gnu_linux.c: Test for exceding max track limit but allow specifying the leadout track in some cases.
Makefile.am: need to build extract unconditionally since that is used in testing
This commit is contained in:
@@ -21,13 +21,18 @@
|
|||||||
if ENABLE_CPP
|
if ENABLE_CPP
|
||||||
SUBDIRS = C++
|
SUBDIRS = C++
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_EXAMPLES
|
if BUILD_EXAMPLES
|
||||||
noinst_PROGRAMS = audio cdchange cdio-eject cdtext device discid drives eject \
|
audio cdchange cdio-eject cdtext device \
|
||||||
|
discid drives eject \
|
||||||
extract isofile isofile2 isofuzzy isolist isolsn \
|
extract isofile isofile2 isofuzzy isolist isolsn \
|
||||||
mmc1 mmc2 mmc2a mmc3 \
|
mmc1 mmc2 mmc2a mmc3 \
|
||||||
sample3 sample4 tracks udf1 udffile
|
sample3 sample4 tracks udf1 udffile
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# extract is used in tests so that has to be built regardless
|
||||||
|
noinst_PROGRAMS = extract $(noinst_programs)
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS)
|
INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS)
|
||||||
|
|
||||||
audio_DEPENDENCIES = $(LIBCDIO_DEPS)
|
audio_DEPENDENCIES = $(LIBCDIO_DEPS)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011
|
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011
|
||||||
Rocky Bernstein <rocky@gnu.org>
|
2012 Rocky Bernstein <rocky@gnu.org>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -601,7 +601,9 @@ get_track_msf_linux(void *p_user_data, track_t i_track, msf_t *msf)
|
|||||||
{
|
{
|
||||||
_img_private_t *p_env = p_user_data;
|
_img_private_t *p_env = p_user_data;
|
||||||
|
|
||||||
if (NULL == msf) return false;
|
if (NULL == msf ||
|
||||||
|
(i_track > CDIO_CD_MAX_TRACKS && i_track != CDIO_CDROM_LEADOUT_TRACK))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!p_env->gen.toc_init) read_toc_linux (p_user_data) ;
|
if (!p_env->gen.toc_init) read_toc_linux (p_user_data) ;
|
||||||
|
|
||||||
@@ -1179,6 +1181,13 @@ read_toc_linux (void *p_user_data)
|
|||||||
p_env->gen.i_first_track = p_env->tochdr.cdth_trk0;
|
p_env->gen.i_first_track = p_env->tochdr.cdth_trk0;
|
||||||
p_env->gen.i_tracks = p_env->tochdr.cdth_trk1;
|
p_env->gen.i_tracks = p_env->tochdr.cdth_trk1;
|
||||||
|
|
||||||
|
if (p_env->gen.i_tracks > CDIO_CD_MAX_TRACKS) {
|
||||||
|
cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n",
|
||||||
|
p_env->gen.i_tracks, CDIO_CD_MAX_TRACKS);
|
||||||
|
p_env->gen.i_tracks = CDIO_CD_MAX_TRACKS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 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++) {
|
||||||
struct cdrom_tocentry *p_toc =
|
struct cdrom_tocentry *p_toc =
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2003, 2004, 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org>
|
Copyright (C) 2003, 2004, 2005, 2008, 2011, 2012
|
||||||
|
Rocky Bernstein <rocky@gnu.org>
|
||||||
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -20,10 +21,10 @@
|
|||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
# define __CDIO_CONFIG_H__ 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
|
#include <cdio/logging.h>
|
||||||
#include "cdio_private.h"
|
#include "cdio_private.h"
|
||||||
|
|
||||||
const char *track_format2str[6] =
|
const char *track_format2str[6] =
|
||||||
@@ -39,9 +40,13 @@ enum cdio_track_enums;
|
|||||||
CDIO_INVALID_TRACK is returned on error.
|
CDIO_INVALID_TRACK is returned on error.
|
||||||
*/
|
*/
|
||||||
track_t
|
track_t
|
||||||
cdio_get_first_track_num (const CdIo_t *p_cdio)
|
cdio_get_first_track_num(const CdIo_t *p_cdio)
|
||||||
{
|
{
|
||||||
if (NULL == p_cdio) return CDIO_INVALID_TRACK;
|
if (NULL == p_cdio) {
|
||||||
|
cdio_info("Null CdIo object passed\n");
|
||||||
|
return CDIO_INVALID_TRACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (p_cdio->op.get_first_track_num) {
|
if (p_cdio->op.get_first_track_num) {
|
||||||
return p_cdio->op.get_first_track_num (p_cdio->env);
|
return p_cdio->op.get_first_track_num (p_cdio->env);
|
||||||
@@ -57,7 +62,11 @@ cdio_get_first_track_num (const CdIo_t *p_cdio)
|
|||||||
track_t
|
track_t
|
||||||
cdio_get_last_track_num (const CdIo_t *p_cdio)
|
cdio_get_last_track_num (const CdIo_t *p_cdio)
|
||||||
{
|
{
|
||||||
if (NULL == p_cdio) return CDIO_INVALID_TRACK;
|
if (NULL == p_cdio) {
|
||||||
|
cdio_info("Null CdIo object passed\n");
|
||||||
|
return CDIO_INVALID_TRACK;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const track_t i_first_track = cdio_get_first_track_num(p_cdio);
|
const track_t i_first_track = cdio_get_first_track_num(p_cdio);
|
||||||
if ( CDIO_INVALID_TRACK != i_first_track ) {
|
if ( CDIO_INVALID_TRACK != i_first_track ) {
|
||||||
@@ -76,6 +85,15 @@ cdio_get_last_track_num (const CdIo_t *p_cdio)
|
|||||||
int
|
int
|
||||||
cdio_get_track_channels(const CdIo_t *p_cdio, track_t i_track)
|
cdio_get_track_channels(const CdIo_t *p_cdio, track_t i_track)
|
||||||
{
|
{
|
||||||
|
if (NULL == p_cdio) {
|
||||||
|
cdio_info("Null CdIo object passed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (i_track > CDIO_CD_MAX_TRACKS) {
|
||||||
|
cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n",
|
||||||
|
i_track, CDIO_CD_MAX_TRACKS);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (p_cdio->op.get_track_channels) {
|
if (p_cdio->op.get_track_channels) {
|
||||||
return p_cdio->op.get_track_channels (p_cdio->env, i_track);
|
return p_cdio->op.get_track_channels (p_cdio->env, i_track);
|
||||||
} else {
|
} else {
|
||||||
@@ -209,7 +227,10 @@ cdio_get_track_green(const CdIo_t *p_cdio, track_t i_track)
|
|||||||
lba_t
|
lba_t
|
||||||
cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track)
|
cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track)
|
||||||
{
|
{
|
||||||
if (!p_cdio) return CDIO_INVALID_LBA;
|
if (NULL == p_cdio) {
|
||||||
|
cdio_info("Null CdIo object passed\n");
|
||||||
|
return CDIO_INVALID_LBA;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_cdio->op.get_track_lba) {
|
if (p_cdio->op.get_track_lba) {
|
||||||
return p_cdio->op.get_track_lba (p_cdio->env, i_track);
|
return p_cdio->op.get_track_lba (p_cdio->env, i_track);
|
||||||
@@ -232,7 +253,16 @@ cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track)
|
|||||||
lsn_t
|
lsn_t
|
||||||
cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track)
|
cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track)
|
||||||
{
|
{
|
||||||
if (p_cdio == NULL) return CDIO_INVALID_LSN;
|
if (NULL == p_cdio) {
|
||||||
|
cdio_info("Null CdIo object passed\n");
|
||||||
|
return CDIO_INVALID_LSN;
|
||||||
|
}
|
||||||
|
if (i_track > CDIO_CD_MAX_TRACKS && i_track != CDIO_CDROM_LEADOUT_TRACK) {
|
||||||
|
cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n",
|
||||||
|
i_track, CDIO_CD_MAX_TRACKS);
|
||||||
|
return CDIO_INVALID_LSN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (p_cdio->op.get_track_lba) {
|
if (p_cdio->op.get_track_lba) {
|
||||||
return cdio_lba_to_lsn(p_cdio->op.get_track_lba (p_cdio->env, i_track));
|
return cdio_lba_to_lsn(p_cdio->op.get_track_lba (p_cdio->env, i_track));
|
||||||
@@ -254,7 +284,16 @@ cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track)
|
|||||||
char *
|
char *
|
||||||
cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track)
|
cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track)
|
||||||
{
|
{
|
||||||
if (p_cdio == NULL) return NULL;
|
if (NULL == p_cdio) {
|
||||||
|
cdio_info("Null CdIo object passed\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i_track > CDIO_CD_MAX_TRACKS) {
|
||||||
|
cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n",
|
||||||
|
i_track, CDIO_CD_MAX_TRACKS);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_cdio->op.get_track_isrc) {
|
if (p_cdio->op.get_track_isrc) {
|
||||||
return p_cdio->op.get_track_isrc (p_cdio->env, i_track);
|
return p_cdio->op.get_track_isrc (p_cdio->env, i_track);
|
||||||
@@ -271,7 +310,10 @@ cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track)
|
|||||||
lba_t
|
lba_t
|
||||||
cdio_get_track_pregap_lba(const CdIo_t *p_cdio, track_t i_track)
|
cdio_get_track_pregap_lba(const CdIo_t *p_cdio, track_t i_track)
|
||||||
{
|
{
|
||||||
if (p_cdio == NULL) return CDIO_INVALID_LBA;
|
if (NULL == p_cdio) {
|
||||||
|
cdio_info("Null CdIo object passed\n");
|
||||||
|
return CDIO_INVALID_LBA;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_cdio->op.get_track_pregap_lba) {
|
if (p_cdio->op.get_track_pregap_lba) {
|
||||||
return p_cdio->op.get_track_pregap_lba (p_cdio->env, i_track);
|
return p_cdio->op.get_track_pregap_lba (p_cdio->env, i_track);
|
||||||
|
|||||||
Reference in New Issue
Block a user