annotate libmpdvdkit2/dvd_reader.h @ 8040:5241f95b5ec4

cleanup
author michael
date Sat, 02 Nov 2002 14:20:05 +0000
parents 9db58ffbd73c
children fc5aba542810
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7029
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
1 #ifndef DVD_READER_H_INCLUDED
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
2 #define DVD_READER_H_INCLUDED
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
3
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
4 /*
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
5 * Copyright (C) 2001, 2002 Billy Biggs <vektor@dumbterm.net>,
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
6 * Håkan Hjort <d95hjort@dtek.chalmers.se>
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
7 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or (at
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
11 * your option) any later version.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
12 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
16 * General Public License for more details.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
17 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
21 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
22
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
23 #include <sys/types.h>
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
24
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
25 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
26 * The length of one Logical Block of a DVD Video.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
27 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
28 #define DVD_VIDEO_LB_LEN 2048
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
29
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
30 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
31 * Maximum length of filenames for UDF.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
32 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
33 #define MAX_UDF_FILE_NAME_LEN 2048
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
34
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
35 #ifdef __cplusplus
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
36 extern "C" {
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
37 #endif
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
38
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
39 typedef struct dvd_reader_s dvd_reader_t;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
40 typedef struct dvd_file_s dvd_file_t;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
41
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
42 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
43 * dvd = DVDOpen(path);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
44 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
45 * Opens a block device of a DVD-ROM file, or an image file, or a directory
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
46 * name for a mounted DVD or HD copy of a DVD. Returns 0 if we can't get any
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
47 * of those methods to work.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
48 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
49 * If the given file is a block device, or is the mountpoint for a block
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
50 * device, then that device is used for CSS authentication using libdvdcss.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
51 * If no device is available, then no CSS authentication is performed,
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
52 * and we hope that the image is decrypted.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
53 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
54 * If the path given is a directory, then the files in that directory may be in
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
55 * any one of these formats:
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
56 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
57 * path/VIDEO_TS/VTS_01_1.VOB
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
58 * path/video_ts/vts_01_1.vob
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
59 * path/VTS_01_1.VOB
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
60 * path/vts_01_1.vob
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
61 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
62 dvd_reader_t *DVDOpen( const char * );
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
63
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
64 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
65 * DVDClose(dvd);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
66 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
67 * Closes and cleans up the DVD reader object. You must close all open files
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
68 * before calling this function.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
69 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
70 void DVDClose( dvd_reader_t * );
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
71
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
72 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
73 * INFO_FILE : VIDEO_TS.IFO (manager)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
74 * VTS_XX_0.IFO (title)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
75 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
76 * INFO_BACKUP_FILE: VIDEO_TS.BUP (manager)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
77 * VTS_XX_0.BUP (title)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
78 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
79 * MENU_VOBS : VIDEO_TS.VOB (manager)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
80 * VTS_XX_0.VOB (title)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
81 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
82 * TITLE_VOBS : VTS_XX_[1-9].VOB (title)
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
83 * All files in the title set are opened and
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
84 * read as a single file.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
85 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
86 typedef enum {
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
87 DVD_READ_INFO_FILE,
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
88 DVD_READ_INFO_BACKUP_FILE,
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
89 DVD_READ_MENU_VOBS,
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
90 DVD_READ_TITLE_VOBS
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
91 } dvd_read_domain_t;
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
92
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
93 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
94 * dvd_file = DVDOpenFile(dvd, titlenum, domain);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
95 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
96 * Opens a file on the DVD given the title number and domain. If the title
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
97 * number is 0, the video manager information is opened
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
98 * (VIDEO_TS.[IFO,BUP,VOB]). Returns a file structure which may be used for
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
99 * reads, or 0 if the file was not found.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
100 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
101 dvd_file_t *DVDOpenFile( dvd_reader_t *, int,
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
102 dvd_read_domain_t );
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
103
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
104 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
105 * DVDCloseFile(dvd_file);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
106 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
107 * Closes a file and frees the associated structure.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
108 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
109 void DVDCloseFile( dvd_file_t * );
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
110
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
111 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
112 * blocks_read = DVDReadBlocks(dvd_file, offset, block_count, data);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
113 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
114 * Reads block_count number of blocks from the file at the given block offset.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
115 * Returns number of blocks read on success, -1 on error. This call is only
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
116 * for reading VOB data, and should not be used when reading the IFO files.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
117 * When reading from an encrypted drive, blocks are decrypted using libdvdcss
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
118 * where required.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
119 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
120 ssize_t DVDReadBlocks( dvd_file_t *, int, size_t, unsigned char * );
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
121
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
122 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
123 * offset_set = DVDFileSeek(dvd_file, seek_offset);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
124 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
125 * Seek to the given position in the file. Returns the resulting position in
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
126 * bytes from the beginning of the file. The seek position is only used for
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
127 * byte reads from the file, the block read call always reads from the given
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
128 * offset.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
129 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
130 int DVDFileSeek( dvd_file_t *, int );
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
131
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
132 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
133 * bytes_read = DVDReadBytes(dvd_file, data, bytes);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
134 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
135 * Reads the given number of bytes from the file. This call can only be used
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
136 * on the information files, and may not be used for reading from a VOB. This
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
137 * reads from and increments the currrent seek position for the file.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
138 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
139 ssize_t DVDReadBytes( dvd_file_t *, void *, size_t );
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
140
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
141 /**
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
142 * blocks = DVDFileSize(dvd_file);
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
143 *
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
144 * Returns the file size in blocks.
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
145 */
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
146 ssize_t DVDFileSize( dvd_file_t * );
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
147
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
148 #ifdef __cplusplus
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
149 };
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
150 #endif
9db58ffbd73c importing libdvdread 0.9.3 files
arpi
parents:
diff changeset
151 #endif /* DVD_READER_H_INCLUDED */