dvd_reader.c File Reference

Go to the source code of this file.

Classes

struct  dvd_reader_s
struct  dvd_file_s

Functions

static int _private_gettimeofday (struct timeval *tv, void *tz)
int UDFReadBlocksRaw (dvd_reader_t *device, uint32_t lb_number, size_t block_count, unsigned char *data, int encrypted)
int DVDUDFCacheLevel (dvd_reader_t *device, int level)
 Set the level of caching on udf level = 0 (no caching) level = 1 (caching filesystem info).
void * GetUDFCacheHandle (dvd_reader_t *device)
void SetUDFCacheHandle (dvd_reader_t *device, void *cache)
static int initAllCSSKeys (dvd_reader_t *dvd)
static dvd_reader_tDVDOpenImageFile (const char *location, int have_css)
 Open a DVD image or block device file.
static dvd_reader_tDVDOpenPath (const char *path_root)
static char * sun_block2char (const char *path)
static char * bsd_block2char (const char *path)
dvd_reader_tDVDOpen (const char *ppath)
 Opens a block device of a DVD-ROM file, or an image file, or a directory name for a mounted DVD or HD copy of a DVD.
void DVDClose (dvd_reader_t *dvd)
 Closes and cleans up the DVD reader object.
static dvd_file_tDVDOpenFileUDF (dvd_reader_t *dvd, char *filename)
 Open an unencrypted file on a DVD image file.
static int findDirFile (const char *path, const char *file, char *filename)
 Searches for <file> in directory <path>, ignoring case.
static int findDVDFile (dvd_reader_t *dvd, const char *file, char *filename)
static dvd_file_tDVDOpenFilePath (dvd_reader_t *dvd, char *filename)
 Open an unencrypted file from a DVD directory tree.
static dvd_file_tDVDOpenVOBUDF (dvd_reader_t *dvd, int title, int menu)
static dvd_file_tDVDOpenVOBPath (dvd_reader_t *dvd, int title, int menu)
dvd_file_tDVDOpenFile (dvd_reader_t *dvd, int titlenum, dvd_read_domain_t domain)
 Opens a file on the DVD given the title number and domain.
void DVDCloseFile (dvd_file_t *dvd_file)
 Closes a file and frees the associated structure.
static int DVDReadBlocksUDF (dvd_file_t *dvd_file, uint32_t offset, size_t block_count, unsigned char *data, int encrypted)
static int DVDReadBlocksPath (dvd_file_t *dvd_file, unsigned int offset, size_t block_count, unsigned char *data, int encrypted)
ssize_t DVDReadBlocks (dvd_file_t *dvd_file, int offset, size_t block_count, unsigned char *data)
 Reads block_count number of blocks from the file at the given block offset.
int32_t DVDFileSeek (dvd_file_t *dvd_file, int32_t offset)
 Seek to the given position in the file.
ssize_t DVDReadBytes (dvd_file_t *dvd_file, void *data, size_t byte_size)
 Reads the given number of bytes from the file.
ssize_t DVDFileSize (dvd_file_t *dvd_file)
 Returns the file size in blocks.
int DVDDiscID (dvd_reader_t *dvd, unsigned char *discid)
 Get a unique 128 bit disc ID.
int DVDISOVolumeInfo (dvd_reader_t *dvd, char *volid, unsigned int volid_size, unsigned char *volsetid, unsigned int volsetid_size)
 Get the ISO9660 VolumeIdentifier and VolumeSetIdentifier.
int DVDUDFVolumeInfo (dvd_reader_t *dvd, char *volid, unsigned int volid_size, unsigned char *volsetid, unsigned int volsetid_size)
 Get the UDF VolumeIdentifier and VolumeSetIdentifier from the PrimaryVolumeDescriptor.


Function Documentation

static int _private_gettimeofday ( struct timeval *  tv,
void *  tz 
) [inline, static]

Definition at line 40 of file dvd_reader.c.

int UDFReadBlocksRaw ( dvd_reader_t device,
uint32_t  lb_number,
size_t  block_count,
unsigned char *  data,
int  encrypted 
)

