1 /*
2  * This file has been modified for the cdrkit suite.
3  *
4  * The behaviour and appearence of the program code below can differ to a major
5  * extent from the version distributed by the original author(s).
6  *
7  * For details, see Changelog file distributed with the cdrkit package. If you
8  * received this file from another source then ask the distributing person for
9  * a log of modifications.
10  *
11  */
12 
13 /* @(#)dvd_reader.h	1.2 04/03/02 joerg */
14 
15 #ifndef	_DVD_READER_H
16 #define	_DVD_READER_H
17 
18 /*
19  * Copyright (C) 2001, 2002 Billy Biggs <vektor@dumbterm.net>,
20  *			    H�kan Hjort <d95hjort@dtek.chalmers.se
21  *			    Olaf Beck <olaf_sc@yahoo.com>
22  *			    (I only did the cut down no other contribs)
23  *			    J�rg Schilling <schilling@fokus.gmd.de>
24  *			    (making the code portable)
25  * This program is free software; you can redistribute it and/or modify
26  * it under the terms of the GNU General Public License as published by
27  * the Free Software Foundation; either version 2 of the License, or (at
28  * your option) any later version.
29  *
30  * This program is distributed in the hope that it will be useful, but
31  * WITHOUT ANY WARRANTY; without even the implied warranty of
32  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
33  * General Public License for more details.
34  *
35  * You should have received a copy of the GNU General Public License
36  * along with this program; if not, write to the Free Software
37  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
38  */
39 
40 /*
41  * NOTE: This is a cut down version of libdvdread for genisoimage, due
42  * to portability issues with the current libdvdread according to
43  * the maintainer of genisoimage.
44  * This cut down version only reads from a harddisk file structure
45  * and it only implements the functions necessary inorder to make
46  * genisoimage produce valid DVD-Video images.
47  * DON'T USE THIS LIBRARY IN ANY OTHER PROGRAM GET THE REAL
48  * LIBDVDREAD INSTEAD
49  */
50 
51 
52 #include <unixstd.h>	/* Make sure <sys/types.h> is included */
53 
54 /*
55  * Maximum length of filenames for UDF.
56  */
57 #define	MAX_UDF_FILE_NAME_LEN 2048
58 
59 /*
60  * The length of one Logical Block of a DVD Video.
61  */
62 #define	DVD_VIDEO_LB_LEN 2048
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 
69 struct dvd_reader_s {
70 	/* Information required for a directory path drive. */
71 	char	*path_root;
72 };
73 
74 
75 typedef struct dvd_reader_s	dvd_reader_t;
76 typedef struct dvd_file_s	dvd_file_t;
77 
78 
79 /*
80  * dvd = DVDOpen(path);
81  * Opens a directory name of a DVD-Video structure on HD.
82  * Returns zero if it fails.
83  * The path should be like this
84  * "path/VIDEO_TS/VTS_01_1.VOB"
85  */
86 
87 
88 extern	dvd_reader_t *DVDOpen(const char *);
89 
90 
91 /*
92  * DVDClose(dvd);
93  *
94  * Closes and cleans up the DVD reader object.  You must close all open files
95  * before calling this function.
96  */
97 
98 
99 extern	void DVDClose(dvd_reader_t *);
100 
101 /*
102  * INFO_FILE       : VIDEO_TS.IFO     (manager)
103  *                   VTS_XX_0.IFO     (title)
104  *
105  * INFO_BACKUP_FILE: VIDEO_TS.BUP     (manager)
106  *                   VTS_XX_0.BUP     (title)
107  *
108  * MENU_VOBS       : VIDEO_TS.VOB     (manager)
109  *                   VTS_XX_0.VOB     (title)
110  *
111  * TITLE_VOBS      : VTS_XX_[1-9].VOB (title)
112  *                   All files in the title set are opened and
113  *                   read as a single file.
114  */
115 typedef enum {
116 	DVD_READ_INFO_FILE,
117 	DVD_READ_INFO_BACKUP_FILE,
118 	DVD_READ_MENU_VOBS,
119 	DVD_READ_TITLE_VOBS
120 } dvd_read_domain_t;
121 
122 /*
123  * dvd_file = DVDOpenFile(dvd, titlenum, domain);
124  *
125  * Opens a file on the DVD given the title number and domain.  If the title
126  * number is 0, the video manager information is opened
127  * (VIDEO_TS.[IFO,BUP,VOB]).  Returns a file structure which may be used for
128  * reads, or 0 if the file was not found.
129  */
130 extern	dvd_file_t * DVDOpenFile(dvd_reader_t *, int, dvd_read_domain_t);
131 
132 /*
133  * DVDCloseFile(dvd_file);
134  *
135  * Closes a file and frees the associated structure.
136  */
137 extern	void DVDCloseFile(dvd_file_t *);
138 
139 
140 /*
141  * blocks = DVDFileSize(dvd_file);
142  *
143  * Returns the file size in blocks.
144  */
145 extern	ssize_t DVDFileSize(dvd_file_t *);
146 
147 
148 #ifdef __cplusplus
149 };
150 #endif
151 #endif /* _DVD_READER_H */
152