hscdio-0.1.0.0: Haskell bindings to the libcdio disc-reading library.
Copyright(c) 2019-2021 Sam May
LicenseGPL-3.0-or-later
Maintainerag@eitilt.life
Stabilitystable
Portabilitynon-portable (requires libcdio)
Safe HaskellNone
LanguageHaskell2010

Sound.Libcdio.Device

Description

Any software dealing with CDs has to deal with the fact that they are, ultimately, a physical medium and thus reading from them requires interfacing with system hardware. This module provides the means to do just that. Note that, unlike the C and Foreign.Libcdio interfaces, however, this doesn't provide any means to open a read session; that functionality is instead exported directly from Sound.Libcdio.

Synopsis

Types

data HardwareInfo #

Information defining the make and model of a (typically physical) device.

Constructors

HardwareInfo 

Fields

  • vendor :: String

    The company who designed and/or built the drive.

  • model :: String

    The name of the specific drive design.

  • revision :: String

    The version number for hardware/firmware following a series.

emptyHardwareInfo :: HardwareInfo #

A HardwareInfo object with values suitable as defaults.

data DriverId #

Devices or file types supported by the library.

data DriverReturnCode #

Descriptions of various error states which may be returned by driver functions.

Instances

Instances details
Bounded DriverReturnCode # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum DriverReturnCode # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Eq DriverReturnCode # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ord DriverReturnCode # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Read DriverReturnCode # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show DriverReturnCode # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Capabilities

type DriveCaps = (DriveReadCaps, DriveWriteCaps, DriveMiscCaps) #

The three types are usually passed around together, so we can simplify the type signatures using them.

data DriveCapabilityRead #

Instances

Instances details
Bounded DriveCapabilityRead # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum DriveCapabilityRead #

Write-related properties a device can have, mostly describing what formats it can burn, which are collected in DriveWriteCaps.

Instance details

Defined in Foreign.Libcdio.Types.Enums

Eq DriveCapabilityRead # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ord DriveCapabilityRead # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Read DriveCapabilityRead # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show DriveCapabilityRead # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ix DriveCapabilityRead # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

type DriveReadCaps = BitArray DriveCapabilityRead #

The collection of features for reading discs a device provides.

data DriveCapabilityWrite #

Instances

Instances details
Bounded DriveCapabilityWrite # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum DriveCapabilityWrite # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Eq DriveCapabilityWrite # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ord DriveCapabilityWrite # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Read DriveCapabilityWrite # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show DriveCapabilityWrite # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ix DriveCapabilityWrite # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

type DriveWriteCaps = BitArray DriveCapabilityWrite #

The collection of features for writing discs a device provides.

capsWriteCd :: DriveWriteCaps #

Capabilites indicating a device has some sort of CD-writing ability.

capsWriteDvd :: DriveWriteCaps #

Capabilites indicating a device has some sort of DVD-writing ability.

capsWrite :: DriveWriteCaps #

Capabilites indicating a device has some sort of disc-writing ability.

data DriveCapabilityMisc #

Miscellaneous properties a device can have, typically describing hardware features, which are collected in DriveMiscCaps.

Instances

Instances details
Bounded DriveCapabilityMisc # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum DriveCapabilityMisc #

Read-related properties a device can have, mostly describing what formats it understands, which are collected in DriveReadCaps.

The difference between ReadAnalogAudio and ReadDigitalAudio is poorly documented in libcdio; they have been named here according to their assumed meanings (see https://www.cdrfaq.org/faq02.html#S2-4-3), but that pattern may not be completely accurate.

Instance details

Defined in Foreign.Libcdio.Types.Enums

Eq DriveCapabilityMisc # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ord DriveCapabilityMisc # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Read DriveCapabilityMisc # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show DriveCapabilityMisc # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ix DriveCapabilityMisc # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

type DriveMiscCaps = BitArray DriveCapabilityMisc #

The collection of hardware features a device was built with.

Drivers

driver :: Cdio DriverId #

Get the driver through which the disc is being read.

drivers :: [DriverId] #

All supported drivers, listed in order of preference.

osDriver :: DriverId #

The particular driver for the current operating system, or DriverUnknown if no device driver exists.

isImageDriver :: DriverId -> Bool #

Whether a particular driver deals with image files saved to disc, or a CD drive itself.

isDevice :: FilePath -> IO Bool #

Whether the path represents a physical disc drive in the system.

Session

setBlocksize :: Int -> Cdio DriverReturnCode #

Specify how much data should be read from a disc at once. Note that this only affects the transport; any reading functions operate on independant byte counts or other sizes derived from such.

setSpeed :: Int -> Cdio DriverReturnCode #

Specify the speed at which the disc is read. Lower values result in slower IO, but better accuracy.

isMediaChanged :: Cdio (Either DriverReturnCode Bool) #

Check if any data in the read session has been changed since the last call of this function. This is most helpful when multiple Cdio computations are run on a partial call of open or similar.

Devices

devices :: DriverId -> IO [FilePath] #

List (static) available devices on the system which can be accessed with a particular driver; some file devices (e.g. with DriverBinCue) might be returned, but an exhaustive list should not be expected in that case.

If passed DriverDevice, the returned value will list any type of hardware device, but no image files. Likewise, if passed DriverUnknown, all hardware devices will be returned along with any already-known images.

defaultDevice :: IO (Maybe FilePath) #

Find the default disc device for the system, if one exists.

The C library allows getting the default device from a Cdio object, but since that seems to only be initialized from either the default device itself or with an explicit path, doing so seems rather redundant.

defaultDeviceDriver #

Arguments

:: DriverId 
-> IO (Maybe FilePath, DriverId)

The name of the device, along with the associated driver if passed DriverUnknown or DriverDevice.

Find the default disc device for a given driver, if one exists.

capabilities :: Cdio DriveCaps #

Which features are provided by the current device. See deviceCapabilities when a session has not yet been opened.

deviceCapabilities :: FilePath -> IO DriveCaps #

Which features are provided by a particular device. See capabilities for accessing these within a Cdio session.

Images

isCue :: FilePath -> IO Bool #

Whether a file is valid according to the (loose) CUE standard.

isToc :: FilePath -> IO Bool #

Check that a cdrdao-style TOC description file is valid.

isNrg :: FilePath -> IO Bool #

Check that a Nero disc image file is valid.

Hardware

hardware :: Cdio HardwareInfo #

Get a description of the device in use.

haveAtapi :: Cdio (Maybe Bool) #

Whether ATAPI commands are understood by the current device.

Returns Nothing if the capability can't be determined.

ejectDevice :: Maybe FilePath -> IO DriverReturnCode #

Open a particular device's tray or otherwise free any disc it holds for removal, replacement, or insertion.

closeDeviceTray :: Maybe FilePath -> IO DriverReturnCode #

If a device supports discs on an extending, motorized tray (i.e. a standard CD drive), close it.

closeDeviceTray' :: Maybe FilePath -> DriverId -> IO DriverReturnCode #

As closeDeviceTray', but specify the driver to use in case of ambiguity.