提交 ab109bf8 编写于 作者: P Pete Batard

[iso] add ISO support part 1 (iso9660)

* uses GNU libcdio
上级 9d2f9faa
/* -*- c -*-
Copyright (C) 2005, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/** \file audio.h
*
* \brief The top-level header for CD audio-related libcdio
* calls. These control playing of the CD-ROM through its
* line-out jack.
*/
#ifndef __CDIO_AUDIO_H__
#define __CDIO_AUDIO_H__
#include <cdio/types.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*! This struct is used by the cdio_audio_read_subchannel */
typedef struct cdio_subchannel_s
{
uint8_t format;
uint8_t audio_status;
uint8_t address: 4;
uint8_t control: 4;
uint8_t track;
uint8_t index;
msf_t abs_addr;
msf_t rel_addr;
} cdio_subchannel_t;
/*! This struct is used by cdio_audio_get_volume and cdio_audio_set_volume */
typedef struct cdio_audio_volume_s
{
uint8_t level[4];
} cdio_audio_volume_t;
/*! This struct is used by the CDROMPLAYTRKIND ioctl */
typedef struct cdio_track_index_s
{
uint8_t i_start_track; /**< start track */
uint8_t i_start_index; /**< start index */
uint8_t i_end_track; /**< end track */
uint8_t i_end_index; /**< end index */
} cdio_track_index_t;
/*!
Get volume of an audio CD.
@param p_cdio the CD object to be acted upon.
@param p_volume place to put the list of volume outputs levels
p_volume can be NULL in which case we return only whether the driver
has the ability to get the volume or not.
*/
driver_return_code_t cdio_audio_get_volume (CdIo_t *p_cdio, /*out*/
cdio_audio_volume_t *p_volume);
/*!
Return the number of seconds (discarding frame portion) of an MSF
*/
uint32_t cdio_audio_get_msf_seconds(msf_t *p_msf);
/*!
Pause playing CD through analog output
@param p_cdio the CD object to be acted upon.
*/
driver_return_code_t cdio_audio_pause (CdIo_t *p_cdio);
/*!
Playing CD through analog output at the given MSF.
@param p_cdio the CD object to be acted upon.
@param p_start_msf pointer to staring MSF
@param p_end_msf pointer to ending MSF
*/
driver_return_code_t cdio_audio_play_msf (CdIo_t *p_cdio,
/*in*/msf_t *p_start_msf,
/*in*/ msf_t *p_end_msf);
/*!
Playing CD through analog output at the desired track and index
@param p_cdio the CD object to be acted upon.
@param p_track_index location to start/end.
*/
driver_return_code_t cdio_audio_play_track_index
( CdIo_t *p_cdio, cdio_track_index_t *p_track_index);
/*!
Get subchannel information.
@param p_cdio the CD object to be acted upon.
@param p_subchannel place for returned subchannel information
*/
driver_return_code_t cdio_audio_read_subchannel (CdIo_t *p_cdio,
/*out*/ cdio_subchannel_t *p_subchannel);
/*!
Resume playing an audio CD.
@param p_cdio the CD object to be acted upon.
*/
driver_return_code_t cdio_audio_resume (CdIo_t *p_cdio);
/*!
Set volume of an audio CD.
@param p_cdio the CD object to be acted upon.
@param p_volume place for returned volume-level information
*/
driver_return_code_t cdio_audio_set_volume (CdIo_t *p_cdio, /*out*/
cdio_audio_volume_t *p_volume);
/*!
Stop playing an audio CD.
@param p_cdio the CD object to be acted upon.
*/
driver_return_code_t cdio_audio_stop (CdIo_t *p_cdio);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __CDIO_AUDIO_H__ */
/*
$Id: bytesex.h,v 1.5 2008/03/25 15:59:08 karl Exp $
Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/** \file bytesex.h
* \brief Generic Byte-swapping routines.
*
* Note: this header will is slated to get removed and libcdio will
* use glib.h routines instead.
*/
#ifndef __CDIO_BYTESEX_H__
#define __CDIO_BYTESEX_H__
#include <cdio/types.h>
#include <cdio/bytesex_asm.h>
#include <cdio/logging.h>
/** 16-bit big-endian to little-endian */
#define UINT16_SWAP_LE_BE_C(val) ((uint16_t) ( \
(((uint16_t) (val) & (uint16_t) 0x00ffU) << 8) | \
(((uint16_t) (val) & (uint16_t) 0xff00U) >> 8)))
/** 32-bit big-endian to little-endian */
#define UINT32_SWAP_LE_BE_C(val) ((uint32_t) ( \
(((uint32_t) (val) & (uint32_t) 0x000000ffU) << 24) | \
(((uint32_t) (val) & (uint32_t) 0x0000ff00U) << 8) | \
(((uint32_t) (val) & (uint32_t) 0x00ff0000U) >> 8) | \
(((uint32_t) (val) & (uint32_t) 0xff000000U) >> 24)))
/** 64-bit big-endian to little-endian */
#define UINT64_SWAP_LE_BE_C(val) ((uint64_t) ( \
(((uint64_t) (val) & (uint64_t) UINT64_C(0x00000000000000ff)) << 56) | \
(((uint64_t) (val) & (uint64_t) UINT64_C(0x000000000000ff00)) << 40) | \
(((uint64_t) (val) & (uint64_t) UINT64_C(0x0000000000ff0000)) << 24) | \
(((uint64_t) (val) & (uint64_t) UINT64_C(0x00000000ff000000)) << 8) | \
(((uint64_t) (val) & (uint64_t) UINT64_C(0x000000ff00000000)) >> 8) | \
(((uint64_t) (val) & (uint64_t) UINT64_C(0x0000ff0000000000)) >> 24) | \
(((uint64_t) (val) & (uint64_t) UINT64_C(0x00ff000000000000)) >> 40) | \
(((uint64_t) (val) & (uint64_t) UINT64_C(0xff00000000000000)) >> 56)))
#ifndef UINT16_SWAP_LE_BE
# define UINT16_SWAP_LE_BE UINT16_SWAP_LE_BE_C
#endif
#ifndef UINT32_SWAP_LE_BE
# define UINT32_SWAP_LE_BE UINT32_SWAP_LE_BE_C
#endif
#ifndef UINT64_SWAP_LE_BE
# define UINT64_SWAP_LE_BE UINT64_SWAP_LE_BE_C
#endif
inline static
uint16_t uint16_swap_le_be (const uint16_t val)
{
return UINT16_SWAP_LE_BE (val);
}
inline static
uint32_t uint32_swap_le_be (const uint32_t val)
{
return UINT32_SWAP_LE_BE (val);
}
inline static
uint64_t uint64_swap_le_be (const uint64_t val)
{
return UINT64_SWAP_LE_BE (val);
}
# define UINT8_TO_BE(val) ((uint8_t) (val))
# define UINT8_TO_LE(val) ((uint8_t) (val))
#ifdef WORDS_BIGENDIAN
# define UINT16_TO_BE(val) ((uint16_t) (val))
# define UINT16_TO_LE(val) ((uint16_t) UINT16_SWAP_LE_BE(val))
# define UINT32_TO_BE(val) ((uint32_t) (val))
# define UINT32_TO_LE(val) ((uint32_t) UINT32_SWAP_LE_BE(val))
# define UINT64_TO_BE(val) ((uint64_t) (val))
# define UINT64_TO_LE(val) ((uint64_t) UINT64_SWAP_LE_BE(val))
#else
# define UINT16_TO_BE(val) ((uint16_t) UINT16_SWAP_LE_BE(val))
# define UINT16_TO_LE(val) ((uint16_t) (val))
# define UINT32_TO_BE(val) ((uint32_t) UINT32_SWAP_LE_BE(val))
# define UINT32_TO_LE(val) ((uint32_t) (val))
# define UINT64_TO_BE(val) ((uint64_t) UINT64_SWAP_LE_BE(val))
# define UINT64_TO_LE(val) ((uint64_t) (val))
#endif
/** symmetric conversions */
#define UINT8_FROM_BE(val) (UINT8_TO_BE (val))
#define UINT8_FROM_LE(val) (UINT8_TO_LE (val))
#define UINT16_FROM_BE(val) (UINT16_TO_BE (val))
#define UINT16_FROM_LE(val) (UINT16_TO_LE (val))
#define UINT32_FROM_BE(val) (UINT32_TO_BE (val))
#define UINT32_FROM_LE(val) (UINT32_TO_LE (val))
#define UINT64_FROM_BE(val) (UINT64_TO_BE (val))
#define UINT64_FROM_LE(val) (UINT64_TO_LE (val))
/** converter function template */
#define CVT_TO_FUNC(bits) \
static inline uint ## bits ## _t \
uint ## bits ## _to_be (uint ## bits ## _t val) \
{ return UINT ## bits ## _TO_BE (val); } \
static inline uint ## bits ## _t \
uint ## bits ## _to_le (uint ## bits ## _t val) \
{ return UINT ## bits ## _TO_LE (val); } \
CVT_TO_FUNC(8)
CVT_TO_FUNC(16)
CVT_TO_FUNC(32)
CVT_TO_FUNC(64)
#undef CVT_TO_FUNC
#define uint8_from_be(val) (uint8_to_be (val))
#define uint8_from_le(val) (uint8_to_le (val))
#define uint16_from_be(val) (uint16_to_be (val))
#define uint16_from_le(val) (uint16_to_le (val))
#define uint32_from_be(val) (uint32_to_be (val))
#define uint32_from_le(val) (uint32_to_le (val))
#define uint64_from_be(val) (uint64_to_be (val))
#define uint64_from_le(val) (uint64_to_le (val))
/** ISO9660-related field conversion routines */
/** Convert from uint8_t to ISO 9660 7.1.1 format */
#define to_711(i) uint8_to_le(i)
/** Convert from ISO 9660 7.1.1 format to uint8_t */
#define from_711(i) uint8_from_le(i)
/** Convert from uint16_t to ISO 9669 7.2.1 format */
#define to_721(i) uint16_to_le(i)
/** Convert from ISO 9660 7.2.1 format to uint16_t */
#define from_721(i) uint16_from_le(i)
/** Convert from uint16_t to ISO 9669 7.2.2 format */
#define to_722(i) uint16_to_be(i)
/** Convert from ISO 9660 7.2.2 format to uint16_t */
#define from_722(i) uint16_from_be(i)
/** Convert from uint16_t to ISO 9669 7.2.3 format */
static inline uint32_t
to_723(uint16_t i)
{
return uint32_swap_le_be(i) | i;
}
/** Convert from ISO 9660 7.2.3 format to uint16_t */
static inline uint16_t
from_723 (uint32_t p)
{
if (uint32_swap_le_be (p) != p)
cdio_warn ("from_723: broken byte order");
return (0xFFFF & p);
}
/** Convert from uint16_t to ISO 9669 7.3.1 format */
#define to_731(i) uint32_to_le(i)
/** Convert from ISO 9660 7.3.1 format to uint32_t */
#define from_731(i) uint32_from_le(i)
/** Convert from uint32_t to ISO 9669 7.3.2 format */
#define to_732(i) uint32_to_be(i)
/** Convert from ISO 9660 7.3.2 format to uint32_t */
#define from_732(i) uint32_from_be(i)
/** Convert from uint16_t to ISO 9669 7.3.3 format */
static inline uint64_t
to_733(uint32_t i)
{
return uint64_swap_le_be(i) | i;
}
/** Convert from ISO 9660 7.3.3 format to uint32_t */
static inline uint32_t
from_733 (uint64_t p)
{
if (uint64_swap_le_be (p) != p)
cdio_warn ("from_733: broken byte order");
return (UINT32_C(0xFFFFFFFF) & p);
}
#endif /* __CDIO_BYTESEX_H__ */
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
/*
$Id: bytesex_asm.h,v 1.3 2008/03/25 15:59:08 karl Exp $
Copyright (C) 2008 Rocky Bernstein <rocky@gnu.org>
2001, 2004, 2005 Herbert Valerio Riedel <hvr@gnu.org>
2001 Sven Ottemann <ac-logic@freenet.de>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/** \file bytesex_asm.h
* \brief Assembly code to handle byte-swapping.
Note: this header will is slated to get removed and libcdio will use
glib.h routines instead.
*/
#ifndef __CDIO_BYTESEX_ASM_H__
#define __CDIO_BYTESEX_ASM_H__
#if !defined(DISABLE_ASM_OPTIMIZE)
#include <cdio/types.h>
#if defined(__powerpc__) && defined(__GNUC__)
inline static
uint32_t uint32_swap_le_be_asm(const uint32_t a)
{
uint32_t b;
__asm__ ("lwbrx %0,0,%1"
:"=r"(b)
:"r"(&a), "m"(a));
return b;
}
inline static
uint16_t uint16_swap_le_be_asm(const uint16_t a)
{
uint32_t b;
__asm__ ("lhbrx %0,0,%1"
:"=r"(b)
:"r"(&a), "m"(a));
return b;
}
#define UINT16_SWAP_LE_BE uint16_swap_le_be_asm
#define UINT32_SWAP_LE_BE uint32_swap_le_be_asm
#elif defined(__mc68000__) && defined(__STORMGCC__)
inline static
uint32_t uint32_swap_le_be_asm(uint32_t a __asm__("d0"))
{
/* __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); */
__asm__("move.l %1,d0;rol.w #8,d0;swap d0;rol.w #8,d0;move.l d0,%0"
:"=r"(a)
:"r"(a));
return(a);
}
inline static
uint16_t uint16_swap_le_be_asm(uint16_t a __asm__("d0"))
{
__asm__("move.l %1,d0;rol.w #8,d0;move.l d0,%0"
:"=r"(a)
:"r"(a));
return(a);
}
#define UINT16_SWAP_LE_BE uint16_swap_le_be_asm
#define UINT32_SWAP_LE_BE uint32_swap_le_be_asm
#elif 0 && defined(__i386__) && defined(__GNUC__)
inline static
uint32_t uint32_swap_le_be_asm(uint32_t a)
{
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
"rorl $16,%0\n\t" /* swap words */
"xchgb %b0,%h0" /* swap higher bytes */
:"=q" (a)
: "0" (a));
return(a);
}
inline static
uint16_t uint16_swap_le_be_asm(uint16_t a)
{
__asm__("xchgb %b0,%h0" /* swap bytes */
: "=q" (a)
: "0" (a));
return(a);
}
#define UINT16_SWAP_LE_BE uint16_swap_le_be_asm
#define UINT32_SWAP_LE_BE uint32_swap_le_be_asm
#endif
#endif /* !defined(DISABLE_ASM_OPTIMIZE) */
#endif /* __CDIO_BYTESEX_ASM_H__ */
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
/* -*- c -*-
Copyright (C) 2003, 2004, 2005, 2008, 2009 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/** \file cdio.h
*
* \brief The top-level header for libcdio: the CD Input and Control
* library. Applications include this for anything regarding libcdio.
*/
#ifndef __CDIO_H__
#define __CDIO_H__
/** Application Interface or Protocol version number. If the public
* interface changes, we increase this number.
*/
#define CDIO_API_VERSION 5
#include <cdio/version.h>
#include <cdio/types.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <cdio/sector.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* For compatibility. */
#define CdIo CdIo_t
/** This is an opaque structure for the CD object. */
typedef struct _CdIo CdIo_t;
typedef struct cdtext_s cdtext_t;
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* Drive(r)/Device-related functions. Perhaps we should break out
Driver from device?
*/
#include <cdio/device.h>
/* Disc-related functions. */
#include <cdio/disc.h>
/* Sector (frame, or block)-related functions. Uses driver_return_code_t
from <cdio/device.h> so it should come after that.
*/
#include <cdio/read.h>
/* CD-Text-related functions. */
#include <cdio/cdtext.h>
/* Track-related functions. */
#include <cdio/track.h>
#endif /* __CDIO_H__ */
/* config.h.in. Generated from configure.ac by autoheader. */
/* compiler does lsbf in struct bitfields */
#undef BITFIELD_LSBF
/* Define 1 if you are compiling using cygwin */
#undef CYGWIN
/* what to put between the brackets for empty arrays */
#define EMPTY_ARRAY_SIZE MAX_PATH
/* Define 1 if you have BSDI-type CD-ROM support */
#undef HAVE_BSDI_CDROM
/* Define to 1 if you have the `bzero' function. */
#undef HAVE_BZERO
/* Define this if you have libcddb installed */
#undef HAVE_CDDB
/* Define to 1 if you have the <CoreFoundation/CFBase.h> header file. */
#undef HAVE_COREFOUNDATION_CFBASE_H
/* Define 1 if you have Darwin OS X-type CD-ROM support */
#undef HAVE_DARWIN_CDROM
/* Define if time.h defines extern long timezone and int daylight vars. */
#undef HAVE_DAYLIGHT
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <dvd.h> header file. */
#undef HAVE_DVD_H
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define 1 if you have FreeBSD CD-ROM support */
#undef HAVE_FREEBSD_CDROM
/* Define to 1 if you have the <glob.h> header file. */
#undef HAVE_GLOB_H
/* Define if you have the iconv() function. */
#undef HAVE_ICONV
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <IOKit/IOKitLib.h> header file. */
#undef HAVE_IOKIT_IOKITLIB_H
/* Supports ISO _Pragma() macro */
#undef HAVE_ISOC99_PRAGMA
/* Define 1 if you want ISO-9660 Joliet extension support. You must have also
libiconv installed to get Joliet extension support. */
#undef HAVE_JOLIET
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define 1 if you have Linux-type CD-ROM support */
#undef HAVE_LINUX_CDROM
/* Define to 1 if you have the <linux/cdrom.h> header file. */
#undef HAVE_LINUX_CDROM_H
/* Define 1 if timeout is in cdrom_generic_command struct */
#undef HAVE_LINUX_CDROM_TIMEOUT
/* Define to 1 if you have the <linux/version.h> header file. */
#undef HAVE_LINUX_VERSION_H
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define 1 if you have Solaris CD-ROM support */
#undef HAVE_SOLARIS_CDROM
/* Define to 1 if you have the <stdbool.h> header file. */
#undef HAVE_STDBOOL_H
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/cdio.h> header file. */
#undef HAVE_SYS_CDIO_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define if struct tm has the tm_gmtoff member. */
#undef HAVE_TM_GMTOFF
/* Define if time.h defines extern extern char *tzname[2] variable */
#undef HAVE_TZNAME
/* Define to 1 if you have the `tzset' function. */
#undef HAVE_TZSET
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define this if you have libvcdinfo installed */
#undef HAVE_VCDINFO
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define 1 if you have MinGW CD-ROM support */
#define HAVE_WIN32_CDROM 1
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* Define 1 if you are compiling using MinGW */
#undef MINGW32
/* Name of package */
#define PACKAGE "libcdio"
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#define PACKAGE_NAME "libcdio"
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#define PACKAGE_VERSION 1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "1"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#define inline __inline
/*
$Id: cdtext.h,v 1.14 2008/03/25 15:59:08 karl Exp $
Copyright (C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org>
adapted from cuetools
Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file cdtext.h
*
* \brief The top-level header for CD-Text information. Applications
* include this for CD-Text access.
*/
#ifndef __CDIO_CDTEXT_H__
#define __CDIO_CDTEXT_H__
#include <cdio/cdio.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define MAX_CDTEXT_FIELDS 13
#define MIN_CDTEXT_FIELD 0
#define MAX_CDTEXT_DATA_LENGTH 5000
#define MAX_CDTEXT_GENRE_CODE 28
/*! \brief structure for holding CD-Text information
@see cdtext_init, cdtext_destroy, cdtext_get, and cdtext_set.
*/
struct cdtext {
char *field[MAX_CDTEXT_FIELDS];
};
typedef struct cdtext cdtext_track_t;
struct cdtext_s {
cdtext_track_t track[100]; /* cdtext for track 1..99. 0 represents cd-text of disc */
uint16_t genre_code; /* genre code */
uint8_t block;
char encoding[16]; /* encoding of character strings */
char language[3]; /* ISO 639-1 (2 letter) language code */
};
/*! \brief A list of all of the CD-Text fields. Because
the interval has no gaps, we can use ++ to iterate over fields.
*/
typedef enum {
CDTEXT_ARRANGER = 0, /**< name(s) of the arranger(s) */
CDTEXT_COMPOSER = 1, /**< name(s) of the composer(s) */
CDTEXT_DISCID = 2, /**< disc identification information */
CDTEXT_GENRE = 3, /**< genre identification and genre information */
CDTEXT_MESSAGE = 4, /**< ISRC code of each track */
CDTEXT_ISRC = 5, /**< message(s) from the content provider or artist */
CDTEXT_PERFORMER = 6, /**< name(s) of the performer(s) */
CDTEXT_SIZE_INFO = 7, /**< size information of the block */
CDTEXT_SONGWRITER = 8, /**< name(s) of the songwriter(s) */
CDTEXT_TITLE = 9, /**< title of album name or track titles */
CDTEXT_TOC_INFO = 10, /**< table of contents information */
CDTEXT_TOC_INFO2 = 11, /**< second table of contents information */
CDTEXT_UPC_EAN = 12,
CDTEXT_INVALID = MAX_CDTEXT_FIELDS
} cdtext_field_t;
/*! Return string representation of the enum values above */
const char *cdtext_field2str (cdtext_field_t i);
/*! CD-Text genre codes */
typedef enum {
CDIO_CDTEXT_GENRE_UNUSED = 0, /**< not used */
CDIO_CDTEXT_GENRE_UNDEFINED = 1, /**< not defined */
CDIO_CDTEXT_GENRE_ADULT_CONTEMP = 2, /**< Adult Contemporary */
CDIO_CDTEXT_GENRE_ALT_ROCK = 3, /**< Alternative Rock */
CDIO_CDTEXT_GENRE_CHILDRENS = 4, /**< Childrens Music */
CDIO_CDTEXT_GENRE_CLASSIC = 5, /**< Classical */
CDIO_CDTEXT_GENRE_CHRIST_CONTEMP = 6, /**< Contemporary Christian */
CDIO_CDTEXT_GENRE_COUNTRY = 7, /**< Country */
CDIO_CDTEXT_GENRE_DANCE = 8, /**< Dance */
CDIO_CDTEXT_GENRE_EASY_LISTENING = 9, /**< Easy Listening */
CDIO_CDTEXT_GENRE_EROTIC = 10, /**< Erotic */
CDIO_CDTEXT_GENRE_FOLK = 11, /**< Folk */
CDIO_CDTEXT_GENRE_GOSPEL = 12, /**< Gospel */
CDIO_CDTEXT_GENRE_HIPHOP = 13, /**< Hip Hop */
CDIO_CDTEXT_GENRE_JAZZ = 14, /**< Jazz */
CDIO_CDTEXT_GENRE_LATIN = 15, /**< Latin */
CDIO_CDTEXT_GENRE_MUSICAL = 16, /**< Musical */
CDIO_CDTEXT_GENRE_NEWAGE = 17, /**< New Age */
CDIO_CDTEXT_GENRE_OPERA = 18, /**< Opera */
CDIO_CDTEXT_GENRE_OPERETTA = 19, /**< Operetta */
CDIO_CDTEXT_GENRE_POP = 20, /**< Pop Music */
CDIO_CDTEXT_GENRE_RAP = 21, /**< RAP */
CDIO_CDTEXT_GENRE_REGGAE = 22, /**< Reggae */
CDIO_CDTEXT_GENRE_ROCK = 23, /**< Rock Music */
CDIO_CDTEXT_GENRE_RYTHMANDBLUES = 24, /**< Rhythm & Blues */
CDIO_CDTEXT_GENRE_SOUNDEFFECTS = 25, /**< Sound Effects */
CDIO_CDTEXT_GENRE_SOUNDTRACK = 26, /**< Soundtrack */
CDIO_CDTEXT_GENRE_SPOKEN_WORD = 27, /**< Spoken Word */
CDIO_CDTEXT_GENRE_WORLD_MUSIC = 28 /**< World Music */
} cdtext_genre_t;
/*! Return string representation of the given genre code */
const char *cdtext_genre2str (cdtext_genre_t i);
/*! Initialize a new cdtext structure.
When the structure is no longer needed, release the
resources using cdtext_delete.
*/
void cdtext_init (cdtext_t *cdtext);
/*! Parse raw CD-Text data into cdtext structure */
bool cdtext_data_init(cdtext_t *cdtext, uint8_t *wdata, size_t length);
/*! Free memory assocated with cdtext*/
void cdtext_destroy (cdtext_t *cdtext);
/*! returns an allocated string associated with the given field. NULL is
returned if key is CDTEXT_INVALID or the field is not set.
The user needs to free the string when done with it.
@see cdio_get_const to retrieve a constant string that doesn't
have to be freed.
*/
char *cdtext_get (cdtext_field_t key, track_t track, const cdtext_t *cdtext);
/*! returns a const string associated with the given field. NULL is
returned if key is CDTEXT_INVALID or the field is not set.
Don't use the string when the cdtext object (i.e. the CdIo_t object
you got it from) is no longer valid.
@see cdio_get to retrieve an allocated string that persists past
the cdtext object.
*/
const char *cdtext_get_const (cdtext_field_t key, track_t track, const cdtext_t *cdtext);
/*!
returns enum of keyword if key is a CD-Text keyword,
returns MAX_CDTEXT_FIELDS non-zero otherwise.
*/
cdtext_field_t cdtext_is_keyword (const char *key);
/*!
sets cdtext's keyword entry to field
*/
void cdtext_set (cdtext_field_t key, track_t track, const char *value, cdtext_t *cdtext);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __CDIO_CDTEXT_H__ */
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
此差异已折叠。
/* -*- c -*-
Copyright (C) 2004, 2005, 2006, 2008, 2010 Rocky Bernstein
<rocky@gnu.org>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
\file disc.h
\brief The top-level header for disc-related libcdio calls.
*/
#ifndef __CDIO_DISC_H__
#define __CDIO_DISC_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
disc modes. The first combined from MMC-5 6.33.3.13 (Send
CUESHEET), "DVD Book" from MMC-5 Table 400, page 419. and
GNU/Linux /usr/include/linux/cdrom.h and we've added DVD.
*/
typedef enum {
CDIO_DISC_MODE_CD_DA, /**< CD-DA */
CDIO_DISC_MODE_CD_DATA, /**< CD-ROM form 1 */
CDIO_DISC_MODE_CD_XA, /**< CD-ROM XA form2 */
CDIO_DISC_MODE_CD_MIXED, /**< Some combo of above. */
CDIO_DISC_MODE_DVD_ROM, /**< DVD ROM (e.g. movies) */
CDIO_DISC_MODE_DVD_RAM, /**< DVD-RAM */
CDIO_DISC_MODE_DVD_R, /**< DVD-R */
CDIO_DISC_MODE_DVD_RW, /**< DVD-RW */
CDIO_DISC_MODE_HD_DVD_ROM, /**< HD DVD-ROM */
CDIO_DISC_MODE_HD_DVD_RAM, /**< HD DVD-RAM */
CDIO_DISC_MODE_HD_DVD_R, /**< HD DVD-R */
CDIO_DISC_MODE_DVD_PR, /**< DVD+R */
CDIO_DISC_MODE_DVD_PRW, /**< DVD+RW */
CDIO_DISC_MODE_DVD_PRW_DL, /**< DVD+RW DL */
CDIO_DISC_MODE_DVD_PR_DL, /**< DVD+R DL */
CDIO_DISC_MODE_DVD_OTHER, /**< Unknown/unclassified DVD type */
CDIO_DISC_MODE_NO_INFO,
CDIO_DISC_MODE_ERROR,
CDIO_DISC_MODE_CD_I /**< CD-i. */
} discmode_t;
extern const char *discmode2str[];
/**
Get binary CD-Text information for a CdIo_t object.
@param p_cdio the CD object that may contain CD-Text information.
@return malloc'd pointer to raw CD-Text data as stored on the disc
or NULL if p_cdio is NULL or CD-Text information does not exist.
Return value should be freed when done with it and not NULL.
*/
uint8_t * cdio_get_cdtext_raw (CdIo_t *p_cdio);
/**
Get CD-Text information for a CdIo_t object.
@param p_cdio the CD object that may contain CD-Text information.
@return the CD-Text object or NULL if p_cdio is NULL
or CD-Text information does not exist.
*/
cdtext_t *cdio_get_cdtext (CdIo_t *p_cdio);
/**
Get disc mode - the kind of CD (CD-DA, CD-ROM mode 1, CD-MIXED, etc.
that we've got. The notion of "CD" is extended a little to include
DVD's.
*/
discmode_t cdio_get_discmode (CdIo_t *p_cdio);
/**
Get the lsn of the end of the CD
@return the lsn. On error 0 or CDIO_INVALD_LSN.
*/
lsn_t cdio_get_disc_last_lsn(const CdIo_t *p_cdio);
/**
Return the Joliet level recognized for p_cdio.
*/
uint8_t cdio_get_joliet_level(const CdIo_t *p_cdio);
/**
Get the media catalog number (MCN) from the CD.
@return the media catalog number or NULL if there is none or we
don't have the ability to get it.
Note: string is malloc'd so caller has to free() the returned
string when done with it.
*/
char * cdio_get_mcn (const CdIo_t *p_cdio);
/**
Get the number of tracks on the CD.
@return the number of tracks, or CDIO_INVALID_TRACK if there is
an error.
*/
track_t cdio_get_num_tracks (const CdIo_t *p_cdio);
/**
Return true if discmode is some sort of CD.
*/
bool cdio_is_discmode_cdrom (discmode_t discmode);
/**
Return true if discmode is some sort of DVD.
*/
bool cdio_is_discmode_dvd (discmode_t discmode);
/**
cdio_stat_size is deprecated. @see cdio_get_disc_last_lsn
*/
#define cdio_stat_size cdio_get_disc_last_lsn
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __CDIO_DISC_H__ */
/*
$Id: ds.h,v 1.5 2008/03/25 15:59:09 karl Exp $
Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/** \file ds.h
* \brief The top-level header for list-related data structures.
Note: this header will is slated to get removed and libcdio will use
glib.h routines instead.
*/
#ifndef __CDIO_DS_H__
#define __CDIO_DS_H__
#include <cdio/types.h>
/** opaque types... */
typedef struct _CdioList CdioList_t;
typedef struct _CdioListNode CdioListNode_t;
typedef int (*_cdio_list_cmp_func_t) (void *p_data1, void *p_data2);
typedef int (*_cdio_list_iterfunc_t) (void *p_data, void *p_user_data);
/** The below are given compatibility with old code. Please use
the above type names, not these. */
#define CdioList CdioList_t
#define CdioListNode CdioListNode_t
#define _cdio_list_cmp_func _cdio_list_cmp_func_t
#define _cdio_list_iterfunc _cdio_list_iterfunc_t
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** methods */
CdioList_t *_cdio_list_new (void);
void _cdio_list_free (CdioList_t *p_list, int free_data);
unsigned _cdio_list_length (const CdioList_t *list);
void _cdio_list_prepend (CdioList_t *p_list, void *p_data);
void _cdio_list_append (CdioList_t *p_list, void *p_data);
void _cdio_list_foreach (CdioList_t *p_list, _cdio_list_iterfunc_t func,
void *p_user_data);
CdioListNode_t *_cdio_list_find (CdioList_t *p_list,
_cdio_list_iterfunc_t cmp_func,
void *p_user_data);
#define _CDIO_LIST_FOREACH(node, list) \
for (node = _cdio_list_begin (list); node; node = _cdio_list_node_next (node))
/** node operations */
CdioListNode_t *_cdio_list_begin (const CdioList_t *p_list);
CdioListNode_t *_cdio_list_end (CdioList_t *p_list);
CdioListNode_t *_cdio_list_node_next (CdioListNode_t *p_node);
void _cdio_list_node_free (CdioListNode_t *p_node, int i_free_data);
void *_cdio_list_node_data (CdioListNode_t *p_node);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __CDIO_DS_H__ */
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
/*
Copyright (C) 2004, 2010 Rocky Bernstein <rocky@gnu.org>
Modeled after GNU/Linux definitions in linux/cdrom.h
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
\file dvd.h
\brief Definitions for DVD access.
The documents we make use of are described Multi-Media Commands
(MMC). This document generally has a numeric level number
appended. For example MMC-5 refers to ``Multi-Media Commands - 5'
which is the current version in 2010.
*/
#ifndef __CDIO_DVD_H__
#define __CDIO_DVD_H__
#include <cdio/types.h>
/**
Values used in a READ DVD STRUCTURE
*/
#define CDIO_DVD_STRUCT_PHYSICAL 0x00
#define CDIO_DVD_STRUCT_COPYRIGHT 0x01
#define CDIO_DVD_STRUCT_DISCKEY 0x02
#define CDIO_DVD_STRUCT_BCA 0x03
#define CDIO_DVD_STRUCT_MANUFACT 0x04
/**
Media definitions for "DVD Book" from MMC-5 Table 400, page 419.
*/
#define CDIO_DVD_BOOK_DVD_ROM 0x0 /**< DVD-ROM */
#define CDIO_DVD_BOOK_DVD_RAM 0x1 /**< DVD-RAM */
#define CDIO_DVD_BOOK_DVD_R 0x2 /**< DVD-R */
#define CDIO_DVD_BOOK_DVD_RW 0x3 /**< DVD-RW */
#define CDIO_DVD_BOOK_HD_DVD_ROM 0x4 /**< HD DVD-ROM */
#define CDIO_DVD_BOOK_HD_DVD_RAM 0x5 /**< HD DVD-RAM */
#define CDIO_DVD_BOOK_HD_DVD_R 0x6 /**< HD DVD-R */
#define CDIO_DVD_BOOK_DVD_PRW 0x9 /**< DVD+RW */
#define CDIO_DVD_BOOK_DVD_PR 0xa /**< DVD+R */
#define CDIO_DVD_BOOK_DVD_PRW_DL 0xd /**< DVD+RW DL */
#define CDIO_DVD_BOOK_DVD_PR_DL 0xe /**< DVD+R DL */
typedef struct cdio_dvd_layer {
unsigned int book_version : 4;
unsigned int book_type : 4;
unsigned int min_rate : 4;
unsigned int disc_size : 4;
unsigned int layer_type : 4;
unsigned int track_path : 1;
unsigned int nlayers : 2;
unsigned int track_density : 4;
unsigned int linear_density : 4;
unsigned int bca : 1;
uint32_t start_sector;
uint32_t end_sector;
uint32_t end_sector_l0;
} cdio_dvd_layer_t;
/**
Maximum number of layers in a DVD.
*/
#define CDIO_DVD_MAX_LAYERS 4
typedef struct cdio_dvd_physical {
uint8_t type;
uint8_t layer_num;
cdio_dvd_layer_t layer[CDIO_DVD_MAX_LAYERS];
} cdio_dvd_physical_t;
typedef struct cdio_dvd_copyright {
uint8_t type;
uint8_t layer_num;
uint8_t cpst;
uint8_t rmi;
} cdio_dvd_copyright_t;
typedef struct cdio_dvd_disckey {
uint8_t type;
unsigned agid : 2;
uint8_t value[2048];
} cdio_dvd_disckey_t;
typedef struct cdio_dvd_bca {
uint8_t type;
int len;
uint8_t value[188];
} cdio_dvd_bca_t;
typedef struct cdio_dvd_manufact {
uint8_t type;
uint8_t layer_num;
int len;
uint8_t value[2048];
} cdio_dvd_manufact_t;
typedef union {
uint8_t type;
cdio_dvd_physical_t physical;
cdio_dvd_copyright_t copyright;
cdio_dvd_disckey_t disckey;
cdio_dvd_bca_t bca;
cdio_dvd_manufact_t manufact;
} cdio_dvd_struct_t;
#endif /* __CDIO_DVD_H__ */
此差异已折叠。
/*
$Id: logging.h,v 1.11 2008/03/25 15:59:09 karl Exp $
Copyright (C) 2003, 2004, 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/** \file logging.h
* \brief Header to control logging and level of detail of output.
*
*/
#ifndef __LOGGING_H__
#define __LOGGING_H__
#include <cdio/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* The different log levels supported.
*/
typedef enum {
CDIO_LOG_DEBUG = 1, /**< Debug-level messages - helps debug what's up. */
CDIO_LOG_INFO, /**< Informational - indicates perhaps something of
interest. */
CDIO_LOG_WARN, /**< Warning conditions - something that looks funny. */
CDIO_LOG_ERROR, /**< Error conditions - may terminate program. */
CDIO_LOG_ASSERT /**< Critical conditions - may abort program. */
} cdio_log_level_t;
/**
* The place to save the preference concerning how much verbosity
* is desired. This is used by the internal default log handler, but
* it could be use by applications which provide their own log handler.
*/
extern cdio_log_level_t cdio_loglevel_default;
/**
* This type defines the signature of a log handler. For every
* message being logged, the handler will receive the log level and
* the message string.
*
* @see cdio_log_set_handler
* @see cdio_log_level_t
*
* @param level The log level.
* @param message The log message.
*/
typedef void (*cdio_log_handler_t) (cdio_log_level_t level,
const char message[]);
/**
* Set a custom log handler for libcdio. The return value is the log
* handler being replaced. If the provided parameter is NULL, then
* the handler will be reset to the default handler.
*
* @see cdio_log_handler_t
*
* @param new_handler The new log handler.
* @return The previous log handler.
*/
cdio_log_handler_t cdio_log_set_handler (cdio_log_handler_t new_handler);
/**
* Handle an message with the given log level.
*
* @see cdio_debug
* @see cdio_info
* @see cdio_warn
* @see cdio_error
* @param level The log level.
* @param format printf-style format string
* @param ... remaining arguments needed by format string
*/
void cdio_log (cdio_log_level_t level,
const char format[], ...) GNUC_PRINTF(2, 3);
/**
* Handle a debugging message.
*
* @see cdio_log for a more generic routine
*/
void cdio_debug (const char format[], ...) GNUC_PRINTF(1,2);
/**
* Handle an informative message.
*
* @see cdio_log for a more generic routine
*/
void cdio_info (const char format[], ...) GNUC_PRINTF(1,2);
/**
* Handle a warning message.
*
* @see cdio_log for a more generic routine
*/
void cdio_warn (const char format[], ...) GNUC_PRINTF(1,2);
/**
* Handle an error message. Execution is terminated.
*
* @see cdio_log for a more generic routine.
*/
void cdio_error (const char format[], ...) GNUC_PRINTF(1,2);
#ifdef __cplusplus
}
#endif
#endif /* __LOGGING_H__ */
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
此差异已折叠。
/*
Copyright (C) 2010 Rocky Bernstein <rocky@gnu.org>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
\file mmc_util.h
\brief Multimedia Command (MMC) "helper" routines that don't depend
on anything other than headers.
*/
#ifndef __CDIO_MMC_UTIL_H__
#define __CDIO_MMC_UTIL_H__
#include <cdio/device.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
Profile profile codes used in GET_CONFIGURATION - PROFILE LIST. */
typedef enum {
CDIO_MMC_FEATURE_PROF_NON_REMOVABLE = 0x0001, /**< Re-writable disc, capable
of changing behavior */
CDIO_MMC_FEATURE_PROF_REMOVABLE = 0x0002, /**< disk Re-writable; with
removable media */
CDIO_MMC_FEATURE_PROF_MO_ERASABLE = 0x0003, /**< Erasable Magneto-Optical
disk with sector erase
capability */
CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE = 0x0004, /**< Write Once Magneto-Optical
write once */
CDIO_MMC_FEATURE_PROF_AS_MO = 0x0005, /**< Advance Storage
Magneto-Optical */
CDIO_MMC_FEATURE_PROF_CD_ROM = 0x0008, /**< Read only Compact Disc
capable */
CDIO_MMC_FEATURE_PROF_CD_R = 0x0009, /**< Write once Compact Disc
capable */
CDIO_MMC_FEATURE_PROF_CD_RW = 0x000A, /**< CD-RW Re-writable
Compact Disc capable */
CDIO_MMC_FEATURE_PROF_DVD_ROM = 0x0010, /**< Read only DVD */
CDIO_MMC_FEATURE_PROF_DVD_R_SEQ = 0x0011, /**< Re-recordable DVD using
Sequential recording */
CDIO_MMC_FEATURE_PROF_DVD_RAM = 0x0012, /**< Re-writable DVD */
CDIO_MMC_FEATURE_PROF_DVD_RW_RO = 0x0013, /**< Re-recordable DVD using
Restricted Overwrite */
CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ = 0x0014, /**< Re-recordable DVD using
Sequential recording */
CDIO_MMC_FEATURE_PROF_DVD_R_DL_SEQ = 0x0015, /**< DVD-R/DL sequential
recording */
CDIO_MMC_FEATURE_PROF_DVD_R_DL_JR = 0x0016, /**< DVD-R/DL layer jump
recording */
CDIO_MMC_FEATURE_PROF_DVD_PRW = 0x001A, /**< DVD+RW - DVD ReWritable */
CDIO_MMC_FEATURE_PROF_DVD_PR = 0x001B, /**< DVD+R - DVD Recordable */
CDIO_MMC_FEATURE_PROF_DDCD_ROM = 0x0020, /**< Read only DDCD */
CDIO_MMC_FEATURE_PROF_DDCD_R = 0x0021, /**< DDCD-R Write only DDCD */
CDIO_MMC_FEATURE_PROF_DDCD_RW = 0x0022, /**< Re-Write only DDCD */
CDIO_MMC_FEATURE_PROF_DVD_PRW_DL = 0x002A, /**< "DVD+RW/DL */
CDIO_MMC_FEATURE_PROF_DVD_PR_DL = 0x002B, /**< DVD+R - DVD Recordable
double layer */
CDIO_MMC_FEATURE_PROF_BD_ROM = 0x0040, /**< BD-ROM */
CDIO_MMC_FEATURE_PROF_BD_SEQ = 0x0041, /**< BD-R sequential
recording */
CDIO_MMC_FEATURE_PROF_BD_R_RANDOM = 0x0042, /**< BD-R random recording */
CDIO_MMC_FEATURE_PROF_BD_RE = 0x0043, /**< BD-RE */
CDIO_MMC_FEATURE_PROF_HD_DVD_ROM = 0x0050, /**< HD-DVD-ROM */
CDIO_MMC_FEATURE_PROF_HD_DVD_R = 0x0051, /**< HD-DVD-R */
CDIO_MMC_FEATURE_PROF_HD_DVD_RAM = 0x0052, /**<"HD-DVD-RAM */
CDIO_MMC_FEATURE_PROF_NON_CONFORM = 0xFFFF, /**< The Logical Unit does not
conform to any Profile. */
} cdio_mmc_feature_profile_t;
/**
@param i_feature MMC feature number
@return string containing the name of the given feature
*/
const char *mmc_feature2str( int i_feature );
/**
Get drive capabilities for a device.
@param p_cdio the CD object to be acted upon.
@param p_read_cap list of read capabilities that are set on return
@param p_write_cap list of write capabilities that are set on return
@param p_misc_cap list of miscellaneous capabilities (that are neither
read nor write related) that are set on return
*/
void mmc_get_drive_cap ( CdIo_t *p_cdio,
/*out*/ cdio_drive_read_cap_t *p_read_cap,
/*out*/ cdio_drive_write_cap_t *p_write_cap,
/*out*/ cdio_drive_misc_cap_t *p_misc_cap);
/**
Return a string containing the name of the given feature
*/
const char *mmc_feature_profile2str( int i_feature_profile );
bool mmc_is_disctype_bd(cdio_mmc_feature_profile_t disctype);
bool mmc_is_disctype_cdrom(cdio_mmc_feature_profile_t disctype);
bool mmc_is_disctype_dvd(cdio_mmc_feature_profile_t disctype);
bool mmc_is_disctype_hd_dvd (cdio_mmc_feature_profile_t disctype);
bool mmc_is_disctype_overwritable (cdio_mmc_feature_profile_t disctype);
bool mmc_is_disctype_rewritable(cdio_mmc_feature_profile_t disctype);
/** The default read timeout is 3 minutes. */
#define MMC_READ_TIMEOUT_DEFAULT 3*60*1000
/**
Set this to the maximum value in milliseconds that we will
wait on an MMC read command.
*/
extern uint32_t mmc_read_timeout_ms;
/**
Maps a mmc_sense_key_t into a string name.
*/
extern const char mmc_sense_key2str[16][40];
/**
The default timeout (non-read) is 6 seconds.
*/
#define MMC_TIMEOUT_DEFAULT 6000
/**
Set this to the maximum value in milliseconds that we will
wait on an MMC command.
*/
extern uint32_t mmc_timeout_ms;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MMC_UTIL_H__ */
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
/*
$Id: posix.h,v 1.2 2008/03/25 15:59:09 karl Exp $
Copyright (C) 2005, 2008 Rocky Bernstein <rocky@gnu.org>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file posix.h
*
* \brief various POSIX definitions.
*/
#ifndef __CDIO_POSIX_H__
#define __CDIO_POSIX_H__
typedef uint32_t posix_mode_t;
typedef uint32_t posix_nlink_t;
typedef uint32_t posix_uid_t;
typedef uint32_t posix_gid_t;
typedef uint16_t unicode16_t;
#endif /* __CDIO_POSIX_H__ */
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
/*
$Id: read.h,v 1.15 2008/03/25 15:59:09 karl Exp $
Copyright (C) 2005, 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/** \file read.h
*
* \brief The top-level header for sector (block, frame)-related
* libcdio calls.
*/
#ifndef __CDIO_READ_H__
#define __CDIO_READ_H__
#ifndef EXTERNAL_LIBCDIO_CONFIG_H
#define EXTERNAL_LIBCDIO_CONFIG_H
/* Need for HAVE_SYS_TYPES_H */
#include <cdio/cdio_config.h>
#endif
#ifdef HAVE_SYS_TYPES_H
/* Some systems need this for off_t and ssize. */
#include <sys/types.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** All the different ways a block/sector can be read. */
typedef enum {
CDIO_READ_MODE_AUDIO, /**< CD-DA, audio, Red Book */
CDIO_READ_MODE_M1F1, /**< Mode 1 Form 1 */
CDIO_READ_MODE_M1F2, /**< Mode 1 Form 2 */
CDIO_READ_MODE_M2F1, /**< Mode 2 Form 1 */
CDIO_READ_MODE_M2F2 /**< Mode 2 Form 2 */
} cdio_read_mode_t;
/*!
Reposition read offset
Similar to (if not the same as) libc's fseek()
@param p_cdio object which gets adjusted
@param offset amount to seek
@param whence like corresponding parameter in libc's fseek, e.g.
SEEK_SET or SEEK_END.
@return (off_t) -1 on error.
*/
off_t cdio_lseek(const CdIo_t *p_cdio, off_t offset, int whence);
/*! Reads into buf the next size bytes. Similar to (if not the
same as) libc's read(). This is a "cooked" read, or one handled by
the OS. It probably won't work on audio data. For that use
cdio_read_audio_sector(s).
@param p_cdio object to read from
@param p_buf place to read data into. The caller should make sure
this location can store at least i_size bytes.
@param i_size number of bytes to read
@return (ssize_t) -1 on error.
*/
ssize_t cdio_read(const CdIo_t *p_cdio, void *p_buf, size_t i_size);
/*!
Read an audio sector
@param p_cdio object to read from
@param p_buf place to read data into. The caller should make sure
this location can store at least CDIO_FRAMESIZE_RAW
bytes.
@param i_lsn sector to read
*/
driver_return_code_t cdio_read_audio_sector (const CdIo_t *p_cdio,
void *p_buf, lsn_t i_lsn);
/*!
Reads audio sectors
@param p_cdio object to read from
@param p_buf place to read data into. The caller should make sure
this location can store at least CDIO_FRAMESIZE_RAW
* i_blocks bytes.
@param i_lsn sector to read
@param i_blocks number of sectors to read
*/
driver_return_code_t cdio_read_audio_sectors (const CdIo_t *p_cdio,
void *p_buf, lsn_t i_lsn,
uint32_t i_blocks);
/*!
Read data sectors
@param p_cdio object to read from
@param p_buf place to read data into. The caller should make sure
this location can store at least ISO_BLOCKSIZE,
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.
@param i_blocks number of blocks to read
*/
driver_return_code_t cdio_read_data_sectors ( const CdIo_t *p_cdio,
void *p_buf, lsn_t i_lsn,
uint16_t i_blocksize,
uint32_t i_blocks );
/*!
Reads a mode 1 sector
@param p_cdio object to read from
@param p_buf place to read data into.
@param i_lsn sector to read
@param b_form2 true for reading mode 1 form 2 sectors or false for
mode 1 form 1 sectors.
*/
driver_return_code_t cdio_read_mode1_sector (const CdIo_t *p_cdio,
void *p_buf, lsn_t i_lsn,
bool b_form2);
/*!
Reads mode 1 sectors
@param p_cdio object to read from
@param p_buf place to read data into
@param i_lsn sector to read
@param b_form2 true for reading mode 1 form 2 sectors or false for
mode 1 form 1 sectors.
@param i_blocks number of sectors to read
*/
driver_return_code_t cdio_read_mode1_sectors (const CdIo_t *p_cdio,
void *p_buf, lsn_t i_lsn,
bool b_form2,
uint32_t i_blocks);
/*!
Reads a mode 2 sector
@param p_cdio object to read from
@param p_buf place to read data into. The caller should make sure
this location can store at least
M2RAW_SECTOR_SIZE (for form 1) or CDIO_CD_FRAMESIZE (for
form 2) bytes.
@param i_lsn sector to read
@param b_form2 true for reading mode 2 form 2 sectors or false for
mode 2 form 1 sectors.
@return 0 if no error, nonzero otherwise.
*/
driver_return_code_t cdio_read_mode2_sector (const CdIo_t *p_cdio,
void *p_buf, lsn_t i_lsn,
bool b_form2);
/** The special case of reading a single block is a common one so we
provide a routine for that as a convenience.
*/
driver_return_code_t cdio_read_sector(const CdIo_t *p_cdio, void *p_buf,
lsn_t i_lsn,
cdio_read_mode_t read_mode);
/*!
Reads mode 2 sectors
@param p_cdio object to read from
@param p_buf place to read data into. The caller should make sure
this location can store at least
M2RAW_SECTOR_SIZE (for form 1) or CDIO_CD_FRAMESIZE (for
form 2) * i_blocks bytes.
@param i_lsn sector to read
@param b_form2 true for reading mode2 form 2 sectors or false for
mode 2 form 1 sectors.
@param i_blocks number of sectors to read
@return 0 if no error, nonzero otherwise.
*/
driver_return_code_t cdio_read_mode2_sectors (const CdIo_t *p_cdio,
void *p_buf, lsn_t i_lsn,
bool b_form2,
uint32_t i_blocks);
/*!
Reads a number of sectors (AKA blocks).
@param p_cdio cdio object
@param p_buf place to read data into. The caller should make sure
this location is large enough. See below for size information.
@param read_mode the kind of "mode" to use in reading.
@param i_lsn sector to read
@param i_blocks number of sectors to read
@return DRIVER_OP_SUCCESS (0) if no error, other (negative) enumerations
are returned on error.
If read_mode is CDIO_MODE_AUDIO,
*p_buf should hold at least CDIO_FRAMESIZE_RAW * i_blocks bytes.
If read_mode is CDIO_MODE_DATA,
*p_buf should hold at least i_blocks times either ISO_BLOCKSIZE,
M1RAW_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
which is M2RAW_SECTOR_SIZE.
If read_mode is CDIO_MODE_M2F1,
*p_buf should hold at least M2RAW_SECTOR_SIZE * i_blocks bytes.
If read_mode is CDIO_MODE_M2F2,
*p_buf should hold at least CDIO_CD_FRAMESIZE * i_blocks bytes.
*/
driver_return_code_t cdio_read_sectors(const CdIo_t *p_cdio, void *p_buf,
lsn_t i_lsn,
cdio_read_mode_t read_mode,
uint32_t i_blocks);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __CDIO_TRACK_H__ */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
$Id: utf8.h,v 1.2 2008/03/25 15:59:09 karl Exp $
Copyright (C) 2008 Rocky Bernstein <rocky@gnu.org>
Copyright (C) 2006 Burkhard Plaum <plaum@ipf.uni-stuttgart.de>
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 3 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, see <http://www.gnu.org/licenses/>.
*/
/* UTF-8 support */
#include <cdio/types.h>
/** \brief Opaque characterset converter
*/
typedef struct cdio_charset_coverter_s cdio_charset_coverter_t;
/** \brief Create a charset converter
* \param src_charset Source charset
* \param dst_charset Destination charset
* \returns A newly allocated charset converter
*/
cdio_charset_coverter_t *
cdio_charset_converter_create(const char * src_charset,
const char * dst_charset);
/** \brief Destroy a characterset converter
* \param cnv A characterset converter
*/
void cdio_charset_converter_destroy(cdio_charset_coverter_t*cnv);
/** \brief Convert a string from one character set to another
* \param cnv A charset converter
* \param src Source string
* \param src_len Length of source string
* \param dst Returns destination string
* \param dst_len If non NULL, returns the length of the destination string
* \returns true if conversion was sucessful, false else.
*
* The destination string must be freed by the caller with free().
* If you pass -1 for src_len, strlen() will be used.
*/
bool cdio_charset_convert(cdio_charset_coverter_t*cnv,
char * src, int src_len,
char ** dst, int * dst_len);
/** \brief Convert a string from UTF-8 to another charset
* \param src Source string (0 terminated)
* \param dst Returns destination string
* \param dst_len If non NULL, returns the length of the destination string
* \param dst_charset The characterset to convert to
* \returns true if conversion was sucessful, false else.
*
* This is a convenience function, which creates a charset converter,
* converts one string and destroys the charset converter.
*/
bool cdio_charset_from_utf8(cdio_utf8_t * src, char ** dst,
int * dst_len, const char * dst_charset);
/** \brief Convert a string from another charset to UTF-8
* \param src Source string
* \param src_len Length of the source string
* \param dst Returns destination string (0 terminated)
* \param src_charset The characterset to convert from
* \returns true if conversion was sucessful, false else.
*
* This is a convenience function, which creates a charset converter,
* converts one string and destroys the charset converter. If you pass -1
* for src_len, strlen() will be used.
*/
bool cdio_charset_to_utf8(char *src, size_t src_len, cdio_utf8_t **dst,
const char * src_charset);
此差异已折叠。
/* $Id: version.h.in,v 1.6 2005/01/29 20:54:20 rocky Exp $ */
/** \file version.h
*
* \brief A file containing the libcdio package version
* number (84) and OS build name.
*/
/*! CDIO_VERSION is a C-Preprocessor macro of a string that shows what
version is used. cdio_version_string has the same value, but it is a
constant variable that can be accessed at run time. */
#define CDIO_VERSION "0.84git i686-pc-mingw32"
extern const char *cdio_version_string; /**< = CDIO_VERSION */
/*! LIBCDIO_VERSION_NUM is a C-Preprocessor macro that can be used for
testing in the C preprocessor. libcdio_version_num has the same
value, but it is a constant variable that can be accessed at run
time. */
#define LIBCDIO_VERSION_NUM 84
extern const unsigned int libcdio_version_num; /**< = LIBCDIO_VERSION_NUM */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -29,8 +29,8 @@
#define _INTTYPES_H_
#include <stdint.h>
/* SysLinux types addon */
#include <sltypes.h>
/* Workaround - TODO: move this include back into source */
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册