Mercurial > libdvdread4.hg
annotate dvd_reader.h @ 24:3552a3d11604 src
Remove useless $Id$, $Log$ and $Name$ keywords.
author | diego |
---|---|
date | Sun, 14 Sep 2008 20:43:32 +0000 |
parents | ac07d427fbc6 |
children | 0d82d0f30c98 |
rev | line source |
---|---|
3 | 1 /* |
2 * Copyright (C) 2001, 2002 Billy Biggs <vektor@dumbterm.net>, | |
22 | 3 * Håkan Hjort <d95hjort@dtek.chalmers.se>, |
4 * Björn Englund <d4bjorn@dtek.chalmers.se> | |
3 | 5 * |
21
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
6 * This file is part of libdvdread. |
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
7 * |
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
8 * libdvdread is free software; you can redistribute it and/or modify |
3 | 9 * it under the terms of the GNU General Public License as published by |
21
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
11 * (at your option) any later version. |
3 | 12 * |
21
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
13 * libdvdread is distributed in the hope that it will be useful, |
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
16 * GNU General Public License for more details. |
3 | 17 * |
21
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
19 * with libdvdread; if not, write to the Free Software Foundation, Inc., |
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
3 | 21 */ |
22 | |
23 | 23 #ifndef LIBDVDREAD_DVD_READER_H |
24 #define LIBDVDREAD_DVD_READER_H | |
25 | |
3 | 26 #ifdef _MSC_VER |
27 #include <config.h> | |
28 | |
29 #include <stdio.h> | |
30 #include <stdlib.h> | |
31 #endif | |
32 | |
33 #include <sys/types.h> | |
34 #include <inttypes.h> | |
35 | |
36 /** | |
37 * The DVD access interface. | |
38 * | |
39 * This file contains the functions that form the interface to to | |
40 * reading files located on a DVD. | |
41 */ | |
42 | |
43 /** | |
44 * The current version. | |
45 */ | |
46 #define DVDREAD_VERSION 904 | |
47 | |
48 /** | |
49 * The length of one Logical Block of a DVD. | |
50 */ | |
51 #define DVD_VIDEO_LB_LEN 2048 | |
52 | |
53 /** | |
54 * Maximum length of filenames allowed in UDF. | |
55 */ | |
56 #define MAX_UDF_FILE_NAME_LEN 2048 | |
57 | |
58 #ifdef __cplusplus | |
59 extern "C" { | |
60 #endif | |
20 | 61 |
3 | 62 /** |
63 * Opaque type that is used as a handle for one instance of an opened DVD. | |
64 */ | |
65 typedef struct dvd_reader_s dvd_reader_t; | |
20 | 66 |
3 | 67 /** |
68 * Opaque type for a file read handle, much like a normal fd or FILE *. | |
69 */ | |
70 typedef struct dvd_file_s dvd_file_t; | |
71 | |
72 /** | |
73 * Opens a block device of a DVD-ROM file, or an image file, or a directory | |
74 * name for a mounted DVD or HD copy of a DVD. | |
75 * | |
76 * If the given file is a block device, or is the mountpoint for a block | |
77 * device, then that device is used for CSS authentication using libdvdcss. | |
20 | 78 * If no device is available, then no CSS authentication is performed, |
3 | 79 * and we hope that the image is decrypted. |
80 * | |
81 * If the path given is a directory, then the files in that directory may be | |
82 * in any one of these formats: | |
83 * | |
84 * path/VIDEO_TS/VTS_01_1.VOB | |
85 * path/video_ts/vts_01_1.vob | |
86 * path/VTS_01_1.VOB | |
87 * path/vts_01_1.vob | |
88 * | |
20 | 89 * @param path Specifies the the device, file or directory to be used. |
3 | 90 * @return If successful a a read handle is returned. Otherwise 0 is returned. |
91 * | |
92 * dvd = DVDOpen(path); | |
93 */ | |
94 dvd_reader_t *DVDOpen( const char * ); | |
95 | |
96 /** | |
97 * Closes and cleans up the DVD reader object. | |
98 * | |
99 * You must close all open files before calling this function. | |
100 * | |
101 * @param dvd A read handle that should be closed. | |
102 * | |
103 * DVDClose(dvd); | |
104 */ | |
105 void DVDClose( dvd_reader_t * ); | |
106 | |
107 /** | |
20 | 108 * |
3 | 109 */ |
110 typedef enum { | |
111 DVD_READ_INFO_FILE, /**< VIDEO_TS.IFO or VTS_XX_0.IFO (title) */ | |
112 DVD_READ_INFO_BACKUP_FILE, /**< VIDEO_TS.BUP or VTS_XX_0.BUP (title) */ | |
113 DVD_READ_MENU_VOBS, /**< VIDEO_TS.VOB or VTS_XX_0.VOB (title) */ | |
20 | 114 DVD_READ_TITLE_VOBS /**< VTS_XX_[1-9].VOB (title). All files in |
3 | 115 the title set are opened and read as a |
116 single file. */ | |
117 } dvd_read_domain_t; | |
118 | |
119 /** | |
120 * Opens a file on the DVD given the title number and domain. | |
121 * | |
122 * If the title number is 0, the video manager information is opened | |
123 * (VIDEO_TS.[IFO,BUP,VOB]). Returns a file structure which may be | |
124 * used for reads, or 0 if the file was not found. | |
125 * | |
126 * @param dvd A dvd read handle. | |
127 * @param titlenum Which Video Title Set should be used, VIDEO_TS is 0. | |
20 | 128 * @param domain Which domain. |
3 | 129 * @return If successful a a file read handle is returned, otherwise 0. |
130 * | |
131 * dvd_file = DVDOpenFile(dvd, titlenum, domain); */ | |
132 dvd_file_t *DVDOpenFile( dvd_reader_t *, int, dvd_read_domain_t ); | |
133 | |
134 /** | |
135 * Closes a file and frees the associated structure. | |
136 * | |
137 * @param dvd_file The file read handle to be closed. | |
138 * | |
139 * DVDCloseFile(dvd_file); | |
140 */ | |
141 void DVDCloseFile( dvd_file_t * ); | |
142 | |
143 /** | |
144 * Reads block_count number of blocks from the file at the given block offset. | |
145 * Returns number of blocks read on success, -1 on error. This call is only | |
20 | 146 * for reading VOB data, and should not be used when reading the IFO files. |
147 * When reading from an encrypted drive, blocks are decrypted using libdvdcss | |
3 | 148 * where required. |
149 * | |
150 * @param dvd_file A file read handle. | |
151 * @param offset Block offset from the start of the file to start reading at. | |
152 * @param block_count Number of block to read. | |
153 * @param data Pointer to a buffer to write the data into. | |
154 * @return Returns number of blocks read on success, -1 on error. | |
155 * | |
156 * blocks_read = DVDReadBlocks(dvd_file, offset, block_count, data); | |
157 */ | |
158 ssize_t DVDReadBlocks( dvd_file_t *, int, size_t, unsigned char * ); | |
159 | |
160 /** | |
161 * Seek to the given position in the file. Returns the resulting position in | |
162 * bytes from the beginning of the file. The seek position is only used for | |
163 * byte reads from the file, the block read call always reads from the given | |
164 * offset. | |
165 * | |
166 * @param dvd_file A file read handle. | |
167 * @param seek_offset Byte offset from the start of the file to seek to. | |
168 * @return The resulting position in bytes from the beginning of the file. | |
169 * | |
170 * offset_set = DVDFileSeek(dvd_file, seek_offset); | |
171 */ | |
172 int32_t DVDFileSeek( dvd_file_t *, int32_t ); | |
173 | |
174 /** | |
175 * Reads the given number of bytes from the file. This call can only be used | |
176 * on the information files, and may not be used for reading from a VOB. This | |
177 * reads from and increments the currrent seek position for the file. | |
178 * | |
179 * @param dvd_file A file read handle. | |
180 * @param data Pointer to a buffer to write the data into. | |
181 * @param bytes Number of bytes to read. | |
182 * @return Returns number of bytes read on success, -1 on error. | |
183 * | |
184 * bytes_read = DVDReadBytes(dvd_file, data, bytes); | |
185 */ | |
186 ssize_t DVDReadBytes( dvd_file_t *, void *, size_t ); | |
187 | |
188 /** | |
189 * Returns the file size in blocks. | |
190 * | |
191 * @param dvd_file A file read handle. | |
192 * @return The size of the file in blocks, -1 on error. | |
193 * | |
194 * blocks = DVDFileSize(dvd_file); | |
195 */ | |
196 ssize_t DVDFileSize( dvd_file_t * ); | |
197 | |
198 /** | |
199 * Get a unique 128 bit disc ID. | |
200 * This is the MD5 sum of VIDEO_TS.IFO and the VTS_0?_0.IFO files | |
201 * in title order (those that exist). | |
202 * If you need a 'text' representation of the id, print it as a | |
20 | 203 * hexadecimal number, using lowercase letters, discid[0] first. |
3 | 204 * I.e. the same format as the command-line 'md5sum' program uses. |
205 * | |
206 * @param dvd A read handle to get the disc ID from | |
207 * @param discid The buffer to put the disc ID into. The buffer must | |
208 * have room for 128 bits (16 chars). | |
209 * @return 0 on success, -1 on error. | |
210 */ | |
211 int DVDDiscID( dvd_reader_t *, unsigned char * ); | |
212 | |
213 /** | |
214 * Get the UDF VolumeIdentifier and VolumeSetIdentifier | |
215 * from the PrimaryVolumeDescriptor. | |
216 * | |
217 * @param dvd A read handle to get the disc ID from | |
218 * @param volid The buffer to put the VolumeIdentifier into. | |
219 * The VolumeIdentifier is latin-1 encoded (8bit unicode) | |
220 * null terminated and max 32 bytes (including '\0') | |
221 * @param volid_size No more than volid_size bytes will be copied to volid. | |
222 * If the VolumeIdentifier is truncated because of this | |
223 * it will still be null terminated. | |
224 * @param volsetid The buffer to put the VolumeSetIdentifier into. | |
225 * The VolumeIdentifier is 128 bytes as | |
226 * stored in the UDF PrimaryVolumeDescriptor. | |
227 * Note that this is not a null terminated string. | |
228 * @param volsetid_size At most volsetid_size bytes will be copied to volsetid. | |
229 * @return 0 on success, -1 on error. | |
230 */ | |
231 int DVDUDFVolumeInfo( dvd_reader_t *, char *, unsigned int, | |
232 unsigned char *, unsigned int ); | |
233 | |
234 int DVDFileSeekForce( dvd_file_t *, int offset, int force_size); | |
235 | |
236 /** | |
237 * Get the ISO9660 VolumeIdentifier and VolumeSetIdentifier | |
238 * | |
239 * * Only use this function as fallback if DVDUDFVolumeInfo returns 0 * | |
240 * * this will happen on a disc mastered only with a iso9660 filesystem * | |
241 * * All video DVD discs have UDF filesystem * | |
242 * | |
243 * @param dvd A read handle to get the disc ID from | |
244 * @param volid The buffer to put the VolumeIdentifier into. | |
245 * The VolumeIdentifier is coded with '0-9','A-Z','_' | |
246 * null terminated and max 33 bytes (including '\0') | |
247 * @param volid_size No more than volid_size bytes will be copied to volid. | |
248 * If the VolumeIdentifier is truncated because of this | |
249 * it will still be null terminated. | |
250 * @param volsetid The buffer to put the VolumeSetIdentifier into. | |
251 * The VolumeIdentifier is 128 bytes as | |
252 * stored in the ISO9660 PrimaryVolumeDescriptor. | |
253 * Note that this is not a null terminated string. | |
254 * @param volsetid_size At most volsetid_size bytes will be copied to volsetid. | |
255 * @return 0 on success, -1 on error. | |
256 */ | |
257 int DVDISOVolumeInfo( dvd_reader_t *, char *, unsigned int, | |
258 unsigned char *, unsigned int ); | |
259 | |
260 /** | |
261 * Sets the level of caching that is done when reading from a device | |
262 * | |
263 * @param dvd A read handle to get the disc ID from | |
264 * @param level The level of caching wanted. | |
265 * -1 - returns the current setting. | |
266 * 0 - UDF Cache turned off. | |
267 * 1 - (default level) Pointers to IFO files and some data from | |
20 | 268 * PrimaryVolumeDescriptor are cached. |
3 | 269 * |
270 * @return The level of caching. | |
271 */ | |
272 int DVDUDFCacheLevel( dvd_reader_t *, int ); | |
273 | |
274 #ifdef __cplusplus | |
275 }; | |
276 #endif | |
23 | 277 #endif /* LIBDVDREAD_DVD_READER_H */ |