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