| Copyright | (c) 2019-2021 Sam May |
|---|---|
| License | GPL-3.0-or-later |
| Maintainer | ag@eitilt.life |
| Stability | stable |
| Portability | non-portable (requires libcdio) |
| Safe Haskell | None |
| Language | Haskell2010 |
Sound.Libcdio.Read.Data
Contents
Description
This module is likely what most usage of the library revolves around: retrieving the data stored on a CD. For more discussion of the layout, see Foreign.Libcdio.Sector.
Synopsis
- data Lsn
- data Whence
- data DiscMode
- = AudioCdMode
- | DataCdMode
- | XaCdMode
- | MixedCdMode
- | DvdRomMode
- | DvdRamMode
- | DvdRecordableMode
- | DvdReWritableMode
- | HighDefinitionDvdRomMode
- | HighDefinitionDvdRamMode
- | HighDefinitionDvdRecordableMode
- | DvdPlusRecordableMode
- | DvdPlusReWritableMode
- | DoubleLayerDvdPlusReWritableMode
- | DoubleLayerDvdPlusRecordableMode
- | OtherDvdMode
- | NoModeInfo
- | CdIMode
- isCdRom :: DiscMode -> Bool
- isDvd :: DiscMode -> Bool
- discMode :: Cdio (Maybe DiscMode)
- discJolietLevel :: Cdio (Maybe Word)
- lastAddress :: Cdio (Maybe Lsn)
- lastSessionAddress :: Cdio (Either DriverReturnCode Lsn)
- audioTimestamp :: Lsn -> Text
- catalogue :: Cdio (Maybe Text)
- isrc :: Track -> Cdio (Maybe Text)
- seek :: Int -> Whence -> Cdio Lsn
- readRaw :: Word -> Cdio ByteString
- readAudio :: Word -> Cdio ByteString
- readData :: Bool -> Word -> Cdio ByteString
- readXa :: Bool -> Word -> Cdio ByteString
- framesPerSec :: Word
- maxCdSectors :: Word
- maxCdMinutes :: Word
- defaultPregapSectors :: Word
- defaultPostgapSectors :: Word
Types
The type-safe representation of a Logical Sector Number, counting sectors
from the start of track 1; this notably excludes the blank session lead-in.
See also Lba.
Instances
| Bounded Lsn Source # | |
| Enum Lsn Source # | |
| Eq Lsn Source # | |
| Integral Lsn Source # | |
| Num Lsn Source # | |
| Ord Lsn Source # | |
| Read Lsn Source # | |
| Real Lsn Source # | |
Defined in Foreign.Libcdio.Types.Internal Methods toRational :: Lsn -> Rational # | |
| Show Lsn Source # | |
| Ix Lsn Source # | |
| PrintfArg Lsn Source # | |
Defined in Foreign.Libcdio.Types.Internal | |
| Storable Lsn Source # | |
Defined in Foreign.Libcdio.Types.Internal | |
| Bits Lsn Source # | |
Defined in Foreign.Libcdio.Types.Internal | |
| FiniteBits Lsn Source # | |
Defined in Foreign.Libcdio.Types.Internal Methods finiteBitSize :: Lsn -> Int # countLeadingZeros :: Lsn -> Int # countTrailingZeros :: Lsn -> Int # | |
Which location an offset passed to seek should be
based on.
Constructors
| SeekStart | |
| SeekCurrent | |
| SeekEnd |
Different types of disc. Modes are combined from several sources, along with some libcdio-specific additions:
- MMC-5 6.33.3.13 (Send CUESHEET)
- MMC-5 Table 400 "DVD Book"
- GNU/Linux
/usr/include/linux/cdrom.h
As C2HS and Haddock don't yet interact well enough to document Enum fields, some of the less obvious mappings include:
DataCdMode: CD-ROM form 1MixedCdMode: some combination ofAudioCdMode,DataCdMode, andXaCdModeDvdPlusRecordableMode: DVD+RDvdPlusReWritableMode: DVD+RW
Constructors
Instances
| Bounded DiscMode Source # | |
| Enum DiscMode Source # | |
Defined in Foreign.Libcdio.Types.Enums | |
| Eq DiscMode Source # | |
| Ord DiscMode Source # | |
Defined in Foreign.Libcdio.Types.Enums | |
| Read DiscMode Source # | |
| Show DiscMode Source # | |
Info
discJolietLevel :: Cdio (Maybe Word) Source #
The original ISO 9660 (data) filesystem specification was rather restrictive in what files could be named; the Joliet extensions allow such exciting features as lowercase letters, not to mention full Unicode support.
lastAddress :: Cdio (Maybe Lsn) Source #
Get the size of a disc in blocks, or equivalently the address of the end of the readable data.
lastSessionAddress :: Cdio (Either DriverReturnCode Lsn) Source #
Get the starting address of the last write session of a disc.
audioTimestamp :: Lsn -> Text Source #
Print a disc timestamp in the standard "MM:SS:FF" format, assuming the address refers to audio data.
Read
For now, the library isn't able to automatically determine which read*
function should be used; refer to format, and switch
on its return value. For more info on the various data layouts, see the
intro to Foreign.Libcdio.Sector.
Compared to the C and Foreign interfaces, all read functions have been
tweaked for better internal consistency. Where a cdio_read or
readBytes call would ask for the number of bytes to read, here it
asks for the number of sectors. On the other hand, the formerly
sector-oriented commands operate from the current seek position rather
than, effectively, hiding a seek behind the scenes.
seek :: Int -> Whence -> Cdio Lsn Source #
Reposition the read pointer in the Cdio session for a future call to
one of the read* functions.
readRaw :: Word -> Cdio ByteString Source #
Read a given number of sectors from the disc. With data of a known
structure, use readAudio, readData, or readXa, which don't include
the headers and footers described in Foreign.Libcdio.Sector.
readAudio :: Word -> Cdio ByteString Source #
Read a given number of sectors stored as CD-DA from the disc.
Arguments
| :: Bool | If |
| -> Word | |
| -> Cdio ByteString |
Read a given number of sectors stored as Mode 1 data from the disc.
Arguments
| :: Bool | If |
| -> Word | |
| -> Cdio ByteString |
Read a given number of sectors stored according to the Mode 2 extension from the disc.
Basic counts
framesPerSec :: Word Source #
The number of disc sectors comprising a second of audio data.
maxCdSectors :: Word Source #
The maximum number of sectors allowed to be stored on a disc.
maxCdMinutes :: Word Source #
The typical maximum length of a disc, though it's not a strict limit.
defaultPregapSectors :: Word Source #
The number of sectors spanned by a track pre-gap by default.
defaultPostgapSectors :: Word Source #
The number of sectors spanned by a track post-gap by default.