lib/cdio++/Makeifle.am iso9660.hpp iso9660_stub.cpp: start C++ libiso9660 library
iso9660.h: documentation changes. device.hpp: reduce number of methods stub.cpp->cdio_stub.cpp
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
$Id: device.cpp,v 1.1 2005/07/15 21:38:57 rocky Exp $
|
||||
$Id: device.cpp,v 1.2 2006/03/05 06:52:15 rocky Exp $
|
||||
|
||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -19,7 +19,9 @@
|
||||
*/
|
||||
|
||||
/* Simple program to show drivers installed and what the default
|
||||
CD-ROM drive is. */
|
||||
CD-ROM drive is. See also corresponding C program of a similar
|
||||
name. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- C++ -*-
|
||||
$Id: cdio.hpp,v 1.8 2006/02/02 04:37:29 rocky Exp $
|
||||
$Id: cdio.hpp,v 1.9 2006/03/05 06:52:15 rocky Exp $
|
||||
|
||||
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -174,9 +174,9 @@ class CdioDevice
|
||||
{
|
||||
|
||||
public:
|
||||
CdioDevice(CdIo_t *p = (CdIo_t *) NULL)
|
||||
CdioDevice()
|
||||
{
|
||||
p_cdio=p;
|
||||
p_cdio = (CdIo_t *) NULL;
|
||||
};
|
||||
|
||||
~CdioDevice()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- C++ -*-
|
||||
$Id: device.hpp,v 1.5 2006/01/25 07:21:52 rocky Exp $
|
||||
$Id: device.hpp,v 1.6 2006/03/05 06:52:15 rocky Exp $
|
||||
|
||||
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -195,7 +195,7 @@ haveATAPI ()
|
||||
|
||||
Sets up to read from the device specified by psz_source. An open
|
||||
routine should be called before using any read routine. If device
|
||||
object was previously opened it is "closed".
|
||||
object was previously opened it is closed first.
|
||||
|
||||
@return true if open succeeded or false if error.
|
||||
|
||||
@@ -208,21 +208,6 @@ open(const char *psz_source)
|
||||
return NULL != p_cdio ;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets up to read from the device specified by psz_source and
|
||||
driver_id. An open routine should be called before using any read
|
||||
routine. If device object was previously opened it is "closed".
|
||||
|
||||
@return true if open succeeded or false if error.
|
||||
*/
|
||||
bool
|
||||
open (const char *psz_source, driver_id_t driver_id)
|
||||
{
|
||||
if (p_cdio) cdio_destroy(p_cdio);
|
||||
p_cdio = cdio_open(psz_source, driver_id);
|
||||
return NULL != p_cdio ;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Sets up to read from the device specified by psz_source and access
|
||||
@@ -233,10 +218,13 @@ open (const char *psz_source, driver_id_t driver_id)
|
||||
*/
|
||||
bool
|
||||
open (const char *psz_source, driver_id_t driver_id,
|
||||
const char *psz_access_mode)
|
||||
const char *psz_access_mode = (const char *) NULL)
|
||||
{
|
||||
if (p_cdio) cdio_destroy(p_cdio);
|
||||
if (psz_access_mode)
|
||||
p_cdio = cdio_open_am(psz_source, driver_id, psz_access_mode);
|
||||
else
|
||||
p_cdio = cdio_open(psz_source, driver_id);
|
||||
return NULL != p_cdio ;
|
||||
}
|
||||
|
||||
|
||||
142
include/cdio++/iso9660.hpp
Normal file
142
include/cdio++/iso9660.hpp
Normal file
@@ -0,0 +1,142 @@
|
||||
/* -*- C++ -*-
|
||||
$Id: iso9660.hpp,v 1.1 2006/03/05 06:52:15 rocky Exp $
|
||||
|
||||
Copyright (C) 2006 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
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
|
||||
*/
|
||||
|
||||
/** \file iso966o.hpp
|
||||
*
|
||||
* \brief C++ class for libcdio: the CD Input and Control
|
||||
* library. Applications use this for anything regarding libcdio.
|
||||
*/
|
||||
|
||||
#ifndef __ISO9660_HPP__
|
||||
#define __ISO9660_HPP__
|
||||
|
||||
#include <cdio/iso9660.h>
|
||||
|
||||
/** ISO 9660 class.
|
||||
*/
|
||||
class ISO9660
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
class IFS
|
||||
{
|
||||
|
||||
IFS()
|
||||
{
|
||||
p_iso9660=NULL;
|
||||
};
|
||||
|
||||
~IFS()
|
||||
{
|
||||
iso9660_close(p_iso9660);
|
||||
p_iso9660 = (iso9660_t *) NULL;
|
||||
};
|
||||
|
||||
/*! Close previously opened ISO 9660 image and free resources
|
||||
associated with the image. Call this when done using using an ISO
|
||||
9660 image.
|
||||
|
||||
@return true is unconditionally returned. If there was an error
|
||||
false would be returned.
|
||||
*/
|
||||
bool
|
||||
close()
|
||||
{
|
||||
iso9660_close(p_iso9660);
|
||||
p_iso9660 = (iso9660_t *) NULL;
|
||||
return true;
|
||||
};
|
||||
|
||||
/*! Open an ISO 9660 image for reading. Maybe in the future we will
|
||||
have a mode. NULL is returned on error. An open routine should be
|
||||
called before using any read routine. If device object was
|
||||
previously opened it is closed first.
|
||||
|
||||
@param psz_path location of ISO 9660 image
|
||||
@param iso_extension_mask the kinds of ISO 9660 extensions will be
|
||||
considered on access.
|
||||
|
||||
@return true if open succeeded or false if error.
|
||||
|
||||
@see open_fuzzy
|
||||
*/
|
||||
bool
|
||||
open(const char *psz_path,
|
||||
iso_extension_mask_t iso_extension_mask=ISO_EXTENSION_NONE)
|
||||
{
|
||||
if (p_iso9660) iso9660_close(p_iso9660);
|
||||
p_iso9660 = iso9660_open_ext(psz_path, iso_extension_mask);
|
||||
return NULL != (iso9660_t *) p_iso9660 ;
|
||||
};
|
||||
|
||||
/*! Open an ISO 9660 image for "fuzzy" reading. This means that we
|
||||
will try to guess various internal offset based on internal
|
||||
checks. This may be useful when trying to read an ISO 9660 image
|
||||
contained in a file format that libiso9660 doesn't know natively
|
||||
(or knows imperfectly.)
|
||||
|
||||
Maybe in the future we will have a mode. NULL is returned on
|
||||
error.
|
||||
|
||||
@see open
|
||||
*/
|
||||
bool
|
||||
open_fuzzy (const char *psz_path,
|
||||
iso_extension_mask_t iso_extension_mask=ISO_EXTENSION_NONE,
|
||||
uint16_t i_fuzz=20)
|
||||
{
|
||||
p_iso9660 = iso9660_open_fuzzy_ext(psz_path, iso_extension_mask, i_fuzz);
|
||||
//return p_iso9660 != (iso9660_t *) NULL;
|
||||
return true;
|
||||
};
|
||||
|
||||
/*!
|
||||
Read the Super block of an ISO 9660 image but determine framesize
|
||||
and datastart and a possible additional offset. Generally here we are
|
||||
not reading an ISO 9660 image but a CD-Image which contains an ISO 9660
|
||||
filesystem.
|
||||
*/
|
||||
bool
|
||||
fuzzy_read_superblock (iso_extension_mask_t iso_extension_mask=
|
||||
ISO_EXTENSION_NONE,
|
||||
uint16_t i_fuzz=20)
|
||||
{
|
||||
return iso9660_ifs_fuzzy_read_superblock (p_iso9660, iso_extension_mask,
|
||||
i_fuzz);
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
Seek to a position and then read n bytes. Size read is returned.
|
||||
*/
|
||||
long int seek_read (void *ptr, lsn_t start, long int i_size=1)
|
||||
{
|
||||
return iso9660_iso_seek_read (p_iso9660, ptr, start, i_size);
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
iso9660_t *p_iso9660;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif /* __ISO9660_HPP__ */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: iso9660.h,v 1.83 2006/03/02 18:59:13 rocky Exp $
|
||||
$Id: iso9660.h,v 1.84 2006/03/05 06:52:15 rocky Exp $
|
||||
|
||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||
@@ -532,6 +532,16 @@ extern enum iso_extension_enum_s {
|
||||
/** This is an opaque structure. */
|
||||
typedef struct _iso9660_s iso9660_t;
|
||||
|
||||
/*! Close previously opened ISO 9660 image and free resources
|
||||
associated with the image. Call this when done using using an ISO
|
||||
9660 image.
|
||||
|
||||
@return true is unconditionally returned. If there was an error
|
||||
false would be returned.
|
||||
*/
|
||||
bool iso9660_close (iso9660_t * p_iso);
|
||||
|
||||
|
||||
/*!
|
||||
Open an ISO 9660 image for reading. Maybe in the future we will have
|
||||
a mode. NULL is returned on error.
|
||||
@@ -542,18 +552,25 @@ typedef struct _iso9660_s iso9660_t;
|
||||
Open an ISO 9660 image for reading allowing various ISO 9660
|
||||
extensions. Maybe in the future we will have a mode. NULL is
|
||||
returned on error.
|
||||
|
||||
@see iso9660_open_fuzzy
|
||||
*/
|
||||
iso9660_t *iso9660_open_ext (const char *psz_path,
|
||||
iso_extension_mask_t iso_extension_mask);
|
||||
|
||||
/*!
|
||||
Open an ISO 9660 image for reading with some tolerence for positioning
|
||||
of the ISO9660 image. We scan for ISO_STANDARD_ID and use that to set
|
||||
the eventual offset to adjust by (as long as that is <= i_fuzz).
|
||||
/*! Open an ISO 9660 image for "fuzzy" reading. This means that we
|
||||
will try to guess various internal offset based on internal
|
||||
checks. This may be useful when trying to read an ISO 9660 image
|
||||
contained in a file format that libiso9660 doesn't know natively
|
||||
(or knows imperfectly.)
|
||||
|
||||
Some tolerence allowed for positioning the ISO 9660 image. We scan
|
||||
for STANDARD_ID and use that to set the eventual offset to adjust
|
||||
by (as long as that is <= i_fuzz).
|
||||
|
||||
Maybe in the future we will have a mode. NULL is returned on error.
|
||||
|
||||
@see iso9660_open
|
||||
@see iso9660_open, @see iso9660_fuzzy_ext
|
||||
*/
|
||||
iso9660_t *iso9660_open_fuzzy (const char *psz_path /*flags, mode */,
|
||||
uint16_t i_fuzz);
|
||||
@@ -565,7 +582,7 @@ typedef struct _iso9660_s iso9660_t;
|
||||
|
||||
Maybe in the future we will have a mode. NULL is returned on error.
|
||||
|
||||
@see iso9660_open
|
||||
@see iso9660_open_ext @see iso9660_open_fuzzy
|
||||
*/
|
||||
iso9660_t *iso9660_open_fuzzy_ext (const char *psz_path,
|
||||
iso_extension_mask_t iso_extension_mask,
|
||||
@@ -582,14 +599,6 @@ typedef struct _iso9660_s iso9660_t;
|
||||
iso_extension_mask_t iso_extension_mask,
|
||||
uint16_t i_fuzz);
|
||||
|
||||
/*!
|
||||
Close previously opened ISO 9660 image.
|
||||
True is unconditionally returned. If there was an error false would
|
||||
be returned.
|
||||
*/
|
||||
bool iso9660_close (iso9660_t * p_iso);
|
||||
|
||||
|
||||
/*!
|
||||
Seek to a position and then read n bytes. Size read is returned.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.am,v 1.1 2005/11/10 11:11:16 rocky Exp $
|
||||
# $Id: Makefile.am,v 1.2 2006/03/05 06:52:15 rocky Exp $
|
||||
#
|
||||
# Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||
#
|
||||
@@ -42,15 +42,24 @@
|
||||
# public release, then set AGE to 0. A changed interface means an
|
||||
# incompatibility with previous versions.
|
||||
|
||||
lib_LTLIBRARIES = libcdio++.la
|
||||
lib_LTLIBRARIES = libiso9660pp.la libcdio++.la
|
||||
|
||||
libcdiopp_la_CURRENT := 0
|
||||
libcdiopp_la_REVISION := 0
|
||||
libcdiopp_la_AGE := 0
|
||||
|
||||
libcdiopp_sources = stub.cpp
|
||||
libcdiopp_sources = cdio_stub.cpp
|
||||
|
||||
libcdio___la_SOURCES = $(libcdiopp_sources)
|
||||
libcdio___la_ldflags = -version-info $(libcdiopp_la_CURRENT):$(libcdiopp_la_REVISION):$(libcdiopp_la_AGE)
|
||||
|
||||
libiso9660pp_la_CURRENT := 0
|
||||
libiso9660pp_la_REVISION := 0
|
||||
libiso9660pp_la_AGE := 0
|
||||
|
||||
libiso9660pp_sources = iso9660_stub.cpp
|
||||
|
||||
libiso9660pp_la_SOURCES = $(libiso9660pp_sources)
|
||||
libiso9660pp_la_ldflags = -version-info $(libiso9660pp_la_CURRENT):$(libiso9660pp_la_REVISION):$(libiso9660pp_la_AGE)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include/
|
||||
|
||||
3
lib/cdio++/iso9660_stub.cpp
Normal file
3
lib/cdio++/iso9660_stub.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#include <sys/types.h>
|
||||
#include <cdio++/iso9660.hpp>
|
||||
|
||||
Reference in New Issue
Block a user