fpc/packages/cdrom
marco e831fde4b6 --- Merging r29409 into '.':
U    packages/zorba/Makefile
U    packages/zorba/Makefile.fpc
U    packages/rtl-extra/Makefile.fpc
U    packages/rtl-extra/Makefile
U    packages/opengl/Makefile
U    packages/opengl/Makefile.fpc
U    packages/fcl-extra/Makefile
U    packages/fcl-extra/Makefile.fpc
U    packages/os2units/Makefile
U    packages/os2units/Makefile.fpc
U    packages/gnome1/Makefile.fpc
U    packages/gnome1/Makefile
U    packages/imlib/Makefile
U    packages/imlib/Makefile.fpc
U    packages/sqlite/Makefile.fpc
U    packages/sqlite/Makefile
U    packages/graph/Makefile
U    packages/graph/Makefile.fpc
U    packages/unzip/Makefile.fpc
U    packages/unzip/Makefile
U    packages/uuid/Makefile
U    packages/uuid/Makefile.fpc
U    packages/fftw/Makefile
U    packages/fftw/Makefile.fpc
U    packages/librsvg/Makefile
U    packages/librsvg/Makefile.fpc
U    packages/libvlc/Makefile.fpc
U    packages/libvlc/Makefile
U    packages/rtl-objpas/Makefile
U    packages/rtl-objpas/Makefile.fpc
U    packages/nvapi/Makefile.fpc
U    packages/nvapi/Makefile
U    packages/sndfile/Makefile.fpc
U    packages/sndfile/Makefile
U    packages/svgalib/Makefile
U    packages/svgalib/Makefile.fpc
U    packages/bfd/Makefile.fpc
U    packages/bfd/Makefile
U    packages/proj4/Makefile.fpc
U    packages/proj4/Makefile
U    packages/iosxlocale/Makefile
U    packages/iosxlocale/Makefile.fpc
U    packages/paszlib/Makefile.fpc
U    packages/paszlib/Makefile
U    packages/libgbafpc/Makefile
U    packages/libgbafpc/Makefile.fpc
U    packages/fcl-registry/Makefile
U    packages/fcl-registry/Makefile.fpc
U    packages/regexpr/Makefile
U    packages/regexpr/Makefile.fpc
U    packages/libtar/Makefile.fpc
U    packages/libtar/Makefile
U    packages/newt/Makefile
U    packages/newt/Makefile.fpc
U    packages/xforms/Makefile.fpc
U    packages/xforms/Makefile
U    packages/openal/Makefile
U    packages/openal/Makefile.fpc
U    packages/aspell/Makefile
U    packages/aspell/Makefile.fpc
U    packages/jni/Makefile.fpc
U    packages/jni/Makefile
U    packages/libgd/Makefile
U    packages/libgd/Makefile.fpc
U    packages/symbolic/Makefile.fpc
U    packages/symbolic/Makefile
U    packages/ncurses/Makefile
U    packages/ncurses/Makefile.fpc
U    packages/sdl/Makefile
U    packages/sdl/Makefile.fpc
U    packages/arosunits/Makefile.fpc
U    packages/arosunits/Makefile
U    packages/fcl-net/Makefile
U    packages/fcl-net/Makefile.fpc
U    packages/fcl-res/Makefile
U    packages/fcl-res/Makefile.fpc
U    packages/mad/Makefile
U    packages/mad/Makefile.fpc
U    packages/oracle/Makefile
U    packages/oracle/Makefile.fpc
U    packages/dblib/Makefile
U    packages/dblib/Makefile.fpc
U    packages/palmunits/Makefile.fpc
U    packages/palmunits/Makefile
U    packages/fcl-js/Makefile.fpc
U    packages/fcl-js/Makefile
U    packages/ldap/Makefile
U    packages/ldap/Makefile.fpc
U    packages/matroska/Makefile
U    packages/matroska/Makefile.fpc
U    packages/tcl/Makefile.fpc
U    packages/tcl/Makefile
U    packages/ibase/Makefile
U    packages/ibase/Makefile.fpc
U    packages/hash/Makefile
U    packages/hash/Makefile.fpc
U    packages/gmp/Makefile.fpc
U    packages/gmp/Makefile
U    packages/openssl/Makefile
U    packages/openssl/Makefile.fpc
U    packages/utmp/Makefile.fpc
U    packages/utmp/Makefile
C    packages/bzip2/Makefile
U    packages/bzip2/Makefile.fpc
U    packages/httpd13/Makefile
U    packages/httpd13/Makefile.fpc
U    packages/a52/Makefile.fpc
U    packages/a52/Makefile
U    packages/fcl-sdo/Makefile.fpc
U    packages/fcl-sdo/Makefile
U    packages/winunits-base/Makefile
U    packages/winunits-base/Makefile.fpc
U    packages/fcl-sound/Makefile.fpc
U    packages/fcl-sound/Makefile
U    packages/libcurl/Makefile
U    packages/libcurl/Makefile.fpc
U    packages/dbus/Makefile
U    packages/dbus/Makefile.fpc
U    packages/libsee/Makefile
U    packages/libsee/Makefile.fpc
U    packages/fcl-stl/Makefile.fpc
U    packages/fcl-stl/Makefile
U    packages/libndsfpc/Makefile.fpc
U    packages/libndsfpc/Makefile
U    packages/mysql/Makefile.fpc
U    packages/mysql/Makefile
U    packages/gdbint/Makefile
U    packages/gdbint/Makefile.fpc
U    packages/fcl-base/Makefile.fpc
U    packages/fcl-base/Makefile
U    packages/opengles/Makefile.fpc
U    packages/opengles/Makefile
U    packages/fcl-web/Makefile
U    packages/fcl-web/Makefile.fpc
U    packages/opencl/Makefile
U    packages/opencl/Makefile.fpc
U    packages/hermes/Makefile
U    packages/hermes/Makefile.fpc
U    packages/httpd20/Makefile.fpc
U    packages/httpd20/Makefile
U    packages/ptc/Makefile
U    packages/ptc/Makefile.fpc
U    packages/httpd22/Makefile.fpc
U    packages/httpd22/Makefile
U    packages/ami-extra/Makefile
U    packages/ami-extra/Makefile.fpc
U    packages/fcl-db/Makefile
U    packages/fcl-db/Makefile.fpc
U    packages/libogcfpc/Makefile
U    packages/libogcfpc/Makefile.fpc
U    packages/winunits-jedi/Makefile.fpc
U    packages/winunits-jedi/Makefile
U    packages/httpd24/Makefile.fpc
U    packages/httpd24/Makefile
U    packages/dts/Makefile.fpc
U    packages/dts/Makefile
U    packages/univint/Makefile
U    packages/univint/Makefile.fpc
U    packages/cocoaint/Makefile
U    packages/cocoaint/Makefile.fpc
U    packages/rtl-console/Makefile
U    packages/rtl-console/Makefile.fpc
U    packages/gtk1/Makefile.fpc
U    packages/gtk1/Makefile
U    packages/ggi/Makefile.fpc
U    packages/ggi/Makefile
U    packages/gtk2/Makefile
U    packages/gtk2/Makefile.fpc
U    packages/odbc/Makefile
U    packages/odbc/Makefile.fpc
U    packages/morphunits/Makefile
U    packages/morphunits/Makefile.fpc
U    packages/gdbm/Makefile
U    packages/gdbm/Makefile.fpc
U    packages/pthreads/Makefile
U    packages/pthreads/Makefile.fpc
U    packages/fcl-json/Makefile
U    packages/fcl-json/Makefile.fpc
U    packages/amunits/Makefile.fpc
U    packages/amunits/Makefile
U    packages/unixutil/Makefile
U    packages/unixutil/Makefile.fpc
U    packages/lua/Makefile.fpc
U    packages/lua/Makefile
U    packages/pcap/Makefile.fpc
U    packages/pcap/Makefile
U    packages/fcl-image/Makefile.fpc
U    packages/fcl-image/Makefile
U    packages/numlib/Makefile
U    packages/numlib/Makefile.fpc
U    packages/winceunits/Makefile.fpc
U    packages/winceunits/Makefile
U    packages/pasjpeg/Makefile
U    packages/pasjpeg/Makefile.fpc
U    packages/zlib/Makefile.fpc
U    packages/zlib/Makefile
U    packages/fuse/Makefile
U    packages/fuse/Makefile.fpc
U    packages/iconvenc/Makefile
U    packages/iconvenc/Makefile.fpc
U    packages/chm/Makefile.fpc
U    packages/chm/Makefile
U    packages/libc/Makefile
U    packages/libc/Makefile.fpc
U    packages/x11/Makefile
U    packages/x11/Makefile.fpc
U    packages/pxlib/Makefile
U    packages/pxlib/Makefile.fpc
U    packages/fpindexer/Makefile
U    packages/fpindexer/Makefile.fpc
U    packages/libxml/Makefile.fpc
U    packages/libxml/Makefile
U    packages/imagemagick/Makefile
U    packages/imagemagick/Makefile.fpc
U    packages/objcrtl/Makefile
U    packages/objcrtl/Makefile.fpc
U    packages/oggvorbis/Makefile.fpc
U    packages/oggvorbis/Makefile
U    packages/users/Makefile.fpc
U    packages/users/Makefile
U    packages/fcl-xml/Makefile
U    packages/fcl-xml/Makefile.fpc
U    packages/fcl-fpcunit/Makefile.fpc
U    packages/fcl-fpcunit/Makefile
U    packages/fpgtk/Makefile.fpc
U    packages/fpgtk/Makefile
U    packages/libpng/Makefile
U    packages/libpng/Makefile.fpc
U    packages/fcl-async/Makefile
U    packages/fcl-async/Makefile.fpc
U    packages/fastcgi/Makefile.fpc
U    packages/fastcgi/Makefile
U    packages/fcl-process/Makefile
U    packages/fcl-process/Makefile.fpc
U    packages/syslog/Makefile.fpc
U    packages/syslog/Makefile
C    packages/pastojs/Makefile
U    packages/pastojs/Makefile.fpc
U    packages/rtl-unicode/Makefile
U    packages/rtl-unicode/Makefile.fpc
U    packages/rexx/Makefile.fpc
U    packages/rexx/Makefile
U    packages/fcl-passrc/Makefile.fpc
U    packages/fcl-passrc/Makefile
U    packages/cairo/Makefile
U    packages/cairo/Makefile.fpc
U    packages/cdrom/Makefile
U    packages/cdrom/Makefile.fpc
U    packages/postgres/Makefile
U    packages/postgres/Makefile.fpc
U    packages/modplug/Makefile.fpc
U    packages/modplug/Makefile
U    packages/fppkg/Makefile.fpc
U    packages/fppkg/Makefile
U    packages/fv/Makefile.fpc
U    packages/fv/Makefile
Summary of conflicts:
  Text conflicts: 2

