# HG changeset patch # User reimar # Date 1230712983 0 # Node ID c743d79f187bb7adb3143d68344f568c2286c1a5 # Parent 6698620c1477fb16bd4e5d2617041024512db50e Move installed headers into dvdread directory to make them easier to use in a consistent way without installing. diff -r 6698620c1477 -r c743d79f187b Makefile.am --- a/Makefile.am Sat Dec 13 14:27:51 2008 +0000 +++ b/Makefile.am Wed Dec 31 08:43:03 2008 +0000 @@ -15,5 +15,5 @@ libdvdread_la_LDFLAGS = -version-info $(DVDREAD_LT_CURRENT):$(DVDREAD_LT_REVISION):$(DVDREAD_LT_AGE) \ -export-symbols-regex "(^dvd.*|^nav.*|^ifo.*|^DVD.*|^UDF.*)" -include_HEADERS = dvd_reader.h nav_read.h ifo_read.h \ - nav_print.h ifo_print.h ifo_types.h nav_types.h dvd_udf.h bitreader.h +include_HEADERS = dvdread/dvd_reader.h dvdread/nav_read.h dvdread/ifo_read.h \ + dvdread/nav_print.h dvdread/ifo_print.h dvdread/ifo_types.h dvdread/nav_types.h dvdread/dvd_udf.h dvdread/bitreader.h diff -r 6698620c1477 -r c743d79f187b bitreader.c --- a/bitreader.c Sat Dec 13 14:27:51 2008 +0000 +++ b/bitreader.c Wed Dec 31 08:43:03 2008 +0000 @@ -25,7 +25,7 @@ #include #include -#include "bitreader.h" +#include "dvdread/bitreader.h" int dvdread_getbits_init(getbits_state_t *state, uint8_t *start) { if ((state == NULL) || (start == NULL)) return 0; diff -r 6698620c1477 -r c743d79f187b bitreader.h --- a/bitreader.h Sat Dec 13 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2002 Håkan Hjort . - * - * This file is part of libdvdread. - * - * libdvdread is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * libdvdread is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with libdvdread; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LIBDVDREAD_BITREADER_H -#define LIBDVDREAD_BITREADER_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - uint8_t *start; - uint32_t byte_position; - uint32_t bit_position; - uint8_t byte; -} getbits_state_t; - -int dvdread_getbits_init(getbits_state_t *state, uint8_t *start); -uint32_t dvdread_getbits(getbits_state_t *state, uint32_t number_of_bits); - -#ifdef __cplusplus -}; -#endif -#endif /* LIBDVDREAD_BITREADER_H */ diff -r 6698620c1477 -r c743d79f187b dvd_input.c --- a/dvd_input.c Sat Dec 13 14:27:51 2008 +0000 +++ b/dvd_input.c Wed Dec 31 08:43:03 2008 +0000 @@ -26,7 +26,7 @@ #include #include -#include "dvd_reader.h" +#include "dvdread/dvd_reader.h" #include "dvd_input.h" diff -r 6698620c1477 -r c743d79f187b dvd_reader.c --- a/dvd_reader.c Sat Dec 13 14:27:51 2008 +0000 +++ b/dvd_reader.c Wed Dec 31 08:43:03 2008 +0000 @@ -65,9 +65,9 @@ #include #endif -#include "dvd_udf.h" +#include "dvdread/dvd_udf.h" #include "dvd_input.h" -#include "dvd_reader.h" +#include "dvdread/dvd_reader.h" #include "md5.h" #define DEFAULT_UDF_CACHE_LEVEL 1 diff -r 6698620c1477 -r c743d79f187b dvd_reader.h --- a/dvd_reader.h Sat Dec 13 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,277 +0,0 @@ -/* - * Copyright (C) 2001, 2002 Billy Biggs , - * Håkan Hjort , - * Björn Englund - * - * This file is part of libdvdread. - * - * libdvdread is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * libdvdread is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with libdvdread; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LIBDVDREAD_DVD_READER_H -#define LIBDVDREAD_DVD_READER_H - -#ifdef _MSC_VER -#include - -#include -#include -#endif - -#include -#include - -/** - * The DVD access interface. - * - * This file contains the functions that form the interface to to - * reading files located on a DVD. - */ - -/** - * The current version. - */ -#define DVDREAD_VERSION 904 - -/** - * The length of one Logical Block of a DVD. - */ -#define DVD_VIDEO_LB_LEN 2048 - -/** - * Maximum length of filenames allowed in UDF. - */ -#define MAX_UDF_FILE_NAME_LEN 2048 - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Opaque type that is used as a handle for one instance of an opened DVD. - */ -typedef struct dvd_reader_s dvd_reader_t; - -/** - * Opaque type for a file read handle, much like a normal fd or FILE *. - */ -typedef struct dvd_file_s dvd_file_t; - -/** - * 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 - * - * @param path Specifies the the device, file or directory to be used. - * @return If successful a a read handle is returned. Otherwise 0 is returned. - * - * dvd = DVDOpen(path); - */ -dvd_reader_t *DVDOpen( const char * ); - -/** - * Closes and cleans up the DVD reader object. - * - * You must close all open files before calling this function. - * - * @param dvd A read handle that should be closed. - * - * DVDClose(dvd); - */ -void DVDClose( dvd_reader_t * ); - -/** - * - */ -typedef enum { - DVD_READ_INFO_FILE, /**< VIDEO_TS.IFO or VTS_XX_0.IFO (title) */ - DVD_READ_INFO_BACKUP_FILE, /**< VIDEO_TS.BUP or VTS_XX_0.BUP (title) */ - DVD_READ_MENU_VOBS, /**< VIDEO_TS.VOB or VTS_XX_0.VOB (title) */ - DVD_READ_TITLE_VOBS /**< VTS_XX_[1-9].VOB (title). All files in - the title set are opened and read as a - single file. */ -} 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. - * - * @param dvd A dvd read handle. - * @param titlenum Which Video Title Set should be used, VIDEO_TS is 0. - * @param domain Which domain. - * @return If successful a a file read handle is returned, otherwise 0. - * - * dvd_file = DVDOpenFile(dvd, titlenum, domain); */ -dvd_file_t *DVDOpenFile( dvd_reader_t *, int, dvd_read_domain_t ); - -/** - * Closes a file and frees the associated structure. - * - * @param dvd_file The file read handle to be closed. - * - * DVDCloseFile(dvd_file); - */ -void DVDCloseFile( dvd_file_t * ); - -/** - * 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. - * - * @param dvd_file A file read handle. - * @param offset Block offset from the start of the file to start reading at. - * @param block_count Number of block to read. - * @param data Pointer to a buffer to write the data into. - * @return Returns number of blocks read on success, -1 on error. - * - * blocks_read = DVDReadBlocks(dvd_file, offset, block_count, data); - */ -ssize_t DVDReadBlocks( dvd_file_t *, int, size_t, unsigned char * ); - -/** - * 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. - * - * @param dvd_file A file read handle. - * @param seek_offset Byte offset from the start of the file to seek to. - * @return The resulting position in bytes from the beginning of the file. - * - * offset_set = DVDFileSeek(dvd_file, seek_offset); - */ -int32_t DVDFileSeek( dvd_file_t *, int32_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. - * - * @param dvd_file A file read handle. - * @param data Pointer to a buffer to write the data into. - * @param bytes Number of bytes to read. - * @return Returns number of bytes read on success, -1 on error. - * - * bytes_read = DVDReadBytes(dvd_file, data, bytes); - */ -ssize_t DVDReadBytes( dvd_file_t *, void *, size_t ); - -/** - * Returns the file size in blocks. - * - * @param dvd_file A file read handle. - * @return The size of the file in blocks, -1 on error. - * - * blocks = DVDFileSize(dvd_file); - */ -ssize_t DVDFileSize( dvd_file_t * ); - -/** - * 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. - * - * @param dvd A read handle to get the disc ID from - * @param discid The buffer to put the disc ID into. The buffer must - * have room for 128 bits (16 chars). - * @return 0 on success, -1 on error. - */ -int DVDDiscID( dvd_reader_t *, unsigned char * ); - -/** - * Get the UDF VolumeIdentifier and VolumeSetIdentifier - * from the PrimaryVolumeDescriptor. - * - * @param dvd A read handle to get the disc ID from - * @param volid The buffer to put the VolumeIdentifier into. - * The VolumeIdentifier is latin-1 encoded (8bit unicode) - * null terminated and max 32 bytes (including '\0') - * @param 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. - * @param 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. - * @param volsetid_size At most volsetid_size bytes will be copied to volsetid. - * @return 0 on success, -1 on error. - */ -int DVDUDFVolumeInfo( dvd_reader_t *, char *, unsigned int, - unsigned char *, unsigned int ); - -int DVDFileSeekForce( dvd_file_t *, int offset, int force_size); - -/** - * 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 * - * - * @param dvd A read handle to get the disc ID from - * @param volid The buffer to put the VolumeIdentifier into. - * The VolumeIdentifier is coded with '0-9','A-Z','_' - * null terminated and max 33 bytes (including '\0') - * @param 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. - * @param 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. - * @param volsetid_size At most volsetid_size bytes will be copied to volsetid. - * @return 0 on success, -1 on error. - */ -int DVDISOVolumeInfo( dvd_reader_t *, char *, unsigned int, - unsigned char *, unsigned int ); - -/** - * Sets the level of caching that is done when reading from a device - * - * @param dvd A read handle to get the disc ID from - * @param level The level of caching wanted. - * -1 - returns the current setting. - * 0 - UDF Cache turned off. - * 1 - (default level) Pointers to IFO files and some data from - * PrimaryVolumeDescriptor are cached. - * - * @return The level of caching. - */ -int DVDUDFCacheLevel( dvd_reader_t *, int ); - -#ifdef __cplusplus -}; -#endif -#endif /* LIBDVDREAD_DVD_READER_H */ diff -r 6698620c1477 -r c743d79f187b dvd_udf.c --- a/dvd_udf.c Sat Dec 13 14:27:51 2008 +0000 +++ b/dvd_udf.c Wed Dec 31 08:43:03 2008 +0000 @@ -39,8 +39,8 @@ #include #include -#include "dvd_reader.h" -#include "dvd_udf.h" +#include "dvdread/dvd_reader.h" +#include "dvdread/dvd_udf.h" /* Private but located in/shared with dvd_reader.c */ extern int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number, diff -r 6698620c1477 -r c743d79f187b dvd_udf.h --- a/dvd_udf.h Sat Dec 13 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * This code is based on dvdudf by: - * Christian Wolff . - * - * Modifications by: - * Billy Biggs . - * Björn Englund . - * - * dvdudf: parse and read the UDF volume information of a DVD Video - * Copyright (C) 1999 Christian Wolff for convergence integrated media - * GmbH The author can be reached at scarabaeus@convergence.de, the - * project's page is at http://linuxtv.org/dvd/ - * - * This file is part of libdvdread. - * - * libdvdread is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * libdvdread is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with libdvdread; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LIBDVDREAD_DVD_UDF_H -#define LIBDVDREAD_DVD_UDF_H - -#include - -#include "dvd_reader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Looks for a file on the UDF disc/imagefile and returns the block number - * where it begins, or 0 if it is not found. The filename should be an - * absolute pathname on the UDF filesystem, starting with '/'. For example, - * '/VIDEO_TS/VTS_01_1.IFO'. On success, filesize will be set to the size of - * the file in bytes. - */ -uint32_t UDFFindFile( dvd_reader_t *device, char *filename, uint32_t *size ); - -void FreeUDFCache(void *cache); -int UDFGetVolumeIdentifier(dvd_reader_t *device, - char *volid, unsigned int volid_size); -int UDFGetVolumeSetIdentifier(dvd_reader_t *device, - uint8_t *volsetid, unsigned int volsetid_size); -void *GetUDFCacheHandle(dvd_reader_t *device); -void SetUDFCacheHandle(dvd_reader_t *device, void *cache); - -#ifdef __cplusplus -}; -#endif -#endif /* LIBDVDREAD_DVD_UDF_H */ diff -r 6698620c1477 -r c743d79f187b dvdread/bitreader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdread/bitreader.h Wed Dec 31 08:43:03 2008 +0000 @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2000, 2001, 2002 Håkan Hjort . + * + * This file is part of libdvdread. + * + * libdvdread is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * libdvdread is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with libdvdread; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIBDVDREAD_BITREADER_H +#define LIBDVDREAD_BITREADER_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + uint8_t *start; + uint32_t byte_position; + uint32_t bit_position; + uint8_t byte; +} getbits_state_t; + +int dvdread_getbits_init(getbits_state_t *state, uint8_t *start); +uint32_t dvdread_getbits(getbits_state_t *state, uint32_t number_of_bits); + +#ifdef __cplusplus +}; +#endif +#endif /* LIBDVDREAD_BITREADER_H */ diff -r 6698620c1477 -r c743d79f187b dvdread/dvd_reader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdread/dvd_reader.h Wed Dec 31 08:43:03 2008 +0000 @@ -0,0 +1,277 @@ +/* + * Copyright (C) 2001, 2002 Billy Biggs , + * Håkan Hjort , + * Björn Englund + * + * This file is part of libdvdread. + * + * libdvdread is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * libdvdread is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with libdvdread; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIBDVDREAD_DVD_READER_H +#define LIBDVDREAD_DVD_READER_H + +#ifdef _MSC_VER +#include + +#include +#include +#endif + +#include +#include + +/** + * The DVD access interface. + * + * This file contains the functions that form the interface to to + * reading files located on a DVD. + */ + +/** + * The current version. + */ +#define DVDREAD_VERSION 904 + +/** + * The length of one Logical Block of a DVD. + */ +#define DVD_VIDEO_LB_LEN 2048 + +/** + * Maximum length of filenames allowed in UDF. + */ +#define MAX_UDF_FILE_NAME_LEN 2048 + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Opaque type that is used as a handle for one instance of an opened DVD. + */ +typedef struct dvd_reader_s dvd_reader_t; + +/** + * Opaque type for a file read handle, much like a normal fd or FILE *. + */ +typedef struct dvd_file_s dvd_file_t; + +/** + * 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 + * + * @param path Specifies the the device, file or directory to be used. + * @return If successful a a read handle is returned. Otherwise 0 is returned. + * + * dvd = DVDOpen(path); + */ +dvd_reader_t *DVDOpen( const char * ); + +/** + * Closes and cleans up the DVD reader object. + * + * You must close all open files before calling this function. + * + * @param dvd A read handle that should be closed. + * + * DVDClose(dvd); + */ +void DVDClose( dvd_reader_t * ); + +/** + * + */ +typedef enum { + DVD_READ_INFO_FILE, /**< VIDEO_TS.IFO or VTS_XX_0.IFO (title) */ + DVD_READ_INFO_BACKUP_FILE, /**< VIDEO_TS.BUP or VTS_XX_0.BUP (title) */ + DVD_READ_MENU_VOBS, /**< VIDEO_TS.VOB or VTS_XX_0.VOB (title) */ + DVD_READ_TITLE_VOBS /**< VTS_XX_[1-9].VOB (title). All files in + the title set are opened and read as a + single file. */ +} 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. + * + * @param dvd A dvd read handle. + * @param titlenum Which Video Title Set should be used, VIDEO_TS is 0. + * @param domain Which domain. + * @return If successful a a file read handle is returned, otherwise 0. + * + * dvd_file = DVDOpenFile(dvd, titlenum, domain); */ +dvd_file_t *DVDOpenFile( dvd_reader_t *, int, dvd_read_domain_t ); + +/** + * Closes a file and frees the associated structure. + * + * @param dvd_file The file read handle to be closed. + * + * DVDCloseFile(dvd_file); + */ +void DVDCloseFile( dvd_file_t * ); + +/** + * 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. + * + * @param dvd_file A file read handle. + * @param offset Block offset from the start of the file to start reading at. + * @param block_count Number of block to read. + * @param data Pointer to a buffer to write the data into. + * @return Returns number of blocks read on success, -1 on error. + * + * blocks_read = DVDReadBlocks(dvd_file, offset, block_count, data); + */ +ssize_t DVDReadBlocks( dvd_file_t *, int, size_t, unsigned char * ); + +/** + * 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. + * + * @param dvd_file A file read handle. + * @param seek_offset Byte offset from the start of the file to seek to. + * @return The resulting position in bytes from the beginning of the file. + * + * offset_set = DVDFileSeek(dvd_file, seek_offset); + */ +int32_t DVDFileSeek( dvd_file_t *, int32_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. + * + * @param dvd_file A file read handle. + * @param data Pointer to a buffer to write the data into. + * @param bytes Number of bytes to read. + * @return Returns number of bytes read on success, -1 on error. + * + * bytes_read = DVDReadBytes(dvd_file, data, bytes); + */ +ssize_t DVDReadBytes( dvd_file_t *, void *, size_t ); + +/** + * Returns the file size in blocks. + * + * @param dvd_file A file read handle. + * @return The size of the file in blocks, -1 on error. + * + * blocks = DVDFileSize(dvd_file); + */ +ssize_t DVDFileSize( dvd_file_t * ); + +/** + * 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. + * + * @param dvd A read handle to get the disc ID from + * @param discid The buffer to put the disc ID into. The buffer must + * have room for 128 bits (16 chars). + * @return 0 on success, -1 on error. + */ +int DVDDiscID( dvd_reader_t *, unsigned char * ); + +/** + * Get the UDF VolumeIdentifier and VolumeSetIdentifier + * from the PrimaryVolumeDescriptor. + * + * @param dvd A read handle to get the disc ID from + * @param volid The buffer to put the VolumeIdentifier into. + * The VolumeIdentifier is latin-1 encoded (8bit unicode) + * null terminated and max 32 bytes (including '\0') + * @param 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. + * @param 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. + * @param volsetid_size At most volsetid_size bytes will be copied to volsetid. + * @return 0 on success, -1 on error. + */ +int DVDUDFVolumeInfo( dvd_reader_t *, char *, unsigned int, + unsigned char *, unsigned int ); + +int DVDFileSeekForce( dvd_file_t *, int offset, int force_size); + +/** + * 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 * + * + * @param dvd A read handle to get the disc ID from + * @param volid The buffer to put the VolumeIdentifier into. + * The VolumeIdentifier is coded with '0-9','A-Z','_' + * null terminated and max 33 bytes (including '\0') + * @param 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. + * @param 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. + * @param volsetid_size At most volsetid_size bytes will be copied to volsetid. + * @return 0 on success, -1 on error. + */ +int DVDISOVolumeInfo( dvd_reader_t *, char *, unsigned int, + unsigned char *, unsigned int ); + +/** + * Sets the level of caching that is done when reading from a device + * + * @param dvd A read handle to get the disc ID from + * @param level The level of caching wanted. + * -1 - returns the current setting. + * 0 - UDF Cache turned off. + * 1 - (default level) Pointers to IFO files and some data from + * PrimaryVolumeDescriptor are cached. + * + * @return The level of caching. + */ +int DVDUDFCacheLevel( dvd_reader_t *, int ); + +#ifdef __cplusplus +}; +#endif +#endif /* LIBDVDREAD_DVD_READER_H */ diff -r 6698620c1477 -r c743d79f187b dvdread/dvd_udf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdread/dvd_udf.h Wed Dec 31 08:43:03 2008 +0000 @@ -0,0 +1,62 @@ +/* + * This code is based on dvdudf by: + * Christian Wolff . + * + * Modifications by: + * Billy Biggs . + * Björn Englund . + * + * dvdudf: parse and read the UDF volume information of a DVD Video + * Copyright (C) 1999 Christian Wolff for convergence integrated media + * GmbH The author can be reached at scarabaeus@convergence.de, the + * project's page is at http://linuxtv.org/dvd/ + * + * This file is part of libdvdread. + * + * libdvdread is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * libdvdread is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with libdvdread; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIBDVDREAD_DVD_UDF_H +#define LIBDVDREAD_DVD_UDF_H + +#include + +#include "dvdread/dvd_reader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Looks for a file on the UDF disc/imagefile and returns the block number + * where it begins, or 0 if it is not found. The filename should be an + * absolute pathname on the UDF filesystem, starting with '/'. For example, + * '/VIDEO_TS/VTS_01_1.IFO'. On success, filesize will be set to the size of + * the file in bytes. + */ +uint32_t UDFFindFile( dvd_reader_t *device, char *filename, uint32_t *size ); + +void FreeUDFCache(void *cache); +int UDFGetVolumeIdentifier(dvd_reader_t *device, + char *volid, unsigned int volid_size); +int UDFGetVolumeSetIdentifier(dvd_reader_t *device, + uint8_t *volsetid, unsigned int volsetid_size); +void *GetUDFCacheHandle(dvd_reader_t *device); +void SetUDFCacheHandle(dvd_reader_t *device, void *cache); + +#ifdef __cplusplus +}; +#endif +#endif /* LIBDVDREAD_DVD_UDF_H */ diff -r 6698620c1477 -r c743d79f187b dvdread/ifo_print.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdread/ifo_print.h Wed Dec 31 08:43:03 2008 +0000 @@ -0,0 +1,28 @@ +/* + * This file is part of libdvdread. + * + * libdvdread is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * libdvdread is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with libdvdread; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIBDVDREAD_IFO_PRINT_H +#define LIBDVDREAD_IFO_PRINT_H + +#include +#include "ifo_types.h" + +void ifo_print(dvd_reader_t *dvd, int title); +void dvdread_print_time(dvd_time_t *dtime); + +#endif /* LIBDVDREAD_IFO_PRINT_H */ diff -r 6698620c1477 -r c743d79f187b dvdread/ifo_read.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdread/ifo_read.h Wed Dec 31 08:43:03 2008 +0000 @@ -0,0 +1,229 @@ +/* + * Copyright (C) 2000, 2001, 2002 Björn Englund , + * Håkan Hjort + * + * This file is part of libdvdread. + * + * libdvdread is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * libdvdread is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with libdvdread; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIBDVDREAD_IFO_READ_H +#define LIBDVDREAD_IFO_READ_H + +#include "ifo_types.h" +#include "dvdread/dvd_reader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * handle = ifoOpen(dvd, title); + * + * Opens an IFO and reads in all the data for the IFO file corresponding to the + * given title. If title 0 is given, the video manager IFO file is read. + * Returns a handle to a completely parsed structure. + */ +ifo_handle_t *ifoOpen(dvd_reader_t *, int ); + +/** + * handle = ifoOpenVMGI(dvd); + * + * Opens an IFO and reads in _only_ the vmgi_mat data. This call can be used + * together with the calls below to read in each segment of the IFO file on + * demand. + */ +ifo_handle_t *ifoOpenVMGI(dvd_reader_t *); + +/** + * handle = ifoOpenVTSI(dvd, title); + * + * Opens an IFO and reads in _only_ the vtsi_mat data. This call can be used + * together with the calls below to read in each segment of the IFO file on + * demand. + */ +ifo_handle_t *ifoOpenVTSI(dvd_reader_t *, int); + +/** + * ifoClose(ifofile); + * Cleans up the IFO information. This will free all data allocated for the + * substructures. + */ +void ifoClose(ifo_handle_t *); + +/** + * The following functions are for reading only part of the VMGI/VTSI files. + * Returns 1 if the data was successfully read and 0 on error. + */ + +/** + * okay = ifoRead_PLT_MAIT(ifofile); + * + * Read in the Parental Management Information table, filling the + * ifofile->ptl_mait structure and its substructures. This data is only + * located in the video manager information file. This fills the + * ifofile->ptl_mait structure and all its substructures. + */ +int ifoRead_PTL_MAIT(ifo_handle_t *); + +/** + * okay = ifoRead_VTS_ATRT(ifofile); + * + * Read in the attribute table for the main menu vob, filling the + * ifofile->vts_atrt structure and its substructures. Only located in the + * video manager information file. This fills in the ifofile->vts_atrt + * structure and all its substructures. + */ +int ifoRead_VTS_ATRT(ifo_handle_t *); + +/** + * okay = ifoRead_TT_SRPT(ifofile); + * + * Reads the title info for the main menu, filling the ifofile->tt_srpt + * structure and its substructures. This data is only located in the video + * manager information file. This structure is mandatory in the IFO file. + */ +int ifoRead_TT_SRPT(ifo_handle_t *); + +/** + * okay = ifoRead_VTS_PTT_SRPT(ifofile); + * + * Reads in the part of title search pointer table, filling the + * ifofile->vts_ptt_srpt structure and its substructures. This data is only + * located in the video title set information file. This structure is + * mandatory, and must be included in the VTSI file. + */ +int ifoRead_VTS_PTT_SRPT(ifo_handle_t *); + +/** + * okay = ifoRead_FP_PGC(ifofile); + * + * Reads in the first play program chain data, filling the + * ifofile->first_play_pgc structure. This data is only located in the video + * manager information file (VMGI). This structure is optional. + */ +int ifoRead_FP_PGC(ifo_handle_t *); + +/** + * okay = ifoRead_PGCIT(ifofile); + * + * Reads in the program chain information table for the video title set. Fills + * in the ifofile->vts_pgcit structure and its substructures, which includes + * the data for each program chain in the set. This data is only located in + * the video title set information file. This structure is mandatory, and must + * be included in the VTSI file. + */ +int ifoRead_PGCIT(ifo_handle_t *); + +/** + * okay = ifoRead_PGCI_UT(ifofile); + * + * Reads in the menu PGCI unit table for the menu VOB. For the video manager, + * this corresponds to the VIDEO_TS.VOB file, and for each title set, this + * corresponds to the VTS_XX_0.VOB file. This data is located in both the + * video manager and video title set information files. For VMGI files, this + * fills the ifofile->vmgi_pgci_ut structure and all its substructures. For + * VTSI files, this fills the ifofile->vtsm_pgci_ut structure. + */ +int ifoRead_PGCI_UT(ifo_handle_t *); + +/** + * okay = ifoRead_VTS_TMAPT(ifofile); + * + * Reads in the VTS Time Map Table, this data is only located in the video + * title set information file. This fills the ifofile->vts_tmapt structure + * and all its substructures. When pressent enables VOBU level time-based + * seeking for One_Sequential_PGC_Titles. + */ +int ifoRead_VTS_TMAPT(ifo_handle_t *); + +/** + * okay = ifoRead_C_ADT(ifofile); + * + * Reads in the cell address table for the menu VOB. For the video manager, + * this corresponds to the VIDEO_TS.VOB file, and for each title set, this + * corresponds to the VTS_XX_0.VOB file. This data is located in both the + * video manager and video title set information files. For VMGI files, this + * fills the ifofile->vmgm_c_adt structure and all its substructures. For VTSI + * files, this fills the ifofile->vtsm_c_adt structure. + */ +int ifoRead_C_ADT(ifo_handle_t *); + +/** + * okay = ifoRead_TITLE_C_ADT(ifofile); + * + * Reads in the cell address table for the video title set corresponding to + * this IFO file. This data is only located in the video title set information + * file. This structure is mandatory, and must be included in the VTSI file. + * This call fills the ifofile->vts_c_adt structure and its substructures. + */ +int ifoRead_TITLE_C_ADT(ifo_handle_t *); + +/** + * okay = ifoRead_VOBU_ADMAP(ifofile); + * + * Reads in the VOBU address map for the menu VOB. For the video manager, this + * corresponds to the VIDEO_TS.VOB file, and for each title set, this + * corresponds to the VTS_XX_0.VOB file. This data is located in both the + * video manager and video title set information files. For VMGI files, this + * fills the ifofile->vmgm_vobu_admap structure and all its substructures. For + * VTSI files, this fills the ifofile->vtsm_vobu_admap structure. + */ +int ifoRead_VOBU_ADMAP(ifo_handle_t *); + +/** + * okay = ifoRead_TITLE_VOBU_ADMAP(ifofile); + * + * Reads in the VOBU address map for the associated video title set. This data + * is only located in the video title set information file. This structure is + * mandatory, and must be included in the VTSI file. Fills the + * ifofile->vts_vobu_admap structure and its substructures. + */ +int ifoRead_TITLE_VOBU_ADMAP(ifo_handle_t *); + +/** + * okay = ifoRead_TXTDT_MGI(ifofile); + * + * Reads in the text data strings for the DVD. Fills the ifofile->txtdt_mgi + * structure and all its substructures. This data is only located in the video + * manager information file. This structure is mandatory, and must be included + * in the VMGI file. + */ +int ifoRead_TXTDT_MGI(ifo_handle_t *); + +/** + * The following functions are used for freeing parsed sections of the + * ifo_handle_t structure and the allocated substructures. The free calls + * below are safe: they will not mind if you attempt to free part of an IFO + * file which was not read in or which does not exist. + */ +void ifoFree_PTL_MAIT(ifo_handle_t *); +void ifoFree_VTS_ATRT(ifo_handle_t *); +void ifoFree_TT_SRPT(ifo_handle_t *); +void ifoFree_VTS_PTT_SRPT(ifo_handle_t *); +void ifoFree_FP_PGC(ifo_handle_t *); +void ifoFree_PGCIT(ifo_handle_t *); +void ifoFree_PGCI_UT(ifo_handle_t *); +void ifoFree_VTS_TMAPT(ifo_handle_t *); +void ifoFree_C_ADT(ifo_handle_t *); +void ifoFree_TITLE_C_ADT(ifo_handle_t *); +void ifoFree_VOBU_ADMAP(ifo_handle_t *); +void ifoFree_TITLE_VOBU_ADMAP(ifo_handle_t *); +void ifoFree_TXTDT_MGI(ifo_handle_t *); + +#ifdef __cplusplus +}; +#endif +#endif /* LIBDVDREAD_IFO_READ_H */ diff -r 6698620c1477 -r c743d79f187b dvdread/ifo_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdread/ifo_types.h Wed Dec 31 08:43:03 2008 +0000 @@ -0,0 +1,750 @@ +/* + * Copyright (C) 2000, 2001 Björn Englund , + * Håkan Hjort + * + * This file is part of libdvdread. + * + * libdvdread is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * libdvdread is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with libdvdread; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIBDVDREAD_IFO_TYPES_H +#define LIBDVDREAD_IFO_TYPES_H + +#include +#include "dvdread/dvd_reader.h" + + +#undef ATTRIBUTE_PACKED +#undef PRAGMA_PACK_BEGIN +#undef PRAGMA_PACK_END + +#if defined(__GNUC__) +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ATTRIBUTE_PACKED __attribute__ ((packed)) +#define PRAGMA_PACK 0 +#endif +#endif + +#if !defined(ATTRIBUTE_PACKED) +#define ATTRIBUTE_PACKED +#define PRAGMA_PACK 1 +#endif + +#if PRAGMA_PACK +#pragma pack(1) +#endif + + +/** + * Common + * + * The following structures are used in both the VMGI and VTSI. + */ + + +/** + * DVD Time Information. + */ +typedef struct { + uint8_t hour; + uint8_t minute; + uint8_t second; + uint8_t frame_u; /* The two high bits are the frame rate. */ +} ATTRIBUTE_PACKED dvd_time_t; + +/** + * Type to store per-command data. + */ +typedef struct { + uint8_t bytes[8]; +} ATTRIBUTE_PACKED vm_cmd_t; +#define COMMAND_DATA_SIZE 8U + + +/** + * Video Attributes. + */ +typedef struct { + unsigned char mpeg_version : 2; + unsigned char video_format : 2; + unsigned char display_aspect_ratio : 2; + unsigned char permitted_df : 2; + + unsigned char line21_cc_1 : 1; + unsigned char line21_cc_2 : 1; + unsigned char unknown1 : 1; + unsigned char bit_rate : 1; + + unsigned char picture_size : 2; + unsigned char letterboxed : 1; + unsigned char film_mode : 1; +} ATTRIBUTE_PACKED video_attr_t; + +/** + * Audio Attributes. + */ +typedef struct { + unsigned char audio_format : 3; + unsigned char multichannel_extension : 1; + unsigned char lang_type : 2; + unsigned char application_mode : 2; + + unsigned char quantization : 2; + unsigned char sample_frequency : 2; + unsigned char unknown1 : 1; + unsigned char channels : 3; + uint16_t lang_code; + uint8_t lang_extension; + uint8_t code_extension; + uint8_t unknown3; + union { + struct ATTRIBUTE_PACKED { + unsigned char unknown4 : 1; + unsigned char channel_assignment : 3; + unsigned char version : 2; + unsigned char mc_intro : 1; /* probably 0: true, 1:false */ + unsigned char mode : 1; /* Karaoke mode 0: solo 1: duet */ + } karaoke; + struct ATTRIBUTE_PACKED { + unsigned char unknown5 : 4; + unsigned char dolby_encoded : 1; /* suitable for surround decoding */ + unsigned char unknown6 : 3; + } surround; + } ATTRIBUTE_PACKED app_info; +} ATTRIBUTE_PACKED audio_attr_t; + + +/** + * MultiChannel Extension + */ +typedef struct { + unsigned int zero1 : 7; + unsigned int ach0_gme : 1; + + unsigned int zero2 : 7; + unsigned int ach1_gme : 1; + + unsigned int zero3 : 4; + unsigned int ach2_gv1e : 1; + unsigned int ach2_gv2e : 1; + unsigned int ach2_gm1e : 1; + unsigned int ach2_gm2e : 1; + + unsigned int zero4 : 4; + unsigned int ach3_gv1e : 1; + unsigned int ach3_gv2e : 1; + unsigned int ach3_gmAe : 1; + unsigned int ach3_se2e : 1; + + unsigned int zero5 : 4; + unsigned int ach4_gv1e : 1; + unsigned int ach4_gv2e : 1; + unsigned int ach4_gmBe : 1; + unsigned int ach4_seBe : 1; + uint8_t zero6[19]; +} ATTRIBUTE_PACKED multichannel_ext_t; + + +/** + * Subpicture Attributes. + */ +typedef struct { + /* + * type: 0 not specified + * 1 language + * 2 other + * coding mode: 0 run length + * 1 extended + * 2 other + * language: indicates language if type == 1 + * lang extension: if type == 1 contains the lang extension + */ + unsigned char code_mode : 3; + unsigned char zero1 : 3; + unsigned char type : 2; + uint8_t zero2; + uint16_t lang_code; + uint8_t lang_extension; + uint8_t code_extension; +} ATTRIBUTE_PACKED subp_attr_t; + + + +/** + * PGC Command Table. + */ +typedef struct { + uint16_t nr_of_pre; + uint16_t nr_of_post; + uint16_t nr_of_cell; + uint16_t zero_1; + vm_cmd_t *pre_cmds; + vm_cmd_t *post_cmds; + vm_cmd_t *cell_cmds; +} ATTRIBUTE_PACKED pgc_command_tbl_t; +#define PGC_COMMAND_TBL_SIZE 8U + +/** + * PGC Program Map + */ +typedef uint8_t pgc_program_map_t; + +/** + * Cell Playback Information. + */ +typedef struct { + unsigned int block_mode : 2; + unsigned int block_type : 2; + unsigned int seamless_play : 1; + unsigned int interleaved : 1; + unsigned int stc_discontinuity: 1; + unsigned int seamless_angle : 1; + + unsigned int playback_mode : 1; /**< When set, enter StillMode after each VOBU */ + unsigned int restricted : 1; /**< ?? drop out of fastforward? */ + unsigned int unknown2 : 6; + uint8_t still_time; + uint8_t cell_cmd_nr; + dvd_time_t playback_time; + uint32_t first_sector; + uint32_t first_ilvu_end_sector; + uint32_t last_vobu_start_sector; + uint32_t last_sector; +} ATTRIBUTE_PACKED cell_playback_t; + +#define BLOCK_TYPE_NONE 0x0 +#define BLOCK_TYPE_ANGLE_BLOCK 0x1 + +#define BLOCK_MODE_NOT_IN_BLOCK 0x0 +#define BLOCK_MODE_FIRST_CELL 0x1 +#define BLOCK_MODE_IN_BLOCK 0x2 +#define BLOCK_MODE_LAST_CELL 0x3 + +/** + * Cell Position Information. + */ +typedef struct { + uint16_t vob_id_nr; + uint8_t zero_1; + uint8_t cell_nr; +} ATTRIBUTE_PACKED cell_position_t; + +/** + * User Operations. + */ +typedef struct { + unsigned int zero : 7; /* 25-31 */ + unsigned int video_pres_mode_change : 1; /* 24 */ + + unsigned int karaoke_audio_pres_mode_change : 1; /* 23 */ + unsigned int angle_change : 1; + unsigned int subpic_stream_change : 1; + unsigned int audio_stream_change : 1; + unsigned int pause_on : 1; + unsigned int still_off : 1; + unsigned int button_select_or_activate : 1; + unsigned int resume : 1; /* 16 */ + + unsigned int chapter_menu_call : 1; /* 15 */ + unsigned int angle_menu_call : 1; + unsigned int audio_menu_call : 1; + unsigned int subpic_menu_call : 1; + unsigned int root_menu_call : 1; + unsigned int title_menu_call : 1; + unsigned int backward_scan : 1; + unsigned int forward_scan : 1; /* 8 */ + + unsigned int next_pg_search : 1; /* 7 */ + unsigned int prev_or_top_pg_search : 1; + unsigned int time_or_chapter_search : 1; + unsigned int go_up : 1; + unsigned int stop : 1; + unsigned int title_play : 1; + unsigned int chapter_search_or_play : 1; + unsigned int title_or_time_play : 1; /* 0 */ +} ATTRIBUTE_PACKED user_ops_t; + +/** + * Program Chain Information. + */ +typedef struct { + uint16_t zero_1; + uint8_t nr_of_programs; + uint8_t nr_of_cells; + dvd_time_t playback_time; + user_ops_t prohibited_ops; + uint16_t audio_control[8]; /* New type? */ + uint32_t subp_control[32]; /* New type? */ + uint16_t next_pgc_nr; + uint16_t prev_pgc_nr; + uint16_t goup_pgc_nr; + uint8_t still_time; + uint8_t pg_playback_mode; + uint32_t palette[16]; /* New type struct {zero_1, Y, Cr, Cb} ? */ + uint16_t command_tbl_offset; + uint16_t program_map_offset; + uint16_t cell_playback_offset; + uint16_t cell_position_offset; + pgc_command_tbl_t *command_tbl; + pgc_program_map_t *program_map; + cell_playback_t *cell_playback; + cell_position_t *cell_position; +} ATTRIBUTE_PACKED pgc_t; +#define PGC_SIZE 236U + +/** + * Program Chain Information Search Pointer. + */ +typedef struct { + uint8_t entry_id; + unsigned int block_mode : 2; + unsigned int block_type : 2; + unsigned int unknown1 : 4; + uint16_t ptl_id_mask; + uint32_t pgc_start_byte; + pgc_t *pgc; +} ATTRIBUTE_PACKED pgci_srp_t; +#define PGCI_SRP_SIZE 8U + +/** + * Program Chain Information Table. + */ +typedef struct { + uint16_t nr_of_pgci_srp; + uint16_t zero_1; + uint32_t last_byte; + pgci_srp_t *pgci_srp; +} ATTRIBUTE_PACKED pgcit_t; +#define PGCIT_SIZE 8U + +/** + * Menu PGCI Language Unit. + */ +typedef struct { + uint16_t lang_code; + uint8_t lang_extension; + uint8_t exists; + uint32_t lang_start_byte; + pgcit_t *pgcit; +} ATTRIBUTE_PACKED pgci_lu_t; +#define PGCI_LU_SIZE 8U + +/** + * Menu PGCI Unit Table. + */ +typedef struct { + uint16_t nr_of_lus; + uint16_t zero_1; + uint32_t last_byte; + pgci_lu_t *lu; +} ATTRIBUTE_PACKED pgci_ut_t; +#define PGCI_UT_SIZE 8U + +/** + * Cell Address Information. + */ +typedef struct { + uint16_t vob_id; + uint8_t cell_id; + uint8_t zero_1; + uint32_t start_sector; + uint32_t last_sector; +} ATTRIBUTE_PACKED cell_adr_t; + +/** + * Cell Address Table. + */ +typedef struct { + uint16_t nr_of_vobs; /* VOBs */ + uint16_t zero_1; + uint32_t last_byte; + cell_adr_t *cell_adr_table; /* No explicit size given. */ +} ATTRIBUTE_PACKED c_adt_t; +#define C_ADT_SIZE 8U + +/** + * VOBU Address Map. + */ +typedef struct { + uint32_t last_byte; + uint32_t *vobu_start_sectors; +} ATTRIBUTE_PACKED vobu_admap_t; +#define VOBU_ADMAP_SIZE 4U + + + + +/** + * VMGI + * + * The following structures relate to the Video Manager. + */ + +/** + * Video Manager Information Management Table. + */ +typedef struct { + char vmg_identifier[12]; + uint32_t vmg_last_sector; + uint8_t zero_1[12]; + uint32_t vmgi_last_sector; + uint8_t zero_2; + uint8_t specification_version; + uint32_t vmg_category; + uint16_t vmg_nr_of_volumes; + uint16_t vmg_this_volume_nr; + uint8_t disc_side; + uint8_t zero_3[19]; + uint16_t vmg_nr_of_title_sets; /* Number of VTSs. */ + char provider_identifier[32]; + uint64_t vmg_pos_code; + uint8_t zero_4[24]; + uint32_t vmgi_last_byte; + uint32_t first_play_pgc; + uint8_t zero_5[56]; + uint32_t vmgm_vobs; /* sector */ + uint32_t tt_srpt; /* sector */ + uint32_t vmgm_pgci_ut; /* sector */ + uint32_t ptl_mait; /* sector */ + uint32_t vts_atrt; /* sector */ + uint32_t txtdt_mgi; /* sector */ + uint32_t vmgm_c_adt; /* sector */ + uint32_t vmgm_vobu_admap; /* sector */ + uint8_t zero_6[32]; + + video_attr_t vmgm_video_attr; + uint8_t zero_7; + uint8_t nr_of_vmgm_audio_streams; /* should be 0 or 1 */ + audio_attr_t vmgm_audio_attr; + audio_attr_t zero_8[7]; + uint8_t zero_9[17]; + uint8_t nr_of_vmgm_subp_streams; /* should be 0 or 1 */ + subp_attr_t vmgm_subp_attr; + subp_attr_t zero_10[27]; /* XXX: how much 'padding' here? */ +} ATTRIBUTE_PACKED vmgi_mat_t; + +typedef struct { + unsigned int zero_1 : 1; + unsigned int multi_or_random_pgc_title : 1; /* 0: one sequential pgc title */ + unsigned int jlc_exists_in_cell_cmd : 1; + unsigned int jlc_exists_in_prepost_cmd : 1; + unsigned int jlc_exists_in_button_cmd : 1; + unsigned int jlc_exists_in_tt_dom : 1; + unsigned int chapter_search_or_play : 1; /* UOP 1 */ + unsigned int title_or_time_play : 1; /* UOP 0 */ +} ATTRIBUTE_PACKED playback_type_t; + +/** + * Title Information. + */ +typedef struct { + playback_type_t pb_ty; + uint8_t nr_of_angles; + uint16_t nr_of_ptts; + uint16_t parental_id; + uint8_t title_set_nr; + uint8_t vts_ttn; + uint32_t title_set_sector; +} ATTRIBUTE_PACKED title_info_t; + +/** + * PartOfTitle Search Pointer Table. + */ +typedef struct { + uint16_t nr_of_srpts; + uint16_t zero_1; + uint32_t last_byte; + title_info_t *title; +} ATTRIBUTE_PACKED tt_srpt_t; +#define TT_SRPT_SIZE 8U + + +/** + * Parental Management Information Unit Table. + * Level 1 (US: G), ..., 7 (US: NC-17), 8 + */ +typedef uint16_t pf_level_t[8]; + +/** + * Parental Management Information Unit Table. + */ +typedef struct { + uint16_t country_code; + uint16_t zero_1; + uint16_t pf_ptl_mai_start_byte; + uint16_t zero_2; + pf_level_t *pf_ptl_mai; /* table of (nr_of_vtss + 1), video_ts is first */ +} ATTRIBUTE_PACKED ptl_mait_country_t; +#define PTL_MAIT_COUNTRY_SIZE 8U + +/** + * Parental Management Information Table. + */ +typedef struct { + uint16_t nr_of_countries; + uint16_t nr_of_vtss; + uint32_t last_byte; + ptl_mait_country_t *countries; +} ATTRIBUTE_PACKED ptl_mait_t; +#define PTL_MAIT_SIZE 8U + +/** + * Video Title Set Attributes. + */ +typedef struct { + uint32_t last_byte; + uint32_t vts_cat; + + video_attr_t vtsm_vobs_attr; + uint8_t zero_1; + uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */ + audio_attr_t vtsm_audio_attr; + audio_attr_t zero_2[7]; + uint8_t zero_3[16]; + uint8_t zero_4; + uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */ + subp_attr_t vtsm_subp_attr; + subp_attr_t zero_5[27]; + + uint8_t zero_6[2]; + + video_attr_t vtstt_vobs_video_attr; + uint8_t zero_7; + uint8_t nr_of_vtstt_audio_streams; + audio_attr_t vtstt_audio_attr[8]; + uint8_t zero_8[16]; + uint8_t zero_9; + uint8_t nr_of_vtstt_subp_streams; + subp_attr_t vtstt_subp_attr[32]; +} ATTRIBUTE_PACKED vts_attributes_t; +#define VTS_ATTRIBUTES_SIZE 542U +#define VTS_ATTRIBUTES_MIN_SIZE 356U + +/** + * Video Title Set Attribute Table. + */ +typedef struct { + uint16_t nr_of_vtss; + uint16_t zero_1; + uint32_t last_byte; + vts_attributes_t *vts; + uint32_t *vts_atrt_offsets; /* offsets table for each vts_attributes */ +} ATTRIBUTE_PACKED vts_atrt_t; +#define VTS_ATRT_SIZE 8U + +/** + * Text Data. (Incomplete) + */ +typedef struct { + uint32_t last_byte; /* offsets are relative here */ + uint16_t offsets[100]; /* == nr_of_srpts + 1 (first is disc title) */ +#if 0 + uint16_t unknown; /* 0x48 ?? 0x48 words (16bit) info following */ + uint16_t zero_1; + + uint8_t type_of_info; /* ?? 01 == disc, 02 == Title, 04 == Title part */ + uint8_t unknown1; + uint8_t unknown2; + uint8_t unknown3; + uint8_t unknown4; /* ?? allways 0x30 language?, text format? */ + uint8_t unknown5; + uint16_t offset; /* from first */ + + char text[12]; /* ended by 0x09 */ +#endif +} ATTRIBUTE_PACKED txtdt_t; + +/** + * Text Data Language Unit. (Incomplete) + */ +typedef struct { + uint16_t lang_code; + uint16_t unknown; /* 0x0001, title 1? disc 1? side 1? */ + uint32_t txtdt_start_byte; /* prt, rel start of vmg_txtdt_mgi */ + txtdt_t *txtdt; +} ATTRIBUTE_PACKED txtdt_lu_t; +#define TXTDT_LU_SIZE 8U + +/** + * Text Data Manager Information. (Incomplete) + */ +typedef struct { + char disc_name[14]; /* how many bytes?? */ + uint16_t nr_of_language_units; /* 32bit?? */ + uint32_t last_byte; + txtdt_lu_t *lu; +} ATTRIBUTE_PACKED txtdt_mgi_t; +#define TXTDT_MGI_SIZE 20U + + +/** + * VTS + * + * Structures relating to the Video Title Set (VTS). + */ + +/** + * Video Title Set Information Management Table. + */ +typedef struct { + char vts_identifier[12]; + uint32_t vts_last_sector; + uint8_t zero_1[12]; + uint32_t vtsi_last_sector; + uint8_t zero_2; + uint8_t specification_version; + uint32_t vts_category; + uint16_t zero_3; + uint16_t zero_4; + uint8_t zero_5; + uint8_t zero_6[19]; + uint16_t zero_7; + uint8_t zero_8[32]; + uint64_t zero_9; + uint8_t zero_10[24]; + uint32_t vtsi_last_byte; + uint32_t zero_11; + uint8_t zero_12[56]; + uint32_t vtsm_vobs; /* sector */ + uint32_t vtstt_vobs; /* sector */ + uint32_t vts_ptt_srpt; /* sector */ + uint32_t vts_pgcit; /* sector */ + uint32_t vtsm_pgci_ut; /* sector */ + uint32_t vts_tmapt; /* sector */ + uint32_t vtsm_c_adt; /* sector */ + uint32_t vtsm_vobu_admap; /* sector */ + uint32_t vts_c_adt; /* sector */ + uint32_t vts_vobu_admap; /* sector */ + uint8_t zero_13[24]; + + video_attr_t vtsm_video_attr; + uint8_t zero_14; + uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */ + audio_attr_t vtsm_audio_attr; + audio_attr_t zero_15[7]; + uint8_t zero_16[17]; + uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */ + subp_attr_t vtsm_subp_attr; + subp_attr_t zero_17[27]; + uint8_t zero_18[2]; + + video_attr_t vts_video_attr; + uint8_t zero_19; + uint8_t nr_of_vts_audio_streams; + audio_attr_t vts_audio_attr[8]; + uint8_t zero_20[17]; + uint8_t nr_of_vts_subp_streams; + subp_attr_t vts_subp_attr[32]; + uint16_t zero_21; + multichannel_ext_t vts_mu_audio_attr[8]; + /* XXX: how much 'padding' here, if any? */ +} ATTRIBUTE_PACKED vtsi_mat_t; + +/** + * PartOfTitle Unit Information. + */ +typedef struct { + uint16_t pgcn; + uint16_t pgn; +} ATTRIBUTE_PACKED ptt_info_t; + +/** + * PartOfTitle Information. + */ +typedef struct { + uint16_t nr_of_ptts; + ptt_info_t *ptt; +} ATTRIBUTE_PACKED ttu_t; + +/** + * PartOfTitle Search Pointer Table. + */ +typedef struct { + uint16_t nr_of_srpts; + uint16_t zero_1; + uint32_t last_byte; + ttu_t *title; + uint32_t *ttu_offset; /* offset table for each ttu */ +} ATTRIBUTE_PACKED vts_ptt_srpt_t; +#define VTS_PTT_SRPT_SIZE 8U + + +/** + * Time Map Entry. + */ +/* Should this be bit field at all or just the uint32_t? */ +typedef uint32_t map_ent_t; + +/** + * Time Map. + */ +typedef struct { + uint8_t tmu; /* Time unit, in seconds */ + uint8_t zero_1; + uint16_t nr_of_entries; + map_ent_t *map_ent; +} ATTRIBUTE_PACKED vts_tmap_t; +#define VTS_TMAP_SIZE 4U + +/** + * Time Map Table. + */ +typedef struct { + uint16_t nr_of_tmaps; + uint16_t zero_1; + uint32_t last_byte; + vts_tmap_t *tmap; + uint32_t *tmap_offset; /* offset table for each tmap */ +} ATTRIBUTE_PACKED vts_tmapt_t; +#define VTS_TMAPT_SIZE 8U + + +#if PRAGMA_PACK +#pragma pack() +#endif + + +/** + * The following structure defines an IFO file. The structure is divided into + * two parts, the VMGI, or Video Manager Information, which is read from the + * VIDEO_TS.[IFO,BUP] file, and the VTSI, or Video Title Set Information, which + * is read in from the VTS_XX_0.[IFO,BUP] files. + */ +typedef struct { + dvd_file_t *file; + + /* VMGI */ + vmgi_mat_t *vmgi_mat; + tt_srpt_t *tt_srpt; + pgc_t *first_play_pgc; + ptl_mait_t *ptl_mait; + vts_atrt_t *vts_atrt; + txtdt_mgi_t *txtdt_mgi; + + /* Common */ + pgci_ut_t *pgci_ut; + c_adt_t *menu_c_adt; + vobu_admap_t *menu_vobu_admap; + + /* VTSI */ + vtsi_mat_t *vtsi_mat; + vts_ptt_srpt_t *vts_ptt_srpt; + pgcit_t *vts_pgcit; + vts_tmapt_t *vts_tmapt; + c_adt_t *vts_c_adt; + vobu_admap_t *vts_vobu_admap; +} ifo_handle_t; + +#endif /* LIBDVDREAD_IFO_TYPES_H */ diff -r 6698620c1477 -r c743d79f187b dvdread/nav_print.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdread/nav_print.h Wed Dec 31 08:43:03 2008 +0000 @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2001, 2002 Billy Biggs , + * Håkan Hjort + * + * This file is part of libdvdread. + * + * libdvdread is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * libdvdread is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with libdvdread; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIBDVDREAD_NAV_PRINT_H +#define LIBDVDREAD_NAV_PRINT_H + +#include "nav_types.h" + +/** + * Pretty printing of the NAV packets, PCI and DSI structs. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Prints information contained in the PCI to stdout. + * + * @param pci Pointer to the PCI data structure to be printed. + */ +void navPrint_PCI(pci_t *); + +/** + * Prints information contained in the DSI to stdout. + * + * @param dsi Pointer to the DSI data structure to be printed. + */ +void navPrint_DSI(dsi_t *); + +#ifdef __cplusplus +}; +#endif +#endif /* LIBDVDREAD_NAV_PRINT_H */ diff -r 6698620c1477 -r c743d79f187b dvdread/nav_read.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdread/nav_read.h Wed Dec 31 08:43:03 2008 +0000 @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2000, 2001, 2002 Håkan Hjort . + * + * This file is part of libdvdread. + * + * libdvdread is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * libdvdread is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with libdvdread; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIBDVDREAD_NAV_READ_H +#define LIBDVDREAD_NAV_READ_H + +#include "nav_types.h" + +/** + * Parsing of NAV data, PCI and DSI parts. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Reads the PCI packet data pointed to into th pci struct. + * + * @param pci Pointer to the PCI data structure to be filled in. + * @param bufffer Pointer to the buffer of the on disc PCI data. + */ +void navRead_PCI(pci_t *, unsigned char *); + +/** + * Reads the DSI packet data pointed to into dsi struct. + * + * @param dsi Pointer to the DSI data structure to be filled in. + * @param bufffer Pointer to the buffer of the on disc DSI data. + */ +void navRead_DSI(dsi_t *, unsigned char *); + +#ifdef __cplusplus +}; +#endif +#endif /* LIBDVDREAD_NAV_READ_H */ diff -r 6698620c1477 -r c743d79f187b dvdread/nav_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dvdread/nav_types.h Wed Dec 31 08:43:03 2008 +0000 @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2000, 2001, 2002 Håkan Hjort + * + * The data structures in this file should represent the layout of the + * pci and dsi packets as they are stored in the stream. Information + * found by reading the source to VOBDUMP is the base for the structure + * and names of these data types. + * + * VOBDUMP: a program for examining DVD .VOB files. + * Copyright 1998, 1999 Eric Smith + * + * VOBDUMP is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. Note that I am not + * granting permission to redistribute or modify VOBDUMP under the terms + * of any later version of the General Public License. + * + * This program is distributed in the hope that it will be useful (or at + * least amusing), but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + * the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef LIBDVDREAD_NAV_TYPES_H +#define LIBDVDREAD_NAV_TYPES_H + +#include +#include "ifo_types.h" /* only dvd_time_t, vm_cmd_t and user_ops_t */ + +/* The length including the substream id byte. */ +#define PCI_BYTES 0x3d4 +#define DSI_BYTES 0x3fa + +#define PS2_PCI_SUBSTREAM_ID 0x00 +#define PS2_DSI_SUBSTREAM_ID 0x01 + +/* Remove this */ +#define DSI_START_BYTE 1031 + +/** + * PCI General Information + */ +typedef struct { + uint32_t nv_pck_lbn; /**< sector address of this nav pack */ + uint16_t vobu_cat; /**< 'category' of vobu */ + uint16_t zero1; /**< reserved */ + user_ops_t vobu_uop_ctl; /**< UOP of vobu */ + uint32_t vobu_s_ptm; /**< start presentation time of vobu */ + uint32_t vobu_e_ptm; /**< end presentation time of vobu */ + uint32_t vobu_se_e_ptm; /**< end ptm of sequence end in vobu */ + dvd_time_t e_eltm; /**< Cell elapsed time */ + char vobu_isrc[32]; +} ATTRIBUTE_PACKED pci_gi_t; + +/** + * Non Seamless Angle Information + */ +typedef struct { + uint32_t nsml_agl_dsta[9]; /**< address of destination vobu in AGL_C#n */ +} ATTRIBUTE_PACKED nsml_agli_t; + +/** + * Highlight General Information + * + * For btngrX_dsp_ty the bits have the following meaning: + * 000b: normal 4/3 only buttons + * XX1b: wide (16/9) buttons + * X1Xb: letterbox buttons + * 1XXb: pan&scan buttons + */ +typedef struct { + uint16_t hli_ss; /**< status, only low 2 bits 0: no buttons, 1: different 2: equal 3: eual except for button cmds */ + uint32_t hli_s_ptm; /**< start ptm of hli */ + uint32_t hli_e_ptm; /**< end ptm of hli */ + uint32_t btn_se_e_ptm; /**< end ptm of button select */ + unsigned int zero1 : 2; /**< reserved */ + unsigned int btngr_ns : 2; /**< number of button groups 1, 2 or 3 with 36/18/12 buttons */ + unsigned int zero2 : 1; /**< reserved */ + unsigned int btngr1_dsp_ty : 3; /**< display type of subpic stream for button group 1 */ + unsigned int zero3 : 1; /**< reserved */ + unsigned int btngr2_dsp_ty : 3; /**< display type of subpic stream for button group 2 */ + unsigned int zero4 : 1; /**< reserved */ + unsigned int btngr3_dsp_ty : 3; /**< display type of subpic stream for button group 3 */ + uint8_t btn_ofn; /**< button offset number range 0-255 */ + uint8_t btn_ns; /**< number of valid buttons <= 36/18/12 (low 6 bits) */ + uint8_t nsl_btn_ns; /**< number of buttons selectable by U_BTNNi (low 6 bits) nsl_btn_ns <= btn_ns */ + uint8_t zero5; /**< reserved */ + uint8_t fosl_btnn; /**< forcedly selected button (low 6 bits) */ + uint8_t foac_btnn; /**< forcedly activated button (low 6 bits) */ +} ATTRIBUTE_PACKED hl_gi_t; + + +/** + * Button Color Information Table + * Each entry beeing a 32bit word that contains the color indexs and alpha + * values to use. They are all represented by 4 bit number and stored + * like this [Ci3, Ci2, Ci1, Ci0, A3, A2, A1, A0]. The actual palette + * that the indexes reference is in the PGC. + * @TODO split the uint32_t into a struct + */ +typedef struct { + uint32_t btn_coli[3][2]; /**< [button color number-1][select:0/action:1] */ +} ATTRIBUTE_PACKED btn_colit_t; + +/** + * Button Information + * + * NOTE: I've had to change the structure from the disk layout to get + * the packing to work with Sun's Forte C compiler. + * The 4 and 7 bytes are 'rotated' was: ABC DEF GHIJ is: ABCG DEFH IJ + */ +typedef struct { + unsigned int btn_coln : 2; /**< button color number */ + unsigned int x_start : 10; /**< x start offset within the overlay */ + unsigned int zero1 : 2; /**< reserved */ + unsigned int x_end : 10; /**< x end offset within the overlay */ + + unsigned int auto_action_mode : 2; /**< 0: no, 1: activated if selected */ + unsigned int y_start : 10; /**< y start offset within the overlay */ + unsigned int zero2 : 2; /**< reserved */ + unsigned int y_end : 10; /**< y end offset within the overlay */ + + unsigned int zero3 : 2; /**< reserved */ + unsigned int up : 6; /**< button index when pressing up */ + unsigned int zero4 : 2; /**< reserved */ + unsigned int down : 6; /**< button index when pressing down */ + unsigned int zero5 : 2; /**< reserved */ + unsigned int left : 6; /**< button index when pressing left */ + unsigned int zero6 : 2; /**< reserved */ + unsigned int right : 6; /**< button index when pressing right */ + vm_cmd_t cmd; +} ATTRIBUTE_PACKED btni_t; + +/** + * Highlight Information + */ +typedef struct { + hl_gi_t hl_gi; + btn_colit_t btn_colit; + btni_t btnit[36]; +} ATTRIBUTE_PACKED hli_t; + +/** + * PCI packet + */ +typedef struct { + pci_gi_t pci_gi; + nsml_agli_t nsml_agli; + hli_t hli; + uint8_t zero1[189]; +} ATTRIBUTE_PACKED pci_t; + + + + +/** + * DSI General Information + */ +typedef struct { + uint32_t nv_pck_scr; + uint32_t nv_pck_lbn; /**< sector address of this nav pack */ + uint32_t vobu_ea; /**< end address of this VOBU */ + uint32_t vobu_1stref_ea; /**< end address of the 1st reference image */ + uint32_t vobu_2ndref_ea; /**< end address of the 2nd reference image */ + uint32_t vobu_3rdref_ea; /**< end address of the 3rd reference image */ + uint16_t vobu_vob_idn; /**< VOB Id number that this VOBU is part of */ + uint8_t zero1; /**< reserved */ + uint8_t vobu_c_idn; /**< Cell Id number that this VOBU is part of */ + dvd_time_t c_eltm; /**< Cell elapsed time */ +} ATTRIBUTE_PACKED dsi_gi_t; + +/** + * Seamless Playback Information + */ +typedef struct { + uint16_t category; /**< 'category' of seamless VOBU */ + uint32_t ilvu_ea; /**< end address of interleaved Unit */ + uint32_t ilvu_sa; /**< start address of next interleaved unit */ + uint16_t size; /**< size of next interleaved unit */ + uint32_t vob_v_s_s_ptm; /**< video start ptm in vob */ + uint32_t vob_v_e_e_ptm; /**< video end ptm in vob */ + struct { + uint32_t stp_ptm1; + uint32_t stp_ptm2; + uint32_t gap_len1; + uint32_t gap_len2; + } vob_a[8]; +} ATTRIBUTE_PACKED sml_pbi_t; + +/** + * Seamless Angle Infromation for one angle + */ +typedef struct { + uint32_t address; /**< offset to next ILVU, high bit is before/after */ + uint16_t size; /**< byte size of the ILVU pointed to by address */ +} ATTRIBUTE_PACKED sml_agl_data_t; + +/** + * Seamless Angle Infromation + */ +typedef struct { + sml_agl_data_t data[9]; +} ATTRIBUTE_PACKED sml_agli_t; + +/** + * VOBU Search Information + */ +typedef struct { + uint32_t next_video; /**< Next vobu that contains video */ + uint32_t fwda[19]; /**< Forwards, time */ + uint32_t next_vobu; + uint32_t prev_vobu; + uint32_t bwda[19]; /**< Backwards, time */ + uint32_t prev_video; +} ATTRIBUTE_PACKED vobu_sri_t; + +#define SRI_END_OF_CELL 0x3fffffff + +/** + * Synchronous Information + */ +typedef struct { + uint16_t a_synca[8]; /**< offset to first audio packet for this VOBU */ + uint32_t sp_synca[32]; /**< offset to first subpicture packet */ +} ATTRIBUTE_PACKED synci_t; + +/** + * DSI packet + */ +typedef struct { + dsi_gi_t dsi_gi; + sml_pbi_t sml_pbi; + sml_agli_t sml_agli; + vobu_sri_t vobu_sri; + synci_t synci; + uint8_t zero1[471]; +} ATTRIBUTE_PACKED dsi_t; + + +#if PRAGMA_PACK +#pragma pack() +#endif + +#endif /* LIBDVDREAD_NAV_TYPES_H */ diff -r 6698620c1477 -r c743d79f187b ifo_print.c --- a/ifo_print.c Sat Dec 13 14:27:51 2008 +0000 +++ b/ifo_print.c Wed Dec 31 08:43:03 2008 +0000 @@ -24,9 +24,9 @@ #include #include -#include "ifo_types.h" -#include "ifo_read.h" -#include "ifo_print.h" +#include "dvdread/ifo_types.h" +#include "dvdread/ifo_read.h" +#include "dvdread/ifo_print.h" /* Put this in some other file / package? It's used in nav_print too. */ static void ifo_print_time(int level, dvd_time_t *dtime) { diff -r 6698620c1477 -r c743d79f187b ifo_print.h --- a/ifo_print.h Sat Dec 13 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * This file is part of libdvdread. - * - * libdvdread is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * libdvdread is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with libdvdread; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LIBDVDREAD_IFO_PRINT_H -#define LIBDVDREAD_IFO_PRINT_H - -#include -#include "ifo_types.h" - -void ifo_print(dvd_reader_t *dvd, int title); -void dvdread_print_time(dvd_time_t *dtime); - -#endif /* LIBDVDREAD_IFO_PRINT_H */ diff -r 6698620c1477 -r c743d79f187b ifo_read.c --- a/ifo_read.c Sat Dec 13 14:27:51 2008 +0000 +++ b/ifo_read.c Wed Dec 31 08:43:03 2008 +0000 @@ -28,11 +28,11 @@ #include #include "bswap.h" -#include "ifo_types.h" -#include "ifo_read.h" -#include "dvd_reader.h" +#include "dvdread/ifo_types.h" +#include "dvdread/ifo_read.h" +#include "dvdread/dvd_reader.h" #include "dvdread_internal.h" -#include "bitreader.h" +#include "dvdread/bitreader.h" #ifndef DVD_BLOCK_LEN #define DVD_BLOCK_LEN 2048 diff -r 6698620c1477 -r c743d79f187b ifo_read.h --- a/ifo_read.h Sat Dec 13 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2002 Björn Englund , - * Håkan Hjort - * - * This file is part of libdvdread. - * - * libdvdread is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * libdvdread is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with libdvdread; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LIBDVDREAD_IFO_READ_H -#define LIBDVDREAD_IFO_READ_H - -#include "ifo_types.h" -#include "dvd_reader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * handle = ifoOpen(dvd, title); - * - * Opens an IFO and reads in all the data for the IFO file corresponding to the - * given title. If title 0 is given, the video manager IFO file is read. - * Returns a handle to a completely parsed structure. - */ -ifo_handle_t *ifoOpen(dvd_reader_t *, int ); - -/** - * handle = ifoOpenVMGI(dvd); - * - * Opens an IFO and reads in _only_ the vmgi_mat data. This call can be used - * together with the calls below to read in each segment of the IFO file on - * demand. - */ -ifo_handle_t *ifoOpenVMGI(dvd_reader_t *); - -/** - * handle = ifoOpenVTSI(dvd, title); - * - * Opens an IFO and reads in _only_ the vtsi_mat data. This call can be used - * together with the calls below to read in each segment of the IFO file on - * demand. - */ -ifo_handle_t *ifoOpenVTSI(dvd_reader_t *, int); - -/** - * ifoClose(ifofile); - * Cleans up the IFO information. This will free all data allocated for the - * substructures. - */ -void ifoClose(ifo_handle_t *); - -/** - * The following functions are for reading only part of the VMGI/VTSI files. - * Returns 1 if the data was successfully read and 0 on error. - */ - -/** - * okay = ifoRead_PLT_MAIT(ifofile); - * - * Read in the Parental Management Information table, filling the - * ifofile->ptl_mait structure and its substructures. This data is only - * located in the video manager information file. This fills the - * ifofile->ptl_mait structure and all its substructures. - */ -int ifoRead_PTL_MAIT(ifo_handle_t *); - -/** - * okay = ifoRead_VTS_ATRT(ifofile); - * - * Read in the attribute table for the main menu vob, filling the - * ifofile->vts_atrt structure and its substructures. Only located in the - * video manager information file. This fills in the ifofile->vts_atrt - * structure and all its substructures. - */ -int ifoRead_VTS_ATRT(ifo_handle_t *); - -/** - * okay = ifoRead_TT_SRPT(ifofile); - * - * Reads the title info for the main menu, filling the ifofile->tt_srpt - * structure and its substructures. This data is only located in the video - * manager information file. This structure is mandatory in the IFO file. - */ -int ifoRead_TT_SRPT(ifo_handle_t *); - -/** - * okay = ifoRead_VTS_PTT_SRPT(ifofile); - * - * Reads in the part of title search pointer table, filling the - * ifofile->vts_ptt_srpt structure and its substructures. This data is only - * located in the video title set information file. This structure is - * mandatory, and must be included in the VTSI file. - */ -int ifoRead_VTS_PTT_SRPT(ifo_handle_t *); - -/** - * okay = ifoRead_FP_PGC(ifofile); - * - * Reads in the first play program chain data, filling the - * ifofile->first_play_pgc structure. This data is only located in the video - * manager information file (VMGI). This structure is optional. - */ -int ifoRead_FP_PGC(ifo_handle_t *); - -/** - * okay = ifoRead_PGCIT(ifofile); - * - * Reads in the program chain information table for the video title set. Fills - * in the ifofile->vts_pgcit structure and its substructures, which includes - * the data for each program chain in the set. This data is only located in - * the video title set information file. This structure is mandatory, and must - * be included in the VTSI file. - */ -int ifoRead_PGCIT(ifo_handle_t *); - -/** - * okay = ifoRead_PGCI_UT(ifofile); - * - * Reads in the menu PGCI unit table for the menu VOB. For the video manager, - * this corresponds to the VIDEO_TS.VOB file, and for each title set, this - * corresponds to the VTS_XX_0.VOB file. This data is located in both the - * video manager and video title set information files. For VMGI files, this - * fills the ifofile->vmgi_pgci_ut structure and all its substructures. For - * VTSI files, this fills the ifofile->vtsm_pgci_ut structure. - */ -int ifoRead_PGCI_UT(ifo_handle_t *); - -/** - * okay = ifoRead_VTS_TMAPT(ifofile); - * - * Reads in the VTS Time Map Table, this data is only located in the video - * title set information file. This fills the ifofile->vts_tmapt structure - * and all its substructures. When pressent enables VOBU level time-based - * seeking for One_Sequential_PGC_Titles. - */ -int ifoRead_VTS_TMAPT(ifo_handle_t *); - -/** - * okay = ifoRead_C_ADT(ifofile); - * - * Reads in the cell address table for the menu VOB. For the video manager, - * this corresponds to the VIDEO_TS.VOB file, and for each title set, this - * corresponds to the VTS_XX_0.VOB file. This data is located in both the - * video manager and video title set information files. For VMGI files, this - * fills the ifofile->vmgm_c_adt structure and all its substructures. For VTSI - * files, this fills the ifofile->vtsm_c_adt structure. - */ -int ifoRead_C_ADT(ifo_handle_t *); - -/** - * okay = ifoRead_TITLE_C_ADT(ifofile); - * - * Reads in the cell address table for the video title set corresponding to - * this IFO file. This data is only located in the video title set information - * file. This structure is mandatory, and must be included in the VTSI file. - * This call fills the ifofile->vts_c_adt structure and its substructures. - */ -int ifoRead_TITLE_C_ADT(ifo_handle_t *); - -/** - * okay = ifoRead_VOBU_ADMAP(ifofile); - * - * Reads in the VOBU address map for the menu VOB. For the video manager, this - * corresponds to the VIDEO_TS.VOB file, and for each title set, this - * corresponds to the VTS_XX_0.VOB file. This data is located in both the - * video manager and video title set information files. For VMGI files, this - * fills the ifofile->vmgm_vobu_admap structure and all its substructures. For - * VTSI files, this fills the ifofile->vtsm_vobu_admap structure. - */ -int ifoRead_VOBU_ADMAP(ifo_handle_t *); - -/** - * okay = ifoRead_TITLE_VOBU_ADMAP(ifofile); - * - * Reads in the VOBU address map for the associated video title set. This data - * is only located in the video title set information file. This structure is - * mandatory, and must be included in the VTSI file. Fills the - * ifofile->vts_vobu_admap structure and its substructures. - */ -int ifoRead_TITLE_VOBU_ADMAP(ifo_handle_t *); - -/** - * okay = ifoRead_TXTDT_MGI(ifofile); - * - * Reads in the text data strings for the DVD. Fills the ifofile->txtdt_mgi - * structure and all its substructures. This data is only located in the video - * manager information file. This structure is mandatory, and must be included - * in the VMGI file. - */ -int ifoRead_TXTDT_MGI(ifo_handle_t *); - -/** - * The following functions are used for freeing parsed sections of the - * ifo_handle_t structure and the allocated substructures. The free calls - * below are safe: they will not mind if you attempt to free part of an IFO - * file which was not read in or which does not exist. - */ -void ifoFree_PTL_MAIT(ifo_handle_t *); -void ifoFree_VTS_ATRT(ifo_handle_t *); -void ifoFree_TT_SRPT(ifo_handle_t *); -void ifoFree_VTS_PTT_SRPT(ifo_handle_t *); -void ifoFree_FP_PGC(ifo_handle_t *); -void ifoFree_PGCIT(ifo_handle_t *); -void ifoFree_PGCI_UT(ifo_handle_t *); -void ifoFree_VTS_TMAPT(ifo_handle_t *); -void ifoFree_C_ADT(ifo_handle_t *); -void ifoFree_TITLE_C_ADT(ifo_handle_t *); -void ifoFree_VOBU_ADMAP(ifo_handle_t *); -void ifoFree_TITLE_VOBU_ADMAP(ifo_handle_t *); -void ifoFree_TXTDT_MGI(ifo_handle_t *); - -#ifdef __cplusplus -}; -#endif -#endif /* LIBDVDREAD_IFO_READ_H */ diff -r 6698620c1477 -r c743d79f187b ifo_types.h --- a/ifo_types.h Sat Dec 13 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,750 +0,0 @@ -/* - * Copyright (C) 2000, 2001 Björn Englund , - * Håkan Hjort - * - * This file is part of libdvdread. - * - * libdvdread is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * libdvdread is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with libdvdread; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LIBDVDREAD_IFO_TYPES_H -#define LIBDVDREAD_IFO_TYPES_H - -#include -#include "dvd_reader.h" - - -#undef ATTRIBUTE_PACKED -#undef PRAGMA_PACK_BEGIN -#undef PRAGMA_PACK_END - -#if defined(__GNUC__) -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -#define ATTRIBUTE_PACKED __attribute__ ((packed)) -#define PRAGMA_PACK 0 -#endif -#endif - -#if !defined(ATTRIBUTE_PACKED) -#define ATTRIBUTE_PACKED -#define PRAGMA_PACK 1 -#endif - -#if PRAGMA_PACK -#pragma pack(1) -#endif - - -/** - * Common - * - * The following structures are used in both the VMGI and VTSI. - */ - - -/** - * DVD Time Information. - */ -typedef struct { - uint8_t hour; - uint8_t minute; - uint8_t second; - uint8_t frame_u; /* The two high bits are the frame rate. */ -} ATTRIBUTE_PACKED dvd_time_t; - -/** - * Type to store per-command data. - */ -typedef struct { - uint8_t bytes[8]; -} ATTRIBUTE_PACKED vm_cmd_t; -#define COMMAND_DATA_SIZE 8U - - -/** - * Video Attributes. - */ -typedef struct { - unsigned char mpeg_version : 2; - unsigned char video_format : 2; - unsigned char display_aspect_ratio : 2; - unsigned char permitted_df : 2; - - unsigned char line21_cc_1 : 1; - unsigned char line21_cc_2 : 1; - unsigned char unknown1 : 1; - unsigned char bit_rate : 1; - - unsigned char picture_size : 2; - unsigned char letterboxed : 1; - unsigned char film_mode : 1; -} ATTRIBUTE_PACKED video_attr_t; - -/** - * Audio Attributes. - */ -typedef struct { - unsigned char audio_format : 3; - unsigned char multichannel_extension : 1; - unsigned char lang_type : 2; - unsigned char application_mode : 2; - - unsigned char quantization : 2; - unsigned char sample_frequency : 2; - unsigned char unknown1 : 1; - unsigned char channels : 3; - uint16_t lang_code; - uint8_t lang_extension; - uint8_t code_extension; - uint8_t unknown3; - union { - struct ATTRIBUTE_PACKED { - unsigned char unknown4 : 1; - unsigned char channel_assignment : 3; - unsigned char version : 2; - unsigned char mc_intro : 1; /* probably 0: true, 1:false */ - unsigned char mode : 1; /* Karaoke mode 0: solo 1: duet */ - } karaoke; - struct ATTRIBUTE_PACKED { - unsigned char unknown5 : 4; - unsigned char dolby_encoded : 1; /* suitable for surround decoding */ - unsigned char unknown6 : 3; - } surround; - } ATTRIBUTE_PACKED app_info; -} ATTRIBUTE_PACKED audio_attr_t; - - -/** - * MultiChannel Extension - */ -typedef struct { - unsigned int zero1 : 7; - unsigned int ach0_gme : 1; - - unsigned int zero2 : 7; - unsigned int ach1_gme : 1; - - unsigned int zero3 : 4; - unsigned int ach2_gv1e : 1; - unsigned int ach2_gv2e : 1; - unsigned int ach2_gm1e : 1; - unsigned int ach2_gm2e : 1; - - unsigned int zero4 : 4; - unsigned int ach3_gv1e : 1; - unsigned int ach3_gv2e : 1; - unsigned int ach3_gmAe : 1; - unsigned int ach3_se2e : 1; - - unsigned int zero5 : 4; - unsigned int ach4_gv1e : 1; - unsigned int ach4_gv2e : 1; - unsigned int ach4_gmBe : 1; - unsigned int ach4_seBe : 1; - uint8_t zero6[19]; -} ATTRIBUTE_PACKED multichannel_ext_t; - - -/** - * Subpicture Attributes. - */ -typedef struct { - /* - * type: 0 not specified - * 1 language - * 2 other - * coding mode: 0 run length - * 1 extended - * 2 other - * language: indicates language if type == 1 - * lang extension: if type == 1 contains the lang extension - */ - unsigned char code_mode : 3; - unsigned char zero1 : 3; - unsigned char type : 2; - uint8_t zero2; - uint16_t lang_code; - uint8_t lang_extension; - uint8_t code_extension; -} ATTRIBUTE_PACKED subp_attr_t; - - - -/** - * PGC Command Table. - */ -typedef struct { - uint16_t nr_of_pre; - uint16_t nr_of_post; - uint16_t nr_of_cell; - uint16_t zero_1; - vm_cmd_t *pre_cmds; - vm_cmd_t *post_cmds; - vm_cmd_t *cell_cmds; -} ATTRIBUTE_PACKED pgc_command_tbl_t; -#define PGC_COMMAND_TBL_SIZE 8U - -/** - * PGC Program Map - */ -typedef uint8_t pgc_program_map_t; - -/** - * Cell Playback Information. - */ -typedef struct { - unsigned int block_mode : 2; - unsigned int block_type : 2; - unsigned int seamless_play : 1; - unsigned int interleaved : 1; - unsigned int stc_discontinuity: 1; - unsigned int seamless_angle : 1; - - unsigned int playback_mode : 1; /**< When set, enter StillMode after each VOBU */ - unsigned int restricted : 1; /**< ?? drop out of fastforward? */ - unsigned int unknown2 : 6; - uint8_t still_time; - uint8_t cell_cmd_nr; - dvd_time_t playback_time; - uint32_t first_sector; - uint32_t first_ilvu_end_sector; - uint32_t last_vobu_start_sector; - uint32_t last_sector; -} ATTRIBUTE_PACKED cell_playback_t; - -#define BLOCK_TYPE_NONE 0x0 -#define BLOCK_TYPE_ANGLE_BLOCK 0x1 - -#define BLOCK_MODE_NOT_IN_BLOCK 0x0 -#define BLOCK_MODE_FIRST_CELL 0x1 -#define BLOCK_MODE_IN_BLOCK 0x2 -#define BLOCK_MODE_LAST_CELL 0x3 - -/** - * Cell Position Information. - */ -typedef struct { - uint16_t vob_id_nr; - uint8_t zero_1; - uint8_t cell_nr; -} ATTRIBUTE_PACKED cell_position_t; - -/** - * User Operations. - */ -typedef struct { - unsigned int zero : 7; /* 25-31 */ - unsigned int video_pres_mode_change : 1; /* 24 */ - - unsigned int karaoke_audio_pres_mode_change : 1; /* 23 */ - unsigned int angle_change : 1; - unsigned int subpic_stream_change : 1; - unsigned int audio_stream_change : 1; - unsigned int pause_on : 1; - unsigned int still_off : 1; - unsigned int button_select_or_activate : 1; - unsigned int resume : 1; /* 16 */ - - unsigned int chapter_menu_call : 1; /* 15 */ - unsigned int angle_menu_call : 1; - unsigned int audio_menu_call : 1; - unsigned int subpic_menu_call : 1; - unsigned int root_menu_call : 1; - unsigned int title_menu_call : 1; - unsigned int backward_scan : 1; - unsigned int forward_scan : 1; /* 8 */ - - unsigned int next_pg_search : 1; /* 7 */ - unsigned int prev_or_top_pg_search : 1; - unsigned int time_or_chapter_search : 1; - unsigned int go_up : 1; - unsigned int stop : 1; - unsigned int title_play : 1; - unsigned int chapter_search_or_play : 1; - unsigned int title_or_time_play : 1; /* 0 */ -} ATTRIBUTE_PACKED user_ops_t; - -/** - * Program Chain Information. - */ -typedef struct { - uint16_t zero_1; - uint8_t nr_of_programs; - uint8_t nr_of_cells; - dvd_time_t playback_time; - user_ops_t prohibited_ops; - uint16_t audio_control[8]; /* New type? */ - uint32_t subp_control[32]; /* New type? */ - uint16_t next_pgc_nr; - uint16_t prev_pgc_nr; - uint16_t goup_pgc_nr; - uint8_t still_time; - uint8_t pg_playback_mode; - uint32_t palette[16]; /* New type struct {zero_1, Y, Cr, Cb} ? */ - uint16_t command_tbl_offset; - uint16_t program_map_offset; - uint16_t cell_playback_offset; - uint16_t cell_position_offset; - pgc_command_tbl_t *command_tbl; - pgc_program_map_t *program_map; - cell_playback_t *cell_playback; - cell_position_t *cell_position; -} ATTRIBUTE_PACKED pgc_t; -#define PGC_SIZE 236U - -/** - * Program Chain Information Search Pointer. - */ -typedef struct { - uint8_t entry_id; - unsigned int block_mode : 2; - unsigned int block_type : 2; - unsigned int unknown1 : 4; - uint16_t ptl_id_mask; - uint32_t pgc_start_byte; - pgc_t *pgc; -} ATTRIBUTE_PACKED pgci_srp_t; -#define PGCI_SRP_SIZE 8U - -/** - * Program Chain Information Table. - */ -typedef struct { - uint16_t nr_of_pgci_srp; - uint16_t zero_1; - uint32_t last_byte; - pgci_srp_t *pgci_srp; -} ATTRIBUTE_PACKED pgcit_t; -#define PGCIT_SIZE 8U - -/** - * Menu PGCI Language Unit. - */ -typedef struct { - uint16_t lang_code; - uint8_t lang_extension; - uint8_t exists; - uint32_t lang_start_byte; - pgcit_t *pgcit; -} ATTRIBUTE_PACKED pgci_lu_t; -#define PGCI_LU_SIZE 8U - -/** - * Menu PGCI Unit Table. - */ -typedef struct { - uint16_t nr_of_lus; - uint16_t zero_1; - uint32_t last_byte; - pgci_lu_t *lu; -} ATTRIBUTE_PACKED pgci_ut_t; -#define PGCI_UT_SIZE 8U - -/** - * Cell Address Information. - */ -typedef struct { - uint16_t vob_id; - uint8_t cell_id; - uint8_t zero_1; - uint32_t start_sector; - uint32_t last_sector; -} ATTRIBUTE_PACKED cell_adr_t; - -/** - * Cell Address Table. - */ -typedef struct { - uint16_t nr_of_vobs; /* VOBs */ - uint16_t zero_1; - uint32_t last_byte; - cell_adr_t *cell_adr_table; /* No explicit size given. */ -} ATTRIBUTE_PACKED c_adt_t; -#define C_ADT_SIZE 8U - -/** - * VOBU Address Map. - */ -typedef struct { - uint32_t last_byte; - uint32_t *vobu_start_sectors; -} ATTRIBUTE_PACKED vobu_admap_t; -#define VOBU_ADMAP_SIZE 4U - - - - -/** - * VMGI - * - * The following structures relate to the Video Manager. - */ - -/** - * Video Manager Information Management Table. - */ -typedef struct { - char vmg_identifier[12]; - uint32_t vmg_last_sector; - uint8_t zero_1[12]; - uint32_t vmgi_last_sector; - uint8_t zero_2; - uint8_t specification_version; - uint32_t vmg_category; - uint16_t vmg_nr_of_volumes; - uint16_t vmg_this_volume_nr; - uint8_t disc_side; - uint8_t zero_3[19]; - uint16_t vmg_nr_of_title_sets; /* Number of VTSs. */ - char provider_identifier[32]; - uint64_t vmg_pos_code; - uint8_t zero_4[24]; - uint32_t vmgi_last_byte; - uint32_t first_play_pgc; - uint8_t zero_5[56]; - uint32_t vmgm_vobs; /* sector */ - uint32_t tt_srpt; /* sector */ - uint32_t vmgm_pgci_ut; /* sector */ - uint32_t ptl_mait; /* sector */ - uint32_t vts_atrt; /* sector */ - uint32_t txtdt_mgi; /* sector */ - uint32_t vmgm_c_adt; /* sector */ - uint32_t vmgm_vobu_admap; /* sector */ - uint8_t zero_6[32]; - - video_attr_t vmgm_video_attr; - uint8_t zero_7; - uint8_t nr_of_vmgm_audio_streams; /* should be 0 or 1 */ - audio_attr_t vmgm_audio_attr; - audio_attr_t zero_8[7]; - uint8_t zero_9[17]; - uint8_t nr_of_vmgm_subp_streams; /* should be 0 or 1 */ - subp_attr_t vmgm_subp_attr; - subp_attr_t zero_10[27]; /* XXX: how much 'padding' here? */ -} ATTRIBUTE_PACKED vmgi_mat_t; - -typedef struct { - unsigned int zero_1 : 1; - unsigned int multi_or_random_pgc_title : 1; /* 0: one sequential pgc title */ - unsigned int jlc_exists_in_cell_cmd : 1; - unsigned int jlc_exists_in_prepost_cmd : 1; - unsigned int jlc_exists_in_button_cmd : 1; - unsigned int jlc_exists_in_tt_dom : 1; - unsigned int chapter_search_or_play : 1; /* UOP 1 */ - unsigned int title_or_time_play : 1; /* UOP 0 */ -} ATTRIBUTE_PACKED playback_type_t; - -/** - * Title Information. - */ -typedef struct { - playback_type_t pb_ty; - uint8_t nr_of_angles; - uint16_t nr_of_ptts; - uint16_t parental_id; - uint8_t title_set_nr; - uint8_t vts_ttn; - uint32_t title_set_sector; -} ATTRIBUTE_PACKED title_info_t; - -/** - * PartOfTitle Search Pointer Table. - */ -typedef struct { - uint16_t nr_of_srpts; - uint16_t zero_1; - uint32_t last_byte; - title_info_t *title; -} ATTRIBUTE_PACKED tt_srpt_t; -#define TT_SRPT_SIZE 8U - - -/** - * Parental Management Information Unit Table. - * Level 1 (US: G), ..., 7 (US: NC-17), 8 - */ -typedef uint16_t pf_level_t[8]; - -/** - * Parental Management Information Unit Table. - */ -typedef struct { - uint16_t country_code; - uint16_t zero_1; - uint16_t pf_ptl_mai_start_byte; - uint16_t zero_2; - pf_level_t *pf_ptl_mai; /* table of (nr_of_vtss + 1), video_ts is first */ -} ATTRIBUTE_PACKED ptl_mait_country_t; -#define PTL_MAIT_COUNTRY_SIZE 8U - -/** - * Parental Management Information Table. - */ -typedef struct { - uint16_t nr_of_countries; - uint16_t nr_of_vtss; - uint32_t last_byte; - ptl_mait_country_t *countries; -} ATTRIBUTE_PACKED ptl_mait_t; -#define PTL_MAIT_SIZE 8U - -/** - * Video Title Set Attributes. - */ -typedef struct { - uint32_t last_byte; - uint32_t vts_cat; - - video_attr_t vtsm_vobs_attr; - uint8_t zero_1; - uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */ - audio_attr_t vtsm_audio_attr; - audio_attr_t zero_2[7]; - uint8_t zero_3[16]; - uint8_t zero_4; - uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */ - subp_attr_t vtsm_subp_attr; - subp_attr_t zero_5[27]; - - uint8_t zero_6[2]; - - video_attr_t vtstt_vobs_video_attr; - uint8_t zero_7; - uint8_t nr_of_vtstt_audio_streams; - audio_attr_t vtstt_audio_attr[8]; - uint8_t zero_8[16]; - uint8_t zero_9; - uint8_t nr_of_vtstt_subp_streams; - subp_attr_t vtstt_subp_attr[32]; -} ATTRIBUTE_PACKED vts_attributes_t; -#define VTS_ATTRIBUTES_SIZE 542U -#define VTS_ATTRIBUTES_MIN_SIZE 356U - -/** - * Video Title Set Attribute Table. - */ -typedef struct { - uint16_t nr_of_vtss; - uint16_t zero_1; - uint32_t last_byte; - vts_attributes_t *vts; - uint32_t *vts_atrt_offsets; /* offsets table for each vts_attributes */ -} ATTRIBUTE_PACKED vts_atrt_t; -#define VTS_ATRT_SIZE 8U - -/** - * Text Data. (Incomplete) - */ -typedef struct { - uint32_t last_byte; /* offsets are relative here */ - uint16_t offsets[100]; /* == nr_of_srpts + 1 (first is disc title) */ -#if 0 - uint16_t unknown; /* 0x48 ?? 0x48 words (16bit) info following */ - uint16_t zero_1; - - uint8_t type_of_info; /* ?? 01 == disc, 02 == Title, 04 == Title part */ - uint8_t unknown1; - uint8_t unknown2; - uint8_t unknown3; - uint8_t unknown4; /* ?? allways 0x30 language?, text format? */ - uint8_t unknown5; - uint16_t offset; /* from first */ - - char text[12]; /* ended by 0x09 */ -#endif -} ATTRIBUTE_PACKED txtdt_t; - -/** - * Text Data Language Unit. (Incomplete) - */ -typedef struct { - uint16_t lang_code; - uint16_t unknown; /* 0x0001, title 1? disc 1? side 1? */ - uint32_t txtdt_start_byte; /* prt, rel start of vmg_txtdt_mgi */ - txtdt_t *txtdt; -} ATTRIBUTE_PACKED txtdt_lu_t; -#define TXTDT_LU_SIZE 8U - -/** - * Text Data Manager Information. (Incomplete) - */ -typedef struct { - char disc_name[14]; /* how many bytes?? */ - uint16_t nr_of_language_units; /* 32bit?? */ - uint32_t last_byte; - txtdt_lu_t *lu; -} ATTRIBUTE_PACKED txtdt_mgi_t; -#define TXTDT_MGI_SIZE 20U - - -/** - * VTS - * - * Structures relating to the Video Title Set (VTS). - */ - -/** - * Video Title Set Information Management Table. - */ -typedef struct { - char vts_identifier[12]; - uint32_t vts_last_sector; - uint8_t zero_1[12]; - uint32_t vtsi_last_sector; - uint8_t zero_2; - uint8_t specification_version; - uint32_t vts_category; - uint16_t zero_3; - uint16_t zero_4; - uint8_t zero_5; - uint8_t zero_6[19]; - uint16_t zero_7; - uint8_t zero_8[32]; - uint64_t zero_9; - uint8_t zero_10[24]; - uint32_t vtsi_last_byte; - uint32_t zero_11; - uint8_t zero_12[56]; - uint32_t vtsm_vobs; /* sector */ - uint32_t vtstt_vobs; /* sector */ - uint32_t vts_ptt_srpt; /* sector */ - uint32_t vts_pgcit; /* sector */ - uint32_t vtsm_pgci_ut; /* sector */ - uint32_t vts_tmapt; /* sector */ - uint32_t vtsm_c_adt; /* sector */ - uint32_t vtsm_vobu_admap; /* sector */ - uint32_t vts_c_adt; /* sector */ - uint32_t vts_vobu_admap; /* sector */ - uint8_t zero_13[24]; - - video_attr_t vtsm_video_attr; - uint8_t zero_14; - uint8_t nr_of_vtsm_audio_streams; /* should be 0 or 1 */ - audio_attr_t vtsm_audio_attr; - audio_attr_t zero_15[7]; - uint8_t zero_16[17]; - uint8_t nr_of_vtsm_subp_streams; /* should be 0 or 1 */ - subp_attr_t vtsm_subp_attr; - subp_attr_t zero_17[27]; - uint8_t zero_18[2]; - - video_attr_t vts_video_attr; - uint8_t zero_19; - uint8_t nr_of_vts_audio_streams; - audio_attr_t vts_audio_attr[8]; - uint8_t zero_20[17]; - uint8_t nr_of_vts_subp_streams; - subp_attr_t vts_subp_attr[32]; - uint16_t zero_21; - multichannel_ext_t vts_mu_audio_attr[8]; - /* XXX: how much 'padding' here, if any? */ -} ATTRIBUTE_PACKED vtsi_mat_t; - -/** - * PartOfTitle Unit Information. - */ -typedef struct { - uint16_t pgcn; - uint16_t pgn; -} ATTRIBUTE_PACKED ptt_info_t; - -/** - * PartOfTitle Information. - */ -typedef struct { - uint16_t nr_of_ptts; - ptt_info_t *ptt; -} ATTRIBUTE_PACKED ttu_t; - -/** - * PartOfTitle Search Pointer Table. - */ -typedef struct { - uint16_t nr_of_srpts; - uint16_t zero_1; - uint32_t last_byte; - ttu_t *title; - uint32_t *ttu_offset; /* offset table for each ttu */ -} ATTRIBUTE_PACKED vts_ptt_srpt_t; -#define VTS_PTT_SRPT_SIZE 8U - - -/** - * Time Map Entry. - */ -/* Should this be bit field at all or just the uint32_t? */ -typedef uint32_t map_ent_t; - -/** - * Time Map. - */ -typedef struct { - uint8_t tmu; /* Time unit, in seconds */ - uint8_t zero_1; - uint16_t nr_of_entries; - map_ent_t *map_ent; -} ATTRIBUTE_PACKED vts_tmap_t; -#define VTS_TMAP_SIZE 4U - -/** - * Time Map Table. - */ -typedef struct { - uint16_t nr_of_tmaps; - uint16_t zero_1; - uint32_t last_byte; - vts_tmap_t *tmap; - uint32_t *tmap_offset; /* offset table for each tmap */ -} ATTRIBUTE_PACKED vts_tmapt_t; -#define VTS_TMAPT_SIZE 8U - - -#if PRAGMA_PACK -#pragma pack() -#endif - - -/** - * The following structure defines an IFO file. The structure is divided into - * two parts, the VMGI, or Video Manager Information, which is read from the - * VIDEO_TS.[IFO,BUP] file, and the VTSI, or Video Title Set Information, which - * is read in from the VTS_XX_0.[IFO,BUP] files. - */ -typedef struct { - dvd_file_t *file; - - /* VMGI */ - vmgi_mat_t *vmgi_mat; - tt_srpt_t *tt_srpt; - pgc_t *first_play_pgc; - ptl_mait_t *ptl_mait; - vts_atrt_t *vts_atrt; - txtdt_mgi_t *txtdt_mgi; - - /* Common */ - pgci_ut_t *pgci_ut; - c_adt_t *menu_c_adt; - vobu_admap_t *menu_vobu_admap; - - /* VTSI */ - vtsi_mat_t *vtsi_mat; - vts_ptt_srpt_t *vts_ptt_srpt; - pgcit_t *vts_pgcit; - vts_tmapt_t *vts_tmapt; - c_adt_t *vts_c_adt; - vobu_admap_t *vts_vobu_admap; -} ifo_handle_t; - -#endif /* LIBDVDREAD_IFO_TYPES_H */ diff -r 6698620c1477 -r c743d79f187b nav_print.c --- a/nav_print.c Sat Dec 13 14:27:51 2008 +0000 +++ b/nav_print.c Wed Dec 31 08:43:03 2008 +0000 @@ -28,9 +28,9 @@ #include #include -#include "nav_types.h" -#include "nav_print.h" -#include "ifo_print.h" +#include "dvdread/nav_types.h" +#include "dvdread/nav_print.h" +#include "dvdread/ifo_print.h" static void navPrint_PCI_GI(pci_gi_t *pci_gi) { int i; diff -r 6698620c1477 -r c743d79f187b nav_print.h --- a/nav_print.h Sat Dec 13 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2001, 2002 Billy Biggs , - * Håkan Hjort - * - * This file is part of libdvdread. - * - * libdvdread is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * libdvdread is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with libdvdread; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LIBDVDREAD_NAV_PRINT_H -#define LIBDVDREAD_NAV_PRINT_H - -#include "nav_types.h" - -/** - * Pretty printing of the NAV packets, PCI and DSI structs. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Prints information contained in the PCI to stdout. - * - * @param pci Pointer to the PCI data structure to be printed. - */ -void navPrint_PCI(pci_t *); - -/** - * Prints information contained in the DSI to stdout. - * - * @param dsi Pointer to the DSI data structure to be printed. - */ -void navPrint_DSI(dsi_t *); - -#ifdef __cplusplus -}; -#endif -#endif /* LIBDVDREAD_NAV_PRINT_H */ diff -r 6698620c1477 -r c743d79f187b nav_read.c --- a/nav_read.c Sat Dec 13 14:27:51 2008 +0000 +++ b/nav_read.c Wed Dec 31 08:43:03 2008 +0000 @@ -26,10 +26,10 @@ #include #include "bswap.h" -#include "nav_types.h" -#include "nav_read.h" +#include "dvdread/nav_types.h" +#include "dvdread/nav_read.h" #include "dvdread_internal.h" -#include "bitreader.h" +#include "dvdread/bitreader.h" #define getbits_init dvdread_getbits_init #define getbits dvdread_getbits diff -r 6698620c1477 -r c743d79f187b nav_read.h --- a/nav_read.h Sat Dec 13 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2002 Håkan Hjort . - * - * This file is part of libdvdread. - * - * libdvdread is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * libdvdread is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with libdvdread; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LIBDVDREAD_NAV_READ_H -#define LIBDVDREAD_NAV_READ_H - -#include "nav_types.h" - -/** - * Parsing of NAV data, PCI and DSI parts. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Reads the PCI packet data pointed to into th pci struct. - * - * @param pci Pointer to the PCI data structure to be filled in. - * @param bufffer Pointer to the buffer of the on disc PCI data. - */ -void navRead_PCI(pci_t *, unsigned char *); - -/** - * Reads the DSI packet data pointed to into dsi struct. - * - * @param dsi Pointer to the DSI data structure to be filled in. - * @param bufffer Pointer to the buffer of the on disc DSI data. - */ -void navRead_DSI(dsi_t *, unsigned char *); - -#ifdef __cplusplus -}; -#endif -#endif /* LIBDVDREAD_NAV_READ_H */ diff -r 6698620c1477 -r c743d79f187b nav_types.h --- a/nav_types.h Sat Dec 13 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,248 +0,0 @@ -/* - * Copyright (C) 2000, 2001, 2002 Håkan Hjort - * - * The data structures in this file should represent the layout of the - * pci and dsi packets as they are stored in the stream. Information - * found by reading the source to VOBDUMP is the base for the structure - * and names of these data types. - * - * VOBDUMP: a program for examining DVD .VOB files. - * Copyright 1998, 1999 Eric Smith - * - * VOBDUMP is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. Note that I am not - * granting permission to redistribute or modify VOBDUMP under the terms - * of any later version of the General Public License. - * - * This program is distributed in the hope that it will be useful (or at - * least amusing), but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef LIBDVDREAD_NAV_TYPES_H -#define LIBDVDREAD_NAV_TYPES_H - -#include -#include "ifo_types.h" /* only dvd_time_t, vm_cmd_t and user_ops_t */ - -/* The length including the substream id byte. */ -#define PCI_BYTES 0x3d4 -#define DSI_BYTES 0x3fa - -#define PS2_PCI_SUBSTREAM_ID 0x00 -#define PS2_DSI_SUBSTREAM_ID 0x01 - -/* Remove this */ -#define DSI_START_BYTE 1031 - -/** - * PCI General Information - */ -typedef struct { - uint32_t nv_pck_lbn; /**< sector address of this nav pack */ - uint16_t vobu_cat; /**< 'category' of vobu */ - uint16_t zero1; /**< reserved */ - user_ops_t vobu_uop_ctl; /**< UOP of vobu */ - uint32_t vobu_s_ptm; /**< start presentation time of vobu */ - uint32_t vobu_e_ptm; /**< end presentation time of vobu */ - uint32_t vobu_se_e_ptm; /**< end ptm of sequence end in vobu */ - dvd_time_t e_eltm; /**< Cell elapsed time */ - char vobu_isrc[32]; -} ATTRIBUTE_PACKED pci_gi_t; - -/** - * Non Seamless Angle Information - */ -typedef struct { - uint32_t nsml_agl_dsta[9]; /**< address of destination vobu in AGL_C#n */ -} ATTRIBUTE_PACKED nsml_agli_t; - -/** - * Highlight General Information - * - * For btngrX_dsp_ty the bits have the following meaning: - * 000b: normal 4/3 only buttons - * XX1b: wide (16/9) buttons - * X1Xb: letterbox buttons - * 1XXb: pan&scan buttons - */ -typedef struct { - uint16_t hli_ss; /**< status, only low 2 bits 0: no buttons, 1: different 2: equal 3: eual except for button cmds */ - uint32_t hli_s_ptm; /**< start ptm of hli */ - uint32_t hli_e_ptm; /**< end ptm of hli */ - uint32_t btn_se_e_ptm; /**< end ptm of button select */ - unsigned int zero1 : 2; /**< reserved */ - unsigned int btngr_ns : 2; /**< number of button groups 1, 2 or 3 with 36/18/12 buttons */ - unsigned int zero2 : 1; /**< reserved */ - unsigned int btngr1_dsp_ty : 3; /**< display type of subpic stream for button group 1 */ - unsigned int zero3 : 1; /**< reserved */ - unsigned int btngr2_dsp_ty : 3; /**< display type of subpic stream for button group 2 */ - unsigned int zero4 : 1; /**< reserved */ - unsigned int btngr3_dsp_ty : 3; /**< display type of subpic stream for button group 3 */ - uint8_t btn_ofn; /**< button offset number range 0-255 */ - uint8_t btn_ns; /**< number of valid buttons <= 36/18/12 (low 6 bits) */ - uint8_t nsl_btn_ns; /**< number of buttons selectable by U_BTNNi (low 6 bits) nsl_btn_ns <= btn_ns */ - uint8_t zero5; /**< reserved */ - uint8_t fosl_btnn; /**< forcedly selected button (low 6 bits) */ - uint8_t foac_btnn; /**< forcedly activated button (low 6 bits) */ -} ATTRIBUTE_PACKED hl_gi_t; - - -/** - * Button Color Information Table - * Each entry beeing a 32bit word that contains the color indexs and alpha - * values to use. They are all represented by 4 bit number and stored - * like this [Ci3, Ci2, Ci1, Ci0, A3, A2, A1, A0]. The actual palette - * that the indexes reference is in the PGC. - * @TODO split the uint32_t into a struct - */ -typedef struct { - uint32_t btn_coli[3][2]; /**< [button color number-1][select:0/action:1] */ -} ATTRIBUTE_PACKED btn_colit_t; - -/** - * Button Information - * - * NOTE: I've had to change the structure from the disk layout to get - * the packing to work with Sun's Forte C compiler. - * The 4 and 7 bytes are 'rotated' was: ABC DEF GHIJ is: ABCG DEFH IJ - */ -typedef struct { - unsigned int btn_coln : 2; /**< button color number */ - unsigned int x_start : 10; /**< x start offset within the overlay */ - unsigned int zero1 : 2; /**< reserved */ - unsigned int x_end : 10; /**< x end offset within the overlay */ - - unsigned int auto_action_mode : 2; /**< 0: no, 1: activated if selected */ - unsigned int y_start : 10; /**< y start offset within the overlay */ - unsigned int zero2 : 2; /**< reserved */ - unsigned int y_end : 10; /**< y end offset within the overlay */ - - unsigned int zero3 : 2; /**< reserved */ - unsigned int up : 6; /**< button index when pressing up */ - unsigned int zero4 : 2; /**< reserved */ - unsigned int down : 6; /**< button index when pressing down */ - unsigned int zero5 : 2; /**< reserved */ - unsigned int left : 6; /**< button index when pressing left */ - unsigned int zero6 : 2; /**< reserved */ - unsigned int right : 6; /**< button index when pressing right */ - vm_cmd_t cmd; -} ATTRIBUTE_PACKED btni_t; - -/** - * Highlight Information - */ -typedef struct { - hl_gi_t hl_gi; - btn_colit_t btn_colit; - btni_t btnit[36]; -} ATTRIBUTE_PACKED hli_t; - -/** - * PCI packet - */ -typedef struct { - pci_gi_t pci_gi; - nsml_agli_t nsml_agli; - hli_t hli; - uint8_t zero1[189]; -} ATTRIBUTE_PACKED pci_t; - - - - -/** - * DSI General Information - */ -typedef struct { - uint32_t nv_pck_scr; - uint32_t nv_pck_lbn; /**< sector address of this nav pack */ - uint32_t vobu_ea; /**< end address of this VOBU */ - uint32_t vobu_1stref_ea; /**< end address of the 1st reference image */ - uint32_t vobu_2ndref_ea; /**< end address of the 2nd reference image */ - uint32_t vobu_3rdref_ea; /**< end address of the 3rd reference image */ - uint16_t vobu_vob_idn; /**< VOB Id number that this VOBU is part of */ - uint8_t zero1; /**< reserved */ - uint8_t vobu_c_idn; /**< Cell Id number that this VOBU is part of */ - dvd_time_t c_eltm; /**< Cell elapsed time */ -} ATTRIBUTE_PACKED dsi_gi_t; - -/** - * Seamless Playback Information - */ -typedef struct { - uint16_t category; /**< 'category' of seamless VOBU */ - uint32_t ilvu_ea; /**< end address of interleaved Unit */ - uint32_t ilvu_sa; /**< start address of next interleaved unit */ - uint16_t size; /**< size of next interleaved unit */ - uint32_t vob_v_s_s_ptm; /**< video start ptm in vob */ - uint32_t vob_v_e_e_ptm; /**< video end ptm in vob */ - struct { - uint32_t stp_ptm1; - uint32_t stp_ptm2; - uint32_t gap_len1; - uint32_t gap_len2; - } vob_a[8]; -} ATTRIBUTE_PACKED sml_pbi_t; - -/** - * Seamless Angle Infromation for one angle - */ -typedef struct { - uint32_t address; /**< offset to next ILVU, high bit is before/after */ - uint16_t size; /**< byte size of the ILVU pointed to by address */ -} ATTRIBUTE_PACKED sml_agl_data_t; - -/** - * Seamless Angle Infromation - */ -typedef struct { - sml_agl_data_t data[9]; -} ATTRIBUTE_PACKED sml_agli_t; - -/** - * VOBU Search Information - */ -typedef struct { - uint32_t next_video; /**< Next vobu that contains video */ - uint32_t fwda[19]; /**< Forwards, time */ - uint32_t next_vobu; - uint32_t prev_vobu; - uint32_t bwda[19]; /**< Backwards, time */ - uint32_t prev_video; -} ATTRIBUTE_PACKED vobu_sri_t; - -#define SRI_END_OF_CELL 0x3fffffff - -/** - * Synchronous Information - */ -typedef struct { - uint16_t a_synca[8]; /**< offset to first audio packet for this VOBU */ - uint32_t sp_synca[32]; /**< offset to first subpicture packet */ -} ATTRIBUTE_PACKED synci_t; - -/** - * DSI packet - */ -typedef struct { - dsi_gi_t dsi_gi; - sml_pbi_t sml_pbi; - sml_agli_t sml_agli; - vobu_sri_t vobu_sri; - synci_t synci; - uint8_t zero1[471]; -} ATTRIBUTE_PACKED dsi_t; - - -#if PRAGMA_PACK -#pragma pack() -#endif - -#endif /* LIBDVDREAD_NAV_TYPES_H */