Macros | Typedefs | Functions | Variables
dvdcss.h File Reference

The libdvdcss public header. More...

Go to the source code of this file.

Macros

#define DVDCSS_BLOCK_SIZE   2048
#define DVDCSS_NOFLAGS   0
#define DVDCSS_READ_DECRYPT   (1 << 0)
#define DVDCSS_SEEK_MPEG   (1 << 0)
#define DVDCSS_SEEK_KEY   (1 << 1)
#define LIBDVDCSS_EXPORT   extern

Typedefs

typedef struct dvdcss_s * dvdcss_t

Functions

LIBDVDCSS_EXPORT dvdcss_t dvdcss_open (char *psz_target)
 Open a DVD device or directory and return a dvdcss instance.
LIBDVDCSS_EXPORT int dvdcss_close (dvdcss_t)
 Close the DVD and clean up the library.
LIBDVDCSS_EXPORT int dvdcss_seek (dvdcss_t, int i_blocks, int i_flags)
 Seek in the disc and change the current key if requested.
LIBDVDCSS_EXPORT int dvdcss_read (dvdcss_t, void *p_buffer, int i_blocks, int i_flags)
 Read from the disc and decrypt data if requested.
LIBDVDCSS_EXPORT int dvdcss_readv (dvdcss_t, void *p_iovec, int i_blocks, int i_flags)
 Read from the disc into multiple buffers and decrypt data if requested.
LIBDVDCSS_EXPORT char * dvdcss_error (dvdcss_t)
 Return a string containing the latest error that occurred in the given libdvdcss instance.
LIBDVDCSS_EXPORT int dvdcss_is_scrambled (dvdcss_t)
 Return 1 if the DVD is scrambled, 0 otherwise.

Variables

LIBDVDCSS_EXPORT char * dvdcss_interface_2

Detailed Description

The libdvdcss public header.

Author
St├ęphane Borel stef@.nosp@m.via..nosp@m.ecp.f.nosp@m.r
Sam Hocevar sam@z.nosp@m.oy.o.nosp@m.rg This header contains the public types and functions that applications using libdvdcss may use.

Macro Definition Documentation

#define DVDCSS_BLOCK_SIZE   2048

The block size of a DVD.

Referenced by dvdcss_open(), dvdcss_read(), and dvdcss_readv().

#define DVDCSS_NOFLAGS   0

The default flag to be used by libdvdcss functions.

#define DVDCSS_READ_DECRYPT   (1 << 0)

Flag to ask dvdcss_read() to decrypt the data it reads.

Referenced by dvdcss_read(), and dvdcss_readv().

#define DVDCSS_SEEK_KEY   (1 << 1)

Flag to ask dvdcss_seek() to check the current title key.

Referenced by dvdcss_seek().

#define DVDCSS_SEEK_MPEG   (1 << 0)

Flag to tell dvdcss_seek() it is seeking in MPEG data.

Referenced by dvdcss_seek().

Typedef Documentation

typedef struct dvdcss_s* dvdcss_t

Library instance handle, to be used for each library call.

Function Documentation

LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t  dvdcss)

Close the DVD and clean up the library.

Parameters
dvdcssa libdvdcss instance.
Returns
zero in case of success, a negative value otherwise.

This function closes the DVD device and frees all the memory allocated by libdvdcss. On return, the dvdcss_t is invalidated and may not be used again.

References dvdcss_close().

Referenced by dvdcss_close().

LIBDVDCSS_EXPORT char* dvdcss_error ( dvdcss_t  dvdcss)

Return a string containing the latest error that occurred in the given libdvdcss instance.

Parameters
dvdcssa libdvdcss instance.
Returns
a null-terminated string containing the latest error message.

This function returns a constant string containing the latest error that occurred in libdvdcss. It can be used to format error messages at your convenience in your application.

References dvdcss_error().

Referenced by dvdcss_error().

LIBDVDCSS_EXPORT int dvdcss_is_scrambled ( dvdcss_t  dvdcss)

Return 1 if the DVD is scrambled, 0 otherwise.

Parameters
dvdcssa libdvdcss instance.
Returns
1 if the DVD is scrambled, 0 otherwise.

This function returns whether the DVD is scrambled.

References dvdcss_is_scrambled().

Referenced by dvdcss_is_scrambled().

LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *  psz_target)

Open a DVD device or directory and return a dvdcss instance.