# revisions: 29409

git-svn-id: branches/fixes_3_0@29414 -
2015-01-05 13:51:02 +00:00
..
examples * mipsel-android: Regenerated makefiles. From now the mipsel-android target can be built and used. 2014-02-07 12:37:17 +00:00
src * use dynlibs and -A versions 2013-06-01 09:17:51 +00:00
fpmake.pp * Use short 8.3 names for archives on limit83fs-hosts 2014-11-28 21:35:46 +00:00
Makefile --- Merging r29409 into '.': 2015-01-05 13:51:02 +00:00
Makefile.fpc --- Merging r29409 into '.': 2015-01-05 13:51:02 +00:00
Makefile.fpc.fpcmake * More packages switched to fpmake building 2012-01-05 16:29:36 +00:00
README.txt * added .txt extensions to all README, TODO and COPYING files 2009-02-28 17:34:08 +00:00

This directory contains some CD-ROM support routines for Free Pascal.

The routines are demonstrated by the 'getdiscid' and 'showcds' programs.
The latter shows the available CD-rom drives on the system, the former
calculates a disc-id and query for use with a freecddb server.

Unit cdrom
----------

The unit 'cdrom' implements a cross-platform interface for handling CD-roms.
Currently, it is implemented for Linux and Windows only.
The other units are support units, needed by various implementations.

