2003-04-21 10:17:50 +00:00
|
|
|
|
/* -*- c -*-
|
2005-01-05 04:16:11 +00:00
|
|
|
|
$Id: cdio.h,v 1.74 2005/01/05 04:16:11 rocky Exp $
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
2005-01-04 04:33:36 +00:00
|
|
|
|
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2003-11-17 12:06:56 +00:00
|
|
|
|
/** \file cdio.h
|
|
|
|
|
|
* \brief The top-level header for libcdio: the CD Input and Control library.
|
|
|
|
|
|
*/
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __CDIO_H__
|
|
|
|
|
|
#define __CDIO_H__
|
|
|
|
|
|
|
2003-11-04 12:28:08 +00:00
|
|
|
|
/** Application Interface or Protocol version number. If the public
|
|
|
|
|
|
* interface changes, we increase this number.
|
2003-04-19 09:02:30 +00:00
|
|
|
|
*/
|
2004-12-15 01:45:15 +00:00
|
|
|
|
#define CDIO_API_VERSION 3
|
2003-04-19 09:02:30 +00:00
|
|
|
|
|
2003-04-22 12:09:08 +00:00
|
|
|
|
#include <cdio/version.h>
|
2003-04-19 09:13:06 +00:00
|
|
|
|
|
2003-03-29 17:32:00 +00:00
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2003-04-22 12:09:08 +00:00
|
|
|
|
#include <cdio/types.h>
|
|
|
|
|
|
#include <cdio/sector.h>
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
2005-01-02 22:43:41 +00:00
|
|
|
|
/* For compatability. */
|
|
|
|
|
|
#define CdIo CdIo_t
|
|
|
|
|
|
|
2004-07-11 14:25:07 +00:00
|
|
|
|
/** This is an opaque structure for the CD object. */
|
2005-01-02 22:43:41 +00:00
|
|
|
|
typedef struct _CdIo CdIo_t;
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
/** This is an opaque structure for the CD-Text object. */
|
2004-07-11 14:25:07 +00:00
|
|
|
|
typedef struct cdtext cdtext_t;
|
|
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
2004-05-11 12:17:17 +00:00
|
|
|
|
Get the value associatied with key.
|
|
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@param p_cdio the CD object queried
|
2004-05-11 12:17:17 +00:00
|
|
|
|
@param key the key to retrieve
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@return the value associatd with "key" or NULL if p_cdio is NULL
|
2003-05-18 01:50:51 +00:00
|
|
|
|
or "key" does not exist.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
const char * cdio_get_arg (const CdIo_t *p_cdio, const char key[]);
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2005-01-02 22:43:41 +00:00
|
|
|
|
off_t cdio_lseek(const CdIo_t *p_cdio, off_t offset, int whence);
|
2003-03-29 17:32:00 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Reads into buf the next size bytes.
|
|
|
|
|
|
Similar to (if not the same as) libc's read()
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
|
|
|
|
|
@return (ssize_t) -1 on error.
|
2003-03-29 17:32:00 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
ssize_t cdio_read(const CdIo_t *p_cdio, void *buf, size_t size);
|
2003-03-29 17:32:00 +00:00
|
|
|
|
|
2003-04-10 04:13:41 +00:00
|
|
|
|
/*!
|
2004-05-11 12:17:17 +00:00
|
|
|
|
Read an audio sector
|
|
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@param p_cdio object to read from
|
2004-05-11 12:17:17 +00:00
|
|
|
|
@param buf place to read data into
|
|
|
|
|
|
@param lsn sector to read
|
|
|
|
|
|
|
|
|
|
|
|
@return 0 if no error, nonzero otherwise.
|
2003-11-04 12:28:08 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
int cdio_read_audio_sector (const CdIo_t *p_cdio, void *buf, lsn_t lsn);
|
2003-04-10 04:13:41 +00:00
|
|
|
|
|
2003-09-20 12:34:02 +00:00
|
|
|
|
/*!
|
2004-05-11 12:17:17 +00:00
|
|
|
|
Reads audio sectors
|
|
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@param p_cdio object to read from
|
2004-05-11 12:17:17 +00:00
|
|
|
|
@param buf place to read data into
|
|
|
|
|
|
@param lsn sector to read
|
2004-06-06 11:45:37 +00:00
|
|
|
|
@param i_sectors number of sectors to read
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
|
|
|
|
|
@return 0 if no error, nonzero otherwise.
|
2003-11-04 12:28:08 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
int cdio_read_audio_sectors (const CdIo_t *p_cdio, void *buf, lsn_t lsn,
|
2004-06-06 11:45:37 +00:00
|
|
|
|
unsigned int i_sectors);
|
2003-09-20 12:34:02 +00:00
|
|
|
|
|
2003-06-07 20:42:49 +00:00
|
|
|
|
/*!
|
2004-12-18 17:29:32 +00:00
|
|
|
|
Reads a mode 1 sector
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@param p_cdio object to read from
|
2004-05-11 12:17:17 +00:00
|
|
|
|
@param buf place to read data into
|
|
|
|
|
|
@param lsn sector to read
|
2004-12-18 17:29:32 +00:00
|
|
|
|
@param b_form2 true for reading mode1 form 2 sectors or false for
|
|
|
|
|
|
mode 1 form 1 sectors.
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
|
|
|
|
|
@return 0 if no error, nonzero otherwise.
|
2003-11-04 12:28:08 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
int cdio_read_mode1_sector (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
2004-03-06 18:30:44 +00:00
|
|
|
|
bool b_form2);
|
2003-11-04 12:28:08 +00:00
|
|
|
|
|
2003-08-31 14:26:06 +00:00
|
|
|
|
/*!
|
2004-12-18 17:29:32 +00:00
|
|
|
|
Reads mode 1 sectors
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@param p_cdio object to read from
|
2004-05-11 12:17:17 +00:00
|
|
|
|
@param buf place to read data into
|
|
|
|
|
|
@param lsn sector to read
|
2004-12-18 17:29:32 +00:00
|
|
|
|
@param b_form2 true for reading mode 1 form 2 sectors or false for
|
|
|
|
|
|
mode 1 form 1 sectors.
|
2004-06-06 11:45:37 +00:00
|
|
|
|
@param i_sectors number of sectors to read
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
|
|
|
|
|
@return 0 if no error, nonzero otherwise.
|
2003-11-04 12:28:08 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
int cdio_read_mode1_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
2004-06-06 11:45:37 +00:00
|
|
|
|
bool b_form2, unsigned int i_sectors);
|
2003-11-04 12:28:08 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
2004-12-18 17:29:32 +00:00
|
|
|
|
Reads a mode 2 sector
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@param p_cdio object to read from
|
2004-05-11 12:17:17 +00:00
|
|
|
|
@param buf place to read data into
|
|
|
|
|
|
@param lsn sector to read
|
2004-12-18 17:29:32 +00:00
|
|
|
|
@param b_form2 true for reading mode 2 form 2 sectors or false for
|
|
|
|
|
|
mode 2 form 1 sectors.
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
|
|
|
|
|
@return 0 if no error, nonzero otherwise.
|
2003-11-04 12:28:08 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
int cdio_read_mode2_sector (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
2004-03-06 18:30:44 +00:00
|
|
|
|
bool b_form2);
|
2003-11-04 12:28:08 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
2004-12-18 17:29:32 +00:00
|
|
|
|
Reads mode 2 sectors
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@param p_cdio object to read from
|
2004-05-11 12:17:17 +00:00
|
|
|
|
@param buf place to read data into
|
|
|
|
|
|
@param lsn sector to read
|
2004-12-18 17:29:32 +00:00
|
|
|
|
@param b_form2 true for reading mode2 form 2 sectors or false for
|
|
|
|
|
|
mode 2 form 1 sectors.
|
2004-06-06 11:45:37 +00:00
|
|
|
|
@param i_sectors number of sectors to read
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
|
|
|
|
|
@return 0 if no error, nonzero otherwise.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
int cdio_read_mode2_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
2004-06-06 11:45:37 +00:00
|
|
|
|
bool b_form2, unsigned int i_sectors);
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
2004-12-18 17:29:32 +00:00
|
|
|
|
Set the arg "key" with "value" in "p_cdio".
|
2004-05-11 12:17:17 +00:00
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@param p_cdio the CD object to set
|
2004-05-11 12:17:17 +00:00
|
|
|
|
@param key the key to set
|
|
|
|
|
|
@param value the value to assocaiate with key
|
|
|
|
|
|
@return 0 if no error was found, and nonzero otherwise.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
int cdio_set_arg (CdIo_t *p_cdio, const char key[], const char value[]);
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/*!
|
2004-05-11 12:17:17 +00:00
|
|
|
|
Get the size of the CD in logical block address (LBA) units.
|
|
|
|
|
|
|
2004-09-04 23:49:47 +00:00
|
|
|
|
@param p_cdio the CD object queried
|
2004-05-11 12:17:17 +00:00
|
|
|
|
@return the size
|
2003-03-24 19:01:09 +00:00
|
|
|
|
*/
|
2005-01-02 22:43:41 +00:00
|
|
|
|
uint32_t cdio_stat_size (const CdIo_t *p_cdio);
|
2003-11-04 12:28:08 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Initialize CD Reading and control routines. Should be called first.
|
2003-11-04 12:28:08 +00:00
|
|
|
|
*/
|
2003-03-24 19:01:09 +00:00
|
|
|
|
bool cdio_init(void);
|
2003-11-04 12:28:08 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
2005-01-04 10:58:03 +00:00
|
|
|
|
/* CD-Text-related functions. */
|
|
|
|
|
|
#include <cdio/cdtext.h>
|
|
|
|
|
|
|
2004-12-31 05:47:36 +00:00
|
|
|
|
/* Track-related functions. */
|
|
|
|
|
|
#include <cdio/track.h>
|
2005-01-04 10:58:03 +00:00
|
|
|
|
|
2005-01-04 04:33:36 +00:00
|
|
|
|
/* Disc-related functions. */
|
|
|
|
|
|
#include <cdio/disc.h>
|
2004-12-31 05:47:36 +00:00
|
|
|
|
|
2005-01-04 10:58:03 +00:00
|
|
|
|
/* Drive(r)/Device-related functions. Perhaps we should break out
|
|
|
|
|
|
Driver from device?
|
|
|
|
|
|
*/
|
|
|
|
|
|
#include <cdio/device.h>
|
|
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
#endif /* __CDIO_H__ */
|