| 1 |
/* !! DO NO EDIT THIS FILE, it is automatically generated */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2001 Rich Wareham <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of libdvdnav, a DVD navigation library. |
| 6 |
* |
| 7 |
* libdvdnav is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* libdvdnav is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License along |
| 18 |
* with libdvdnav; if not, write to the Free Software Foundation, Inc., |
| 19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef LIBDVDNAV_DVDNAV_INTERNAL_H |
| 23 |
#define LIBDVDNAV_DVDNAV_INTERNAL_H |
| 24 |
|
| 25 |
#ifdef HAVE_CONFIG_H |
| 26 |
#include "config.h" |
| 27 |
#endif |
| 28 |
|
| 29 |
#include <stdlib.h> |
| 30 |
#include <stdio.h> |
| 31 |
#include <unistd.h> |
| 32 |
#include <limits.h> |
| 33 |
#include <string.h> |
| 34 |
#include <pthread.h> |
| 35 |
|
| 36 |
#undef WORDS_BIGENDIAN |
| 37 |
|
| 38 |
#include "dvd_reader.h" |
| 39 |
#include "ifo_read.h" |
| 40 |
|
| 41 |
/* Uncomment for VM command tracing */ |
| 42 |
/* #define TRACE */ |
| 43 |
|
| 44 |
#include "decoder.h" |
| 45 |
#include "dvdnav.h" |
| 46 |
#include "vm.h" |
| 47 |
#include "vmcmd.h" |
| 48 |
|
| 49 |
/* where should libdvdnav write its messages (stdout/stderr) */ |
| 50 |
#define MSG_OUT stdout |
| 51 |
|
| 52 |
/* Maximum length of an error string */ |
| 53 |
#define MAX_ERR_LEN 255 |
| 54 |
|
| 55 |
/* Use the POSIX PATH_MAX if available */ |
| 56 |
#ifdef PATH_MAX |
| 57 |
#define MAX_PATH_LEN PATH_MAX |
| 58 |
#else |
| 59 |
#define MAX_PATH_LEN 255 /* Arbitrary */ |
| 60 |
#endif |
| 61 |
|
| 62 |
#ifndef DVD_VIDEO_LB_LEN |
| 63 |
#define DVD_VIDEO_LB_LEN 2048 |
| 64 |
#endif |
| 65 |
|
| 66 |
typedef struct read_cache_s read_cache_t; |
| 67 |
|
| 68 |
/* |
| 69 |
* These are defined here because they are |
| 70 |
* not in ifo_types.h, they maybe one day |
| 71 |
*/ |
| 72 |
|
| 73 |
#ifndef audio_status_t |
| 74 |
typedef struct { |
| 75 |
#ifdef WORDS_BIGENDIAN |
| 76 |
unsigned int available : 1; |
| 77 |
unsigned int zero1 : 4; |
| 78 |
unsigned int stream_number : 3; |
| 79 |
uint8_t zero2; |
| 80 |
#else |
| 81 |
uint8_t zero2; |
| 82 |
unsigned int stream_number : 3; |
| 83 |
unsigned int zero1 : 4; |
| 84 |
unsigned int available : 1; |
| 85 |
#endif |
| 86 |
} ATTRIBUTE_PACKED audio_status_t; |
| 87 |
#endif |
| 88 |
|
| 89 |
#ifndef spu_status_t |
| 90 |
typedef struct { |
| 91 |
#ifdef WORDS_BIGENDIAN |
| 92 |
unsigned int available : 1; |
| 93 |
unsigned int zero1 : 2; |
| 94 |
unsigned int stream_number_4_3 : 5; |
| 95 |
unsigned int zero2 : 3; |
| 96 |
unsigned int stream_number_wide : 5; |
| 97 |
unsigned int zero3 : 3; |
| 98 |
unsigned int stream_number_letterbox : 5; |
| 99 |
unsigned int zero4 : 3; |
| 100 |
unsigned int stream_number_pan_scan : 5; |
| 101 |
#else |
| 102 |
unsigned int stream_number_pan_scan : 5; |
| 103 |
unsigned int zero4 : 3; |
| 104 |
unsigned int stream_number_letterbox : 5; |
| 105 |
unsigned int zero3 : 3; |
| 106 |
unsigned int stream_number_wide : 5; |
| 107 |
unsigned int zero2 : 3; |
| 108 |
unsigned int stream_number_4_3 : 5; |
| 109 |
unsigned int zero1 : 2; |
| 110 |
unsigned int available : 1; |
| 111 |
#endif |
| 112 |
} ATTRIBUTE_PACKED spu_status_t; |
| 113 |
#endif |
| 114 |
|
| 115 |
typedef struct dvdnav_vobu_s { |
| 116 |
int32_t vobu_start; /* Logical Absolute. MAX needed is 0x300000 */ |
| 117 |
int32_t vobu_length; |
| 118 |
int32_t blockN; /* Relative offset */ |
| 119 |
int32_t vobu_next; /* Relative offset */ |
| 120 |
} dvdnav_vobu_t; |
| 121 |
|
| 122 |
/** The main DVDNAV type **/ |
| 123 |
|
| 124 |
struct dvdnav_s { |
| 125 |
/* General data */ |
| 126 |
char path[MAX_PATH_LEN]; /* Path to DVD device/dir */ |
| 127 |
dvd_file_t *file; /* Currently opened file */ |
| 128 |
int open_vtsN; /* The domain and number of the... */ |
| 129 |
int open_domain; /* ..currently opened VOB */ |
| 130 |
|
| 131 |
/* Position data */ |
| 132 |
vm_position_t position_next; |
| 133 |
vm_position_t position_current; |
| 134 |
dvdnav_vobu_t vobu; |
| 135 |
|
| 136 |
/* NAV data */ |
| 137 |
pci_t pci; |
| 138 |
dsi_t dsi; |
| 139 |
uint32_t last_cmd_nav_lbn; /* detects when a command is issued on an already left NAV */ |
| 140 |
|
| 141 |
/* Flags */ |
| 142 |
int skip_still; /* Set when skipping a still */ |
| 143 |
int sync_wait; /* applications should wait till they are in sync with us */ |
| 144 |
int sync_wait_skip; /* Set when skipping wait state */ |
| 145 |
int spu_clut_changed; /* The SPU CLUT changed */ |
| 146 |
int started; /* vm_start has been called? */ |
| 147 |
int use_read_ahead; /* 1 - use read-ahead cache, 0 - don't */ |
| 148 |
int pgc_based; /* positioning works PGC based instead of PG based */ |
| 149 |
|
| 150 |
/* VM */ |
| 151 |
vm_t *vm; |
| 152 |
pthread_mutex_t vm_lock; |
| 153 |
|
| 154 |
/* Read-ahead cache */ |
| 155 |
read_cache_t *cache; |
| 156 |
|
| 157 |
/* Errors */ |
| 158 |
char err_str[MAX_ERR_LEN]; |
| 159 |
}; |
| 160 |
|
| 161 |
/** USEFUL MACROS **/ |
| 162 |
|
| 163 |
#ifdef __GNUC__ |
| 164 |
#define printerrf(format, args...) snprintf(this->err_str, MAX_ERR_LEN, format, ## args); |
| 165 |
#else |
| 166 |
#ifdef _MSC_VER |
| 167 |
#define printerrf(str) snprintf(this->err_str, MAX_ERR_LEN, str); |
| 168 |
#else |
| 169 |
#define printerrf(...) snprintf(this->err_str, MAX_ERR_LEN, __VA_ARGS__); |
| 170 |
#endif /* WIN32 */ |
| 171 |
#endif |
| 172 |
#define printerr(str) strncpy(this->err_str, str, MAX_ERR_LEN); |
| 173 |
|
| 174 |
/* Save my typing */ |
| 175 |
#define S_ERR DVDNAV_STATUS_ERR |
| 176 |
|
| 177 |
#ifndef _MSC_VER |
| 178 |
#define S_OK DVDNAV_STATUS_OK |
| 179 |
#endif /* MSC_VER */ |
| 180 |
|
| 181 |
#endif /* LIBDVDNAV_DVDNAV_INTERNAL_H */ |