Mercurial > libdvdnav.hg
annotate searching.c @ 118:48ba92648842 src
current versions of libdvdread use a nav_types.h we cannot use any more, because the
structures differ from what is actually on the disc -> provide a private copy
author | mroi |
---|---|
date | Thu, 06 Mar 2003 22:43:52 +0000 |
parents | b6834e6359cf |
children | bd8601b74c3d |
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 | |
114 | 28 #include <assert.h> |
29 | |
0 | 30 #include "dvdnav_internal.h" |
31 | |
32 #include "vm.h" | |
118
48ba92648842
current versions of libdvdread use a nav_types.h we cannot use any more, because the
mroi
parents:
114
diff
changeset
|
33 #include "nav_types.h" |
0 | 34 |
114 | 35 /* |
36 #define LOG_DEBUG | |
37 */ | |
38 | |
0 | 39 /* Searching API calls */ |
40 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
41 dvdnav_status_t dvdnav_time_search(dvdnav_t *this, |
0 | 42 unsigned long int time) { |
114 | 43 /* FIXME: Time search the current PGC based on the xxx table */ |
0 | 44 return S_OK; |
45 } | |
46 | |
24 | 47 /* Scan the ADMAP for a particular block number. */ |
48 /* Return placed in vobu. */ | |
49 /* Returns error status */ | |
114 | 50 /* FIXME: Maybe need to handle seeking outside current cell. */ |
51 static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int32_t domain, int32_t seekto_block, int32_t *vobu) { | |
24 | 52 vobu_admap_t *admap = NULL; |
114 | 53 |
54 #ifdef LOG_DEBUG | |
55 fprintf(MSG_OUT, "libdvdnav: Seeking to target %u ...\n", seekto_block); | |
56 #endif | |
24 | 57 *vobu = -1; |
58 | |
59 /* Search through the VOBU_ADMAP for the nearest VOBU | |
60 * to the target block */ | |
61 switch(domain) { | |
114 | 62 case FP_DOMAIN: |
63 case VMGM_DOMAIN: | |
64 admap = this->vm->vmgi->menu_vobu_admap; | |
65 break; | |
66 case VTSM_DOMAIN: | |
67 admap = this->vm->vtsi->menu_vobu_admap; | |
68 break; | |
69 case VTS_DOMAIN: | |
70 admap = this->vm->vtsi->vts_vobu_admap; | |
71 break; | |
72 default: | |
73 fprintf(MSG_OUT, "libdvdnav: Error: Unknown domain for seeking.\n"); | |
24 | 74 } |
75 if(admap) { | |
76 int32_t address = 0; | |
77 int32_t vobu_start, next_vobu; | |
78 int found = 0; | |
79 | |
80 /* Search through ADMAP for best sector */ | |
81 vobu_start = 0x3fffffff; | |
82 /* FIXME: Implement a faster search algorithm */ | |
83 while((!found) && ((address<<2) < admap->last_byte)) { | |
84 next_vobu = admap->vobu_start_sectors[address]; | |
85 | |
76 | 86 /* fprintf(MSG_OUT, "libdvdnav: Found block %u\n", next_vobu); */ |
24 | 87 |
88 if(vobu_start <= seekto_block && | |
89 next_vobu > seekto_block) { | |
90 found = 1; | |
91 } else { | |
92 vobu_start = next_vobu; | |
93 } | |
94 address ++; | |
95 } | |
96 if(found) { | |
97 *vobu = vobu_start; | |
98 return S_OK; | |
99 } else { | |
76 | 100 fprintf(MSG_OUT, "libdvdnav: Could not locate block\n"); |
24 | 101 return S_ERR; |
102 } | |
103 } | |
76 | 104 fprintf(MSG_OUT, "libdvdnav: admap not located\n"); |
24 | 105 return S_ERR; |
106 } | |
107 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
108 dvdnav_status_t dvdnav_sector_search(dvdnav_t *this, |
114 | 109 unsigned long int offset, int origin) { |
0 | 110 uint32_t target = 0; |
111 uint32_t length = 0; | |
114 | 112 uint32_t first_cell_nr, last_cell_nr, cell_nr; |
0 | 113 int found; |
114 | 114 cell_playback_t *cell; |
0 | 115 dvd_state_t *state; |
116 dvdnav_status_t result; | |
117 | |
114 | 118 if(this->position_current.still != 0) { |
119 printerr("Cannot seek in a still frame."); | |
120 return S_ERR; | |
121 } | |
0 | 122 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
123 result = dvdnav_get_position(this, &target, &length); |
114 | 124 #ifdef LOG_DEBUG |
125 fprintf(MSG_OUT, "libdvdnav: seeking to offset=%lu pos=%u length=%u\n", offset, target, length); | |
126 fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN); | |
127 #endif | |
0 | 128 if(!result) { |
114 | 129 return S_ERR; |
0 | 130 } |
131 | |
114 | 132 pthread_mutex_lock(&this->vm_lock); |
133 state = &(this->vm->state); | |
134 if(!state->pgc) { | |
135 printerr("No current PGC."); | |
136 pthread_mutex_unlock(&this->vm_lock); | |
137 return S_ERR; | |
138 } | |
139 | |
0 | 140 switch(origin) { |
141 case SEEK_SET: | |
142 if(offset > length) { | |
114 | 143 printerr("Request to seek behind end."); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
144 pthread_mutex_unlock(&this->vm_lock); |
114 | 145 return S_ERR; |
0 | 146 } |
147 target = offset; | |
148 break; | |
149 case SEEK_CUR: | |
150 if(target + offset > length) { | |
114 | 151 printerr("Request to seek behind end."); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
152 pthread_mutex_unlock(&this->vm_lock); |
114 | 153 return S_ERR; |
0 | 154 } |
155 target += offset; | |
156 break; | |
157 case SEEK_END: | |
158 if(length - offset < 0) { | |
114 | 159 printerr("Request to seek before start."); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
160 pthread_mutex_unlock(&this->vm_lock); |
114 | 161 return S_ERR; |
0 | 162 } |
163 target = length - offset; | |
102
3e6970dbe8d6
- allow seeking to offset 0 (pressing '0' in xine won't work otherwise)
mroi
parents:
90
diff
changeset
|
164 break; |
0 | 165 default: |
166 /* Error occured */ | |
114 | 167 printerr("Illegal seek mode."); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
168 pthread_mutex_unlock(&this->vm_lock); |
114 | 169 return S_ERR; |
0 | 170 } |
171 | |
172 /* First find closest cell number in program */ | |
173 first_cell_nr = state->pgc->program_map[state->pgN-1]; | |
174 if(state->pgN < state->pgc->nr_of_programs) { | |
175 last_cell_nr = state->pgc->program_map[state->pgN] - 1; | |
176 } else { | |
177 last_cell_nr = state->pgc->nr_of_cells; | |
178 } | |
179 | |
114 | 180 found = 0; |
181 target += state->pgc->cell_playback[first_cell_nr-1].first_sector; | |
0 | 182 for(cell_nr = first_cell_nr; (cell_nr <= last_cell_nr) && !found; cell_nr ++) { |
183 cell = &(state->pgc->cell_playback[cell_nr-1]); | |
184 if((cell->first_sector <= target) && (cell->last_sector >= target)) { | |
114 | 185 found = 1; |
0 | 186 state->cellN = cell_nr; |
187 state->blockN = 0; | |
114 | 188 state->cell_restart++; |
0 | 189 } |
190 } | |
191 | |
114 | 192 if(found) { |
26 | 193 int32_t vobu, start; |
114 | 194 #ifdef LOG_DEBUG |
76 | 195 fprintf(MSG_OUT, "libdvdnav: Seeking to cell %i from choice of %i to %i\n", |
114 | 196 state->cellN, first_cell_nr, last_cell_nr); |
197 #endif | |
198 dvdnav_scan_admap(this, state->domain, target, &vobu); | |
199 start = state->pgc->cell_playback[state->cellN - 1].first_sector; | |
200 #ifdef LOG_DEBUG | |
201 fprintf(MSG_OUT, "libdvdnav: After cellN=%u blockN=%u target=%x vobu=%x start=%x\n" , | |
0 | 202 state->cellN, |
24 | 203 state->blockN, |
204 target, | |
205 vobu, | |
206 start); | |
114 | 207 #endif |
208 state->blockN = vobu - start; | |
209 #ifdef LOG_DEBUG | |
210 fprintf(MSG_OUT, "libdvdnav: After vobu=%x start=%x blockN=%x\n" , | |
24 | 211 vobu, |
212 start, | |
0 | 213 state->blockN); |
114 | 214 #endif |
215 this->vm->hop_channel += HOP_SEEK; | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
216 pthread_mutex_unlock(&this->vm_lock); |
114 | 217 return S_OK; |
0 | 218 } |
114 | 219 |
220 fprintf(MSG_OUT, "libdvdnav: Error when seeking, asked to seek outside program\n"); | |
76 | 221 fprintf(MSG_OUT, "libdvdnav: FIXME: Implement seeking to location %u\n", target); |
114 | 222 printerr("Error when seeking."); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
223 pthread_mutex_unlock(&this->vm_lock); |
114 | 224 return S_ERR; |
0 | 225 } |
226 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
227 dvdnav_status_t dvdnav_part_search(dvdnav_t *this, int part) { |
114 | 228 int title, old_part; |
229 | |
230 if (dvdnav_current_title_info(this, &title, &old_part) == S_OK) | |
231 return dvdnav_part_play(this, title, part); | |
232 return S_ERR; | |
0 | 233 } |
234 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
235 dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *this) { |
68
3b45c78f061e
Some NULL-pointer check from aschultz@cs.uni-magdeburg.de
richwareham
parents:
63
diff
changeset
|
236 |
114 | 237 if(!this) { |
238 printerr("Passed a NULL pointer."); | |
68
3b45c78f061e
Some NULL-pointer check from aschultz@cs.uni-magdeburg.de
richwareham
parents:
63
diff
changeset
|
239 return S_ERR; |
114 | 240 } |
241 | |
242 pthread_mutex_lock(&this->vm_lock); | |
243 if(!this->vm->state.pgc) { | |
244 printerr("No current PGC."); | |
245 pthread_mutex_unlock(&this->vm_lock); | |
246 return S_ERR; | |
247 } | |
68
3b45c78f061e
Some NULL-pointer check from aschultz@cs.uni-magdeburg.de
richwareham
parents:
63
diff
changeset
|
248 |
114 | 249 #ifdef LOG_DEBUG |
113 | 250 fprintf(MSG_OUT, "libdvdnav: previous chapter\n"); |
114 | 251 #endif |
252 if (!vm_jump_prev_pg(this->vm)) { | |
253 fprintf(MSG_OUT, "libdvdnav: previous chapter failed.\n"); | |
254 printerr("Skip to previous chapter failed."); | |
102
3e6970dbe8d6
- allow seeking to offset 0 (pressing '0' in xine won't work otherwise)
mroi
parents:
90
diff
changeset
|
255 pthread_mutex_unlock(&this->vm_lock); |
0 | 256 return S_ERR; |
257 } | |
102
3e6970dbe8d6
- allow seeking to offset 0 (pressing '0' in xine won't work otherwise)
mroi
parents:
90
diff
changeset
|
258 this->position_current.still = 0; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
259 this->vm->hop_channel++; |
114 | 260 #ifdef LOG_DEBUG |
76 | 261 fprintf(MSG_OUT, "libdvdnav: previous chapter done\n"); |
114 | 262 #endif |
102
3e6970dbe8d6
- allow seeking to offset 0 (pressing '0' in xine won't work otherwise)
mroi
parents:
90
diff
changeset
|
263 pthread_mutex_unlock(&this->vm_lock); |
0 | 264 |
265 return S_OK; | |
266 } | |
267 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
268 dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *this) { |
0 | 269 |
114 | 270 if(!this) { |
271 printerr("Passed a NULL pointer."); | |
68
3b45c78f061e
Some NULL-pointer check from aschultz@cs.uni-magdeburg.de
richwareham
parents:
63
diff
changeset
|
272 return S_ERR; |
114 | 273 } |
68
3b45c78f061e
Some NULL-pointer check from aschultz@cs.uni-magdeburg.de
richwareham
parents:
63
diff
changeset
|
274 |
114 | 275 pthread_mutex_lock(&this->vm_lock); |
276 if(!this->vm->state.pgc) { | |
277 printerr("No current PGC."); | |
278 pthread_mutex_unlock(&this->vm_lock); | |
279 return S_ERR; | |
280 } | |
68
3b45c78f061e
Some NULL-pointer check from aschultz@cs.uni-magdeburg.de
richwareham
parents:
63
diff
changeset
|
281 |
114 | 282 #ifdef LOG_DEBUG |
283 fprintf(MSG_OUT, "libdvdnav: top chapter\n"); | |
284 #endif | |
285 if (!vm_jump_top_pg(this->vm)) { | |
286 fprintf(MSG_OUT, "libdvdnav: top chapter failed.\n"); | |
287 printerr("Skip to top chapter failed."); | |
113 | 288 pthread_mutex_unlock(&this->vm_lock); |
289 return S_ERR; | |
0 | 290 } |
102
3e6970dbe8d6
- allow seeking to offset 0 (pressing '0' in xine won't work otherwise)
mroi
parents:
90
diff
changeset
|
291 this->position_current.still = 0; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
292 this->vm->hop_channel++; |
114 | 293 #ifdef LOG_DEBUG |
294 fprintf(MSG_OUT, "libdvdnav: top chapter done\n"); | |
295 #endif | |
296 pthread_mutex_unlock(&this->vm_lock); | |
297 | |
298 return S_OK; | |
299 } | |
300 | |
301 dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *this) { | |
302 | |
303 if(!this) { | |
304 printerr("Passed a NULL pointer."); | |
305 return S_ERR; | |
306 } | |
307 | |
308 pthread_mutex_lock(&this->vm_lock); | |
309 if(!this->vm->state.pgc) { | |
310 printerr("No current PGC."); | |
311 pthread_mutex_unlock(&this->vm_lock); | |
312 return S_ERR; | |
313 } | |
314 | |
315 #ifdef LOG_DEBUG | |
316 fprintf(MSG_OUT, "libdvdnav: next chapter\n"); | |
317 #endif | |
318 if (!vm_jump_next_pg(this->vm)) { | |
319 fprintf(MSG_OUT, "libdvdnav: next chapter failed.\n"); | |
320 printerr("Skip to next chapter failed."); | |
321 pthread_mutex_unlock(&this->vm_lock); | |
322 return S_ERR; | |
323 } | |
324 this->position_current.still = 0; | |
325 this->vm->hop_channel++; | |
326 #ifdef LOG_DEBUG | |
76 | 327 fprintf(MSG_OUT, "libdvdnav: next chapter done\n"); |
114 | 328 #endif |
102
3e6970dbe8d6
- allow seeking to offset 0 (pressing '0' in xine won't work otherwise)
mroi
parents:
90
diff
changeset
|
329 pthread_mutex_unlock(&this->vm_lock); |
0 | 330 |
331 return S_OK; | |
332 } | |
333 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
334 dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) { |
114 | 335 |
336 if(!this) { | |
337 printerr("Passed a NULL pointer."); | |
0 | 338 return S_ERR; |
339 } | |
340 | |
114 | 341 pthread_mutex_lock(&this->vm_lock); |
342 if(!this->vm->state.pgc) { | |
343 printerr("No current PGC."); | |
344 pthread_mutex_unlock(&this->vm_lock); | |
345 return S_ERR; | |
346 } | |
347 | |
348 if (vm_jump_menu(this->vm, menu)) { | |
349 this->vm->hop_channel++; | |
350 pthread_mutex_unlock(&this->vm_lock); | |
351 return S_OK; | |
352 } else { | |
353 printerr("No such menu."); | |
354 pthread_mutex_unlock(&this->vm_lock); | |
355 return S_ERR; | |
356 } | |
0 | 357 } |
358 | |
114 | 359 dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos, |
0 | 360 unsigned int *len) { |
361 uint32_t cur_sector; | |
362 uint32_t first_cell_nr; | |
363 uint32_t last_cell_nr; | |
364 cell_playback_t *first_cell; | |
365 cell_playback_t *last_cell; | |
366 dvd_state_t *state; | |
114 | 367 |
368 if(!this || !pos || !len) { | |
369 printerr("Passed a NULL pointer."); | |
370 return S_ERR; | |
371 } | |
372 if(!this->started) { | |
373 printerr("Virtual DVD machine not started."); | |
374 return S_ERR; | |
375 } | |
376 | |
377 pthread_mutex_lock(&this->vm_lock); | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
378 state = &(this->vm->state); |
114 | 379 if(!state->pgc) { |
380 printerr("No current PGC."); | |
381 pthread_mutex_unlock(&this->vm_lock); | |
382 return S_ERR; | |
0 | 383 } |
114 | 384 |
0 | 385 /* Get current sector */ |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
386 cur_sector = this->vobu.vobu_start + this->vobu.blockN; |
0 | 387 |
388 /* Find start cell of program. */ | |
389 first_cell_nr = state->pgc->program_map[state->pgN-1]; | |
390 first_cell = &(state->pgc->cell_playback[first_cell_nr-1]); | |
114 | 391 |
392 /* Find end cell of program */ | |
0 | 393 if(state->pgN < state->pgc->nr_of_programs) { |
394 last_cell_nr = state->pgc->program_map[state->pgN] - 1; | |
395 } else { | |
396 last_cell_nr = state->pgc->nr_of_cells; | |
397 } | |
398 last_cell = &(state->pgc->cell_playback[last_cell_nr-1]); | |
399 | |
400 *pos= cur_sector - first_cell->first_sector; | |
401 *len= last_cell->last_sector - first_cell->first_sector; | |
114 | 402 pthread_mutex_unlock(&this->vm_lock); |
0 | 403 |
404 return S_OK; | |
405 } | |
406 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
407 dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *this, |
8
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
408 unsigned int *pos, |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
409 unsigned int *len) { |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
410 uint32_t cur_sector; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
411 uint32_t first_cell_nr; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
412 uint32_t last_cell_nr; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
413 cell_playback_t *first_cell; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
414 cell_playback_t *last_cell; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
415 dvd_state_t *state; |
114 | 416 |
417 if(!this || !pos || !len) { | |
418 printerr("Passed a NULL pointer."); | |
8
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
419 return S_ERR; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
420 } |
114 | 421 |
422 state = &(this->vm->state); | |
423 if(!state->pgc) { | |
424 printerr("No current PGC."); | |
425 return S_ERR; | |
426 } | |
427 | |
8
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
428 /* Get current sector */ |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
429 cur_sector = this->vobu.vobu_start + this->vobu.blockN; |
8
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
430 |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
431 /* Now find first and last cells in title. */ |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
432 first_cell_nr = state->pgc->program_map[0]; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
433 first_cell = &(state->pgc->cell_playback[first_cell_nr-1]); |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
434 last_cell_nr = state->pgc->nr_of_cells; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
435 last_cell = &(state->pgc->cell_playback[last_cell_nr-1]); |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
436 |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
437 *pos = cur_sector - first_cell->first_sector; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
438 *len = last_cell->last_sector - first_cell->first_sector; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
439 |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
440 return S_OK; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
441 } |