dvdread-0.1: A monadic interface to libdvdread

Safe HaskellNone

DVD.DVDRead

Contents

Description

Example:

  do may <- dvdRead "/path/to/dvd/" (do Just s <- fileStat 1 TitleVobs
                                        liftIO (print s)
                                        file 1 TitleVobs (readBlocks 0 100)
                                    )
     case may of
       Just b -> writeFile "tmp.vob" b
       Nothing -> putStrLn "Could not read file"

Synopsis

Datatypes

data DVDRead a Source

This is the main data type in this module and represent an action in the underlying C library

Instances

Monad DVDRead 
Functor DVDRead 
MonadIO DVDRead 

data File a Source

The File a monad represents a file operation returning the type a, to be executed on the content of a DVD. It can be converted into a DVDRead action using file.

Instances

Monad File 
Functor File 
MonadIO File 

data Status Source

Status is a list containing the sizes in bytes of each file corresponding to a given Title / ReadDomain.

Instances

Eq Status 
Read Status 
Show Status 

type Offset = Word32Source

The number of bytes or blocks since the beginning of the file (offset 0). A block equals blockSize bytes.

type Size = Word64Source

Size in bytes or blocks of a file corresponding to a given Title / ReadDomain. A block equals blockSize bytes.

type Title = Word8Source

The number of the title inside a DVD, between 0 and 99, with 0 referring to the Video Manager (VIDEO_TS.*).

data ReadDomain Source

Specifies a file type inside a Title

Instances

data VolumeIdentifier Source

Volume Identifier as described in ECMA-167.

data VolumeSetIdentifier Source

Volume Set Identifier as described in ECMA-167.

dvdReadSource

Arguments

:: FilePath

A block device, mount point, image file or directory containing a copy of a DVD

-> DVDRead a

Action to perform on the DVD

-> IO a

Resulting action

Runs an action of type DVDRead on the specified device/image file.

fileStat :: Title -> ReadDomain -> DVDRead (Maybe Status)Source

Returns the Status of the given Title / ReadDomain, or Nothing in case of error.

getUDFCacheLevel :: DVDRead BoolSource

Returns whether or not some UDF operations are cached.

setUDFCacheLevel :: Bool -> DVDRead ()Source

Sets the cache level for UDF operations.

Disc info

udfVolumeInfo :: DVDRead (Maybe (VolumeIdentifier, VolumeSetIdentifier))Source

Returns Volume Identifier and Volume Set Identifier of the UDF filesystem, or Nothing in case of error.

isoVolumeInfo :: DVDRead (Maybe (VolumeIdentifier, VolumeSetIdentifier))Source

Only use this function as fallback if udfVolumeInfo returns Nothing. This will happen on a disc mastered only with a iso9660 filesystem.

blockSize :: Word64Source

Number of bytes in a logical block (2048).

File operations

fileSource

Arguments

:: Title

DVD title

-> ReadDomain

Domain

-> File a

Read operation

-> DVDRead a

Reasulting action

Applies File a to the given Title and ReadDomain, and generates the corresponding DVDRead action.

size :: File SizeSource

Returns the size of a file in blocks.

readBlocksSource

Arguments

:: Offset

Starting offset in blocks

-> Size

Number of blocks to read

-> File (Maybe ByteString) 

Reads Size number of blocks from the file starting at the given block Offset. Returns Nothing in case of error. This function should be used only for reading VOB data (VIDEO_TS.VOB or VTS_??_?.VOB). When reading from an encrypted drive, blocks are decrypted using libdvdcss where required.

readBytesSource

Arguments

:: Offset

Starting offset in bytes

-> Size

Number of bytes to read

-> File (Maybe ByteString) 

Reads Size number of bytes from the file starting at the given bytes Offset. Returns Nothing in case of error. This function should be used only for reading Info data (VIDEO_TS.IFO, VIDEO_TS.BUP, VTS_??_?.IFO or VTS_??_?.BUP).

Utility read functions

readVMGInfoFile :: DVDRead ByteStringSource

Returns the content of VIDEO_TS.IFO file.

readVMGInfoBackupFile :: DVDRead ByteStringSource

Returns the content of VIDEO_TS.BUP file.

readVMGMenu :: DVDRead ByteStringSource

Returns the content of VIDEO_TS.VOB file.

readVTSInfoFile :: Title -> DVDRead ByteStringSource

Returns the content of VTS_??_0.IFO file. Use with Title from 1 to 99.

readVTSInfoBackupFile :: Title -> DVDRead ByteStringSource

Returns the content of VTS_??_0.BUP file. Use with Title from 1 to 99.

readVTSMenu :: Title -> DVDRead ByteStringSource

Returns the content of VTS_??_0.VOB file. Use with Title from 1 to 99.