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