# HG changeset patch # User mroi # Date 1033132682 0 # Node ID 3e6970dbe8d6d991d45978cf39f025ca89d10d55 # Parent f885a4cb7bce6a4086f5840f3640f15e6f00b46c - allow seeking to offset 0 (pressing '0' in xine won't work otherwise) - add a forgotten break - lock the vm on the program jumps - jump to the end of the last cell when trying to jump to next program on last program - disable stills when doing program jumps diff -r f885a4cb7bce -r 3e6970dbe8d6 searching.c --- a/searching.c Sun Sep 22 11:53:32 2002 +0000 +++ b/searching.c Fri Sep 27 13:18:02 2002 +0000 @@ -112,16 +112,13 @@ dvd_state_t *state; dvdnav_status_t result; - if((!this) || (!this->vm) ) + if((!this) || (!this->vm) || (!this->started)) return -1; state = &(this->vm->state); if((!state) || (!state->pgc) ) return -1; - if(offset == 0) - return -1; - if(this->position_current.still != 0) /* Cannot do seeking in a still frame. */ return -1; @@ -158,6 +155,7 @@ return -1; } target = length - offset; + break; default: /* Error occured */ pthread_mutex_unlock(&this->vm_lock); @@ -238,15 +236,19 @@ if((!state) || (!state->pgc) ) return S_ERR; + pthread_mutex_lock(&this->vm_lock); /* Make sure this is not the first chapter */ if(state->pgN <= 1 ) { fprintf(MSG_OUT, "libdvdnav: at first chapter. prev chapter failed.\n"); + pthread_mutex_unlock(&this->vm_lock); return S_ERR; } fprintf(MSG_OUT, "libdvdnav: previous chapter\n"); vm_jump_prog(this->vm, state->pgN - 1); + this->position_current.still = 0; this->vm->hop_channel++; fprintf(MSG_OUT, "libdvdnav: previous chapter done\n"); + pthread_mutex_unlock(&this->vm_lock); return S_OK; } @@ -271,15 +273,20 @@ if((!state) || (!state->pgc) ) return S_ERR; + pthread_mutex_lock(&this->vm_lock); /* Make sure this is not the last chapter */ if(state->pgN >= state->pgc->nr_of_programs) { - fprintf(MSG_OUT, "libdvdnav: at last chapter. next chapter failed.\n"); - return S_ERR; + fprintf(MSG_OUT, "libdvdnav: at last chapter. jumping to end of last cell.\n"); + this->vm->state.cellN = this->vm->state.pgc->nr_of_cells; + vm_get_next_cell(this->vm); + } else { + fprintf(MSG_OUT, "libdvdnav: next chapter\n"); + vm_jump_prog(this->vm, state->pgN + 1); } - fprintf(MSG_OUT, "libdvdnav: next chapter\n"); - vm_jump_prog(this->vm, state->pgN + 1); + this->position_current.still = 0; this->vm->hop_channel++; fprintf(MSG_OUT, "libdvdnav: next chapter done\n"); + pthread_mutex_unlock(&this->vm_lock); return S_OK; }