Parameters
psz_targeta string containing the target name, for instance "/dev/hdc" or "E:".
Returns
a handle to a dvdcss instance or NULL on error.

Initialize the libdvdcss library and open the requested DVD device or directory. libdvdcss checks whether ioctls can be performed on the disc, and when possible, the disc key is retrieved.

dvdcss_open() returns a handle to be used for all subsequent libdvdcss calls. If an error occurred, NULL is returned.

References DVDCSS_BLOCK_SIZE, and dvdcss_open().

Referenced by dvdcss_open().

LIBDVDCSS_EXPORT int dvdcss_read ( dvdcss_t  dvdcss,
void *  p_buffer,
int  i_blocks,
int  i_flags 
)

Read from the disc and decrypt data if requested.

Parameters
dvdcssa libdvdcss instance.
p_buffera buffer that will contain the data read from the disc.
i_blocksthe amount of blocks to read.
i_flagsDVDCSS_NOFLAGS, optionally ORed with DVDCSS_READ_DECRYPT.
Returns
the amount of blocks read, or a negative value in case an error happened.

This function reads i_blocks logical blocks from the DVD.

You typically set i_flags to DVDCSS_NOFLAGS when reading data from a .IFO file on the DVD.

If DVDCSS_READ_DECRYPT is specified in i_flags, dvdcss_read() will automatically decrypt scrambled sectors. This flag is typically used when reading data from a .VOB file on the DVD. It has no effect on unscrambled discs or unscrambled sectors, and can be safely used on those.

Warning
dvdcss_read() expects to be able to write i_blocks * DVDCSS_BLOCK_SIZE bytes in p_buffer.

References DVDCSS_BLOCK_SIZE, dvdcss_read(), and DVDCSS_READ_DECRYPT.

Referenced by dvdcss_read().

LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t  dvdcss,
void *  p_iovec,
int  i_blocks,
int  i_flags 
)

Read from the disc into multiple buffers and decrypt data if requested.

Parameters
dvdcssa libdvdcss instance.
p_ioveca pointer to an array of iovec structures that will contain the data read from the disc.
i_blocksthe amount of blocks to read.
i_flagsDVDCSS_NOFLAGS, optionally ORed with DVDCSS_READ_DECRYPT.
Returns
the amount of blocks read, or a negative value in case an error happened.

This function reads i_blocks logical blocks from the DVD and writes them to an array of iovec structures.

You typically set i_flags to DVDCSS_NOFLAGS when reading data from a .IFO file on the DVD.

If DVDCSS_READ_DECRYPT is specified in i_flags, dvdcss_readv() will automatically decrypt scrambled sectors. This flag is typically used when reading data from a .VOB file on the DVD. It has no effect on unscrambled discs or unscrambled sectors, and can be safely used on those.

Warning
dvdcss_readv() expects to be able to write i_blocks * DVDCSS_BLOCK_SIZE bytes in the buffers pointed by p_iovec. Moreover, all iov_len members of the iovec structures should be multiples of DVDCSS_BLOCK_SIZE.

References DVDCSS_BLOCK_SIZE, DVDCSS_READ_DECRYPT, and dvdcss_readv().

Referenced by dvdcss_readv().

LIBDVDCSS_EXPORT int dvdcss_seek ( dvdcss_t  dvdcss,
int  i_blocks,
int  i_flags 
)

Seek in the disc and change the current key if requested.

Parameters
dvdcssa libdvdcss instance.
i_blocksan absolute block offset to seek to.
i_flagsDVDCSS_NOFLAGS, optionally ORed with one of DVDCSS_SEEK_KEY or DVDCSS_SEEK_MPEG.
Returns
the new position in blocks, or a negative value in case an error happened.

This function seeks to the requested position, in logical blocks.

You typically set i_flags to DVDCSS_NOFLAGS when seeking in a .IFO.

If DVDCSS_SEEK_MPEG is specified in i_flags and if libdvdcss finds it reasonable to do so (i.e., if the dvdcss method is not "title"), the current title key will be checked and a new one will be calculated if necessary. This flag is typically used when reading data from a VOB.

If DVDCSS_SEEK_KEY is specified, the title key will be always checked, even with the "title" method. This is equivalent to using the now deprecated dvdcss_title() call. This flag is typically used when seeking in a new title.

References dvdcss_seek(), DVDCSS_SEEK_KEY, and DVDCSS_SEEK_MPEG.

Referenced by dvdcss_seek().