Definition at line 871 of file dvd_reader.c.

Referenced by DVDISOVolumeInfo(), DVDReadBlocksUDF(), and DVDReadLBUDF().

int DVDUDFCacheLevel ( dvd_reader_t device,
int  level 
)

Set the level of caching on udf level = 0 (no caching) level = 1 (caching filesystem info).

Sets the level of caching that is done when reading from a device.

Definition at line 120 of file dvd_reader.c.

Referenced by GetUDFCache(), SetUDFCache(), and UDFScanDir().

void* GetUDFCacheHandle ( dvd_reader_t device  ) 

Definition at line 135 of file dvd_reader.c.

Referenced by GetUDFCache(), and SetUDFCache().

void SetUDFCacheHandle ( dvd_reader_t device,
void *  cache 
)

Definition at line 142 of file dvd_reader.c.

Referenced by SetUDFCache().

static int initAllCSSKeys ( dvd_reader_t dvd  )  [static]

Definition at line 152 of file dvd_reader.c.

Referenced by DVDOpenVOBUDF().

static dvd_reader_t* DVDOpenImageFile ( const char *  location,
int  have_css 
) [static]

Open a DVD image or block device file.

Definition at line 223 of file dvd_reader.c.

Referenced by DVDOpen().

static dvd_reader_t* DVDOpenPath ( const char *  path_root  )  [static]

Definition at line 255 of file dvd_reader.c.

Referenced by DVDOpen().

static char* sun_block2char ( const char *  path  )  [static]

Definition at line 278 of file dvd_reader.c.

Referenced by DVDOpen().

static char* bsd_block2char ( const char *  path  )  [static]

Definition at line 302 of file dvd_reader.c.

Referenced by DVDOpen().

dvd_reader_t* DVDOpen ( const char *   ) 

Opens a block device of a DVD-ROM file, or an image file, or a directory name for a mounted DVD or HD copy of a DVD.

If the given file is a block device, or is the mountpoint for a block device, then that device is used for CSS authentication using libdvdcss. If no device is available, then no CSS authentication is performed, and we hope that the image is decrypted.

If the path given is a directory, then the files in that directory may be in any one of these formats:

path/VIDEO_TS/VTS_01_1.VOB path/video_ts/vts_01_1.vob path/VTS_01_1.VOB path/vts_01_1.vob

Parameters:
path Specifies the the device, file or directory to be used.
Returns:
If successful a a read handle is returned. Otherwise 0 is returned.
dvd = DVDOpen(path);

Definition at line 319 of file dvd_reader.c.

Referenced by DVDProbe::probe(), DVDThread::ripTitle(), and vm_reset().

void DVDClose ( dvd_reader_t  ) 

Closes and cleans up the DVD reader object.

You must close all open files before calling this function.

Parameters:
dvd A read handle that should be closed.
DVDClose(dvd);

Definition at line 532 of file dvd_reader.c.

Referenced by DVDProbe::probe(), DVDThread::ripTitle(), vm_stop(), and DVDProbe::~DVDProbe().

static dvd_file_t* DVDOpenFileUDF ( dvd_reader_t dvd,
char *  filename 
) [static]

Open an unencrypted file on a DVD image file.

Definition at line 545 of file dvd_reader.c.

Referenced by DVDOpenFile().

static int findDirFile ( const char *  path,
const char *  file,
char *  filename 
) [static]

Searches for <file> in directory <path>, ignoring case.

Returns 0 and full filename in <filename>. or -1 on file not found. or -2 on path not found.

Definition at line 577 of file dvd_reader.c.

Referenced by findDVDFile().

static int findDVDFile ( dvd_reader_t dvd,
const char *  file,
char *  filename 
) [static]

Definition at line 599 of file dvd_reader.c.

Referenced by DVDOpenFilePath(), and DVDOpenVOBPath().

static dvd_file_t* DVDOpenFilePath ( dvd_reader_t dvd,
char *  filename 
) [static]

Open an unencrypted file from a DVD directory tree.

Definition at line 633 of file dvd_reader.c.

Referenced by DVDOpenFile().

