Mercurial > libdvdnav.hg
comparison searching.c @ 125:87400040e4a4 src
try-run menu jumps
author | mroi |
---|---|
date | Fri, 14 Mar 2003 18:48:25 +0000 |
parents | 29b046894eac |
children | b48f53f7cff2 |
comparison
equal
deleted
inserted
replaced
124:e404d210ff91 | 125:87400040e4a4 |
---|---|
342 | 342 |
343 return S_OK; | 343 return S_OK; |
344 } | 344 } |
345 | 345 |
346 dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) { | 346 dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) { |
347 vm_t *try_vm; | |
347 | 348 |
348 if(!this) { | 349 if(!this) { |
349 printerr("Passed a NULL pointer."); | 350 printerr("Passed a NULL pointer."); |
350 return S_ERR; | 351 return S_ERR; |
351 } | 352 } |
355 printerr("No current PGC."); | 356 printerr("No current PGC."); |
356 pthread_mutex_unlock(&this->vm_lock); | 357 pthread_mutex_unlock(&this->vm_lock); |
357 return S_ERR; | 358 return S_ERR; |
358 } | 359 } |
359 | 360 |
360 if (vm_jump_menu(this->vm, menu)) { | 361 /* make a copy of current VM and try to navigate the copy to the menu */ |
362 try_vm = vm_new_copy(this->vm); | |
363 if (vm_jump_menu(try_vm, menu) && !try_vm->stopped) { | |
364 /* merge changes on success */ | |
365 vm_merge(this->vm, try_vm); | |
366 vm_free_copy(try_vm); | |
361 this->vm->hop_channel++; | 367 this->vm->hop_channel++; |
362 pthread_mutex_unlock(&this->vm_lock); | 368 pthread_mutex_unlock(&this->vm_lock); |
363 return S_OK; | 369 return S_OK; |
364 } else { | 370 } else { |
365 printerr("No such menu."); | 371 vm_free_copy(try_vm); |
372 printerr("No such menu or menu not reachable."); | |
366 pthread_mutex_unlock(&this->vm_lock); | 373 pthread_mutex_unlock(&this->vm_lock); |
367 return S_ERR; | 374 return S_ERR; |
368 } | 375 } |
369 } | 376 } |
370 | 377 |