Mercurial > libdvdnav.hg
comparison searching.c @ 193:b80dff4bef76 src
Remove all references to S_OK and S_ERR.
DVDNAV_STATUS_OK will always be 1.
DVDNAV_STATUS_ERR will always be 0.
author | jcdutton |
---|---|
date | Sun, 11 May 2003 00:25:24 +0000 |
parents | 5d9770cb2961 |
children | 6b1bfe8f5283 |
comparison
equal
deleted
inserted
replaced
192:a3d7b149cc0f | 193:b80dff4bef76 |
---|---|
35 /* Searching API calls */ | 35 /* Searching API calls */ |
36 | 36 |
37 dvdnav_status_t dvdnav_time_search(dvdnav_t *this, | 37 dvdnav_status_t dvdnav_time_search(dvdnav_t *this, |
38 unsigned long int time) { | 38 unsigned long int time) { |
39 /* FIXME: Time search the current PGC based on the xxx table */ | 39 /* FIXME: Time search the current PGC based on the xxx table */ |
40 return S_OK; | 40 return DVDNAV_STATUS_OK; |
41 } | 41 } |
42 | 42 |
43 /* Scan the ADMAP for a particular block number. */ | 43 /* Scan the ADMAP for a particular block number. */ |
44 /* Return placed in vobu. */ | 44 /* Return placed in vobu. */ |
45 /* Returns error status */ | 45 /* Returns error status */ |
89 } | 89 } |
90 address ++; | 90 address ++; |
91 } | 91 } |
92 if(found) { | 92 if(found) { |
93 *vobu = vobu_start; | 93 *vobu = vobu_start; |
94 return S_OK; | 94 return DVDNAV_STATUS_OK; |
95 } else { | 95 } else { |
96 fprintf(MSG_OUT, "libdvdnav: Could not locate block\n"); | 96 fprintf(MSG_OUT, "libdvdnav: Could not locate block\n"); |
97 return S_ERR; | 97 return DVDNAV_STATUS_ERR; |
98 } | 98 } |
99 } | 99 } |
100 fprintf(MSG_OUT, "libdvdnav: admap not located\n"); | 100 fprintf(MSG_OUT, "libdvdnav: admap not located\n"); |
101 return S_ERR; | 101 return DVDNAV_STATUS_ERR; |
102 } | 102 } |
103 | 103 |
104 dvdnav_status_t dvdnav_sector_search(dvdnav_t *this, | 104 dvdnav_status_t dvdnav_sector_search(dvdnav_t *this, |
105 unsigned long int offset, int origin) { | 105 unsigned long int offset, int origin) { |
106 uint32_t target = 0; | 106 uint32_t target = 0; |
111 dvd_state_t *state; | 111 dvd_state_t *state; |
112 dvdnav_status_t result; | 112 dvdnav_status_t result; |
113 | 113 |
114 if(this->position_current.still != 0) { | 114 if(this->position_current.still != 0) { |
115 printerr("Cannot seek in a still frame."); | 115 printerr("Cannot seek in a still frame."); |
116 return S_ERR; | 116 return DVDNAV_STATUS_ERR; |
117 } | 117 } |
118 | 118 |
119 result = dvdnav_get_position(this, &target, &length); | 119 result = dvdnav_get_position(this, &target, &length); |
120 if(!result) { | 120 if(!result) { |
121 return S_ERR; | 121 return DVDNAV_STATUS_ERR; |
122 } | 122 } |
123 | 123 |
124 pthread_mutex_lock(&this->vm_lock); | 124 pthread_mutex_lock(&this->vm_lock); |
125 state = &(this->vm->state); | 125 state = &(this->vm->state); |
126 if(!state->pgc) { | 126 if(!state->pgc) { |
127 printerr("No current PGC."); | 127 printerr("No current PGC."); |
128 pthread_mutex_unlock(&this->vm_lock); | 128 pthread_mutex_unlock(&this->vm_lock); |
129 return S_ERR; | 129 return DVDNAV_STATUS_ERR; |
130 } | 130 } |
131 #ifdef LOG_DEBUG | 131 #ifdef LOG_DEBUG |
132 fprintf(MSG_OUT, "libdvdnav: seeking to offset=%lu pos=%u length=%u\n", offset, target, length); | 132 fprintf(MSG_OUT, "libdvdnav: seeking to offset=%lu pos=%u length=%u\n", offset, target, length); |
133 fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN); | 133 fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN); |
134 #endif | 134 #endif |
136 switch(origin) { | 136 switch(origin) { |
137 case SEEK_SET: | 137 case SEEK_SET: |
138 if(offset > length) { | 138 if(offset > length) { |
139 printerr("Request to seek behind end."); | 139 printerr("Request to seek behind end."); |
140 pthread_mutex_unlock(&this->vm_lock); | 140 pthread_mutex_unlock(&this->vm_lock); |
141 return S_ERR; | 141 return DVDNAV_STATUS_ERR; |
142 } | 142 } |
143 target = offset; | 143 target = offset; |
144 break; | 144 break; |
145 case SEEK_CUR: | 145 case SEEK_CUR: |
146 if(target + offset > length) { | 146 if(target + offset > length) { |
147 printerr("Request to seek behind end."); | 147 printerr("Request to seek behind end."); |
148 pthread_mutex_unlock(&this->vm_lock); | 148 pthread_mutex_unlock(&this->vm_lock); |
149 return S_ERR; | 149 return DVDNAV_STATUS_ERR; |
150 } | 150 } |
151 target += offset; | 151 target += offset; |
152 break; | 152 break; |
153 case SEEK_END: | 153 case SEEK_END: |
154 if(length - offset < 0) { | 154 if(length - offset < 0) { |
155 printerr("Request to seek before start."); | 155 printerr("Request to seek before start."); |
156 pthread_mutex_unlock(&this->vm_lock); | 156 pthread_mutex_unlock(&this->vm_lock); |
157 return S_ERR; | 157 return DVDNAV_STATUS_ERR; |
158 } | 158 } |
159 target = length - offset; | 159 target = length - offset; |
160 break; | 160 break; |
161 default: | 161 default: |
162 /* Error occured */ | 162 /* Error occured */ |
163 printerr("Illegal seek mode."); | 163 printerr("Illegal seek mode."); |
164 pthread_mutex_unlock(&this->vm_lock); | 164 pthread_mutex_unlock(&this->vm_lock); |
165 return S_ERR; | 165 return DVDNAV_STATUS_ERR; |
166 } | 166 } |
167 | 167 |
168 if (this->pgc_based) { | 168 if (this->pgc_based) { |
169 first_cell_nr = 1; | 169 first_cell_nr = 1; |
170 last_cell_nr = state->pgc->nr_of_cells; | 170 last_cell_nr = state->pgc->nr_of_cells; |
196 int32_t vobu; | 196 int32_t vobu; |
197 #ifdef LOG_DEBUG | 197 #ifdef LOG_DEBUG |
198 fprintf(MSG_OUT, "libdvdnav: Seeking to cell %i from choice of %i to %i\n", | 198 fprintf(MSG_OUT, "libdvdnav: Seeking to cell %i from choice of %i to %i\n", |
199 cell_nr, first_cell_nr, last_cell_nr); | 199 cell_nr, first_cell_nr, last_cell_nr); |
200 #endif | 200 #endif |
201 if (dvdnav_scan_admap(this, state->domain, target, &vobu) == S_OK) { | 201 if (dvdnav_scan_admap(this, state->domain, target, &vobu) == DVDNAV_STATUS_OK) { |
202 int32_t start = state->pgc->cell_playback[cell_nr-1].first_sector; | 202 int32_t start = state->pgc->cell_playback[cell_nr-1].first_sector; |
203 | 203 |
204 if (vm_jump_cell_block(this->vm, cell_nr, vobu - start)) { | 204 if (vm_jump_cell_block(this->vm, cell_nr, vobu - start)) { |
205 #ifdef LOG_DEBUG | 205 #ifdef LOG_DEBUG |
206 fprintf(MSG_OUT, "libdvdnav: After cellN=%u blockN=%u target=%x vobu=%x start=%x\n" , | 206 fprintf(MSG_OUT, "libdvdnav: After cellN=%u blockN=%u target=%x vobu=%x start=%x\n" , |
207 state->cellN, state->blockN, target, vobu, start); | 207 state->cellN, state->blockN, target, vobu, start); |
208 #endif | 208 #endif |
209 this->vm->hop_channel += HOP_SEEK; | 209 this->vm->hop_channel += HOP_SEEK; |
210 pthread_mutex_unlock(&this->vm_lock); | 210 pthread_mutex_unlock(&this->vm_lock); |
211 return S_OK; | 211 return DVDNAV_STATUS_OK; |
212 } | 212 } |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 fprintf(MSG_OUT, "libdvdnav: Error when seeking\n"); | 216 fprintf(MSG_OUT, "libdvdnav: Error when seeking\n"); |
217 fprintf(MSG_OUT, "libdvdnav: FIXME: Implement seeking to location %u\n", target); | 217 fprintf(MSG_OUT, "libdvdnav: FIXME: Implement seeking to location %u\n", target); |
218 printerr("Error when seeking."); | 218 printerr("Error when seeking."); |
219 pthread_mutex_unlock(&this->vm_lock); | 219 pthread_mutex_unlock(&this->vm_lock); |
220 return S_ERR; | 220 return DVDNAV_STATUS_ERR; |
221 } | 221 } |
222 | 222 |
223 dvdnav_status_t dvdnav_part_search(dvdnav_t *this, int part) { | 223 dvdnav_status_t dvdnav_part_search(dvdnav_t *this, int part) { |
224 int title, old_part; | 224 int title, old_part; |
225 | 225 |
226 if (dvdnav_current_title_info(this, &title, &old_part) == S_OK) | 226 if (dvdnav_current_title_info(this, &title, &old_part) == DVDNAV_STATUS_OK) |
227 return dvdnav_part_play(this, title, part); | 227 return dvdnav_part_play(this, title, part); |
228 return S_ERR; | 228 return DVDNAV_STATUS_ERR; |
229 } | 229 } |
230 | 230 |
231 dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *this) { | 231 dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *this) { |
232 | 232 |
233 if(!this) { | 233 if(!this) { |
234 printerr("Passed a NULL pointer."); | 234 printerr("Passed a NULL pointer."); |
235 return S_ERR; | 235 return DVDNAV_STATUS_ERR; |
236 } | 236 } |
237 | 237 |
238 pthread_mutex_lock(&this->vm_lock); | 238 pthread_mutex_lock(&this->vm_lock); |
239 if(!this->vm->state.pgc) { | 239 if(!this->vm->state.pgc) { |
240 printerr("No current PGC."); | 240 printerr("No current PGC."); |
241 pthread_mutex_unlock(&this->vm_lock); | 241 pthread_mutex_unlock(&this->vm_lock); |
242 return S_ERR; | 242 return DVDNAV_STATUS_ERR; |
243 } | 243 } |
244 | 244 |
245 #ifdef LOG_DEBUG | 245 #ifdef LOG_DEBUG |
246 fprintf(MSG_OUT, "libdvdnav: previous chapter\n"); | 246 fprintf(MSG_OUT, "libdvdnav: previous chapter\n"); |
247 #endif | 247 #endif |
248 if (!vm_jump_prev_pg(this->vm)) { | 248 if (!vm_jump_prev_pg(this->vm)) { |
249 fprintf(MSG_OUT, "libdvdnav: previous chapter failed.\n"); | 249 fprintf(MSG_OUT, "libdvdnav: previous chapter failed.\n"); |
250 printerr("Skip to previous chapter failed."); | 250 printerr("Skip to previous chapter failed."); |
251 pthread_mutex_unlock(&this->vm_lock); | 251 pthread_mutex_unlock(&this->vm_lock); |
252 return S_ERR; | 252 return DVDNAV_STATUS_ERR; |
253 } | 253 } |
254 this->position_current.still = 0; | 254 this->position_current.still = 0; |
255 this->vm->hop_channel++; | 255 this->vm->hop_channel++; |
256 #ifdef LOG_DEBUG | 256 #ifdef LOG_DEBUG |
257 fprintf(MSG_OUT, "libdvdnav: previous chapter done\n"); | 257 fprintf(MSG_OUT, "libdvdnav: previous chapter done\n"); |
258 #endif | 258 #endif |
259 pthread_mutex_unlock(&this->vm_lock); | 259 pthread_mutex_unlock(&this->vm_lock); |
260 | 260 |
261 return S_OK; | 261 return DVDNAV_STATUS_OK; |
262 } | 262 } |
263 | 263 |
264 dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *this) { | 264 dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *this) { |
265 | 265 |
266 if(!this) { | 266 if(!this) { |
267 printerr("Passed a NULL pointer."); | 267 printerr("Passed a NULL pointer."); |
268 return S_ERR; | 268 return DVDNAV_STATUS_ERR; |
269 } | 269 } |
270 | 270 |
271 pthread_mutex_lock(&this->vm_lock); | 271 pthread_mutex_lock(&this->vm_lock); |
272 if(!this->vm->state.pgc) { | 272 if(!this->vm->state.pgc) { |
273 printerr("No current PGC."); | 273 printerr("No current PGC."); |
274 pthread_mutex_unlock(&this->vm_lock); | 274 pthread_mutex_unlock(&this->vm_lock); |
275 return S_ERR; | 275 return DVDNAV_STATUS_ERR; |
276 } | 276 } |
277 | 277 |
278 #ifdef LOG_DEBUG | 278 #ifdef LOG_DEBUG |
279 fprintf(MSG_OUT, "libdvdnav: top chapter\n"); | 279 fprintf(MSG_OUT, "libdvdnav: top chapter\n"); |
280 #endif | 280 #endif |
281 if (!vm_jump_top_pg(this->vm)) { | 281 if (!vm_jump_top_pg(this->vm)) { |
282 fprintf(MSG_OUT, "libdvdnav: top chapter failed.\n"); | 282 fprintf(MSG_OUT, "libdvdnav: top chapter failed.\n"); |
283 printerr("Skip to top chapter failed."); | 283 printerr("Skip to top chapter failed."); |
284 pthread_mutex_unlock(&this->vm_lock); | 284 pthread_mutex_unlock(&this->vm_lock); |
285 return S_ERR; | 285 return DVDNAV_STATUS_ERR; |
286 } | 286 } |
287 this->position_current.still = 0; | 287 this->position_current.still = 0; |
288 this->vm->hop_channel++; | 288 this->vm->hop_channel++; |
289 #ifdef LOG_DEBUG | 289 #ifdef LOG_DEBUG |
290 fprintf(MSG_OUT, "libdvdnav: top chapter done\n"); | 290 fprintf(MSG_OUT, "libdvdnav: top chapter done\n"); |
291 #endif | 291 #endif |
292 pthread_mutex_unlock(&this->vm_lock); | 292 pthread_mutex_unlock(&this->vm_lock); |
293 | 293 |
294 return S_OK; | 294 return DVDNAV_STATUS_OK; |
295 } | 295 } |
296 | 296 |
297 dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *this) { | 297 dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *this) { |
298 vm_t *try_vm; | 298 vm_t *try_vm; |
299 | 299 |
300 if(!this) { | 300 if(!this) { |
301 printerr("Passed a NULL pointer."); | 301 printerr("Passed a NULL pointer."); |
302 return S_ERR; | 302 return DVDNAV_STATUS_ERR; |
303 } | 303 } |
304 | 304 |
305 pthread_mutex_lock(&this->vm_lock); | 305 pthread_mutex_lock(&this->vm_lock); |
306 if(!this->vm->state.pgc) { | 306 if(!this->vm->state.pgc) { |
307 printerr("No current PGC."); | 307 printerr("No current PGC."); |
308 pthread_mutex_unlock(&this->vm_lock); | 308 pthread_mutex_unlock(&this->vm_lock); |
309 return S_ERR; | 309 return DVDNAV_STATUS_ERR; |
310 } | 310 } |
311 | 311 |
312 #ifdef LOG_DEBUG | 312 #ifdef LOG_DEBUG |
313 fprintf(MSG_OUT, "libdvdnav: next chapter\n"); | 313 fprintf(MSG_OUT, "libdvdnav: next chapter\n"); |
314 #endif | 314 #endif |
322 if (try_vm->stopped) { | 322 if (try_vm->stopped) { |
323 vm_free_copy(try_vm); | 323 vm_free_copy(try_vm); |
324 fprintf(MSG_OUT, "libdvdnav: next chapter failed.\n"); | 324 fprintf(MSG_OUT, "libdvdnav: next chapter failed.\n"); |
325 printerr("Skip to next chapter failed."); | 325 printerr("Skip to next chapter failed."); |
326 pthread_mutex_unlock(&this->vm_lock); | 326 pthread_mutex_unlock(&this->vm_lock); |
327 return S_ERR; | 327 return DVDNAV_STATUS_ERR; |
328 } | 328 } |
329 } | 329 } |
330 /* merge changes on success */ | 330 /* merge changes on success */ |
331 vm_merge(this->vm, try_vm); | 331 vm_merge(this->vm, try_vm); |
332 vm_free_copy(try_vm); | 332 vm_free_copy(try_vm); |
335 #ifdef LOG_DEBUG | 335 #ifdef LOG_DEBUG |
336 fprintf(MSG_OUT, "libdvdnav: next chapter done\n"); | 336 fprintf(MSG_OUT, "libdvdnav: next chapter done\n"); |
337 #endif | 337 #endif |
338 pthread_mutex_unlock(&this->vm_lock); | 338 pthread_mutex_unlock(&this->vm_lock); |
339 | 339 |
340 return S_OK; | 340 return DVDNAV_STATUS_OK; |
341 } | 341 } |
342 | 342 |
343 dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) { | 343 dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) { |
344 vm_t *try_vm; | 344 vm_t *try_vm; |
345 | 345 |
346 if(!this) { | 346 if(!this) { |
347 printerr("Passed a NULL pointer."); | 347 printerr("Passed a NULL pointer."); |
348 return S_ERR; | 348 return DVDNAV_STATUS_ERR; |
349 } | 349 } |
350 | 350 |
351 pthread_mutex_lock(&this->vm_lock); | 351 pthread_mutex_lock(&this->vm_lock); |
352 if(!this->vm->state.pgc) { | 352 if(!this->vm->state.pgc) { |
353 printerr("No current PGC."); | 353 printerr("No current PGC."); |
354 pthread_mutex_unlock(&this->vm_lock); | 354 pthread_mutex_unlock(&this->vm_lock); |
355 return S_ERR; | 355 return DVDNAV_STATUS_ERR; |
356 } | 356 } |
357 | 357 |
358 /* make a copy of current VM and try to navigate the copy to the menu */ | 358 /* make a copy of current VM and try to navigate the copy to the menu */ |
359 try_vm = vm_new_copy(this->vm); | 359 try_vm = vm_new_copy(this->vm); |
360 if ( (menu == DVD_MENU_Escape) && (this->vm->state.domain != VTS_DOMAIN)) { | 360 if ( (menu == DVD_MENU_Escape) && (this->vm->state.domain != VTS_DOMAIN)) { |
364 vm_merge(this->vm, try_vm); | 364 vm_merge(this->vm, try_vm); |
365 vm_free_copy(try_vm); | 365 vm_free_copy(try_vm); |
366 this->position_current.still = 0; | 366 this->position_current.still = 0; |
367 this->vm->hop_channel++; | 367 this->vm->hop_channel++; |
368 pthread_mutex_unlock(&this->vm_lock); | 368 pthread_mutex_unlock(&this->vm_lock); |
369 return S_OK; | 369 return DVDNAV_STATUS_OK; |
370 } | 370 } |
371 } | 371 } |
372 if (menu == DVD_MENU_Escape) menu = DVD_MENU_Root; | 372 if (menu == DVD_MENU_Escape) menu = DVD_MENU_Root; |
373 | 373 |
374 if (vm_jump_menu(try_vm, menu) && !try_vm->stopped) { | 374 if (vm_jump_menu(try_vm, menu) && !try_vm->stopped) { |
376 vm_merge(this->vm, try_vm); | 376 vm_merge(this->vm, try_vm); |
377 vm_free_copy(try_vm); | 377 vm_free_copy(try_vm); |
378 this->position_current.still = 0; | 378 this->position_current.still = 0; |
379 this->vm->hop_channel++; | 379 this->vm->hop_channel++; |
380 pthread_mutex_unlock(&this->vm_lock); | 380 pthread_mutex_unlock(&this->vm_lock); |
381 return S_OK; | 381 return DVDNAV_STATUS_OK; |
382 } else { | 382 } else { |
383 vm_free_copy(try_vm); | 383 vm_free_copy(try_vm); |
384 printerr("No such menu or menu not reachable."); | 384 printerr("No such menu or menu not reachable."); |
385 pthread_mutex_unlock(&this->vm_lock); | 385 pthread_mutex_unlock(&this->vm_lock); |
386 return S_ERR; | 386 return DVDNAV_STATUS_ERR; |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos, | 390 dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos, |
391 unsigned int *len) { | 391 unsigned int *len) { |
394 cell_playback_t *cell; | 394 cell_playback_t *cell; |
395 dvd_state_t *state; | 395 dvd_state_t *state; |
396 | 396 |
397 if(!this || !pos || !len) { | 397 if(!this || !pos || !len) { |
398 printerr("Passed a NULL pointer."); | 398 printerr("Passed a NULL pointer."); |
399 return S_ERR; | 399 return DVDNAV_STATUS_ERR; |
400 } | 400 } |
401 if(!this->started) { | 401 if(!this->started) { |
402 printerr("Virtual DVD machine not started."); | 402 printerr("Virtual DVD machine not started."); |
403 return S_ERR; | 403 return DVDNAV_STATUS_ERR; |
404 } | 404 } |
405 | 405 |
406 pthread_mutex_lock(&this->vm_lock); | 406 pthread_mutex_lock(&this->vm_lock); |
407 state = &(this->vm->state); | 407 state = &(this->vm->state); |
408 if(!state->pgc) { | 408 if(!state->pgc) { |
409 printerr("No current PGC."); | 409 printerr("No current PGC."); |
410 pthread_mutex_unlock(&this->vm_lock); | 410 pthread_mutex_unlock(&this->vm_lock); |
411 return S_ERR; | 411 return DVDNAV_STATUS_ERR; |
412 } | 412 } |
413 if (this->position_current.hop_channel != this->vm->hop_channel || | 413 if (this->position_current.hop_channel != this->vm->hop_channel || |
414 this->position_current.domain != state->domain || | 414 this->position_current.domain != state->domain || |
415 this->position_current.vts != state->vtsN || | 415 this->position_current.vts != state->vtsN || |
416 this->position_current.cell_restart != state->cell_restart) { | 416 this->position_current.cell_restart != state->cell_restart) { |
417 printerr("New position not yet determined."); | 417 printerr("New position not yet determined."); |
418 pthread_mutex_unlock(&this->vm_lock); | 418 pthread_mutex_unlock(&this->vm_lock); |
419 return S_ERR; | 419 return DVDNAV_STATUS_ERR; |
420 } | 420 } |
421 | 421 |
422 /* Get current sector */ | 422 /* Get current sector */ |
423 cur_sector = this->vobu.vobu_start + this->vobu.blockN; | 423 cur_sector = this->vobu.vobu_start + this->vobu.blockN; |
424 | 424 |
449 | 449 |
450 assert((signed)*pos != -1); | 450 assert((signed)*pos != -1); |
451 | 451 |
452 pthread_mutex_unlock(&this->vm_lock); | 452 pthread_mutex_unlock(&this->vm_lock); |
453 | 453 |
454 return S_OK; | 454 return DVDNAV_STATUS_OK; |
455 } | 455 } |
456 | 456 |
457 dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *this, | 457 dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *this, |
458 unsigned int *pos, | 458 unsigned int *pos, |
459 unsigned int *len) { | 459 unsigned int *len) { |
464 cell_playback_t *last_cell; | 464 cell_playback_t *last_cell; |
465 dvd_state_t *state; | 465 dvd_state_t *state; |
466 | 466 |
467 if(!this || !pos || !len) { | 467 if(!this || !pos || !len) { |
468 printerr("Passed a NULL pointer."); | 468 printerr("Passed a NULL pointer."); |
469 return S_ERR; | 469 return DVDNAV_STATUS_ERR; |
470 } | 470 } |
471 | 471 |
472 state = &(this->vm->state); | 472 state = &(this->vm->state); |
473 if(!state->pgc) { | 473 if(!state->pgc) { |
474 printerr("No current PGC."); | 474 printerr("No current PGC."); |
475 return S_ERR; | 475 return DVDNAV_STATUS_ERR; |
476 } | 476 } |
477 | 477 |
478 /* Get current sector */ | 478 /* Get current sector */ |
479 cur_sector = this->vobu.vobu_start + this->vobu.blockN; | 479 cur_sector = this->vobu.vobu_start + this->vobu.blockN; |
480 | 480 |
485 last_cell = &(state->pgc->cell_playback[last_cell_nr-1]); | 485 last_cell = &(state->pgc->cell_playback[last_cell_nr-1]); |
486 | 486 |
487 *pos = cur_sector - first_cell->first_sector; | 487 *pos = cur_sector - first_cell->first_sector; |
488 *len = last_cell->last_sector - first_cell->first_sector; | 488 *len = last_cell->last_sector - first_cell->first_sector; |
489 | 489 |
490 return S_OK; | 490 return DVDNAV_STATUS_OK; |
491 } | 491 } |