annotate dvdread/dvd_reader.h @ 46:4f40782ab5fc src

Expose the dvd_stat_t struct. The commits that brought in the DVDFileStat() function from libdvdread 0.9.7 incorrectly made the stat struct opaque. This can't be done because the API does not use any allocation or deallocation code. So callers of DVDFileStat cannot declare stat structs. Since we are attempting to maintain the API compatibility w/ those releases of libdvdread, the struct has been brought into the header. Thanks again to Rathann for bringing this issue to the dvdnav list. And thanks to the original bug reportera(O. Rolland) to fedora.
author erik
date Mon, 07 Dec 2009 03:50:20 +0000
parents 92b4694792da
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
1 /*
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
2 * Copyright (C) 2001, 2002 Billy Biggs <vektor@dumbterm.net>,
22
447c5319a522 Convert all ISO8859-1 sequences to proper UTF-8.
diego
parents: 21
diff changeset
3 * Håkan Hjort <d95hjort@dtek.chalmers.se>,
447c5319a522 Convert all ISO8859-1 sequences to proper UTF-8.
diego
parents: 21
diff changeset
4 * Björn Englund <d4bjorn@dtek.chalmers.se>
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
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
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
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
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
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
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
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
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
21 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
22
23
ac07d427fbc6 Use consistent multiple inclusion guards everywhere:
diego
parents: 22
diff changeset
23 #ifndef LIBDVDREAD_DVD_READER_H
ac07d427fbc6 Use consistent multiple inclusion guards everywhere:
diego
parents: 22
diff changeset
24 #define LIBDVDREAD_DVD_READER_H
ac07d427fbc6 Use consistent multiple inclusion guards everywhere:
diego
parents: 22
diff changeset
25
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
26 #ifdef _MSC_VER
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
27 #include <config.h>
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
28
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
29 #include <stdio.h>
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
30 #include <stdlib.h>
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
31 #endif
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
32
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
33 #include <sys/types.h>
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
34 #include <inttypes.h>
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
35
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
36 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
37 * The DVD access interface.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
38 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
39 * This file contains the functions that form the interface to to
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
40 * reading files located on a DVD.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
41 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
42
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
43 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
44 * The current version.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
45 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
46 #define DVDREAD_VERSION 904
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
47
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
48 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
49 * The length of one Logical Block of a DVD.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
50 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
51 #define DVD_VIDEO_LB_LEN 2048
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
52
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
53 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
54 * Maximum length of filenames allowed in UDF.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
55 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
56 #define MAX_UDF_FILE_NAME_LEN 2048
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
57
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
58 #ifdef __cplusplus
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
59 extern "C" {
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
60 #endif
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
61
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
62 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
63 * Opaque type that is used as a handle for one instance of an opened DVD.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
64 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
65 typedef struct dvd_reader_s dvd_reader_t;
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
66
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
67 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
68 * Opaque type for a file read handle, much like a normal fd or FILE *.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
69 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
70 typedef struct dvd_file_s dvd_file_t;
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
71
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
72 /**
46
4f40782ab5fc Expose the dvd_stat_t struct.
erik
parents: 44
diff changeset
73 * Public type that is used to provide statistics on a handle.
44
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
74 */
46
4f40782ab5fc Expose the dvd_stat_t struct.
erik
parents: 44
diff changeset
75 typedef struct {
4f40782ab5fc Expose the dvd_stat_t struct.
erik
parents: 44
diff changeset
76 off_t size; /**< Total size of file in bytes */
4f40782ab5fc Expose the dvd_stat_t struct.
erik
parents: 44
diff changeset
77 int nr_parts; /**< Number of file parts */
4f40782ab5fc Expose the dvd_stat_t struct.
erik
parents: 44
diff changeset
78 off_t parts_size[9]; /**< Size of each part in bytes */
4f40782ab5fc Expose the dvd_stat_t struct.
erik
parents: 44
diff changeset
79 } dvd_stat_t;
44
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
80
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
81 /**
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
82 * Opens a block device of a DVD-ROM file, or an image file, or a directory
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
83 * name for a mounted DVD or HD copy of a DVD.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
84 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
85 * If the given file is a block device, or is the mountpoint for a block
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
86 * device, then that device is used for CSS authentication using libdvdcss.
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
87 * If no device is available, then no CSS authentication is performed,
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
88 * and we hope that the image is decrypted.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
89 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
90 * If the path given is a directory, then the files in that directory may be
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
91 * in any one of these formats:
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
92 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
93 * path/VIDEO_TS/VTS_01_1.VOB
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
94 * path/video_ts/vts_01_1.vob
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
95 * path/VTS_01_1.VOB
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
96 * path/vts_01_1.vob
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
97 *
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
98 * @param path Specifies the the device, file or directory to be used.
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
99 * @return If successful a a read handle is returned. Otherwise 0 is returned.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
100 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
101 * dvd = DVDOpen(path);
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
102 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
103 dvd_reader_t *DVDOpen( const char * );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
104
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
105 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
106 * Closes and cleans up the DVD reader object.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
107 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
108 * You must close all open files before calling this function.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
109 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
110 * @param dvd A read handle that should be closed.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
111 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
112 * DVDClose(dvd);
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
113 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
114 void DVDClose( dvd_reader_t * );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
115
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
116 /**
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
117 *
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
118 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
119 typedef enum {
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
120 DVD_READ_INFO_FILE, /**< VIDEO_TS.IFO or VTS_XX_0.IFO (title) */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
121 DVD_READ_INFO_BACKUP_FILE, /**< VIDEO_TS.BUP or VTS_XX_0.BUP (title) */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
122 DVD_READ_MENU_VOBS, /**< VIDEO_TS.VOB or VTS_XX_0.VOB (title) */
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
123 DVD_READ_TITLE_VOBS /**< VTS_XX_[1-9].VOB (title). All files in
26
0d82d0f30c98 cosmetics: Convert all tabs to spaces.
diego
parents: 23
diff changeset
124 the title set are opened and read as a
0d82d0f30c98 cosmetics: Convert all tabs to spaces.
diego
parents: 23
diff changeset
125 single file. */
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
126 } dvd_read_domain_t;
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
127
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
128 /**
44
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
129 * Stats a file on the DVD given the title number and domain.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
130 * The information about the file is stored in a dvd_stat_t
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
131 * which contains information about the size of the file and
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
132 * the number of parts in case of a multipart file and the respective
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
133 * sizes of the parts.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
134 * A multipart file is for instance VTS_02_1.VOB, VTS_02_2.VOB, VTS_02_3.VOB
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
135 * The size of VTS_02_1.VOB will be stored in stat->parts_size[0],
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
136 * VTS_02_2.VOB in stat->parts_size[1], ...
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
137 * The total size (sum of all parts) is stored in stat->size and
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
138 * stat->nr_parts will hold the number of parts.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
139 * Only DVD_READ_TITLE_VOBS (VTS_??_[1-9].VOB) can be multipart files.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
140 *
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
141 * This function is only of use if you want to get the size of each file
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
142 * in the filesystem. These sizes are not needed to use any other
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
143 * functions in libdvdread.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
144 *
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
145 * @param dvd A dvd read handle.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
146 * @param titlenum Which Video Title Set should be used, VIDEO_TS is 0.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
147 * @param domain Which domain.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
148 * @param stat Pointer to where the result is stored.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
149 * @return If successful 0, otherwise -1.
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
150 *
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
151 * int DVDFileStat(dvd, titlenum, domain, stat);
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
152 */
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
153 int DVDFileStat(dvd_reader_t *, int, dvd_read_domain_t, dvd_stat_t *);
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
154
92b4694792da Add DVD file stat from version 0.9.7 to libdvdread
erik
parents: 33
diff changeset
155 /**
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
156 * Opens a file on the DVD given the title number and domain.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
157 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
158 * If the title number is 0, the video manager information is opened
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
159 * (VIDEO_TS.[IFO,BUP,VOB]). Returns a file structure which may be
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
160 * used for reads, or 0 if the file was not found.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
161 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
162 * @param dvd A dvd read handle.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
163 * @param titlenum Which Video Title Set should be used, VIDEO_TS is 0.
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
164 * @param domain Which domain.
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
165 * @return If successful a a file read handle is returned, otherwise 0.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
166 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
167 * dvd_file = DVDOpenFile(dvd, titlenum, domain); */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
168 dvd_file_t *DVDOpenFile( dvd_reader_t *, int, dvd_read_domain_t );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
169
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
170 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
171 * Closes a file and frees the associated structure.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
172 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
173 * @param dvd_file The file read handle to be closed.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
174 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
175 * DVDCloseFile(dvd_file);
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
176 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
177 void DVDCloseFile( dvd_file_t * );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
178
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
179 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
180 * Reads block_count number of blocks from the file at the given block offset.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
181 * Returns number of blocks read on success, -1 on error. This call is only
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
182 * for reading VOB data, and should not be used when reading the IFO files.
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
183 * When reading from an encrypted drive, blocks are decrypted using libdvdcss
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
184 * where required.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
185 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
186 * @param dvd_file A file read handle.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
187 * @param offset Block offset from the start of the file to start reading at.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
188 * @param block_count Number of block to read.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
189 * @param data Pointer to a buffer to write the data into.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
190 * @return Returns number of blocks read on success, -1 on error.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
191 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
192 * blocks_read = DVDReadBlocks(dvd_file, offset, block_count, data);
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
193 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
194 ssize_t DVDReadBlocks( dvd_file_t *, int, size_t, unsigned char * );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
195
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
196 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
197 * Seek to the given position in the file. Returns the resulting position in
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
198 * bytes from the beginning of the file. The seek position is only used for
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
199 * byte reads from the file, the block read call always reads from the given
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
200 * offset.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
201 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
202 * @param dvd_file A file read handle.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
203 * @param seek_offset Byte offset from the start of the file to seek to.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
204 * @return The resulting position in bytes from the beginning of the file.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
205 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
206 * offset_set = DVDFileSeek(dvd_file, seek_offset);
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
207 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
208 int32_t DVDFileSeek( dvd_file_t *, int32_t );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
209
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
210 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
211 * Reads the given number of bytes from the file. This call can only be used
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
212 * on the information files, and may not be used for reading from a VOB. This
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
213 * reads from and increments the currrent seek position for the file.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
214 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
215 * @param dvd_file A file read handle.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
216 * @param data Pointer to a buffer to write the data into.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
217 * @param bytes Number of bytes to read.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
218 * @return Returns number of bytes read on success, -1 on error.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
219 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
220 * bytes_read = DVDReadBytes(dvd_file, data, bytes);
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
221 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
222 ssize_t DVDReadBytes( dvd_file_t *, void *, size_t );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
223
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
224 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
225 * Returns the file size in blocks.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
226 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
227 * @param dvd_file A file read handle.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
228 * @return The size of the file in blocks, -1 on error.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
229 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
230 * blocks = DVDFileSize(dvd_file);
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
231 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
232 ssize_t DVDFileSize( dvd_file_t * );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
233
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
234 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
235 * Get a unique 128 bit disc ID.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
236 * This is the MD5 sum of VIDEO_TS.IFO and the VTS_0?_0.IFO files
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
237 * in title order (those that exist).
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
238 * If you need a 'text' representation of the id, print it as a
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
239 * hexadecimal number, using lowercase letters, discid[0] first.
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
240 * I.e. the same format as the command-line 'md5sum' program uses.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
241 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
242 * @param dvd A read handle to get the disc ID from
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
243 * @param discid The buffer to put the disc ID into. The buffer must
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
244 * have room for 128 bits (16 chars).
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
245 * @return 0 on success, -1 on error.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
246 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
247 int DVDDiscID( dvd_reader_t *, unsigned char * );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
248
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
249 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
250 * Get the UDF VolumeIdentifier and VolumeSetIdentifier
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
251 * from the PrimaryVolumeDescriptor.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
252 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
253 * @param dvd A read handle to get the disc ID from
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
254 * @param volid The buffer to put the VolumeIdentifier into.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
255 * The VolumeIdentifier is latin-1 encoded (8bit unicode)
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
256 * null terminated and max 32 bytes (including '\0')
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
257 * @param volid_size No more than volid_size bytes will be copied to volid.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
258 * If the VolumeIdentifier is truncated because of this
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
259 * it will still be null terminated.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
260 * @param volsetid The buffer to put the VolumeSetIdentifier into.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
261 * The VolumeIdentifier is 128 bytes as
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
262 * stored in the UDF PrimaryVolumeDescriptor.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
263 * Note that this is not a null terminated string.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
264 * @param volsetid_size At most volsetid_size bytes will be copied to volsetid.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
265 * @return 0 on success, -1 on error.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
266 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
267 int DVDUDFVolumeInfo( dvd_reader_t *, char *, unsigned int,
26
0d82d0f30c98 cosmetics: Convert all tabs to spaces.
diego
parents: 23
diff changeset
268 unsigned char *, unsigned int );
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
269
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
270 int DVDFileSeekForce( dvd_file_t *, int offset, int force_size);
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
271
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
272 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
273 * Get the ISO9660 VolumeIdentifier and VolumeSetIdentifier
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
274 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
275 * * Only use this function as fallback if DVDUDFVolumeInfo returns 0 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
276 * * this will happen on a disc mastered only with a iso9660 filesystem *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
277 * * All video DVD discs have UDF filesystem *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
278 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
279 * @param dvd A read handle to get the disc ID from
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
280 * @param volid The buffer to put the VolumeIdentifier into.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
281 * The VolumeIdentifier is coded with '0-9','A-Z','_'
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
282 * null terminated and max 33 bytes (including '\0')
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
283 * @param volid_size No more than volid_size bytes will be copied to volid.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
284 * If the VolumeIdentifier is truncated because of this
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
285 * it will still be null terminated.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
286 * @param volsetid The buffer to put the VolumeSetIdentifier into.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
287 * The VolumeIdentifier is 128 bytes as
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
288 * stored in the ISO9660 PrimaryVolumeDescriptor.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
289 * Note that this is not a null terminated string.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
290 * @param volsetid_size At most volsetid_size bytes will be copied to volsetid.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
291 * @return 0 on success, -1 on error.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
292 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
293 int DVDISOVolumeInfo( dvd_reader_t *, char *, unsigned int,
26
0d82d0f30c98 cosmetics: Convert all tabs to spaces.
diego
parents: 23
diff changeset
294 unsigned char *, unsigned int );
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
295
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
296 /**
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
297 * Sets the level of caching that is done when reading from a device
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
298 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
299 * @param dvd A read handle to get the disc ID from
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
300 * @param level The level of caching wanted.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
301 * -1 - returns the current setting.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
302 * 0 - UDF Cache turned off.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
303 * 1 - (default level) Pointers to IFO files and some data from
20
fce16251755c Remove all trailing whitespace,
rathann
parents: 3
diff changeset
304 * PrimaryVolumeDescriptor are cached.
3
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
305 *
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
306 * @return The level of caching.
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
307 */
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
308 int DVDUDFCacheLevel( dvd_reader_t *, int );
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
309
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
310 #ifdef __cplusplus
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
311 };
fdbae45c30fc moved to src/ the sources files
nicodvb
parents:
diff changeset
312 #endif
23
ac07d427fbc6 Use consistent multiple inclusion guards everywhere:
diego
parents: 22
diff changeset
313 #endif /* LIBDVDREAD_DVD_READER_H */