Mercurial > libdvdnav.hg
annotate dvdnav.c @ 264:8c86b61eb06f src
fix compiler warnings related to aliasing violations
author | mroi |
---|---|
date | Wed, 20 Apr 2005 16:16:20 +0000 |
parents | d999338cab17 |
children | 99d33725395d |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (C) 2000 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 #ifdef HAVE_CONFIG_H | |
25 #include "config.h" | |
26 #endif | |
27 | |
31 | 28 /* |
29 #define LOG_DEBUG | |
30 */ | |
31 | |
0 | 32 #include "dvdnav_internal.h" |
33 #include "read_cache.h" | |
231 | 34 #include "nav_read.h" |
0 | 35 |
36 #include <stdlib.h> | |
37 #include <stdio.h> | |
84 | 38 #include <sys/time.h> |
0 | 39 |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
92
diff
changeset
|
40 #include "remap.h" |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
92
diff
changeset
|
41 |
114 | 42 static dvdnav_status_t dvdnav_clear(dvdnav_t * this) { |
43 /* clear everything except file, vm, mutex, readahead */ | |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
44 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
45 if (this->file) DVDCloseFile(this->file); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
46 this->file = NULL; |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
47 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
48 memset(&this->pci,0,sizeof(this->pci)); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
49 memset(&this->dsi,0,sizeof(this->dsi)); |
197
a20a5976a207
last_cmd_nav_lbn has to be initialized with an invalid value, so that the first
mroi
parents:
195
diff
changeset
|
50 this->last_cmd_nav_lbn = SRI_END_OF_CELL; |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
51 |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
52 /* Set initial values of flags */ |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
53 this->position_current.still = 0; |
23 | 54 this->skip_still = 0; |
116 | 55 this->sync_wait = 0; |
56 this->sync_wait_skip = 0; | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
57 this->spu_clut_changed = 0; |
114 | 58 this->started = 0; |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
59 |
34
1f29402ef2ef
'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents:
33
diff
changeset
|
60 dvdnav_read_cache_clear(this->cache); |
1f29402ef2ef
'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents:
33
diff
changeset
|
61 |
193 | 62 return DVDNAV_STATUS_OK; |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
63 } |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
64 |
114 | 65 dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char *path) { |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
66 dvdnav_t *this; |
84 | 67 struct timeval time; |
0 | 68 |
69 /* Create a new structure */ | |
100 | 70 fprintf(MSG_OUT, "libdvdnav: Using dvdnav version %s from http://dvd.sf.net\n", VERSION); |
82 | 71 |
0 | 72 (*dest) = NULL; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
73 this = (dvdnav_t*)malloc(sizeof(dvdnav_t)); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
74 if(!this) |
193 | 75 return DVDNAV_STATUS_ERR; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
76 memset(this, 0, (sizeof(dvdnav_t) ) ); /* Make sure this structure is clean */ |
114 | 77 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
78 pthread_mutex_init(&this->vm_lock, NULL); |
0 | 79 /* Initialise the error string */ |
80 printerr(""); | |
81 | |
82 /* Initialise the VM */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
83 this->vm = vm_new_vm(); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
84 if(!this->vm) { |
114 | 85 printerr("Error initialising the DVD VM."); |
92 | 86 pthread_mutex_destroy(&this->vm_lock); |
87 free(this); | |
193 | 88 return DVDNAV_STATUS_ERR; |
0 | 89 } |
114 | 90 if(!vm_reset(this->vm, path)) { |
91 printerr("Error starting the VM / opening the DVD device."); | |
92 | 92 pthread_mutex_destroy(&this->vm_lock); |
93 vm_free_vm(this->vm); | |
94 free(this); | |
193 | 95 return DVDNAV_STATUS_ERR; |
0 | 96 } |
97 | |
98 /* Set the path. FIXME: Is a deep copy 'right' */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
99 strncpy(this->path, path, MAX_PATH_LEN); |
0 | 100 |
101 /* Pre-open and close a file so that the CSS-keys are cached. */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
102 this->file = DVDOpenFile(vm_get_dvd_reader(this->vm), 0, DVD_READ_MENU_VOBS); |
0 | 103 |
34
1f29402ef2ef
'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents:
33
diff
changeset
|
104 /* Start the read-ahead cache. */ |
1f29402ef2ef
'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents:
33
diff
changeset
|
105 this->cache = dvdnav_read_cache_new(this); |
84 | 106 |
114 | 107 /* Seed the random numbers. So that the DVD VM Command rand() |
108 * gives a different start value each time a DVD is played. */ | |
109 gettimeofday(&time, NULL); | |
84 | 110 srand(time.tv_usec); |
111 | |
114 | 112 dvdnav_clear(this); |
113 | |
114 (*dest) = this; | |
193 | 115 return DVDNAV_STATUS_OK; |
0 | 116 } |
117 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
118 dvdnav_status_t dvdnav_close(dvdnav_t *this) { |
114 | 119 |
31 | 120 #ifdef LOG_DEBUG |
76 | 121 fprintf(MSG_OUT, "libdvdnav: close:called\n"); |
31 | 122 #endif |
34
1f29402ef2ef
'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents:
33
diff
changeset
|
123 |
114 | 124 if(!this) { |
125 printerr("Passed a NULL pointer."); | |
193 | 126 return DVDNAV_STATUS_ERR; |
114 | 127 } |
128 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
129 if (this->file) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
130 DVDCloseFile(this->file); |
31 | 131 #ifdef LOG_DEBUG |
76 | 132 fprintf(MSG_OUT, "libdvdnav: close:file closing\n"); |
31 | 133 #endif |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
134 this->file = NULL; |
0 | 135 } |
136 | |
137 /* Free the VM */ | |
114 | 138 if(this->vm) |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
139 vm_free_vm(this->vm); |
114 | 140 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
141 pthread_mutex_destroy(&this->vm_lock); |
60 | 142 |
143 /* We leave the final freeing of the entire structure to the cache, | |
144 * because we don't know, if there are still buffers out in the wild, | |
145 * that must return first. */ | |
114 | 146 if(this->cache) |
60 | 147 dvdnav_read_cache_free(this->cache); |
114 | 148 else |
149 free(this); | |
0 | 150 |
193 | 151 return DVDNAV_STATUS_OK; |
0 | 152 } |
153 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
154 dvdnav_status_t dvdnav_reset(dvdnav_t *this) { |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
155 dvdnav_status_t result; |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
156 |
31 | 157 #ifdef LOG_DEBUG |
76 | 158 fprintf(MSG_OUT, "libdvdnav: reset:called\n"); |
31 | 159 #endif |
114 | 160 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
161 if(!this) { |
114 | 162 printerr("Passed a NULL pointer."); |
193 | 163 return DVDNAV_STATUS_ERR; |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
164 } |
114 | 165 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
166 pthread_mutex_lock(&this->vm_lock); |
114 | 167 |
31 | 168 #ifdef LOG_DEBUG |
76 | 169 fprintf(MSG_OUT, "libdvdnav: reseting vm\n"); |
31 | 170 #endif |
114 | 171 if(!vm_reset(this->vm, NULL)) { |
172 printerr("Error restarting the VM."); | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
173 pthread_mutex_unlock(&this->vm_lock); |
193 | 174 return DVDNAV_STATUS_ERR; |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
175 } |
31 | 176 #ifdef LOG_DEBUG |
76 | 177 fprintf(MSG_OUT, "libdvdnav: clearing dvdnav\n"); |
31 | 178 #endif |
114 | 179 result = dvdnav_clear(this); |
180 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
181 pthread_mutex_unlock(&this->vm_lock); |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
182 return result; |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
183 } |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
184 |
114 | 185 dvdnav_status_t dvdnav_path(dvdnav_t *this, const char** path) { |
186 | |
187 if(!this || !path) { | |
188 printerr("Passed a NULL pointer."); | |
193 | 189 return DVDNAV_STATUS_ERR; |
0 | 190 } |
191 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
192 (*path) = this->path; |
0 | 193 |
193 | 194 return DVDNAV_STATUS_OK; |
0 | 195 } |
196 | |
114 | 197 const char* dvdnav_err_to_string(dvdnav_t *this) { |
198 | |
199 if(!this) | |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
200 return "Hey! You gave me a NULL pointer you naughty person!"; |
0 | 201 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
202 return this->err_str; |
0 | 203 } |
204 | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
205 /* converts a dvd_time_t to PTS ticks */ |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
206 static int64_t dvdnav_convert_time(dvd_time_t *time) { |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
207 int64_t result; |
195 | 208 int64_t frames; |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
209 |
135 | 210 result = (time->hour >> 4 ) * 10 * 60 * 60 * 90000; |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
211 result += (time->hour & 0x0f) * 60 * 60 * 90000; |
135 | 212 result += (time->minute >> 4 ) * 10 * 60 * 90000; |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
213 result += (time->minute & 0x0f) * 60 * 90000; |
135 | 214 result += (time->second >> 4 ) * 10 * 90000; |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
215 result += (time->second & 0x0f) * 90000; |
135 | 216 |
217 frames = ((time->frame_u & 0x30) >> 4) * 10; | |
218 frames += ((time->frame_u & 0x0f) ) ; | |
219 | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
220 if (time->frame_u & 0x80) |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
221 result += frames * 3000; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
222 else |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
223 result += frames * 3600; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
224 |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
225 return result; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
226 } |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
227 |
114 | 228 /* |
0 | 229 * Returns 1 if block contains NAV packet, 0 otherwise. |
217 | 230 * Processes said NAV packet if present. |
0 | 231 * |
232 * Most of the code in here is copied from xine's MPEG demuxer | |
233 * so any bugs which are found in that should be corrected here also. | |
234 */ | |
195 | 235 static int32_t dvdnav_decode_packet(dvdnav_t *this, uint8_t *p, dsi_t *nav_dsi, pci_t *nav_pci) { |
236 int32_t bMpeg1 = 0; | |
0 | 237 uint32_t nHeaderLen; |
238 uint32_t nPacketLen; | |
239 uint32_t nStreamID; | |
240 | |
241 if (p[3] == 0xBA) { /* program stream pack header */ | |
195 | 242 int32_t nStuffingBytes; |
0 | 243 |
244 bMpeg1 = (p[4] & 0x40) == 0; | |
245 | |
246 if (bMpeg1) { | |
114 | 247 p += 12; |
0 | 248 } else { /* mpeg2 */ |
249 nStuffingBytes = p[0xD] & 0x07; | |
250 p += 14 + nStuffingBytes; | |
251 } | |
252 } | |
253 | |
254 if (p[3] == 0xbb) { /* program stream system header */ | |
255 nHeaderLen = (p[4] << 8) | p[5]; | |
256 p += 6 + nHeaderLen; | |
257 } | |
258 | |
259 /* we should now have a PES packet here */ | |
260 if (p[0] || p[1] || (p[2] != 1)) { | |
76 | 261 fprintf(MSG_OUT, "libdvdnav: demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]); |
0 | 262 return 0; |
263 } | |
264 | |
265 nPacketLen = p[4] << 8 | p[5]; | |
266 nStreamID = p[3]; | |
267 | |
268 nHeaderLen = 6; | |
269 p += nHeaderLen; | |
270 | |
271 if (nStreamID == 0xbf) { /* Private stream 2 */ | |
114 | 272 #if 0 |
195 | 273 int32_t i; |
114 | 274 fprintf(MSG_OUT, "libdvdnav: nav packet=%u\n",p-p_start-6); |
275 for(i=0;i<80;i++) | |
276 fprintf(MSG_OUT, "%02x ",p[i-6]); | |
277 fprintf(MSG_OUT, "\n"); | |
278 #endif | |
279 | |
0 | 280 if(p[0] == 0x00) { |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
281 navRead_PCI(nav_pci, p+1); |
0 | 282 } |
283 | |
284 p += nPacketLen; | |
285 | |
286 /* We should now have a DSI packet. */ | |
287 if(p[6] == 0x01) { | |
288 nPacketLen = p[4] << 8 | p[5]; | |
289 p += 6; | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
290 navRead_DSI(nav_dsi, p+1); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
291 } |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
292 return 1; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
293 } |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
294 return 0; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
295 } |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
296 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
297 /* DSI is used for most angle stuff. |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
298 * PCI is used for only non-seemless angle stuff |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
299 */ |
195 | 300 static int32_t dvdnav_get_vobu(dvdnav_t *this, dsi_t *nav_dsi, pci_t *nav_pci, dvdnav_vobu_t *vobu) { |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
301 uint32_t next; |
195 | 302 int32_t angle, num_angle; |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
303 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
304 vobu->vobu_start = nav_dsi->dsi_gi.nv_pck_lbn; /* Absolute offset from start of disk */ |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
305 vobu->vobu_length = nav_dsi->dsi_gi.vobu_ea; /* Relative offset from vobu_start */ |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
306 |
43
0ba15bf3dc25
Biiiiiiig change to let doxygen generate some docs for the library. Note that I'm in no way sure that the autoconf stuff plays nice.
richwareham
parents:
42
diff
changeset
|
307 /* |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
308 * If we're not at the end of this cell, we can determine the next |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
309 * VOBU to display using the VOBU_SRI information section of the |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
310 * DSI. Using this value correctly follows the current angle, |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
311 * avoiding the doubled scenes in The Matrix, and makes our life |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
312 * really happy. |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
313 * |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
314 * vobu_next is an offset value, 0x3fffffff = SRI_END_OF_CELL |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
315 * DVDs are about 6 Gigs, which is only up to 0x300000 blocks |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
316 * Should really assert if bit 31 != 1 |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
317 */ |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
318 |
114 | 319 #if 0 |
320 /* Old code -- may still be useful one day */ | |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
321 if(nav_dsi->vobu_sri.next_vobu != SRI_END_OF_CELL ) { |
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
322 vobu->vobu_next = ( nav_dsi->vobu_sri.next_vobu & 0x3fffffff ); |
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
323 } else { |
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
324 vobu->vobu_next = vobu->vobu_length; |
114 | 325 } |
326 #else | |
327 /* Relative offset from vobu_start */ | |
328 vobu->vobu_next = ( nav_dsi->vobu_sri.next_vobu & 0x3fffffff ); | |
329 #endif | |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
330 |
114 | 331 vm_get_angle_info(this->vm, &angle, &num_angle); |
332 | |
333 /* FIMXE: The angle reset doesn't work for some reason for the moment */ | |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
334 #if 0 |
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
335 if((num_angle < angle) && (angle != 1)) { |
114 | 336 fprintf(MSG_OUT, "libdvdnav: angle ends!\n"); |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
337 |
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
338 /* This is to switch back to angle one when we |
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
339 * finish with angles. */ |
114 | 340 dvdnav_angle_change(this, 1); |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
341 } |
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
342 #endif |
0 | 343 |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
344 if(num_angle != 0) { |
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
345 |
114 | 346 if((next = nav_pci->nsml_agli.nsml_agl_dsta[angle-1]) != 0) { |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
347 if((next & 0x3fffffff) != 0) { |
114 | 348 if(next & 0x80000000) |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
349 vobu->vobu_next = - (int32_t)(next & 0x3fffffff); |
114 | 350 else |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
351 vobu->vobu_next = + (int32_t)(next & 0x3fffffff); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
352 } |
114 | 353 } else if((next = nav_dsi->sml_agli.data[angle-1].address) != 0) { |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
354 vobu->vobu_length = nav_dsi->sml_pbi.ilvu_ea; |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
355 |
114 | 356 if((next & 0x80000000) && (next != 0x7fffffff)) |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
357 vobu->vobu_next = - (int32_t)(next & 0x3fffffff); |
114 | 358 else |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
359 vobu->vobu_next = + (int32_t)(next & 0x3fffffff); |
0 | 360 } |
361 } | |
33
ef2136c4e7b2
Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents:
31
diff
changeset
|
362 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
363 return 1; |
0 | 364 } |
60 | 365 |
114 | 366 /* |
367 * These are the main get_next_block function which actually get the media stream video and audio etc. | |
368 * | |
369 * There are two versions: The second one is using the zero-copy read ahead cache and therefore | |
370 * hands out pointers targetting directly into the cache. | |
371 * The first one uses a memcopy to fill this cache block into the application provided memory. | |
372 * The benefit of this first one is that no special memory management is needed. The application is | |
373 * the only one responsible of allocating and freeing the memory associated with the pointer. | |
374 * The drawback is the additional memcopy. | |
28 | 375 */ |
60 | 376 |
195 | 377 dvdnav_status_t dvdnav_get_next_block(dvdnav_t *this, uint8_t *buf, |
378 int32_t *event, int32_t *len) { | |
60 | 379 unsigned char *block; |
380 dvdnav_status_t status; | |
381 | |
382 block = buf; | |
383 status = dvdnav_get_next_cache_block(this, &block, event, len); | |
193 | 384 if (status == DVDNAV_STATUS_OK && block != buf) { |
60 | 385 /* we received a block from the cache, copy it, so we can give it back */ |
386 memcpy(buf, block, DVD_VIDEO_LB_LEN); | |
387 dvdnav_free_cache_block(this, block); | |
388 } | |
389 return status; | |
390 } | |
391 | |
195 | 392 dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf, |
393 int32_t *event, int32_t *len) { | |
0 | 394 dvd_state_t *state; |
195 | 395 int32_t result; |
114 | 396 |
60 | 397 if(!this || !event || !len || !buf || !*buf) { |
114 | 398 printerr("Passed a NULL pointer."); |
193 | 399 return DVDNAV_STATUS_ERR; |
0 | 400 } |
114 | 401 |
402 pthread_mutex_lock(&this->vm_lock); | |
0 | 403 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
404 if(!this->started) { |
0 | 405 /* Start the VM */ |
256
6299ccea8a38
killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents:
249
diff
changeset
|
406 if (!vm_start(this->vm)) { |
6299ccea8a38
killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents:
249
diff
changeset
|
407 printerr("Encrypted or faulty DVD"); |
6299ccea8a38
killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents:
249
diff
changeset
|
408 return DVDNAV_STATUS_ERR; |
6299ccea8a38
killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents:
249
diff
changeset
|
409 } |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
410 this->started = 1; |
0 | 411 } |
412 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
413 state = &(this->vm->state); |
0 | 414 (*event) = DVDNAV_NOP; |
415 (*len) = 0; | |
416 | |
417 /* Check the STOP flag */ | |
114 | 418 if(this->vm->stopped) { |
121 | 419 vm_stop(this->vm); |
0 | 420 (*event) = DVDNAV_STOP; |
114 | 421 this->started = 0; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
422 pthread_mutex_unlock(&this->vm_lock); |
193 | 423 return DVDNAV_STATUS_OK; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
424 } |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
425 |
114 | 426 vm_position_get(this->vm, &this->position_next); |
0 | 427 |
126 | 428 #ifdef LOG_DEBUG |
114 | 429 fprintf(MSG_OUT, "libdvdnav: POS-NEXT "); |
430 vm_position_print(this->vm, &this->position_next); | |
116 | 431 fprintf(MSG_OUT, "libdvdnav: POS-CUR "); |
114 | 432 vm_position_print(this->vm, &this->position_current); |
31 | 433 #endif |
114 | 434 |
435 /* did we hop? */ | |
436 if(this->position_current.hop_channel != this->position_next.hop_channel) { | |
437 (*event) = DVDNAV_HOP_CHANNEL; | |
58 | 438 #ifdef LOG_DEBUG |
114 | 439 fprintf(MSG_OUT, "libdvdnav: HOP_CHANNEL\n"); |
31 | 440 #endif |
115 | 441 if (this->position_next.hop_channel - this->position_current.hop_channel >= HOP_SEEK) { |
195 | 442 int32_t num_angles = 0, current; |
114 | 443 |
444 /* we seeked -> check for multiple angles */ | |
445 vm_get_angle_info(this->vm, ¤t, &num_angles); | |
446 if (num_angles > 1) { | |
195 | 447 int32_t result, block; |
114 | 448 /* we have to skip the first VOBU when seeking in a multiangle feature, |
449 * because it might belong to the wrong angle */ | |
450 block = this->position_next.cell_start + this->position_next.block; | |
451 result = dvdnav_read_cache_block(this->cache, block, 1, buf); | |
452 if(result <= 0) { | |
453 printerr("Error reading NAV packet."); | |
454 pthread_mutex_unlock(&this->vm_lock); | |
193 | 455 return DVDNAV_STATUS_ERR; |
114 | 456 } |
457 /* Decode nav into pci and dsi. Then get next VOBU info. */ | |
458 if(!dvdnav_decode_packet(this, *buf, &this->dsi, &this->pci)) { | |
459 printerr("Expected NAV packet but none found."); | |
460 pthread_mutex_unlock(&this->vm_lock); | |
193 | 461 return DVDNAV_STATUS_ERR; |
114 | 462 } |
463 dvdnav_get_vobu(this, &this->dsi, &this->pci, &this->vobu); | |
464 /* skip to next, if there is a next */ | |
465 if (this->vobu.vobu_next != SRI_END_OF_CELL) { | |
466 this->vobu.vobu_start += this->vobu.vobu_next; | |
467 this->vobu.vobu_next = 0; | |
468 } | |
469 /* update VM state */ | |
470 this->vm->state.blockN = this->vobu.vobu_start - this->position_next.cell_start; | |
471 } | |
472 } | |
473 this->position_current.hop_channel = this->position_next.hop_channel; | |
141
8f63f4c25f2f
update position on HOP_CHANNEL, do not rely on a following CELL_CHANGE
mroi
parents:
135
diff
changeset
|
474 /* update VOBU info */ |
8f63f4c25f2f
update position on HOP_CHANNEL, do not rely on a following CELL_CHANGE
mroi
parents:
135
diff
changeset
|
475 this->vobu.vobu_start = this->position_next.cell_start + this->position_next.block; |
8f63f4c25f2f
update position on HOP_CHANNEL, do not rely on a following CELL_CHANGE
mroi
parents:
135
diff
changeset
|
476 this->vobu.vobu_next = 0; |
127 | 477 /* Make blockN == vobu_length to do expected_nav */ |
114 | 478 this->vobu.vobu_length = 0; |
127 | 479 this->vobu.blockN = 0; |
116 | 480 this->sync_wait = 0; |
30 | 481 pthread_mutex_unlock(&this->vm_lock); |
193 | 482 return DVDNAV_STATUS_OK; |
0 | 483 } |
484 | |
116 | 485 /* Check the HIGHLIGHT flag */ |
486 if(this->position_current.button != this->position_next.button) { | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
487 dvdnav_highlight_event_t *hevent = (dvdnav_highlight_event_t *)*buf; |
116 | 488 |
489 (*event) = DVDNAV_HIGHLIGHT; | |
490 #ifdef LOG_DEBUG | |
491 fprintf(MSG_OUT, "libdvdnav: HIGHLIGHT\n"); | |
492 #endif | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
493 (*len) = sizeof(dvdnav_highlight_event_t); |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
494 hevent->display = 1; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
495 hevent->buttonN = this->position_next.button; |
116 | 496 this->position_current.button = this->position_next.button; |
497 pthread_mutex_unlock(&this->vm_lock); | |
193 | 498 return DVDNAV_STATUS_OK; |
116 | 499 } |
500 | |
501 /* Check the WAIT flag */ | |
502 if(this->sync_wait) { | |
503 (*event) = DVDNAV_WAIT; | |
504 #ifdef LOG_DEBUG | |
505 fprintf(MSG_OUT, "libdvdnav: WAIT\n"); | |
506 #endif | |
507 (*len) = 0; | |
508 pthread_mutex_unlock(&this->vm_lock); | |
193 | 509 return DVDNAV_STATUS_OK; |
116 | 510 } |
511 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
512 /* Check to see if we need to change the currently opened VOB */ |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
513 if((this->position_current.vts != this->position_next.vts) || |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
514 (this->position_current.domain != this->position_next.domain)) { |
0 | 515 dvd_read_domain_t domain; |
195 | 516 int32_t vtsN; |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
517 dvdnav_vts_change_event_t *vts_event = (dvdnav_vts_change_event_t *)*buf; |
0 | 518 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
519 if(this->file) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
520 DVDCloseFile(this->file); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
521 this->file = NULL; |
0 | 522 } |
523 | |
217 | 524 vts_event->old_vtsN = this->position_current.vts; |
525 vts_event->old_domain = this->position_current.domain; | |
0 | 526 |
114 | 527 /* Use the DOMAIN to find whether to open menu or title VOBs */ |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
528 switch(this->position_next.domain) { |
114 | 529 case FP_DOMAIN: |
530 case VMGM_DOMAIN: | |
0 | 531 domain = DVD_READ_MENU_VOBS; |
532 vtsN = 0; | |
533 break; | |
114 | 534 case VTSM_DOMAIN: |
0 | 535 domain = DVD_READ_MENU_VOBS; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
536 vtsN = this->position_next.vts; |
0 | 537 break; |
114 | 538 case VTS_DOMAIN: |
0 | 539 domain = DVD_READ_TITLE_VOBS; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
540 vtsN = this->position_next.vts; |
0 | 541 break; |
114 | 542 default: |
0 | 543 printerr("Unknown domain when changing VTS."); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
544 pthread_mutex_unlock(&this->vm_lock); |
193 | 545 return DVDNAV_STATUS_ERR; |
0 | 546 } |
547 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
548 this->position_current.vts = this->position_next.vts; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
549 this->position_current.domain = this->position_next.domain; |
34
1f29402ef2ef
'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents:
33
diff
changeset
|
550 dvdnav_read_cache_clear(this->cache); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
551 this->file = DVDOpenFile(vm_get_dvd_reader(this->vm), vtsN, domain); |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
552 vts_event->new_vtsN = this->position_next.vts; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
553 vts_event->new_domain = this->position_next.domain; |
0 | 554 |
555 /* If couldn't open the file for some reason, moan */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
556 if(this->file == NULL) { |
0 | 557 printerrf("Error opening vtsN=%i, domain=%i.", vtsN, domain); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
558 pthread_mutex_unlock(&this->vm_lock); |
193 | 559 return DVDNAV_STATUS_ERR; |
0 | 560 } |
561 | |
562 /* File opened successfully so return a VTS change event */ | |
563 (*event) = DVDNAV_VTS_CHANGE; | |
114 | 564 #ifdef LOG_DEBUG |
565 fprintf(MSG_OUT, "libdvdnav: VTS_CHANGE\n"); | |
566 #endif | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
567 (*len) = sizeof(dvdnav_vts_change_event_t); |
0 | 568 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
569 this->spu_clut_changed = 1; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
570 this->position_current.cell = -1; /* Force an update */ |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
571 this->position_current.spu_channel = -1; /* Force an update */ |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
572 this->position_current.audio_channel = -1; /* Force an update */; |
0 | 573 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
574 pthread_mutex_unlock(&this->vm_lock); |
193 | 575 return DVDNAV_STATUS_OK; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
576 } |
114 | 577 |
578 /* Check if the cell changed */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
579 if( (this->position_current.cell != this->position_next.cell) || |
50
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
45
diff
changeset
|
580 (this->position_current.cell_restart != this->position_next.cell_restart) || |
114 | 581 (this->position_current.cell_start != this->position_next.cell_start) ) { |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
582 dvdnav_cell_change_event_t *cell_event = (dvdnav_cell_change_event_t *)*buf; |
195 | 583 int32_t first_cell_nr, last_cell_nr, i; |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
584 dvd_state_t *state = &this->vm->state; |
114 | 585 |
586 (*event) = DVDNAV_CELL_CHANGE; | |
587 #ifdef LOG_DEBUG | |
588 fprintf(MSG_OUT, "libdvdnav: CELL_CHANGE\n"); | |
589 #endif | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
590 (*len) = sizeof(dvdnav_cell_change_event_t); |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
591 |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
592 cell_event->cellN = state->cellN; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
593 cell_event->pgN = state->pgN; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
594 cell_event->cell_length = |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
595 dvdnav_convert_time(&state->pgc->cell_playback[state->cellN-1].playback_time); |
161 | 596 |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
597 cell_event->pg_length = 0; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
598 /* Find start cell of program. */ |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
599 first_cell_nr = state->pgc->program_map[state->pgN-1]; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
600 /* Find end cell of program */ |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
601 if(state->pgN < state->pgc->nr_of_programs) |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
602 last_cell_nr = state->pgc->program_map[state->pgN] - 1; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
603 else |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
604 last_cell_nr = state->pgc->nr_of_cells; |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
605 for (i = first_cell_nr; i <= last_cell_nr; i++) |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
606 cell_event->pg_length += |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
607 dvdnav_convert_time(&state->pgc->cell_playback[i - 1].playback_time); |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
608 cell_event->pgc_length = dvdnav_convert_time(&state->pgc->playback_time); |
151 | 609 |
610 cell_event->cell_start = 0; | |
611 for (i = 1; i < state->cellN; i++) | |
612 cell_event->cell_start += | |
613 dvdnav_convert_time(&state->pgc->cell_playback[i - 1].playback_time); | |
161 | 614 |
615 cell_event->pg_start = 0; | |
616 for (i = 1; i < state->pgc->program_map[state->pgN-1]; i++) | |
617 cell_event->pg_start += | |
618 dvdnav_convert_time(&state->pgc->cell_playback[i - 1].playback_time); | |
619 | |
114 | 620 this->position_current.cell = this->position_next.cell; |
50
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
45
diff
changeset
|
621 this->position_current.cell_restart = this->position_next.cell_restart; |
114 | 622 this->position_current.cell_start = this->position_next.cell_start; |
623 this->position_current.block = this->position_next.block; | |
624 | |
625 /* vobu info is used for mid cell resumes */ | |
626 this->vobu.vobu_start = this->position_next.cell_start + this->position_next.block; | |
627 this->vobu.vobu_next = 0; | |
127 | 628 /* Make blockN == vobu_length to do expected_nav */ |
114 | 629 this->vobu.vobu_length = 0; |
127 | 630 this->vobu.blockN = 0; |
114 | 631 |
632 /* update the spu palette at least on PGC changes */ | |
633 this->spu_clut_changed = 1; | |
634 this->position_current.spu_channel = -1; /* Force an update */ | |
635 this->position_current.audio_channel = -1; /* Force an update */ | |
636 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
637 pthread_mutex_unlock(&this->vm_lock); |
193 | 638 return DVDNAV_STATUS_OK; |
0 | 639 } |
640 | |
114 | 641 /* has the CLUT changed? */ |
642 if(this->spu_clut_changed) { | |
643 (*event) = DVDNAV_SPU_CLUT_CHANGE; | |
644 #ifdef LOG_DEBUG | |
645 fprintf(MSG_OUT, "libdvdnav: SPU_CLUT_CHANGE\n"); | |
646 #endif | |
647 (*len) = 16 * sizeof(uint32_t); | |
648 memcpy(*buf, &(state->pgc->palette), 16 * sizeof(uint32_t)); | |
649 this->spu_clut_changed = 0; | |
650 pthread_mutex_unlock(&this->vm_lock); | |
193 | 651 return DVDNAV_STATUS_OK; |
114 | 652 } |
653 | |
654 /* has the SPU channel changed? */ | |
655 if(this->position_current.spu_channel != this->position_next.spu_channel) { | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
656 dvdnav_spu_stream_change_event_t *stream_change = (dvdnav_spu_stream_change_event_t *)*buf; |
114 | 657 |
658 (*event) = DVDNAV_SPU_STREAM_CHANGE; | |
659 #ifdef LOG_DEBUG | |
660 fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE\n"); | |
661 #endif | |
662 (*len) = sizeof(dvdnav_spu_stream_change_event_t); | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
663 stream_change->physical_wide = vm_get_subp_active_stream(this->vm, 0); |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
664 stream_change->physical_letterbox = vm_get_subp_active_stream(this->vm, 1); |
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
665 stream_change->physical_pan_scan = vm_get_subp_active_stream(this->vm, 2); |
114 | 666 this->position_current.spu_channel = this->position_next.spu_channel; |
667 #ifdef LOG_DEBUG | |
143
0b302ca31859
merge James fixes from xine-lib cvs back into libdvdnav cvs so they will not be lost
mroi
parents:
142
diff
changeset
|
668 fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE stream_id_wide=%d\n",stream_change->physical_wide); |
0b302ca31859
merge James fixes from xine-lib cvs back into libdvdnav cvs so they will not be lost
mroi
parents:
142
diff
changeset
|
669 fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE stream_id_letterbox=%d\n",stream_change->physical_letterbox); |
0b302ca31859
merge James fixes from xine-lib cvs back into libdvdnav cvs so they will not be lost
mroi
parents:
142
diff
changeset
|
670 fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE stream_id_pan_scan=%d\n",stream_change->physical_pan_scan); |
249
5d643668f1e3
I added this code myself a long time ago, but now I am quite convinced that
mroi
parents:
231
diff
changeset
|
671 fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE returning DVDNAV_STATUS_OK\n"); |
114 | 672 #endif |
249
5d643668f1e3
I added this code myself a long time ago, but now I am quite convinced that
mroi
parents:
231
diff
changeset
|
673 pthread_mutex_unlock(&this->vm_lock); |
5d643668f1e3
I added this code myself a long time ago, but now I am quite convinced that
mroi
parents:
231
diff
changeset
|
674 return DVDNAV_STATUS_OK; |
114 | 675 } |
0 | 676 |
114 | 677 /* has the audio channel changed? */ |
678 if(this->position_current.audio_channel != this->position_next.audio_channel) { | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
679 dvdnav_audio_stream_change_event_t *stream_change = (dvdnav_audio_stream_change_event_t *)*buf; |
114 | 680 |
681 (*event) = DVDNAV_AUDIO_STREAM_CHANGE; | |
682 #ifdef LOG_DEBUG | |
683 fprintf(MSG_OUT, "libdvdnav: AUDIO_STREAM_CHANGE\n"); | |
684 #endif | |
685 (*len) = sizeof(dvdnav_audio_stream_change_event_t); | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
686 stream_change->physical = vm_get_audio_active_stream( this->vm ); |
114 | 687 this->position_current.audio_channel = this->position_next.audio_channel; |
688 #ifdef LOG_DEBUG | |
193 | 689 fprintf(MSG_OUT, "libdvdnav: AUDIO_STREAM_CHANGE stream_id=%d returning DVDNAV_STATUS_OK\n",stream_change->physical); |
114 | 690 #endif |
691 pthread_mutex_unlock(&this->vm_lock); | |
193 | 692 return DVDNAV_STATUS_OK; |
114 | 693 } |
694 | |
695 /* Check the STILLFRAME flag */ | |
696 if(this->position_current.still != 0) { | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
697 dvdnav_still_event_t *still_event = (dvdnav_still_event_t *)*buf; |
114 | 698 |
699 (*event) = DVDNAV_STILL_FRAME; | |
700 #ifdef LOG_DEBUG | |
701 fprintf(MSG_OUT, "libdvdnav: STILL_FRAME\n"); | |
702 #endif | |
703 (*len) = sizeof(dvdnav_still_event_t); | |
134
d9d75a22a061
- new event on cell changes to report program and cell number and some time info
mroi
parents:
127
diff
changeset
|
704 still_event->length = this->position_current.still; |
114 | 705 pthread_mutex_unlock(&this->vm_lock); |
194 | 706 return DVDNAV_STATUS_OK; |
114 | 707 } |
708 | |
709 /* Have we reached the end of a VOBU? */ | |
710 if (this->vobu.blockN >= this->vobu.vobu_length) { | |
711 | |
712 /* Have we reached the end of a cell? */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
713 if(this->vobu.vobu_next == SRI_END_OF_CELL) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
714 /* End of Cell from NAV DSI info */ |
31 | 715 #ifdef LOG_DEBUG |
76 | 716 fprintf(MSG_OUT, "libdvdnav: Still set to %x\n", this->position_next.still); |
31 | 717 #endif |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
718 this->position_current.still = this->position_next.still; |
0 | 719 |
116 | 720 /* we are about to leave a cell, so a lot of state changes could occur; |
721 * under certain conditions, the application should get in sync with us before this, | |
722 * otherwise it might show stills or menus too shortly */ | |
723 if ((this->position_current.still || this->pci.hli.hl_gi.hli_ss) && !this->sync_wait_skip) { | |
724 this->sync_wait = 1; | |
725 } else { | |
726 if( this->position_current.still == 0 || this->skip_still ) { | |
727 /* no active cell still -> get us to the next cell */ | |
728 vm_get_next_cell(this->vm); | |
729 this->position_current.still = 0; /* still gets activated at end of cell */ | |
730 this->skip_still = 0; | |
731 this->sync_wait_skip = 0; | |
732 } | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
733 } |
114 | 734 /* handle related state changes in next iteration */ |
735 (*event) = DVDNAV_NOP; | |
736 (*len) = 0; | |
737 pthread_mutex_unlock(&this->vm_lock); | |
193 | 738 return DVDNAV_STATUS_OK; |
114 | 739 } |
0 | 740 |
114 | 741 /* Perform remapping jump if necessary (this is always a |
0 | 742 * VOBU boundary). */ |
114 | 743 if (this->vm->map) { |
744 this->vobu.vobu_next = remap_block( this->vm->map, | |
745 this->vm->state.domain, this->vm->state.TTN_REG, | |
746 this->vm->state.pgN, | |
747 this->vobu.vobu_start, this->vobu.vobu_next); | |
748 } | |
0 | 749 |
114 | 750 /* at the start of the next VOBU -> expecting NAV packet */ |
45 | 751 result = dvdnav_read_cache_block(this->cache, this->vobu.vobu_start + this->vobu.vobu_next, 1, buf); |
0 | 752 |
753 if(result <= 0) { | |
754 printerr("Error reading NAV packet."); | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
755 pthread_mutex_unlock(&this->vm_lock); |
193 | 756 return DVDNAV_STATUS_ERR; |
0 | 757 } |
114 | 758 /* Decode nav into pci and dsi. Then get next VOBU info. */ |
759 if(!dvdnav_decode_packet(this, *buf, &this->dsi, &this->pci)) { | |
0 | 760 printerr("Expected NAV packet but none found."); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
761 pthread_mutex_unlock(&this->vm_lock); |
193 | 762 return DVDNAV_STATUS_ERR; |
0 | 763 } |
114 | 764 /* We need to update the vm state->blockN with which VOBU we are in. |
765 * This is so RSM resumes to the VOBU level and not just the CELL level. | |
28 | 766 */ |
114 | 767 this->vm->state.blockN = this->vobu.vobu_start - this->position_current.cell_start; |
768 | |
769 dvdnav_get_vobu(this, &this->dsi, &this->pci, &this->vobu); | |
770 this->vobu.blockN = 0; | |
771 /* Give the cache a hint about the size of next VOBU. | |
772 * This improves pre-caching, because the VOBU will almost certainly be read entirely. | |
45 | 773 */ |
774 dvdnav_pre_cache_blocks(this->cache, this->vobu.vobu_start+1, this->vobu.vobu_length+1); | |
0 | 775 |
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
179
diff
changeset
|
776 /* release NAV menu filter, when we reach the same NAV packet again */ |
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
179
diff
changeset
|
777 if (this->last_cmd_nav_lbn == this->pci.pci_gi.nv_pck_lbn) |
198
373f27da196b
This one should also be reset to an invalid value, but 0 is not invalid.
mroi
parents:
197
diff
changeset
|
778 this->last_cmd_nav_lbn = SRI_END_OF_CELL; |
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
179
diff
changeset
|
779 |
0 | 780 /* Successfully got a NAV packet */ |
781 (*event) = DVDNAV_NAV_PACKET; | |
114 | 782 #ifdef LOG_DEBUG |
783 fprintf(MSG_OUT, "libdvdnav: NAV_PACKET\n"); | |
784 #endif | |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
785 (*len) = 2048; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
786 pthread_mutex_unlock(&this->vm_lock); |
193 | 787 return DVDNAV_STATUS_OK; |
0 | 788 } |
789 | |
790 /* If we've got here, it must just be a normal block. */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
791 if(!this->file) { |
114 | 792 printerr("Attempting to read without opening file."); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
793 pthread_mutex_unlock(&this->vm_lock); |
193 | 794 return DVDNAV_STATUS_ERR; |
0 | 795 } |
796 | |
114 | 797 this->vobu.blockN++; |
34
1f29402ef2ef
'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents:
33
diff
changeset
|
798 result = dvdnav_read_cache_block(this->cache, this->vobu.vobu_start + this->vobu.blockN, 1, buf); |
0 | 799 if(result <= 0) { |
800 printerr("Error reading from DVD."); | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
801 pthread_mutex_unlock(&this->vm_lock); |
193 | 802 return DVDNAV_STATUS_ERR; |
0 | 803 } |
114 | 804 (*event) = DVDNAV_BLOCK_OK; |
0 | 805 (*len) = 2048; |
806 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
807 pthread_mutex_unlock(&this->vm_lock); |
193 | 808 return DVDNAV_STATUS_OK; |
0 | 809 } |
810 | |
114 | 811 dvdnav_status_t dvdnav_get_title_string(dvdnav_t *this, const char **title_str) { |
812 | |
813 if(!this || !title_str) { | |
814 printerr("Passed a NULL pointer."); | |
193 | 815 return DVDNAV_STATUS_ERR; |
114 | 816 } |
817 | |
818 (*title_str) = this->vm->dvd_name; | |
193 | 819 return DVDNAV_STATUS_OK; |
114 | 820 } |
821 | |
822 uint8_t dvdnav_get_video_aspect(dvdnav_t *this) { | |
823 uint8_t retval; | |
824 | |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
825 if(!this) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
826 printerr("Passed a NULL pointer."); |
114 | 827 return -1; |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
828 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
829 if(!this->started) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
830 printerr("Virtual DVD machine not started."); |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
831 return -1; |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
832 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
833 |
114 | 834 pthread_mutex_lock(&this->vm_lock); |
835 retval = (uint8_t)vm_get_video_aspect(this->vm); | |
836 pthread_mutex_unlock(&this->vm_lock); | |
837 | |
838 return retval; | |
839 } | |
840 | |
841 uint8_t dvdnav_get_video_scale_permission(dvdnav_t *this) { | |
842 uint8_t retval; | |
843 | |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
844 if(!this) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
845 printerr("Passed a NULL pointer."); |
114 | 846 return -1; |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
847 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
848 if(!this->started) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
849 printerr("Virtual DVD machine not started."); |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
850 return -1; |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
851 } |
114 | 852 |
853 pthread_mutex_lock(&this->vm_lock); | |
854 retval = (uint8_t)vm_get_video_scale_permission(this->vm); | |
855 pthread_mutex_unlock(&this->vm_lock); | |
856 | |
857 return retval; | |
858 } | |
859 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
860 uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *this, uint8_t stream) { |
25
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
861 audio_attr_t attr; |
0 | 862 |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
863 if(!this) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
864 printerr("Passed a NULL pointer."); |
0 | 865 return -1; |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
866 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
867 if(!this->started) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
868 printerr("Virtual DVD machine not started."); |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
869 return -1; |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
870 } |
0 | 871 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
872 pthread_mutex_lock(&this->vm_lock); |
25
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
873 attr = vm_get_audio_attr(this->vm, stream); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
874 pthread_mutex_unlock(&this->vm_lock); |
0 | 875 |
25
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
876 if(attr.lang_type != 1) |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
877 return 0xffff; |
0 | 878 |
25
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
879 return attr.lang_code; |
0 | 880 } |
881 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
882 uint16_t dvdnav_spu_stream_to_lang(dvdnav_t *this, uint8_t stream) { |
25
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
883 subp_attr_t attr; |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
884 |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
885 if(!this) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
886 printerr("Passed a NULL pointer."); |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
887 return -1; |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
888 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
889 if(!this->started) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
890 printerr("Virtual DVD machine not started."); |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
891 return -1; |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
892 } |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
893 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
894 pthread_mutex_lock(&this->vm_lock); |
25
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
895 attr = vm_get_subp_attr(this->vm, stream); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
896 pthread_mutex_unlock(&this->vm_lock); |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
897 |
25
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
898 if(attr.type != 1) |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
899 return 0xffff; |
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
900 |
25
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
901 return attr.lang_code; |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
902 } |
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
903 |
114 | 904 int8_t dvdnav_get_audio_logical_stream(dvdnav_t *this, uint8_t audio_num) { |
905 int8_t retval; | |
906 | |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
907 if(!this) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
908 printerr("Passed a NULL pointer."); |
114 | 909 return -1; |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
910 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
911 if(!this->started) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
912 printerr("Virtual DVD machine not started."); |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
913 return -1; |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
914 } |
114 | 915 |
916 pthread_mutex_lock(&this->vm_lock); | |
917 if (!this->vm->state.pgc) { | |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
918 printerr("No current PGC."); |
114 | 919 pthread_mutex_unlock(&this->vm_lock); |
920 return -1; | |
921 } | |
922 retval = vm_get_audio_stream(this->vm, audio_num); | |
923 pthread_mutex_unlock(&this->vm_lock); | |
924 | |
925 return retval; | |
926 } | |
927 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
928 int8_t dvdnav_get_spu_logical_stream(dvdnav_t *this, uint8_t subp_num) { |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
929 int8_t retval; |
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
930 |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
931 if(!this) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
932 printerr("Passed a NULL pointer."); |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
933 return -1; |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
934 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
935 if(!this->started) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
936 printerr("Virtual DVD machine not started."); |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
937 return -1; |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
938 } |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
939 |
114 | 940 pthread_mutex_lock(&this->vm_lock); |
941 if (!this->vm->state.pgc) { | |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
942 printerr("No current PGC."); |
114 | 943 pthread_mutex_unlock(&this->vm_lock); |
944 return -1; | |
945 } | |
946 retval = vm_get_subp_stream(this->vm, subp_num, 0); | |
947 pthread_mutex_unlock(&this->vm_lock); | |
948 | |
949 return retval; | |
950 } | |
951 | |
952 int8_t dvdnav_get_active_audio_stream(dvdnav_t *this) { | |
953 int8_t retval; | |
954 | |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
955 if(!this) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
956 printerr("Passed a NULL pointer."); |
114 | 957 return -1; |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
958 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
959 if(!this->started) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
960 printerr("Virtual DVD machine not started."); |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
961 return -1; |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
962 } |
114 | 963 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
964 pthread_mutex_lock(&this->vm_lock); |
114 | 965 if (!this->vm->state.pgc) { |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
966 printerr("No current PGC."); |
114 | 967 pthread_mutex_unlock(&this->vm_lock); |
968 return -1; | |
969 } | |
970 retval = vm_get_audio_active_stream(this->vm); | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
971 pthread_mutex_unlock(&this->vm_lock); |
114 | 972 |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
973 return retval; |
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
974 } |
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
975 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
976 int8_t dvdnav_get_active_spu_stream(dvdnav_t *this) { |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
977 int8_t retval; |
0 | 978 |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
979 if(!this) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
980 printerr("Passed a NULL pointer."); |
0 | 981 return -1; |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
982 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
983 if(!this->started) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
984 printerr("Virtual DVD machine not started."); |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
985 return -1; |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
986 } |
0 | 987 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
988 pthread_mutex_lock(&this->vm_lock); |
114 | 989 if (!this->vm->state.pgc) { |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
990 printerr("No current PGC."); |
114 | 991 pthread_mutex_unlock(&this->vm_lock); |
992 return -1; | |
993 } | |
994 retval = vm_get_subp_active_stream(this->vm, 0); | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
995 pthread_mutex_unlock(&this->vm_lock); |
0 | 996 |
21
d2d73f2ad8d3
Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents:
17
diff
changeset
|
997 return retval; |
0 | 998 } |
999 | |
114 | 1000 static int8_t dvdnav_is_domain(dvdnav_t *this, domain_t domain) { |
1001 int8_t retval; | |
1002 | |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
1003 if(!this) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
1004 printerr("Passed a NULL pointer."); |
114 | 1005 return -1; |
142
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
1006 } |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
1007 if(!this->started) { |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
1008 printerr("Virtual DVD machine not started."); |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
1009 return -1; |
e375b765ebf5
some more sanity checking will prevent segfaults in these functions
mroi
parents:
141
diff
changeset
|
1010 } |
114 | 1011 |
1012 pthread_mutex_lock(&this->vm_lock); | |
1013 retval = (this->vm->state.domain == domain); | |
1014 pthread_mutex_unlock(&this->vm_lock); | |
1015 | |
1016 return retval; | |
1017 } | |
1018 | |
0 | 1019 /* First Play domain. (Menu) */ |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
1020 int8_t dvdnav_is_domain_fp(dvdnav_t *this) { |
114 | 1021 return dvdnav_is_domain(this, FP_DOMAIN); |
0 | 1022 } |
1023 /* Video management Menu domain. (Menu) */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
1024 int8_t dvdnav_is_domain_vmgm(dvdnav_t *this) { |
114 | 1025 return dvdnav_is_domain(this, VMGM_DOMAIN); |
0 | 1026 } |
1027 /* Video Title Menu domain (Menu) */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
1028 int8_t dvdnav_is_domain_vtsm(dvdnav_t *this) { |
114 | 1029 return dvdnav_is_domain(this, VTSM_DOMAIN); |
0 | 1030 } |
1031 /* Video Title domain (playing movie). */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
1032 int8_t dvdnav_is_domain_vts(dvdnav_t *this) { |
114 | 1033 return dvdnav_is_domain(this, VTS_DOMAIN); |
0 | 1034 } |
1035 | |
114 | 1036 /* Generally delegate angle information handling to VM */ |
195 | 1037 dvdnav_status_t dvdnav_angle_change(dvdnav_t *this, int32_t angle) { |
1038 int32_t num, current; | |
0 | 1039 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
1040 if(!this) { |
114 | 1041 printerr("Passed a NULL pointer."); |
193 | 1042 return DVDNAV_STATUS_ERR; |
0 | 1043 } |
1044 | |
114 | 1045 pthread_mutex_lock(&this->vm_lock); |
1046 vm_get_angle_info(this->vm, ¤t, &num); | |
0 | 1047 /* Set angle SPRM if valid */ |
1048 if((angle > 0) && (angle <= num)) { | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
1049 this->vm->state.AGL_REG = angle; |
0 | 1050 } else { |
114 | 1051 printerr("Passed an invalid angle number."); |
1052 pthread_mutex_unlock(&this->vm_lock); | |
193 | 1053 return DVDNAV_STATUS_ERR; |
0 | 1054 } |
114 | 1055 pthread_mutex_unlock(&this->vm_lock); |
0 | 1056 |
193 | 1057 return DVDNAV_STATUS_OK; |
0 | 1058 } |
1059 | |
195 | 1060 dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *this, int32_t *current_angle, |
1061 int32_t *number_of_angles) { | |
114 | 1062 if(!this || !current_angle || !number_of_angles) { |
1063 printerr("Passed a NULL pointer."); | |
193 | 1064 return DVDNAV_STATUS_ERR; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
21
diff
changeset
|
1065 } |
114 | 1066 |
1067 pthread_mutex_lock(&this->vm_lock); | |
1068 vm_get_angle_info(this->vm, current_angle, number_of_angles); | |
1069 pthread_mutex_unlock(&this->vm_lock); | |
1070 | |
193 | 1071 return DVDNAV_STATUS_OK; |
114 | 1072 } |
0 | 1073 |
67
61c0ee1bbb7a
Moved get_current_nav_pci into dvdnac.c, changed example to use it instead of 'home-rolled'
richwareham
parents:
66
diff
changeset
|
1074 pci_t* dvdnav_get_current_nav_pci(dvdnav_t *this) { |
114 | 1075 if(!this) return 0; |
67
61c0ee1bbb7a
Moved get_current_nav_pci into dvdnac.c, changed example to use it instead of 'home-rolled'
richwareham
parents:
66
diff
changeset
|
1076 return &this->pci; |
61c0ee1bbb7a
Moved get_current_nav_pci into dvdnac.c, changed example to use it instead of 'home-rolled'
richwareham
parents:
66
diff
changeset
|
1077 } |
61c0ee1bbb7a
Moved get_current_nav_pci into dvdnac.c, changed example to use it instead of 'home-rolled'
richwareham
parents:
66
diff
changeset
|
1078 |
66
2bd4a78eefce
Patch from aschultz@cs.uni-magdeburg.de to allow for still-frame 'peek-ahead'
richwareham
parents:
60
diff
changeset
|
1079 dsi_t* dvdnav_get_current_nav_dsi(dvdnav_t *this) { |
114 | 1080 if(!this) return 0; |
66
2bd4a78eefce
Patch from aschultz@cs.uni-magdeburg.de to allow for still-frame 'peek-ahead'
richwareham
parents:
60
diff
changeset
|
1081 return &this->dsi; |
2bd4a78eefce
Patch from aschultz@cs.uni-magdeburg.de to allow for still-frame 'peek-ahead'
richwareham
parents:
60
diff
changeset
|
1082 } |
2bd4a78eefce
Patch from aschultz@cs.uni-magdeburg.de to allow for still-frame 'peek-ahead'
richwareham
parents:
60
diff
changeset
|
1083 |
2bd4a78eefce
Patch from aschultz@cs.uni-magdeburg.de to allow for still-frame 'peek-ahead'
richwareham
parents:
60
diff
changeset
|
1084 uint32_t dvdnav_get_next_still_flag(dvdnav_t *this) { |
114 | 1085 if(!this) return -1; |
66
2bd4a78eefce
Patch from aschultz@cs.uni-magdeburg.de to allow for still-frame 'peek-ahead'
richwareham
parents:
60
diff
changeset
|
1086 return this->position_next.still; |
2bd4a78eefce
Patch from aschultz@cs.uni-magdeburg.de to allow for still-frame 'peek-ahead'
richwareham
parents:
60
diff
changeset
|
1087 } |
2bd4a78eefce
Patch from aschultz@cs.uni-magdeburg.de to allow for still-frame 'peek-ahead'
richwareham
parents:
60
diff
changeset
|
1088 |
262 | 1089 user_ops_t dvdnav_get_restrictions(dvdnav_t* this) { |
1090 /* | |
1091 * user_ops_t is a structure of 32 bits. We want to compute | |
1092 * the union of two of those bitfields so to make this quicker | |
1093 * than performing 32 ORs, we will access them as 32bits words. | |
1094 */ | |
264 | 1095 union { |
1096 user_ops_t ops_struct; | |
1097 uint32_t ops_int; | |
1098 } ops; | |
1099 | |
1100 ops.ops_int = 0; | |
262 | 1101 |
263 | 1102 if(!this) { |
1103 printerr("Passed a NULL pointer."); | |
264 | 1104 return ops.ops_struct; |
263 | 1105 } |
1106 if(!this->started) { | |
1107 printerr("Virtual DVD machine not started."); | |
264 | 1108 return ops.ops_struct; |
263 | 1109 } |
1110 | |
1111 pthread_mutex_lock(&this->vm_lock); | |
264 | 1112 ops.ops_int |= *(uint32_t*)&this->pci.pci_gi.vobu_uop_ctl; |
262 | 1113 |
1114 if(this->vm && this->vm->state.pgc) | |
264 | 1115 ops.ops_int |= *(uint32_t*)&this->vm->state.pgc->prohibited_ops; |
263 | 1116 pthread_mutex_unlock(&this->vm_lock); |
262 | 1117 |
264 | 1118 return ops.ops_struct; |
262 | 1119 } |