| 1 |
/* |
| 2 |
* Copyright (C) 2001 Rich Wareham <[email protected]> |
| 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 along |
| 17 |
* with libdvdnav; if not, write to the Free Software Foundation, Inc., |
| 18 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
/* |
| 22 |
* This is the main header file applications should include if they want |
| 23 |
* to access dvdnav functionality. |
| 24 |
*/ |
| 25 |
|
| 26 |
#ifndef LIBDVDNAV_DVDNAV_H |
| 27 |
#define LIBDVDNAV_DVDNAV_H |
| 28 |
|
| 29 |
#ifdef __cplusplus |
| 30 |
extern "C" { |
| 31 |
#endif |
| 32 |
|
| 33 |
#ifdef DVDNAV_API_EXPORT |
| 34 |
# if defined(_WIN32) |
| 35 |
# define DVDNAV_API __declspec(dllexport) |
| 36 |
# elif defined(__GNUC__) && __GNUC__ >= 4 |
| 37 |
# define DVDNAV_API __attribute__((visibility("default"))) |
| 38 |
# endif |
| 39 |
#else |
| 40 |
# define DVDNAV_API |
| 41 |
#endif |
| 42 |
|
| 43 |
#include <dvdnav/version.h> |
| 44 |
#include <dvdnav/dvd_types.h> |
| 45 |
#include <dvdread/dvd_reader.h> |
| 46 |
#include <dvdread/nav_types.h> |
| 47 |
#include <dvdnav/dvdnav_events.h> |
| 48 |
|
| 49 |
#include <stdarg.h> |
| 50 |
|
| 51 |
/********************************************************************* |
| 52 |
* dvdnav data types * |
| 53 |
*********************************************************************/ |
| 54 |
|
| 55 |
/* |
| 56 |
* Opaque data-type can be viewed as a 'DVD handle'. You should get |
| 57 |
* a pointer to a dvdnav_t from the dvdnav_open() function. |
| 58 |
* Never call free() on the pointer, you have to give it back with |
| 59 |
* dvdnav_close(). |
| 60 |
*/ |
| 61 |
typedef struct dvdnav_s dvdnav_t; |
| 62 |
|
| 63 |
/* Status as reported by most of libdvdnav's functions */ |
| 64 |
typedef int32_t dvdnav_status_t; |
| 65 |
|
| 66 |
typedef dvd_reader_stream_cb dvdnav_stream_cb; |
| 67 |
|
| 68 |
/* |
| 69 |
* Unless otherwise stated, all functions return DVDNAV_STATUS_OK if |
| 70 |
* they succeeded, otherwise DVDNAV_STATUS_ERR is returned and the error may |
| 71 |
* be obtained by calling dvdnav_err_to_string(). |
| 72 |
*/ |
| 73 |
#define DVDNAV_STATUS_ERR 0 |
| 74 |
#define DVDNAV_STATUS_OK 1 |
| 75 |
|
| 76 |
/********************************************************************* |
| 77 |
* initialisation & housekeeping functions * |
| 78 |
*********************************************************************/ |
| 79 |
|
| 80 |
/* |
| 81 |
* Logger callback definition |
| 82 |
*/ |
| 83 |
typedef enum |
| 84 |
{ |
| 85 |
DVDNAV_LOGGER_LEVEL_INFO, |
| 86 |
DVDNAV_LOGGER_LEVEL_ERROR, |
| 87 |
DVDNAV_LOGGER_LEVEL_WARN, |
| 88 |
DVDNAV_LOGGER_LEVEL_DEBUG, |
| 89 |
} dvdnav_logger_level_t; |
| 90 |
|
| 91 |
typedef struct |
| 92 |
{ |
| 93 |
void ( *pf_log ) ( void *, dvdnav_logger_level_t, const char *, va_list ); |
| 94 |
} dvdnav_logger_cb; |
| 95 |
|
| 96 |
/* |
| 97 |
* These functions allow you to open a DVD device and associate it |
| 98 |
* with a dvdnav_t. |
| 99 |
*/ |
| 100 |
|
| 101 |
/* |
| 102 |
* Attempts to open the DVD drive at the specified path or using external |
| 103 |
* seek/read functions (dvdnav_open_stream) and pre-cache the CSS-keys. |
| 104 |
* libdvdread is used to access the DVD, so any source supported by libdvdread |
| 105 |
* can be given with "path" or "stream_cb". Currently, using dvdnav_open, |
| 106 |
* libdvdread can access : DVD drives, DVD image files, DVD file-by-file |
| 107 |
* copies. Using dvdnav_open_stream, libdvdread can access any kind of DVD |
| 108 |
* storage via custom implementation of seek/read functions. |
| 109 |
* |
| 110 |
* The resulting dvdnav_t handle will be written to *dest. |
| 111 |
*/ |
| 112 |
DVDNAV_API dvdnav_status_t dvdnav_open(dvdnav_t **dest, const char *path); |
| 113 |
DVDNAV_API dvdnav_status_t |
| 114 |
dvdnav_open_stream(dvdnav_t **dest, void *priv, dvdnav_stream_cb *stream_cb); |
| 115 |
|
| 116 |
DVDNAV_API dvdnav_status_t dvdnav_open2(dvdnav_t **dest, |
| 117 |
void *, const dvdnav_logger_cb *, |
| 118 |
const char *path); |
| 119 |
DVDNAV_API dvdnav_status_t dvdnav_open_stream2(dvdnav_t **dest, |
| 120 |
void *priv, const dvdnav_logger_cb *, |
| 121 |
dvdnav_stream_cb *stream_cb); |
| 122 |
|
| 123 |
DVDNAV_API dvdnav_status_t dvdnav_dup(dvdnav_t **dest, dvdnav_t *src); |
| 124 |
DVDNAV_API dvdnav_status_t dvdnav_free_dup(dvdnav_t * _this); |
| 125 |
|
| 126 |
/* |
| 127 |
* Closes a dvdnav_t previously opened with dvdnav_open(), freeing any |
| 128 |
* memory associated with it. |
| 129 |
*/ |
| 130 |
DVDNAV_API dvdnav_status_t dvdnav_close(dvdnav_t *self); |
| 131 |
|
| 132 |
/* |
| 133 |
* Resets the DVD virtual machine and cache buffers. |
| 134 |
*/ |
| 135 |
DVDNAV_API dvdnav_status_t dvdnav_reset(dvdnav_t *self); |
| 136 |
|
| 137 |
/* |
| 138 |
* Fills a pointer with a value pointing to a string describing |
| 139 |
* the path associated with an open dvdnav_t. It assigns *path to NULL |
| 140 |
* on error. |
| 141 |
*/ |
| 142 |
DVDNAV_API dvdnav_status_t dvdnav_path(dvdnav_t *self, const char **path); |
| 143 |
|
| 144 |
/* |
| 145 |
* Returns a human-readable string describing the last error. |
| 146 |
*/ |
| 147 |
DVDNAV_API const char* dvdnav_err_to_string(dvdnav_t *self); |
| 148 |
|
| 149 |
DVDNAV_API const char* dvdnav_version(void); |
| 150 |
|
| 151 |
/********************************************************************* |
| 152 |
* changing and reading DVD player characteristics * |
| 153 |
*********************************************************************/ |
| 154 |
|
| 155 |
/* |
| 156 |
* These functions allow you to manipulate the various global characteristics |
| 157 |
* of the DVD playback engine. |
| 158 |
*/ |
| 159 |
|
| 160 |
/* |
| 161 |
* Sets the region mask (bit 0 set implies region 1, bit 1 set implies |
| 162 |
* region 2, etc) of the virtual machine. Generally you will only need to set |
| 163 |
* this if you are playing RCE discs which query the virtual machine as to its |
| 164 |
* region setting. |
| 165 |
* |
| 166 |
* This has _nothing_ to do with the region setting of the DVD drive. |
| 167 |
*/ |
| 168 |
DVDNAV_API dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *self, int32_t region_mask); |
| 169 |
|
| 170 |
/* |
| 171 |
* Returns the region mask (bit 0 set implies region 1, bit 1 set implies |
| 172 |
* region 2, etc) of the virtual machine. |
| 173 |
* |
| 174 |
* This has _nothing_ to do with the region setting of the DVD drive. |
| 175 |
*/ |
| 176 |
DVDNAV_API dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *self, int32_t *region_mask); |
| 177 |
|
| 178 |
/* |
| 179 |
* Specify whether read-ahead caching should be used. You may not want this if your |
| 180 |
* decoding engine does its own buffering. |
| 181 |
* |
| 182 |
* The default read-ahead cache does not use an additional thread for the reading |
| 183 |
* (see read_cache.c for a threaded cache, but note that this code is currently |
| 184 |
* unmaintained). It prebuffers on VOBU level by reading ahead several buffers |
| 185 |
* on every read request. The speed of this prebuffering has been optimized to |
| 186 |
* also work on slow DVD drives. |
| 187 |
* |
| 188 |
* If in addition you want to prevent memcpy's to improve performance, have a look |
| 189 |
* at dvdnav_get_next_cache_block(). |
| 190 |
*/ |
| 191 |
DVDNAV_API dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *self, int32_t read_ahead_flag); |
| 192 |
|
| 193 |
/* |
| 194 |
* Query whether read-ahead caching/buffering will be used. |
| 195 |
*/ |
| 196 |
DVDNAV_API dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *self, int32_t *read_ahead_flag); |
| 197 |
|
| 198 |
/* |
| 199 |
* Specify whether the positioning works PGC or PG based. |
| 200 |
* Programs (PGs) on DVDs are similar to Chapters and a program chain (PGC) |
| 201 |
* usually covers a whole feature. This affects the behaviour of the |
| 202 |
* functions dvdnav_get_position() and dvdnav_sector_search(). See there. |
| 203 |
* Default is PG based positioning. |
| 204 |
*/ |
| 205 |
DVDNAV_API dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *self, int32_t pgc_based_flag); |
| 206 |
|
| 207 |
/* |
| 208 |
* Query whether positioning is PG or PGC based. |
| 209 |
*/ |
| 210 |
DVDNAV_API dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *self, int32_t *pgc_based_flag); |
| 211 |
|
| 212 |
|
| 213 |
/********************************************************************* |
| 214 |
* reading data * |
| 215 |
*********************************************************************/ |
| 216 |
|
| 217 |
/* |
| 218 |
* These functions are used to poll the playback engine and actually get data |
| 219 |
* off the DVD. |
| 220 |
*/ |
| 221 |
|
| 222 |
/* |
| 223 |
* Attempts to get the next block off the DVD and copies it into the buffer 'buf'. |
| 224 |
* If there is any special actions that may need to be performed, the value |
| 225 |
* pointed to by 'event' gets set accordingly. |
| 226 |
* |
| 227 |
* If 'event' is DVDNAV_BLOCK_OK then 'buf' is filled with the next block |
| 228 |
* (note that means it has to be at /least/ 2048 bytes big). 'len' is |
| 229 |
* then set to 2048. |
| 230 |
* |
| 231 |
* Otherwise, buf is filled with an appropriate event structure and |
| 232 |
* len is set to the length of that structure. |
| 233 |
* |
| 234 |
* See the dvdnav_events.h header for information on the various events. |
| 235 |
*/ |
| 236 |
DVDNAV_API dvdnav_status_t dvdnav_get_next_block(dvdnav_t *self, uint8_t *buf, |
| 237 |
int32_t *event, int32_t *len); |
| 238 |
|
| 239 |
/* |
| 240 |
* This basically does the same as dvdnav_get_next_block. The only difference is |
| 241 |
* that it avoids a memcopy, when the requested block was found in the cache. |
| 242 |
* In such a case (cache hit) this function will return a different pointer than |
| 243 |
* the one handed in, pointing directly into the relevant block in the cache. |
| 244 |
* Those pointers must _never_ be freed but instead returned to the library via |
| 245 |
* dvdnav_free_cache_block(). |
| 246 |
*/ |
| 247 |
DVDNAV_API dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *self, uint8_t **buf, |
| 248 |
int32_t *event, int32_t *len); |
| 249 |
|
| 250 |
/* |
| 251 |
* All buffers which came from the internal cache (when dvdnav_get_next_cache_block() |
| 252 |
* returned a buffer different from the one handed in) have to be freed with this |
| 253 |
* function. Although handing in other buffers not from the cache doesn't cause any harm. |
| 254 |
*/ |
| 255 |
DVDNAV_API dvdnav_status_t dvdnav_free_cache_block(dvdnav_t *self, unsigned char *buf); |
| 256 |
|
| 257 |
/* |
| 258 |
* If we are currently in a still-frame this function skips it. |
| 259 |
* |
| 260 |
* See also the DVDNAV_STILL_FRAME event. |
| 261 |
*/ |
| 262 |
DVDNAV_API dvdnav_status_t dvdnav_still_skip(dvdnav_t *self); |
| 263 |
|
| 264 |
/* |
| 265 |
* If we are currently in WAIT state, that is: the application is required to |
| 266 |
* wait for its fifos to become empty, calling this signals libdvdnav that this |
| 267 |
* is achieved and that it can continue. |
| 268 |
* |
| 269 |
* See also the DVDNAV_WAIT event. |
| 270 |
*/ |
| 271 |
DVDNAV_API dvdnav_status_t dvdnav_wait_skip(dvdnav_t *self); |
| 272 |
|
| 273 |
/* |
| 274 |
* Returns the still time from the currently playing cell. |
| 275 |
* The still time is given in seconds with 0xff meaning an indefinite still. |
| 276 |
* |
| 277 |
* This function can be used to detect still frames before they are reached. |
| 278 |
* Some players might need this to prepare for a frame to be shown for a |
| 279 |
* longer time than usual. |
| 280 |
*/ |
| 281 |
DVDNAV_API uint32_t dvdnav_get_next_still_flag(dvdnav_t *self); |
| 282 |
|
| 283 |
/* |
| 284 |
* Stops playback. The next event obtained with one of the get_next_block |
| 285 |
* functions will be a DVDNAV_STOP event. |
| 286 |
* |
| 287 |
* It is not required to call this before dvdnav_close(). |
| 288 |
*/ |
| 289 |
DVDNAV_API dvdnav_status_t dvdnav_stop(dvdnav_t *self); |
| 290 |
|
| 291 |
/* |
| 292 |
* Returns the region mask (bit 0 set implies region 1, bit 1 set implies |
| 293 |
* region 2, etc) reported by the dvd disc being played. |
| 294 |
* |
| 295 |
* Note this has no relation with the region setting of the DVD drive. |
| 296 |
* Old DVD drives (RPC-I) used to delegate most of the RCE handling to the CPU and |
| 297 |
* will actually call the virtual machine (VM) for its region setting. In those cases, |
| 298 |
* changing the VM region mask via dvdnav_set_region_mask() will circunvent |
| 299 |
* the region protection scheme. This is no longer the case with more recent (RPC-II) drives |
| 300 |
* as RCE is handled internally by the drive firmware. |
| 301 |
* |
| 302 |
*/ |
| 303 |
DVDNAV_API dvdnav_status_t dvdnav_get_disk_region_mask(dvdnav_t *self, int32_t *region_mask); |
| 304 |
|
| 305 |
/********************************************************************* |
| 306 |
* title/part navigation * |
| 307 |
*********************************************************************/ |
| 308 |
|
| 309 |
/* |
| 310 |
* Returns the number of titles on the disk. |
| 311 |
*/ |
| 312 |
DVDNAV_API dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *self, int32_t *titles); |
| 313 |
|
| 314 |
/* |
| 315 |
* Returns the number of parts within the given title. |
| 316 |
*/ |
| 317 |
DVDNAV_API dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *self, int32_t title, int32_t *parts); |
| 318 |
|
| 319 |
/* |
| 320 |
* Returns the number of angles for the given title. |
| 321 |
*/ |
| 322 |
DVDNAV_API dvdnav_status_t dvdnav_get_number_of_angles(dvdnav_t *self, int32_t title, int32_t *angles); |
| 323 |
|
| 324 |
/* |
| 325 |
* Plays the specified title of the DVD from its beginning (that is: part 1). |
| 326 |
*/ |
| 327 |
DVDNAV_API dvdnav_status_t dvdnav_title_play(dvdnav_t *self, int32_t title); |
| 328 |
|
| 329 |
/* |
| 330 |
* Plays the specified title, starting from the specified part. |
| 331 |
*/ |
| 332 |
DVDNAV_API dvdnav_status_t dvdnav_part_play(dvdnav_t *self, int32_t title, int32_t part); |
| 333 |
|
| 334 |
/* |
| 335 |
* Plays the specified title, starting from the specified program |
| 336 |
*/ |
| 337 |
DVDNAV_API dvdnav_status_t dvdnav_program_play(dvdnav_t *self, int32_t title, int32_t pgcn, int32_t pgn); |
| 338 |
|
| 339 |
/* |
| 340 |
* Stores in *times an array (that the application *must* free) of |
| 341 |
* dvdtimes corresponding to the chapter times for the chosen title. |
| 342 |
* *duration will have the duration of the title |
| 343 |
* The number of entries in *times is the result of the function. |
| 344 |
* On error *times is NULL and the output is 0 |
| 345 |
*/ |
| 346 |
DVDNAV_API uint32_t dvdnav_describe_title_chapters(dvdnav_t *self, int32_t title, uint64_t **times, uint64_t *duration); |
| 347 |
|
| 348 |
/* |
| 349 |
* Play the specified amount of parts of the specified title of |
| 350 |
* the DVD then STOP. |
| 351 |
* |
| 352 |
* Currently unimplemented! |
| 353 |
*/ |
| 354 |
DVDNAV_API dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *self, int32_t title, |
| 355 |
int32_t part, int32_t parts_to_play); |
| 356 |
|
| 357 |
/* |
| 358 |
* Play the specified title starting from the specified time. |
| 359 |
* |
| 360 |
* Currently unimplemented! |
| 361 |
*/ |
| 362 |
DVDNAV_API dvdnav_status_t dvdnav_time_play(dvdnav_t *self, int32_t title, |
| 363 |
uint64_t time); |
| 364 |
|
| 365 |
/* |
| 366 |
* Stop playing the current position and jump to the specified menu. |
| 367 |
* |
| 368 |
* See also DVDMenuID_t from libdvdread |
| 369 |
*/ |
| 370 |
DVDNAV_API dvdnav_status_t dvdnav_menu_call(dvdnav_t *self, DVDMenuID_t menu); |
| 371 |
|
| 372 |
/* |
| 373 |
* Return the title number and part currently being played. |
| 374 |
* A title of 0 indicates we are in a menu. In this case, part |
| 375 |
* is set to the current menu's ID. |
| 376 |
*/ |
| 377 |
DVDNAV_API dvdnav_status_t dvdnav_current_title_info(dvdnav_t *self, int32_t *title, |
| 378 |
int32_t *part); |
| 379 |
|
| 380 |
/* |
| 381 |
* Return the title number, pgcn and pgn currently being played. |
| 382 |
* A title of 0 indicates, we are in a menu. |
| 383 |
*/ |
| 384 |
DVDNAV_API dvdnav_status_t dvdnav_current_title_program(dvdnav_t *self, int32_t *title, |
| 385 |
int32_t *pgcn, int32_t *pgn); |
| 386 |
|
| 387 |
/* |
| 388 |
* Return the current position (in blocks) within the current |
| 389 |
* title and the length (in blocks) of said title. |
| 390 |
* |
| 391 |
* Current implementation is wrong and likely to behave unpredictably! |
| 392 |
* Use is discouraged! |
| 393 |
*/ |
| 394 |
DVDNAV_API dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *self, |
| 395 |
uint32_t *pos, |
| 396 |
uint32_t *len); |
| 397 |
|
| 398 |
/* |
| 399 |
* This function is only available for compatibility reasons. |
| 400 |
* |
| 401 |
* Stop playing the current position and start playback of the current title |
| 402 |
* from the specified part. |
| 403 |
*/ |
| 404 |
DVDNAV_API dvdnav_status_t dvdnav_part_search(dvdnav_t *self, int32_t part); |
| 405 |
|
| 406 |
|
| 407 |
/********************************************************************* |
| 408 |
* program chain/program navigation * |
| 409 |
*********************************************************************/ |
| 410 |
|
| 411 |
/* |
| 412 |
* Stop playing the current position and start playback from the last |
| 413 |
* VOBU boundary before the given sector. The sector number is not |
| 414 |
* meant to be an absolute physical DVD sector, but a relative sector |
| 415 |
* in the current program. This function cannot leave the current |
| 416 |
* program and will fail if asked to do so. |
| 417 |
* |
| 418 |
* If program chain based positioning is enabled |
| 419 |
* (see dvdnav_set_PGC_positioning_flag()), this will seek to the relative |
| 420 |
* sector inside the current program chain. |
| 421 |
* |
| 422 |
* 'origin' can be one of SEEK_SET, SEEK_CUR, SEEK_END as defined in |
| 423 |
* fcntl.h. |
| 424 |
*/ |
| 425 |
DVDNAV_API dvdnav_status_t dvdnav_sector_search(dvdnav_t *self, |
| 426 |
int64_t offset, int32_t origin); |
| 427 |
|
| 428 |
/* |
| 429 |
returns the current stream time in PTS ticks as reported by the IFO structures |
| 430 |
divide it by 90000 to get the current play time in seconds |
| 431 |
*/ |
| 432 |
DVDNAV_API int64_t dvdnav_get_current_time(dvdnav_t *self); |
| 433 |
|
| 434 |
/* |
| 435 |
* Stop playing the current position and start playback of the title |
| 436 |
* from the specified timecode. |
| 437 |
* |
| 438 |
* Currently implemented using interpolation. That interpolation is slightly |
| 439 |
* inaccurate. |
| 440 |
*/ |
| 441 |
DVDNAV_API dvdnav_status_t dvdnav_time_search(dvdnav_t *self, |
| 442 |
uint64_t time); |
| 443 |
|
| 444 |
/* |
| 445 |
* Find the nearest vobu and jump to it |
| 446 |
* |
| 447 |
* Alternative to dvdnav_time_search (see full documentation on searching.jump_to_time.readme) |
| 448 |
* Jumps to the provided PTS (which is defined as time_in_ms * 90). mode means the navigation mode, |
| 449 |
* currently only the Default (0) is implemented: |
| 450 |
* 0: Default. Jump to a time which may be either <> time_in_pts_ticks |
| 451 |
* 1: After. Always jump to a time that is > time_in_pts_ticks |
| 452 |
* -1: Before. Always jump to a time that is < time_in_pts_ticks |
| 453 |
*/ |
| 454 |
DVDNAV_API dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *self, |
| 455 |
uint64_t time_in_pts_ticks, int32_t mode); |
| 456 |
|
| 457 |
/* |
| 458 |
* Stop playing current position and play the "GoUp"-program chain. |
| 459 |
* (which generally leads to the title menu or a higher-level menu). |
| 460 |
*/ |
| 461 |
DVDNAV_API dvdnav_status_t dvdnav_go_up(dvdnav_t *self); |
| 462 |
|
| 463 |
/* |
| 464 |
* Stop playing the current position and start playback at the |
| 465 |
* previous program (if it exists). |
| 466 |
*/ |
| 467 |
DVDNAV_API dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *self); |
| 468 |
|
| 469 |
/* |
| 470 |
* Stop playing the current position and start playback at the |
| 471 |
* first program. |
| 472 |
*/ |
| 473 |
DVDNAV_API dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *self); |
| 474 |
|
| 475 |
/* |
| 476 |
* Stop playing the current position and start playback at the |
| 477 |
* next program (if it exists). |
| 478 |
*/ |
| 479 |
DVDNAV_API dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *self); |
| 480 |
|
| 481 |
/* |
| 482 |
* Return the current position (in blocks) within the current |
| 483 |
* program and the length (in blocks) of current program. |
| 484 |
* |
| 485 |
* If program chain based positioning is enabled |
| 486 |
* (see dvdnav_set_PGC_positioning_flag()), this will return the |
| 487 |
* relative position in and the length of the current program chain. |
| 488 |
*/ |
| 489 |
DVDNAV_API dvdnav_status_t dvdnav_get_position(dvdnav_t *self, uint32_t *pos, |
| 490 |
uint32_t *len); |
| 491 |
|
| 492 |
|
| 493 |
/********************************************************************* |
| 494 |
* menu highlights * |
| 495 |
*********************************************************************/ |
| 496 |
|
| 497 |
/* |
| 498 |
* Most functions related to highlights take a NAV PCI packet as a parameter. |
| 499 |
* While you can get such a packet from libdvdnav, this will result in |
| 500 |
* errors for players with internal FIFOs because due to the FIFO length, |
| 501 |
* libdvdnav will be ahead in the stream compared to what the user is |
| 502 |
* seeing on screen. Therefore, player applications who have a NAV |
| 503 |
* packet available, which is better in sync with the actual playback, |
| 504 |
* should always pass this one to these functions. |
| 505 |
*/ |
| 506 |
|
| 507 |
/* |
| 508 |
* Get the currently highlighted button |
| 509 |
* number (1..36) or 0 if no button is highlighted. |
| 510 |
*/ |
| 511 |
DVDNAV_API dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *self, int32_t *button); |
| 512 |
|
| 513 |
/* |
| 514 |
* Returns the Presentation Control Information (PCI) structure associated |
| 515 |
* with the current position. |
| 516 |
* |
| 517 |
* Read the general notes above. |
| 518 |
* See also libdvdreads nav_types.h for definition of pci_t. |
| 519 |
*/ |
| 520 |
DVDNAV_API pci_t* dvdnav_get_current_nav_pci(dvdnav_t *self); |
| 521 |
|
| 522 |
/* |
| 523 |
* Returns the DSI (data search information) structure associated |
| 524 |
* with the current position. |
| 525 |
* |
| 526 |
* Read the general notes above. |
| 527 |
* See also libdvdreads nav_types.h for definition of dsi_t. |
| 528 |
*/ |
| 529 |
DVDNAV_API dsi_t* dvdnav_get_current_nav_dsi(dvdnav_t *self); |
| 530 |
|
| 531 |
/* |
| 532 |
* Get the area associated with a certain button. |
| 533 |
*/ |
| 534 |
DVDNAV_API dvdnav_status_t dvdnav_get_highlight_area(pci_t *nav_pci , int32_t button, int32_t mode, |
| 535 |
dvdnav_highlight_area_t *highlight); |
| 536 |
|
| 537 |
/* |
| 538 |
* Move button highlight around as suggested by function name (e.g. with arrow keys). |
| 539 |
*/ |
| 540 |
DVDNAV_API dvdnav_status_t dvdnav_upper_button_select(dvdnav_t *self, pci_t *pci); |
| 541 |
DVDNAV_API dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *self, pci_t *pci); |
| 542 |
DVDNAV_API dvdnav_status_t dvdnav_right_button_select(dvdnav_t *self, pci_t *pci); |
| 543 |
DVDNAV_API dvdnav_status_t dvdnav_left_button_select(dvdnav_t *self, pci_t *pci); |
| 544 |
|
| 545 |
/* |
| 546 |
* Activate ("press") the currently highlighted button. |
| 547 |
*/ |
| 548 |
DVDNAV_API dvdnav_status_t dvdnav_button_activate(dvdnav_t *self, pci_t *pci); |
| 549 |
|
| 550 |
/* |
| 551 |
* Highlight a specific button. |
| 552 |
*/ |
| 553 |
DVDNAV_API dvdnav_status_t dvdnav_button_select(dvdnav_t *self, pci_t *pci, int32_t button); |
| 554 |
|
| 555 |
/* |
| 556 |
* Activate ("press") specified button. |
| 557 |
*/ |
| 558 |
DVDNAV_API dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, pci_t *pci, int32_t button); |
| 559 |
|
| 560 |
/* |
| 561 |
* Activate ("press") a button and execute specified command. |
| 562 |
*/ |
| 563 |
DVDNAV_API dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *self, int32_t button, vm_cmd_t *cmd); |
| 564 |
|
| 565 |
/* |
| 566 |
* Select button at specified video frame coordinates. |
| 567 |
*/ |
| 568 |
DVDNAV_API dvdnav_status_t dvdnav_mouse_select(dvdnav_t *self, pci_t *pci, int32_t x, int32_t y); |
| 569 |
|
| 570 |
/* |
| 571 |
* Activate ("press") button at specified video frame coordinates. |
| 572 |
*/ |
| 573 |
DVDNAV_API dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *self, pci_t *pci, int32_t x, int32_t y); |
| 574 |
|
| 575 |
|
| 576 |
/********************************************************************* |
| 577 |
* languages * |
| 578 |
*********************************************************************/ |
| 579 |
|
| 580 |
/* |
| 581 |
* The language codes expected by these functions are two character |
| 582 |
* codes as defined in ISO639. |
| 583 |
*/ |
| 584 |
|
| 585 |
/* |
| 586 |
* Set which menu language we should use per default. |
| 587 |
*/ |
| 588 |
DVDNAV_API dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *self, |
| 589 |
char *code); |
| 590 |
|
| 591 |
/* |
| 592 |
* Set which audio language we should use per default. |
| 593 |
*/ |
| 594 |
DVDNAV_API dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *self, |
| 595 |
char *code); |
| 596 |
|
| 597 |
/* |
| 598 |
* Set which spu language we should use per default. |
| 599 |
*/ |
| 600 |
DVDNAV_API dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *self, |
| 601 |
char *code); |
| 602 |
|
| 603 |
|
| 604 |
/********************************************************************* |
| 605 |
* obtaining stream attributes * |
| 606 |
*********************************************************************/ |
| 607 |
|
| 608 |
/* |
| 609 |
* Return a string describing the title of the DVD. |
| 610 |
* This is an ID string encoded on the disc by the author. In many cases |
| 611 |
* this is a descriptive string such as `THE_MATRIX' but sometimes is singularly |
| 612 |
* uninformative such as `PDVD-011421'. Some DVD authors even forget to set this, |
| 613 |
* so you may also read the default of the authoring software they used, like |
| 614 |
* `DVDVolume' (see also dvdnav_get_volid_string). |
| 615 |
*/ |
| 616 |
DVDNAV_API dvdnav_status_t dvdnav_get_title_string(dvdnav_t *self, const char **title_str); |
| 617 |
|
| 618 |
/* |
| 619 |
* Returns a string containing the serial number of the DVD. |
| 620 |
* This has a max of 15 characters and should be more unique than the |
| 621 |
* title string. |
| 622 |
*/ |
| 623 |
DVDNAV_API dvdnav_status_t dvdnav_get_serial_string(dvdnav_t *self, const char **serial_str); |
| 624 |
|
| 625 |
/* |
| 626 |
* Returns the VolumeIdentifier of the disc or NULL if it could |
| 627 |
* not be obtained. The VolumeIdentifier might be latin-1 encoded |
| 628 |
* (8bit unicode) null terminated and max 32 bytes (including '\0'); |
| 629 |
* or coded with '0-9','A-Z','_' null terminated and max 33 bytes |
| 630 |
* (including '\0'). |
| 631 |
* See also dvdnav_get_title_string |
| 632 |
* |
| 633 |
* Note: The string is malloc'd so caller has to free() the returned |
| 634 |
* string when done with it. |
| 635 |
*/ |
| 636 |
DVDNAV_API char * dvdnav_get_volid_string(dvdnav_t *self); |
| 637 |
|
| 638 |
/* |
| 639 |
* Get video aspect code. |
| 640 |
* The aspect code does only change on VTS boundaries. |
| 641 |
* See the DVDNAV_VTS_CHANGE event. |
| 642 |
* |
| 643 |
* 0 -- 4:3, 2 -- 16:9 |
| 644 |
*/ |
| 645 |
DVDNAV_API uint8_t dvdnav_get_video_aspect(dvdnav_t *self); |
| 646 |
|
| 647 |
/* |
| 648 |
* Get video resolution. |
| 649 |
*/ |
| 650 |
DVDNAV_API dvdnav_status_t dvdnav_get_video_resolution(dvdnav_t *self, uint32_t *width, uint32_t *height); |
| 651 |
|
| 652 |
/* |
| 653 |
* Get video scaling permissions. |
| 654 |
* The scaling permission does only change on VTS boundaries. |
| 655 |
* See the DVDNAV_VTS_CHANGE event. |
| 656 |
* |
| 657 |
* bit0 set = deny letterboxing, bit1 set = deny pan&scan |
| 658 |
*/ |
| 659 |
DVDNAV_API uint8_t dvdnav_get_video_scale_permission(dvdnav_t *self); |
| 660 |
|
| 661 |
/* |
| 662 |
* Converts a *logical* audio stream id into language code |
| 663 |
* (returns 0xffff if no such stream). |
| 664 |
*/ |
| 665 |
DVDNAV_API uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *self, uint8_t stream); |
| 666 |
|
| 667 |
/* |
| 668 |
* Returns the format of *logical* audio stream 'stream' |
| 669 |
* (returns 0xffff if no such stream). |
| 670 |
*/ |
| 671 |
DVDNAV_API uint16_t dvdnav_audio_stream_format(dvdnav_t *self, uint8_t stream); |
| 672 |
|
| 673 |
/* |
| 674 |
* Returns number of channels in *logical* audio stream 'stream' |
| 675 |
* (returns 0xffff if no such stream). |
| 676 |
*/ |
| 677 |
DVDNAV_API uint16_t dvdnav_audio_stream_channels(dvdnav_t *self, uint8_t stream); |
| 678 |
|
| 679 |
/* |
| 680 |
* Converts a *logical* subpicture stream id into country code |
| 681 |
* (returns 0xffff if no such stream). |
| 682 |
*/ |
| 683 |
DVDNAV_API uint16_t dvdnav_spu_stream_to_lang(dvdnav_t *self, uint8_t stream); |
| 684 |
|
| 685 |
/* |
| 686 |
* Converts a *physical* (MPEG) audio stream id into a logical stream number. |
| 687 |
*/ |
| 688 |
DVDNAV_API int8_t dvdnav_get_audio_logical_stream(dvdnav_t *self, uint8_t audio_num); |
| 689 |
|
| 690 |
#define HAVE_GET_AUDIO_ATTR |
| 691 |
/* |
| 692 |
* Get audio attr |
| 693 |
*/ |
| 694 |
DVDNAV_API dvdnav_status_t dvdnav_get_audio_attr(dvdnav_t *self, uint8_t audio_mum, audio_attr_t *audio_attr); |
| 695 |
|
| 696 |
/* |
| 697 |
* Converts a *physical* (MPEG) subpicture stream id into a logical stream number. |
| 698 |
*/ |
| 699 |
DVDNAV_API int8_t dvdnav_get_spu_logical_stream(dvdnav_t *self, uint8_t subp_num); |
| 700 |
|
| 701 |
#define HAVE_GET_SPU_ATTR |
| 702 |
/* |
| 703 |
* Get spu attr |
| 704 |
*/ |
| 705 |
DVDNAV_API dvdnav_status_t dvdnav_get_spu_attr(dvdnav_t *self, uint8_t audio_mum, subp_attr_t *subp_attr); |
| 706 |
|
| 707 |
/* |
| 708 |
* Get active audio stream. |
| 709 |
*/ |
| 710 |
DVDNAV_API int8_t dvdnav_get_active_audio_stream(dvdnav_t *self); |
| 711 |
|
| 712 |
/* |
| 713 |
* Get active spu stream. |
| 714 |
*/ |
| 715 |
DVDNAV_API int8_t dvdnav_get_active_spu_stream(dvdnav_t *self); |
| 716 |
|
| 717 |
/* |
| 718 |
* Get the set of user operations that are currently prohibited. |
| 719 |
* There are potentially new restrictions right after |
| 720 |
* DVDNAV_CHANNEL_HOP and DVDNAV_NAV_PACKET. |
| 721 |
*/ |
| 722 |
DVDNAV_API user_ops_t dvdnav_get_restrictions(dvdnav_t *self); |
| 723 |
|
| 724 |
/* |
| 725 |
* Returns the number of streams provided its type (e.g. subtitles, audio, etc) |
| 726 |
*/ |
| 727 |
DVDNAV_API int8_t dvdnav_get_number_of_streams(dvdnav_t *self, dvdnav_stream_type_t stream_type); |
| 728 |
|
| 729 |
|
| 730 |
/********************************************************************* |
| 731 |
* setting stream attributes * |
| 732 |
*********************************************************************/ |
| 733 |
|
| 734 |
/* |
| 735 |
* Set the visible (enable) status of the current spu stream |
| 736 |
* (to enable/disable subtitles) |
| 737 |
* visibility defines if the spu stream should be enabled/visible (1) or disabled (0) |
| 738 |
*/ |
| 739 |
DVDNAV_API dvdnav_status_t dvdnav_toggle_spu_stream(dvdnav_t *self, uint8_t visibility); |
| 740 |
|
| 741 |
/* |
| 742 |
* Set the given stream id and stream type as active |
| 743 |
* stream_num - the physical index of the stream |
| 744 |
* stream_type - the stream type (audio or subtitles) |
| 745 |
*/ |
| 746 |
DVDNAV_API dvdnav_status_t dvdnav_set_active_stream(dvdnav_t *self, uint8_t stream_num, |
| 747 |
dvdnav_stream_type_t stream_type); |
| 748 |
|
| 749 |
/********************************************************************* |
| 750 |
* multiple angles * |
| 751 |
*********************************************************************/ |
| 752 |
|
| 753 |
/* |
| 754 |
* The libdvdnav library abstracts away the difference between seamless and |
| 755 |
* non-seamless angles. From the point of view of the programmer you just set the |
| 756 |
* angle number and all is well in the world. You will always see only the |
| 757 |
* selected angle coming from the get_next_block functions. |
| 758 |
* |
| 759 |
* Note: |
| 760 |
* It is quite possible that some tremendously strange DVD feature might change the |
| 761 |
* angle number from under you. Generally you should always view the results from |
| 762 |
* dvdnav_get_angle_info() as definitive only up to the next time you call |
| 763 |
* dvdnav_get_next_block(). |
| 764 |
*/ |
| 765 |
|
| 766 |
/* |
| 767 |
* Sets the current angle. If you try to follow a non existent angle |
| 768 |
* the call fails. |
| 769 |
*/ |
| 770 |
DVDNAV_API dvdnav_status_t dvdnav_angle_change(dvdnav_t *self, int32_t angle); |
| 771 |
|
| 772 |
/* |
| 773 |
* Returns the current angle and number of angles present. |
| 774 |
*/ |
| 775 |
DVDNAV_API dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *self, int32_t *current_angle, |
| 776 |
int32_t *number_of_angles); |
| 777 |
|
| 778 |
/********************************************************************* |
| 779 |
* domain queries * |
| 780 |
*********************************************************************/ |
| 781 |
|
| 782 |
/* |
| 783 |
* Are we in the First Play domain? |
| 784 |
*/ |
| 785 |
DVDNAV_API int8_t dvdnav_is_domain_fp(dvdnav_t *self); |
| 786 |
|
| 787 |
/* |
| 788 |
* Are we in the Video management Menu domain? |
| 789 |
*/ |
| 790 |
DVDNAV_API int8_t dvdnav_is_domain_vmgm(dvdnav_t *self); |
| 791 |
|
| 792 |
/* |
| 793 |
* Are we in the Video Title Menu domain? |
| 794 |
*/ |
| 795 |
DVDNAV_API int8_t dvdnav_is_domain_vtsm(dvdnav_t *self); |
| 796 |
|
| 797 |
/* |
| 798 |
* Are we in the Video Title Set domain? |
| 799 |
*/ |
| 800 |
DVDNAV_API int8_t dvdnav_is_domain_vts(dvdnav_t *self); |
| 801 |
|
| 802 |
|
| 803 |
#ifdef __cplusplus |
| 804 |
} |
| 805 |
#endif |
| 806 |
|
| 807 |
#endif /* LIBDVDNAV_DVDNAV_H */ |