35
|
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_INTERNAL_H_INCLUDED
|
|
25 #define DVDNAV_INTERNAL_H_INCLUDED
|
|
26
|
|
27 #ifdef HAVE_CONFIG_H
|
|
28 #include "config.h"
|
|
29 #endif
|
|
30
|
|
31 #include "dvdnav.h"
|
|
32 #include "vm.h"
|
|
33
|
|
34 #include <stdlib.h>
|
|
35 #include <stdio.h>
|
|
36 #include <unistd.h>
|
|
37 #include <limits.h>
|
|
38 #include <string.h>
|
|
39 #include <pthread.h>
|
|
40
|
|
41 @BIGENDIAN@
|
|
42
|
|
43 #include <dvdread/dvd_reader.h>
|
|
44 #include <dvdread/ifo_read.h>
|
|
45 #include <dvdread/ifo_types.h>
|
|
46
|
|
47
|
|
48 /* Maximum length of an error string */
|
|
49 #define MAX_ERR_LEN 255
|
|
50
|
|
51 /* Use the POSIX PATH_MAX if available */
|
|
52 #ifdef PATH_MAX
|
|
53 #define MAX_PATH_LEN PATH_MAX
|
|
54 #else
|
|
55 #define MAX_PATH_LEN 255 /* Arbitary */
|
|
56 #endif
|
|
57
|
|
58 #ifndef DVD_VIDEO_LB_LEN
|
|
59 #define DVD_VIDEO_LB_LEN 2048
|
|
60 #endif
|
|
61
|
|
62 typedef struct read_cache_s read_cache_t;
|
|
63
|
|
64 /*
|
|
65 * These are defined here because they are
|
|
66 * not in ifo_types.h, they maybe one day
|
|
67 */
|
|
68
|
|
69 #ifndef audio_status_t
|
|
70 typedef struct {
|
|
71 #ifdef WORDS_BIGENDIAN
|
|
72 unsigned int available : 1;
|
|
73 unsigned int zero1 : 4;
|
|
74 unsigned int stream_number : 3;
|
|
75 uint8_t zero2;
|
|
76 #else
|
|
77 uint8_t zero2;
|
|
78 unsigned int stream_number : 3;
|
|
79 unsigned int zero1 : 4;
|
|
80 unsigned int available : 1;
|
|
81 #endif
|
|
82 } ATTRIBUTE_PACKED audio_status_t;
|
|
83 #endif
|
|
84
|
|
85 #ifndef spu_status_t
|
|
86 typedef struct {
|
|
87 #ifdef WORDS_BIGENDIAN
|
|
88 unsigned int available : 1;
|
|
89 unsigned int zero1 : 2;
|
|
90 unsigned int stream_number_4_3 : 5;
|
|
91 unsigned int zero2 : 3;
|
|
92 unsigned int stream_number_wide : 5;
|
|
93 unsigned int zero3 : 3;
|
|
94 unsigned int stream_number_letterbox : 5;
|
|
95 unsigned int zero4 : 3;
|
|
96 unsigned int stream_number_pan_scan : 5;
|
|
97 #else
|
|
98 unsigned int stream_number_pan_scan : 5;
|
|
99 unsigned int zero4 : 3;
|
|
100 unsigned int stream_number_letterbox : 5;
|
|
101 unsigned int zero3 : 3;
|
|
102 unsigned int stream_number_wide : 5;
|
|
103 unsigned int zero2 : 3;
|
|
104 unsigned int stream_number_4_3 : 5;
|
|
105 unsigned int zero1 : 2;
|
|
106 unsigned int available : 1;
|
|
107 #endif
|
|
108 } ATTRIBUTE_PACKED spu_status_t;
|
|
109 #endif
|
|
110
|
|
111 typedef struct dvdnav_vobu_s {
|
|
112 int32_t vobu_start; /* Logical Absolute. MAX needed is 0x300000 */
|
|
113 int32_t vobu_length; /* Relative offset */
|
|
114 int32_t blockN; /* Relative offset */
|
|
115 int32_t vobu_next; /* Relative offset */
|
|
116 } dvdnav_vobu_t;
|
|
117
|
|
118 /* The main DVDNAV type */
|
|
119
|
|
120 struct dvdnav_s {
|
|
121 /* General data */
|
|
122 char path[MAX_PATH_LEN]; /* Path to DVD device/dir */
|
|
123 dvd_file_t *file; /* Currently opened file */
|
|
124 int open_vtsN; /* The domain and number of the... */
|
|
125 int open_domain; /* ..currently opened VOB */
|
|
126
|
|
127 /* Position data */
|
|
128 vm_position_t position_next;
|
|
129 vm_position_t position_current;
|
|
130 dvdnav_vobu_t vobu;
|
|
131
|
|
132 /* NAV data */
|
|
133 pci_t pci;
|
|
134 dsi_t dsi;
|
|
135
|
|
136 /* Flags */
|
|
137 int skip_still; /* Set when skipping a still */
|
|
138 int stop; /* Are we stopped? (note not paused, actually stopped) */
|
|
139 int spu_clut_changed; /* The SPU CLUT changed */
|
|
140 int started; /* vm_start has been called? */
|
|
141 int use_read_ahead; /* 1 - use read-ahead cache, 0 - don't */
|
|
142 /* VM */
|
|
143 vm_t* vm;
|
|
144 pthread_mutex_t vm_lock;
|
|
145
|
|
146 /* Highlight */
|
|
147 int hli_state; /* State of highlight: 0 - disabled,
|
|
148 1 - selected,
|
|
149 2 - activated */
|
|
150
|
|
151 /* Read-ahead cache */
|
|
152 read_cache_t *cache;
|
|
153
|
|
154 /* Errors */
|
|
155 char err_str[MAX_ERR_LEN];
|
|
156 };
|
|
157
|
|
158 /** USEFUL MACROS **/
|
|
159
|
|
160 #define printerrf(format, args...) snprintf(this->err_str, MAX_ERR_LEN, format, ## args);
|
|
161 #define printerr(str) strncpy(this->err_str, str, MAX_ERR_LEN);
|
|
162 /* Save my typing */
|
|
163
|
|
164 #define S_ERR DVDNAV_STATUS_ERR
|
|
165 #define S_OK DVDNAV_STATUS_OK
|
|
166
|
|
167 #endif /* DVDNAV_INTERNAL_H_INCLUDED */
|