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