static dvd_file_t* DVDOpenVOBUDF ( dvd_reader_t dvd,
int  title,
int  menu 
) [static]

Definition at line 676 of file dvd_reader.c.

Referenced by DVDOpenFile().

static dvd_file_t* DVDOpenVOBPath ( dvd_reader_t dvd,
int  title,
int  menu 
) [static]

Definition at line 725 of file dvd_reader.c.

Referenced by DVDOpenFile().

dvd_file_t* DVDOpenFile ( dvd_reader_t ,
int  ,
dvd_read_domain_t   
)

Opens a file on the DVD given the title number and domain.

If the title number is 0, the video manager information is opened (VIDEO_TS.[IFO,BUP,VOB]). Returns a file structure which may be used for reads, or 0 if the file was not found.

Parameters:
dvd A dvd read handle.
titlenum Which Video Title Set should be used, VIDEO_TS is 0.
domain Which domain.
Returns:
If successful a a file read handle is returned, otherwise 0.
dvd_file = DVDOpenFile(dvd, titlenum, domain);

Definition at line 799 of file dvd_reader.c.

Referenced by DVDDiscID(), dvdnav_get_next_cache_block(), dvdnav_open(), ifoOpen(), ifoOpenVMGI(), ifoOpenVTSI(), and DVDThread::ripTitle().

void DVDCloseFile ( dvd_file_t  ) 

Closes a file and frees the associated structure.

Parameters:
dvd_file The file read handle to be closed.
DVDCloseFile(dvd_file);

Definition at line 850 of file dvd_reader.c.

Referenced by DVDDiscID(), dvdnav_clear(), dvdnav_close(), dvdnav_get_next_cache_block(), ifoClose(), and DVDThread::ripTitle().

static int DVDReadBlocksUDF ( dvd_file_t dvd_file,
uint32_t  offset,
size_t  block_count,
unsigned char *  data,
int  encrypted 
) [static]

Definition at line 898 of file dvd_reader.c.

Referenced by DVDReadBlocks(), and DVDReadBytes().

static int DVDReadBlocksPath ( dvd_file_t dvd_file,
unsigned int  offset,
size_t  block_count,
unsigned char *  data,
int  encrypted 
) [static]

Definition at line 912 of file dvd_reader.c.

Referenced by DVDReadBlocks(), and DVDReadBytes().

ssize_t DVDReadBlocks ( dvd_file_t ,
int  ,
size_t  ,
unsigned char *   
)

Reads block_count number of blocks from the file at the given block offset.

Returns number of blocks read on success, -1 on error. This call is only for reading VOB data, and should not be used when reading the IFO files. When reading from an encrypted drive, blocks are decrypted using libdvdcss where required.

Parameters:
dvd_file A file read handle.
offset Block offset from the start of the file to start reading at.
block_count Number of block to read.
data Pointer to a buffer to write the data into.
Returns:
Returns number of blocks read on success, -1 on error.
blocks_read = DVDReadBlocks(dvd_file, offset, block_count, data);

Definition at line 980 of file dvd_reader.c.

Referenced by dvdnav_read_cache_block(), and DVDThread::ripTitle().

int32_t DVDFileSeek ( dvd_file_t ,
int32_t   
)

Seek to the given position in the file.

Returns the resulting position in bytes from the beginning of the file. The seek position is only used for byte reads from the file, the block read call always reads from the given offset.

Parameters:
dvd_file A file read handle.
seek_offset Byte offset from the start of the file to seek to.
Returns:
The resulting position in bytes from the beginning of the file.
offset_set = DVDFileSeek(dvd_file, seek_offset);

Definition at line 1011 of file dvd_reader.c.

Referenced by DVDFileSeek_().

ssize_t DVDReadBytes ( dvd_file_t ,
void *  ,
size_t   
)

Reads the given number of bytes from the file.

This call can only be used on the information files, and may not be used for reading from a VOB. This reads from and increments the currrent seek position for the file.

Parameters:
dvd_file A file read handle.
data Pointer to a buffer to write the data into.
bytes Number of bytes to read.
Returns:
Returns number of bytes read on success, -1 on error.
bytes_read = DVDReadBytes(dvd_file, data, bytes);

