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 Source #

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 Source #

A HardwareInfo object with values suitable as defaults.

data DriverId Source #

Devices or file types supported by the library.

data DriverReturnCode Source #

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

Instances

Instances details
Bounded DriverReturnCode Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum DriverReturnCode Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Eq DriverReturnCode Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ord DriverReturnCode Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Read DriverReturnCode Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show DriverReturnCode Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Capabilities

type DriveCaps = (DriveReadCaps, DriveWriteCaps, DriveMiscCaps) Source #

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

data DriveCapabilityRead Source #

Instances

Instances details
Bounded DriveCapabilityRead Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum DriveCapabilityRead Source #

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 Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ord DriveCapabilityRead Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Read DriveCapabilityRead Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show DriveCapabilityRead Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ix DriveCapabilityRead Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

type DriveReadCaps = BitArray DriveCapabilityRead Source #

The collection of features for reading discs a device provides.

data DriveCapabilityWrite Source #

Instances

Instances details
Bounded DriveCapabilityWrite Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum DriveCapabilityWrite Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Eq DriveCapabilityWrite Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ord DriveCapabilityWrite Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Read DriveCapabilityWrite Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show DriveCapabilityWrite Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ix DriveCapabilityWrite Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

type DriveWriteCaps = BitArray DriveCapabilityWrite Source #

The collection of features for writing discs a device provides.

capsWriteCd :: DriveWriteCaps Source #

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

capsWriteDvd :: DriveWriteCaps Source #

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

capsWrite :: DriveWriteCaps Source #

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

data DriveCapabilityMisc Source #

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

Instances

Instances details
Bounded DriveCapabilityMisc Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Enum DriveCapabilityMisc Source #

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 Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ord DriveCapabilityMisc Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Read DriveCapabilityMisc Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Show DriveCapabilityMisc Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

Ix DriveCapabilityMisc Source # 
Instance details

Defined in Foreign.Libcdio.Types.Enums

type DriveMiscCaps = BitArray DriveCapabilityMisc Source #

The collection of hardware features a device was built with.

Drivers

driver :: Cdio DriverId Source #

Get the driver through which the disc is being read.

drivers :: [DriverId] Source #

All supported drivers, listed in order of preference.

osDriver :: DriverId Source #

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

isImageDriver :: DriverId -> Bool Source #

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

isDevice :: FilePath -> IO Bool Source #

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

Session

setBlocksize :: Int -> Cdio DriverReturnCode Source #

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 Source #

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

isMediaChanged :: Cdio (Either DriverReturnCode Bool) Source #

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] Source #

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) Source #

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 Source #

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 Source #

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

deviceCapabilities :: FilePath -> IO DriveCaps Source #

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

Images

isCue :: FilePath -> IO Bool Source #

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

isToc :: FilePath -> IO Bool Source #

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

isNrg :: FilePath -> IO Bool Source #

Check that a Nero disc image file is valid.

Hardware

hardware :: Cdio HardwareInfo Source #

Get a description of the device in use.

haveAtapi :: Cdio (Maybe Bool) Source #

Whether ATAPI commands are understood by the current device.

Returns Nothing if the capability can't be determined.

ejectDevice :: Maybe FilePath -> IO DriverReturnCode Source #

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

closeDeviceTray :: Maybe FilePath -> IO DriverReturnCode Source #

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

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

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