The unit presents 2 calls:

Type 
  TTocEntry = Record 
    min, sec, frame : Integer
  end;
  PTocEntry = ^TTocEntry;

Function GetCDRomDevices(Var Devices : Array of string) : Integer;
Function ReadCDTOC(Device : String; Var CDTOC : Array of TTocEntry) : Integer;

The GetCDRomDevices call retrieves a list of available CD-ROM devices/drives
on the system. The algorithm used to detect these devices depends on the
system. The function returns the number of devices found, or a negative
number on error. The 'Devices' array is filled with strings that describe
the devices. For unix like systems, these are the device files (/dev/hdc
etc), for windows, these can be drive letters (D: etc) or ASPI Adaptor,
Target, lun IDs triples, for example ASPI[1;0;0].

(an algorithm mapping these to drive letters would be appreciated)

The ReadCDTOC call retrieves the table of contents of a CD in the CD-rom
drive (Device) This returns the number of tracks on the CD-ROM. On return,
The CDTOC array will be filled with the length of the tracks, and the frame
number, manipulated to be usable in a disc ID calculation. There will be one
extra entry at the end of the array, describing the lead-out.

unit discid
-----------

The DISCID unit calculates a DISC-ID as needed by a freecddb server to 
query for the contents of a disc.

Function CDDBDiscID(Const CDTOC : Array of TTocEntry; Count : Integer) : integer ;

