Mercurial > libdvdnav.hg
annotate searching.c @ 22:3c1df0cb3aee src
Start of rewrite of libdvdnav. Still need to re-implement seeking.
author | jcdutton |
---|---|
date | Mon, 22 Apr 2002 22:01:28 +0000 |
parents | 66708b4a1b5e |
children | 870a0a1eee41 |
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 | |
28 #include <dvdnav.h> | |
29 #include "dvdnav_internal.h" | |
30 | |
31 #include "vm.h" | |
32 #include <dvdread/nav_types.h> | |
33 | |
34 /* Searching API calls */ | |
35 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
36 dvdnav_status_t dvdnav_time_search(dvdnav_t *this, |
0 | 37 unsigned long int time) { |
38 /* Time search the current PGC based on the xxx table */ | |
39 return S_OK; | |
40 } | |
41 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
42 dvdnav_status_t dvdnav_sector_search(dvdnav_t *this, |
0 | 43 unsigned long int offset, int origin) { |
44 /* FIXME: Implement */ | |
45 | |
46 uint32_t target = 0; | |
47 uint32_t length = 0; | |
48 uint32_t first_cell_nr, last_cell_nr, cell_nr, fnd_cell_nr; | |
49 int found; | |
50 cell_playback_t *cell, *fnd_cell; | |
51 dvd_state_t *state; | |
52 dvdnav_status_t result; | |
53 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
54 if((!this) || (!this->vm) ) |
0 | 55 return -1; |
56 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
57 state = &(this->vm->state); |
0 | 58 if((!state) || (!state->pgc) ) |
59 return -1; | |
60 | |
61 if(offset == 0) | |
62 return -1; | |
63 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
64 if(this->position_current.still != 0) |
0 | 65 /* Cannot do seeking in a still frame. */ |
66 return -1; | |
67 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
68 pthread_mutex_lock(&this->vm_lock); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
69 result = dvdnav_get_position(this, &target, &length); |
0 | 70 fprintf(stderr,"FIXME: seeking to offset=%lu pos=%u length=%u\n", offset, target, length); |
71 fprintf(stderr,"FIXME: Before cellN=%u blockN=%u\n" , | |
72 state->cellN, | |
73 state->blockN); | |
74 if(!result) { | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
75 pthread_mutex_unlock(&this->vm_lock); |
0 | 76 return -1; |
77 } | |
78 | |
79 switch(origin) { | |
80 case SEEK_SET: | |
81 if(offset > length) { | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
82 pthread_mutex_unlock(&this->vm_lock); |
0 | 83 return -1; |
84 } | |
85 target = offset; | |
86 break; | |
87 case SEEK_CUR: | |
88 if(target + offset > length) { | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
89 pthread_mutex_unlock(&this->vm_lock); |
0 | 90 return -1; |
91 } | |
92 target += offset; | |
93 break; | |
94 case SEEK_END: | |
95 if(length - offset < 0) { | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
96 pthread_mutex_unlock(&this->vm_lock); |
0 | 97 return -1; |
98 } | |
99 target = length - offset; | |
100 default: | |
101 /* Error occured */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
102 pthread_mutex_unlock(&this->vm_lock); |
0 | 103 return -1; |
104 } | |
105 | |
106 /* First find closest cell number in program */ | |
107 first_cell_nr = state->pgc->program_map[state->pgN-1]; | |
108 if(state->pgN < state->pgc->nr_of_programs) { | |
109 last_cell_nr = state->pgc->program_map[state->pgN] - 1; | |
110 } else { | |
111 last_cell_nr = state->pgc->nr_of_cells; | |
112 } | |
113 | |
114 found = 0; target += state->pgc->cell_playback[first_cell_nr-1].first_sector; | |
115 fnd_cell_nr = last_cell_nr + 1; | |
116 for(cell_nr = first_cell_nr; (cell_nr <= last_cell_nr) && !found; cell_nr ++) { | |
117 cell = &(state->pgc->cell_playback[cell_nr-1]); | |
118 if((cell->first_sector <= target) && (cell->last_sector >= target)) { | |
119 state->cellN = cell_nr; | |
120 state->blockN = 0; | |
121 found = 1; | |
122 fnd_cell_nr = cell_nr; | |
123 fnd_cell = cell; | |
124 } | |
125 } | |
126 | |
127 if(fnd_cell_nr <= last_cell_nr) { | |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
128 fprintf(stderr,"Seeking to cell %i from choice of %i to %i\n", |
0 | 129 fnd_cell_nr, first_cell_nr, last_cell_nr); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
130 this->seekto_block = target; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
131 this->seeking = 1; |
0 | 132 /* |
133 * Clut does not actually change, | |
134 * but as the decoders have been closed then opened, | |
135 * A new clut has to be sent. | |
136 */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
137 this->spu_clut_changed = 1; |
0 | 138 //ogle_do_post_jump(ogle); |
139 fprintf(stderr,"FIXME: After cellN=%u blockN=%u\n" , | |
140 state->cellN, | |
141 state->blockN); | |
142 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
143 pthread_mutex_unlock(&this->vm_lock); |
0 | 144 return target; |
145 } else { | |
146 fprintf(stderr, "Error when seeking, asked to seek outside program\n"); | |
147 } | |
148 | |
149 | |
150 | |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
151 fprintf(stderr,"FIXME: Implement seeking to location %u\n", target); |
0 | 152 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
153 // this->seekto_block=target; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
154 // this->seeking = 1; |
0 | 155 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
156 pthread_mutex_unlock(&this->vm_lock); |
0 | 157 return -1; |
158 } | |
159 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
160 dvdnav_status_t dvdnav_part_search(dvdnav_t *this, int part) { |
0 | 161 return S_OK; |
162 } | |
163 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
164 dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *this) { |
0 | 165 dvd_state_t *state; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
166 state = &(this->vm->state); |
0 | 167 /* Make sure this is not the first chapter */ |
168 | |
169 if(state->pgN <= 1 ) { | |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
170 fprintf(stderr,"dvdnav: at first chapter. prev chapter failed.\n"); |
0 | 171 return S_ERR; |
172 } | |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
173 fprintf(stderr,"dvdnav: previous chapter\n"); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
174 vm_jump_prog(this->vm, state->pgN - 1); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
175 dvdnav_do_post_jump(this); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
176 this->vm->hop_channel++; |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
177 fprintf(stderr,"dvdnav: previous chapter done\n"); |
0 | 178 |
179 return S_OK; | |
180 } | |
181 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
182 dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *this) { |
0 | 183 |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
184 fprintf(stderr,"dvdnav: top chapter. NOP.\n"); |
0 | 185 |
186 return S_OK; | |
187 } | |
188 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
189 dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *this) { |
0 | 190 dvd_state_t *state; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
191 state = &(this->vm->state); |
0 | 192 /* Make sure this is not the last chapter */ |
193 if(state->pgN >= state->pgc->nr_of_programs) { | |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
194 fprintf(stderr,"dvdnav: at last chapter. next chapter failed.\n"); |
0 | 195 return S_ERR; |
196 } | |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
197 fprintf(stderr,"dvdnav: next chapter\n"); |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
198 vm_jump_prog(this->vm, state->pgN + 1); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
199 dvdnav_do_post_jump(this); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
200 this->vm->hop_channel++; |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
201 fprintf(stderr,"dvdnav: next chapter done\n"); |
0 | 202 |
203 return S_OK; | |
204 } | |
205 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
206 dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) { |
0 | 207 dvd_state_t *state; |
208 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
209 pthread_mutex_lock(&this->vm_lock); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
210 state = &(this->vm->state); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
211 vm_menu_call(this->vm, menu, 0); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
212 dvdnav_do_post_jump(this); |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
213 pthread_mutex_unlock(&this->vm_lock); |
0 | 214 return S_OK; |
215 } | |
216 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
217 dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int *tt, int *pr) { |
0 | 218 int vts_ttn = 0; |
219 int vts, i; | |
220 domain_t domain; | |
221 tt_srpt_t* srpt; | |
222 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
223 if(!this) |
0 | 224 return S_ERR; |
225 | |
226 if(!tt || !pr) { | |
227 printerr("Passed a NULL pointer"); | |
228 } | |
229 | |
230 if(tt) | |
231 *tt = -1; | |
232 if(*pr) | |
233 *pr = -1; | |
234 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
235 domain = this->vm->state.domain; |
0 | 236 if((domain == FP_DOMAIN) || (domain == VMGM_DOMAIN)) { |
237 /* Not in a title */ | |
238 return S_OK; | |
239 } | |
240 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
241 vts_ttn = this->vm->state.VTS_TTN_REG; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
242 vts = this->vm->state.vtsN; |
0 | 243 |
244 if(pr) { | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
245 *pr = this->vm->state.pgN; |
0 | 246 } |
247 | |
248 /* Search TT_SRPT for title */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
249 if(!(vm_get_vmgi(this->vm))) { |
0 | 250 printerr("Oh poo, no SRPT"); |
251 return S_ERR; | |
252 } | |
253 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
254 srpt = vm_get_vmgi(this->vm)->tt_srpt; |
0 | 255 for(i=0; i<srpt->nr_of_srpts; i++) { |
256 title_info_t* info = &(srpt->title[i]); | |
257 if((info->title_set_nr == vts) && (info->vts_ttn == vts_ttn)) { | |
258 if(tt) | |
259 *tt = i+1; | |
260 } | |
261 } | |
262 | |
263 return S_OK; | |
264 } | |
265 | |
266 static char __title_str[] = "DVDNAV"; | |
267 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
268 dvdnav_status_t dvdnav_get_title_string(dvdnav_t *this, char **title_str) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
269 if(!this) |
0 | 270 return S_ERR; |
271 | |
272 if(!title_str) { | |
273 printerr("Passed a NULL pointer"); | |
274 return S_ERR; | |
275 } | |
276 | |
277 (*title_str) = __title_str; | |
278 | |
279 return S_OK; | |
280 } | |
281 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
282 dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int* pos, |
0 | 283 unsigned int *len) { |
284 uint32_t cur_sector; | |
285 uint32_t first_cell_nr; | |
286 uint32_t last_cell_nr; | |
287 cell_playback_t *first_cell; | |
288 cell_playback_t *last_cell; | |
289 dvd_state_t *state; | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
290 if((!this) || (!this->vm) ) |
0 | 291 return 0; |
292 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
293 state = &(this->vm->state); |
0 | 294 if((!state) || (!state->pgc) ) |
295 return 0; | |
296 | |
297 /* Sanity check */ | |
298 if(state->pgN > state->pgc->nr_of_programs) { | |
299 return 0; | |
300 } | |
301 | |
302 /* Get current sector */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
303 cur_sector = this->vobu.vobu_start + this->vobu.blockN; |
0 | 304 |
305 /* Find start cell of program. */ | |
306 first_cell_nr = state->pgc->program_map[state->pgN-1]; | |
307 first_cell = &(state->pgc->cell_playback[first_cell_nr-1]); | |
308 if(state->pgN < state->pgc->nr_of_programs) { | |
309 last_cell_nr = state->pgc->program_map[state->pgN] - 1; | |
310 } else { | |
311 last_cell_nr = state->pgc->nr_of_cells; | |
312 } | |
313 last_cell = &(state->pgc->cell_playback[last_cell_nr-1]); | |
314 | |
315 *pos= cur_sector - first_cell->first_sector; | |
316 *len= last_cell->last_sector - first_cell->first_sector; | |
317 /* printf("dvdnav:searching:current pos=%u length=%u\n",*pos,*len); */ | |
318 | |
319 | |
320 return S_OK; | |
321 } | |
322 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
323 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
|
324 unsigned int *pos, |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
325 unsigned int *len) { |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
326 uint32_t cur_sector; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
327 uint32_t first_cell_nr; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
328 uint32_t last_cell_nr; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
329 cell_playback_t *first_cell; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
330 cell_playback_t *last_cell; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
331 dvd_state_t *state; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
332 if((!this) || (!this->vm) ) |
8
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
333 return S_ERR; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
334 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
335 state = &(this->vm->state); |
8
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
336 if((!state) || (!state->pgc) ) |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
337 return S_ERR; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
338 |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
339 /* Sanity check */ |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
340 if(state->pgN > state->pgc->nr_of_programs) { |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
341 return S_ERR; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
342 } |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
343 |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
344 /* Get current sector */ |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
8
diff
changeset
|
345 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
|
346 |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
347 /* 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
|
348 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
|
349 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
|
350 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
|
351 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
|
352 |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
353 *pos = cur_sector - first_cell->first_sector; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
354 *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
|
355 |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
356 return S_OK; |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
357 } |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
358 |
66708b4a1b5e
Stop C++ bitching about some things and extend the menus example
richwareham
parents:
3
diff
changeset
|
359 |