Definition at line 1024 of file dvd_reader.c.

Referenced by DVDDiscID(), ifoRead_C_ADT_internal(), ifoRead_CELL_PLAYBACK_TBL(), ifoRead_CELL_POSITION_TBL(), ifoRead_PGC(), ifoRead_PGC_COMMAND_TBL(), ifoRead_PGC_PROGRAM_MAP(), ifoRead_PGCI_UT(), ifoRead_PGCIT_internal(), ifoRead_PTL_MAIT(), ifoRead_TT_SRPT(), ifoRead_TXTDT_MGI(), ifoRead_VMG(), ifoRead_VOBU_ADMAP_internal(), ifoRead_VTS(), ifoRead_VTS_ATRT(), ifoRead_VTS_ATTRIBUTES(), ifoRead_VTS_PTT_SRPT(), and ifoRead_VTS_TMAPT().

ssize_t DVDFileSize ( dvd_file_t  ) 

Returns the file size in blocks.

Parameters:
dvd_file A file read handle.
Returns:
The size of the file in blocks, -1 on error.
blocks = DVDFileSize(dvd_file);

Definition at line 1068 of file dvd_reader.c.

int DVDDiscID ( dvd_reader_t ,
unsigned char *   
)

Get a unique 128 bit disc ID.

This is the MD5 sum of VIDEO_TS.IFO and the VTS_0?_0.IFO files in title order (those that exist). If you need a 'text' representation of the id, print it as a hexadecimal number, using lowercase letters, discid[0] first. I.e. the same format as the command-line 'md5sum' program uses.

Parameters:
dvd A read handle to get the disc ID from
discid The buffer to put the disc ID into. The buffer must have room for 128 bits (16 chars).
Returns:
0 on success, -1 on error.

Definition at line 1077 of file dvd_reader.c.

int DVDISOVolumeInfo ( dvd_reader_t ,
char *  ,
unsigned  int,
unsigned char *  ,
unsigned  int 
)

Get the ISO9660 VolumeIdentifier and VolumeSetIdentifier.

* Only use this function as fallback if DVDUDFVolumeInfo returns 0 * * this will happen on a disc mastered only with a iso9660 filesystem * * All video DVD discs have UDF filesystem *

Parameters:
dvd A read handle to get the disc ID from
volid The buffer to put the VolumeIdentifier into. The VolumeIdentifier is coded with '0-9','A-Z','_' null terminated and max 33 bytes (including '')
volid_size No more than volid_size bytes will be copied to volid. If the VolumeIdentifier is truncated because of this it will still be null terminated.
volsetid The buffer to put the VolumeSetIdentifier into. The VolumeIdentifier is 128 bytes as stored in the ISO9660 PrimaryVolumeDescriptor. Note that this is not a null terminated string.
volsetid_size At most volsetid_size bytes will be copied to volsetid.
Returns:
0 on success, -1 on error.

Definition at line 1124 of file dvd_reader.c.

int DVDUDFVolumeInfo ( dvd_reader_t ,
char *  ,
unsigned  int,
unsigned char *  ,
unsigned  int 
)

Get the UDF VolumeIdentifier and VolumeSetIdentifier from the PrimaryVolumeDescriptor.

Parameters:
dvd A read handle to get the disc ID from
volid The buffer to put the VolumeIdentifier into. The VolumeIdentifier is latin-1 encoded (8bit unicode) null terminated and max 32 bytes (including '')
volid_size No more than volid_size bytes will be copied to volid. If the VolumeIdentifier is truncated because of this it will still be null terminated.
volsetid The buffer to put the VolumeSetIdentifier into. The VolumeIdentifier is 128 bytes as stored in the UDF PrimaryVolumeDescriptor. Note that this is not a null terminated string.
volsetid_size At most volsetid_size bytes will be copied to volsetid.
Returns:
0 on success, -1 on error.

Definition at line 1184 of file dvd_reader.c.

Referenced by DVDProbe::probe().


Generated on Sat Dec 18 05:15:51 2010 for MythTV by  doxygen 1.5.5