The count is the number of tracks, the array should contain Count+1
elements, the last one being the lead out. The output of the ReadCDToc
function can be used as input for this function.

Function GetCDDBQueryString(Const Tracks : Array of TTocEntry; Count : Integer) : String;

This function returns a query string as expected by a freecddb server.
It consists of the disc id, number of tracks, and the frame fields of the 
TCDToc records in the tracks array.

unit lincd
----------

Essentially translation of the linux/cdrom.h include file, plus 2 functions

Function IsCDDevice(Device : String) : Boolean;

Returns True if the device file is a cdrom.

Function DetectCd : String;

Detects the first cd in the system; it does this by checking a number of
well-known common device files; the first once for which IsCDDevice returns
True is returned. Note that this can take some time.

unit major
----------

Definitions of the major device numbers under linux. used by the lincd unit.

unit wincd
----------
Some CD-routines. Essentially the low-level counterpart of the cd-rom unit.
The unit tries to use the windows ASPI layer to detect cd-roms. If the layer
is not present, the common IOCTL or SPTI interfaces are used.

TCDAccessMethod = (camNone,camASPI,camSPTI,camIOCTL);

Determines which access method is used.

Records used in the low-level calls:

TTOCTrack = packed record
  rsvd,
  ADR,
  trackNumber,
  rsvd2 : Byte;
  addr : Array[0..3] of byte;
end;  

TTOC = packed Record
  toclen : word;
  firsttrack,
  lastTrack  : byte;
  toctrack:  Array[0..99] of TTocTrack;
end;

Const
  AccessMethodNames : Array[TCDAccessMethod] of string
                    = ('None','ASPI','SPTI','IOCTL');
                    
Function  GetCDAccessMethod : TCDAccessMethod;

Returns the current CD-rom detection method.

Procedure SetCDAccessMethod (Value : TCDAccessMethod);

Sets the current CD-rom detection method.

Function  ReadTOC(Device : String; Var TOC : TTOc) : Integer;

Reads the CD-Rom devices. Device is a drive letter, or if ASPI is used
a string of the form [Aid,TgID,LunID] (Adapter ID, Target ID, LUN id)

Function  EnumCDDrives(Var Drives : Array of String) : Integer;

Returns the CD-ROM drive letters of the system, or strings describing ASPI
drives.

Function  GetNumDrives : Integer;

Returns the number of drives.

NOTE: A function mapping an ASPI triple to a drive letter would be
appreciated.

unit Wnaspi32:
--------------

Low-level ASPI unit. Contains all structures, plus the following:

  TSendASPI32Command = function( LPSRB : Pointer ) : DWORD; cdecl;
  TGetASPI32SupportInfo = function : DWORD; cdecl;

  SendASPI32Command : TSendASPI32Command = nil;
  GetASPI32SupportInfo : TGetASPI32SupportInfo = nil;

These procedural variables map to the actual API calls. They are only valid
and usable if ASPILoaded returns TRUE.

Function ASPILoaded : Boolean;

Returns TRUE if ASPI is available and loaded.

Procedure CheckASPI;

Checks whether ASPI is available. After calling this it is possible to use
the ASPIAvailable function. This procedure is called in the initialization
section of the unit.

procedure UnloadASPI;

Unloads the ASPI library if it was loaded. This procedure is called in the
finalization section of the unit.

scsidefs.pp
-----------

Bare translation of the scsidefs.h windows SDK header.

cdromioctl.pp
-------------

This unit contains some records and constants defined in window's 
cdromioctl.h


Michael.