Mercurial > libdvdnav.hg
annotate dvdnav.h @ 4:99bed5d6db2f src
Added reset patch from Kees Cook <kees@outflux.net>
author | richwareham |
---|---|
date | Tue, 02 Apr 2002 18:22:27 +0000 |
parents | 3ddf0eaece51 |
children | c1b55dc1bfed |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net> | |
3 * | |
4 * This file is part of libdvdnav, a DVD navigation library. | |
5 * | |
6 * libdvdnav is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * libdvdnav is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | |
19 * | |
20 * $Id$ | |
21 * | |
22 */ | |
23 | |
24 #ifndef DVDNAV_H_INCLUDED | |
25 #define DVDNAV_H_INCLUDED | |
26 | |
27 /* Defines the various events and dvdnav_event_t */ | |
28 #include "dvdnav_events.h" | |
29 | |
30 /* Various useful types */ | |
31 #include "dvd_types.h" | |
32 | |
33 #include <dvdread/dvd_reader.h> | |
34 | |
35 /* Opaque dvdnav data-type */ | |
36 typedef struct dvdnav_s dvdnav_t; | |
37 | |
38 /* Status */ | |
39 typedef int dvdnav_status_t; | |
40 | |
41 #define DVDNAV_STATUS_ERR 0 | |
42 #define DVDNAV_STATUS_OK 1 | |
43 | |
44 /** | |
45 * NOTE: Unless otherwise stated, all functions return DVDNAV_STATUS_OK if | |
46 * they succeeded, otherwise DVDNAV_STATUS_ERR is returned and the error may | |
47 * be obtained by calling dvdnav_err_to_string(). | |
48 */ | |
49 | |
50 /*** Initialisation & housekeeping functions ***/ | |
51 | |
52 /** | |
53 * Attempts to open the DVD drive at the specifiec path and pre-cache | |
54 * any CSS-keys that your hacked libdvdread may use. | |
55 * | |
56 * Arguments: | |
57 * dest -- Pointer to a dvdnav_t pointer to fill in. | |
58 * path -- Any libdvdread acceptable path | |
59 */ | |
60 dvdnav_status_t dvdnav_open(dvdnav_t** dest, char *path); | |
61 | |
62 /** | |
63 * Closes a dvdnav_t previously opened with dvdnav_open(), freeing any | |
64 * memory associated with it. | |
65 * | |
66 * Arguments: | |
67 * self -- dvdnav_t to close. | |
68 */ | |
69 dvdnav_status_t dvdnav_close(dvdnav_t *self); | |
70 | |
71 /** | |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
0
diff
changeset
|
72 * Resets the VM and buffers in a previously opened dvdnav |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
0
diff
changeset
|
73 * |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
0
diff
changeset
|
74 * Arguments: |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
0
diff
changeset
|
75 * self -- dvdnav_t to reset. |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
0
diff
changeset
|
76 */ |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
0
diff
changeset
|
77 dvdnav_status_t dvdnav_reset(dvdnav_t *self); |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
0
diff
changeset
|
78 |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
0
diff
changeset
|
79 /** |
0 | 80 * Fills a pointer wiht a value pointing to a string describing |
81 * the path associated with an open dvdnav_t. It assigns it NULL | |
82 * on error. | |
83 * | |
84 * Arguments: | |
85 * path -- Pointer to char* to fill in. | |
86 */ | |
87 dvdnav_status_t dvdnav_path(dvdnav_t *self, char** path); | |
88 | |
89 /** | |
90 * Returns a human-readable string describing the last error. | |
91 * | |
92 * Returns: A pointer to said string. | |
93 */ | |
94 char* dvdnav_err_to_string(dvdnav_t *self); | |
95 | |
96 /** DVD Player characteristics (FIXME: Need more entries) **/ | |
97 | |
98 /** | |
99 * Returns the region mask (bit 0 - region 1, bit 1 - R 2, etc) of the | |
100 * VM | |
101 */ | |
102 dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *self, int *region); | |
103 | |
104 /** | |
105 * Sets the region mask of the VM. | |
106 * | |
107 * mask: 0x00..0xff | |
108 */ | |
109 dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *self, int mask); | |
110 | |
111 /** | |
112 * Specify whether read-ahead caching should be used | |
113 * | |
114 * use_readahead: 0 - no, 1 - yes | |
115 */ | |
116 dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *self, int use_readahead); | |
117 | |
118 /** | |
119 * Query state of readahead flag | |
120 * | |
121 * flag: pointer to int to recieve flag value | |
122 */ | |
123 dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *self, int* flag); | |
124 | |
125 /** Getting data **/ | |
126 | |
127 /** | |
128 * Gets the next block off the DVD places it in 'buf'. If there is any | |
129 * special information, the value pointed to by 'event' gets set | |
130 * accordingly. | |
131 * | |
132 * If 'event' is DVDNAV_BLOCK_OK then 'buf' is filled with the next block | |
133 * (note that means it has to be at /least/ 2048 bytes big). 'len' is | |
134 * then set to 2048. | |
135 * | |
136 * Otherwise, buf is filled with an appropriate event structure and | |
137 * len is set to the length of that structure, | |
138 */ | |
139 dvdnav_status_t dvdnav_get_next_block(dvdnav_t *self, unsigned char *buf, | |
140 int *event, int *len); | |
141 | |
142 /** Navigation **/ | |
143 | |
144 /** | |
145 * Returns the number of titles on the disk in titles. | |
146 */ | |
147 dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *self, int *titles); | |
148 | |
149 /** | |
150 * If we are currently in a still-frame, skip it. | |
151 */ | |
152 dvdnav_status_t dvdnav_still_skip(dvdnav_t *self); | |
153 | |
154 /** | |
155 * Plays a specified title of the DVD | |
156 * | |
157 * Arguments: | |
158 * title -- 1..99 | |
159 */ | |
160 dvdnav_status_t dvdnav_title_play(dvdnav_t *self, int title); | |
161 | |
162 /** | |
163 * Plays the specifiec title, starting from the specified | |
164 * part (chapter) | |
165 * | |
166 * Arguments: | |
167 * title -- 1..99 | |
168 * part -- 1..999 | |
169 */ | |
170 dvdnav_status_t dvdnav_part_play(dvdnav_t *self, int title, int part); | |
171 | |
172 /** | |
173 * Play the specified amount of parts of the specified title of | |
174 * the DVD then STOP. | |
175 * | |
176 * Arguments: | |
177 * title -- 1..99 | |
178 * part -- 1..999 | |
179 * parts_to_play -- 1..999 | |
180 */ | |
181 dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *self, int title, | |
182 int part, int parts_to_play); | |
183 | |
184 /** | |
185 * Play the specified title starting from the specified time | |
186 * | |
187 * Arguments: | |
188 * title -- 1..99 | |
189 * time: (timecode) hours, minutes, seconds + frames. | |
190 */ | |
191 dvdnav_status_t dvdnav_time_play(dvdnav_t *self, int title, | |
192 unsigned long int time); | |
193 | |
194 /** | |
195 * Stops playing the current title (causes a STOP action in | |
196 * dvdnav_get_next_block). | |
197 */ | |
198 dvdnav_status_t dvdnav_stop(dvdnav_t *self); | |
199 | |
200 /** | |
201 * Stop playing current title and play the "GoUp"-program chain | |
202 */ | |
203 dvdnav_status_t dvdnav_go_up(dvdnav_t *self); | |
204 | |
205 /** SEARCHING **/ | |
206 | |
207 /** | |
208 * Stop playing the current title and start playback of the title | |
209 * from the specified timecode. | |
210 * | |
211 * Arguments: | |
212 * time -- timecode. | |
213 */ | |
214 dvdnav_status_t dvdnav_time_search(dvdnav_t *self, | |
215 unsigned long int time); | |
216 | |
217 /** | |
218 * Stop playing the current title and start playback of the title | |
219 * from the specified sector offset. | |
220 * | |
221 * Arguments: | |
222 * offset -- sector offset. | |
223 * origin -- Start from here, start or end. | |
224 */ | |
225 dvdnav_status_t dvdnav_sector_search(dvdnav_t *self, | |
226 unsigned long int offset, int origin); | |
227 | |
228 /** | |
229 * Stop playing the current title and start playback of the title | |
230 * from the specified part (chapter). | |
231 * | |
232 * Arguments: | |
233 * part: 1..999 | |
234 */ | |
235 dvdnav_status_t dvdnav_part_search(dvdnav_t *self, int part); | |
236 | |
237 /** | |
238 * Stop playing the current title and start playback of the title | |
239 * from the previous program (if it exists) | |
240 */ | |
241 dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *self); | |
242 | |
243 /** | |
244 * Stop playing the current title and start playback of the title | |
245 * from the first program. | |
246 */ | |
247 dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *self); | |
248 | |
249 /** | |
250 * Stop playing the current title and start playback of the title | |
251 * from the next program (if it exists) | |
252 */ | |
253 dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *self); | |
254 | |
255 /** | |
256 * Stop playing the current title and jump to the specified menu. | |
257 * | |
258 * Arguments: | |
259 * menu -- Which menu to call | |
260 */ | |
261 dvdnav_status_t dvdnav_menu_call(dvdnav_t *self, DVDMenuID_t menu); | |
262 | |
263 /** | |
264 * Return the title number and chapter currently being played or | |
265 * -1 if in a menu. | |
266 */ | |
267 dvdnav_status_t dvdnav_current_title_info(dvdnav_t *self, int *title, | |
268 int *part); | |
269 | |
270 /** | |
271 * Return a string describing the title | |
272 */ | |
273 dvdnav_status_t dvdnav_get_title_string(dvdnav_t *self, char **title_str); | |
274 | |
275 /** | |
276 * Return the current position (in blocks) within the current | |
277 * part and the length (in blocks) of said part. | |
278 */ | |
279 dvdnav_status_t dvdnav_get_position(dvdnav_t *self, unsigned int* pos, | |
280 unsigned int *len); | |
281 | |
282 /** Highlights **/ | |
283 | |
284 /** | |
285 * Set the value pointed to to the currently highlighted button | |
286 * number (1..36) or 0 if no button is highlighed. | |
287 * | |
288 * Arguments: | |
289 * button -- Pointer to the value to fill in. | |
290 */ | |
291 dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *self, int* button); | |
292 | |
293 /** | |
294 * Move button highlight around (e.g. with arrow keys) | |
295 */ | |
296 dvdnav_status_t dvdnav_upper_button_select(dvdnav_t *self); | |
297 dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *self); | |
298 dvdnav_status_t dvdnav_right_button_select(dvdnav_t *self); | |
299 dvdnav_status_t dvdnav_left_button_select(dvdnav_t *self); | |
300 | |
301 /** | |
302 * Activate (press) highlighted button | |
303 */ | |
304 dvdnav_status_t dvdnav_button_activate(dvdnav_t *self); | |
305 | |
306 /** | |
307 * Highlight a specific button button | |
308 * | |
309 * button -- 1..39. | |
310 */ | |
311 dvdnav_status_t dvdnav_button_select(dvdnav_t *self, int button); | |
312 | |
313 /** | |
314 * Activate (press) specified button. | |
315 * | |
316 * Arguments: | |
317 * button: 1..36 | |
318 */ | |
319 dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, int button); | |
320 | |
321 /** | |
322 * Select button at specified (image) co-ordinates. | |
323 * | |
324 * Arguments: | |
325 * x,y: Image co-ordinates | |
326 */ | |
327 dvdnav_status_t dvdnav_mouse_select(dvdnav_t *self, int x, int y); | |
328 | |
329 /** | |
330 * Activate (press) button at specified co-ordinates. | |
331 */ | |
332 dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *self, int x, int y); | |
333 | |
334 /** i18n **/ | |
335 | |
336 /** | |
337 * Set specified menu language. | |
338 * | |
339 * Arguments: | |
340 * code: 1 char ISO 639 Language code | |
341 */ | |
342 dvdnav_status_t dvdnav_menu_languge_select(dvdnav_t *self, | |
343 char *code); | |
344 | |
345 /** SPU/Audio streams **/ | |
346 | |
347 /** | |
348 * Set a specific PHYSICAL MPEG stream. | |
349 * | |
350 * Arguments: | |
351 * audio: 0..7 | |
352 */ | |
353 dvdnav_status_t dvdnav_physical_audio_stream_change(dvdnav_t *self, | |
354 int audio); | |
355 | |
356 /** | |
357 * Set a specific logical audio stream. | |
358 * | |
359 * Arguments: | |
360 * audio: 0..7 | |
361 */ | |
362 dvdnav_status_t dvdnav_logical_audio_stream_change(dvdnav_t *self, | |
363 int audio); | |
364 | |
365 /** | |
366 * Set the int pointed to to the current PHYSICAL audio | |
367 * stream. | |
368 * | |
369 * Arguments: | |
370 * audio: Pointer to value | |
371 */ | |
372 dvdnav_status_t dvdnav_get_physical_audio_stream(dvdnav_t *self, int* audio); | |
373 | |
374 /** | |
375 * Set the int pointed to to the current LOGICAL audio | |
376 * stream. | |
377 * | |
378 * Arguments: | |
379 * audio: Pointer to value | |
380 */ | |
381 dvdnav_status_t dvdnav_get_logical_audio_stream(dvdnav_t *self, int* audio); | |
382 | |
383 /** | |
384 * Set a specific PHYSICAL MPEG SPU stream and whether it should be | |
385 * displayed. | |
386 * | |
387 * Arguments: | |
388 * stream: 0..31 or 63 (dummy) | |
389 * display: 0..1 | |
390 */ | |
391 dvdnav_status_t dvdnav_physical_spu_stream_change(dvdnav_t *self, | |
392 int stream, int display); | |
393 | |
394 /** | |
395 * Set a specific LOGICAL SPU stream and whether it should be | |
396 * displayed. | |
397 * | |
398 * Arguments: | |
399 * stream: 0..31 or 63 (dummy) | |
400 * display: 0..1 | |
401 */ | |
402 dvdnav_status_t dvdnav_logical_spu_stream_change(dvdnav_t *self, | |
403 int stream, int display); | |
404 | |
405 /** | |
406 * Set the ints pointed to to the current PHYSICAL SPU | |
407 * stream & display flag. | |
408 * | |
409 * Arguments: | |
410 * stream, display: Pointers to value | |
411 */ | |
412 dvdnav_status_t dvdnav_get_physical_spu_stream(dvdnav_t *self, | |
413 int* stream, int* disply); | |
414 | |
415 /** | |
416 * Set the ints pointed to to the current LOGICAL SPU | |
417 * stream & display flag. | |
418 * | |
419 * Arguments: | |
420 * stream, display: Pointers to value | |
421 */ | |
422 dvdnav_status_t dvdnav_get_logical_spu_stream(dvdnav_t *self, | |
423 int* stream, int* disply); | |
424 | |
425 /** ANGLES **/ | |
426 | |
427 /** | |
428 * Sets the current angle | |
429 * | |
430 * Arguments: | |
431 * angle: 1..9 | |
432 */ | |
433 dvdnav_status_t dvdnav_angle_change(dvdnav_t *self, int angle); | |
434 | |
435 /** | |
436 * Returns the current angle and number of angles present | |
437 */ | |
438 dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *self, int* current_angle, | |
439 int *number_of_angles); | |
440 | |
441 /** | |
442 * Converts a *logical* subpicture stream id into country code | |
443 * (returns 0xffff if no such stream). | |
444 */ | |
445 uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *self, uint8_t stream); | |
446 uint16_t dvdnav_spu_stream_to_lang(dvdnav_t *self, uint8_t stream); | |
447 | |
448 /** | |
449 * Converts a _logical_ audio/spu stream number (as in the SPRMs) to the physical | |
450 * stream number encoded on the DVD. Returns -1 if this audio/spu stream is not | |
451 * present. | |
452 */ | |
453 int8_t dvdnav_audio_logical_to_physical(dvdnav_t *self, uint8_t logical); | |
454 int8_t dvdnav_spu_logical_to_physical(dvdnav_t *self, uint8_t logical); | |
455 | |
456 /** | |
457 * The exact opposite of the above two calls | |
458 */ | |
459 int8_t dvdnav_audio_physical_to_logical(dvdnav_t *self, uint8_t physical); | |
460 int8_t dvdnav_spu_physical_to_logical(dvdnav_t *self, uint8_t physical); | |
461 | |
462 /* Following functions returns: | |
463 * -1 on failure, | |
464 * 1 if condition is true, | |
465 * 0 if condition is false | |
466 */ | |
467 /*** Current VM domain state ***/ | |
468 /* First Play domain. (Menu) */ | |
469 int8_t dvdnav_is_domain_fp(dvdnav_t *self); | |
470 /* Video management Menu domain. (Menu) */ | |
471 int8_t dvdnav_is_domain_vmgm(dvdnav_t *self); | |
472 /* Video Title Menu domain (Menu) */ | |
473 int8_t dvdnav_is_domain_vtsm(dvdnav_t *self); | |
474 /* Video Title domain (playing movie). */ | |
475 int8_t dvdnav_is_domain_vts(dvdnav_t *self); | |
476 | |
477 #endif /* DVDNAV_H_INCLUDED */ | |
478 |