comparison vm.c @ 113:ec2df154be56 src

slightly improved logic of program skipping: previous program: -> if PG > 1, jump to PG - 1 -> otherwise, if prev_PGC is set, jump to last PG of prev_PGC -> otherwise fail next program: -> if PG < last_PG, jump to PG + 1 -> otherwise, if next_PGC is set, jump to first PG of next_PGC -> otherwise, move to last Cell of current PG and ask the VM for the next Cell
author mroi
date Mon, 13 Jan 2003 13:33:45 +0000
parents 50ee8763a312
children b6834e6359cf
comparison
equal deleted inserted replaced
112:50ee8763a312 113:ec2df154be56
511 return 1; /* Jump */ 511 return 1; /* Jump */
512 } 512 }
513 513
514 int vm_next_pg(vm_t *vm) 514 int vm_next_pg(vm_t *vm)
515 { 515 {
516 /* Do we need to get a updated pgN value first? */ 516 if((vm->state).pgN >= (vm->state).pgc->nr_of_programs) {
517 (vm->state).pgN += 1; 517 /* last program -> move to first program of next PGC */
518 return vm_top_pg(vm); 518 if ((vm->state).pgc->next_pgc_nr != 0 && set_PGC(vm, (vm->state).pgc->next_pgc_nr) == 0) {
519 vm_jump_prog(vm, 1);
520 return 1;
521 }
522 /* something failed, try to move to the cell after the last */
523 (vm->state).cellN = (vm->state).pgc->nr_of_cells;
524 vm_get_next_cell(vm);
525 return 1;
526 } else {
527 vm_jump_prog(vm, (vm->state).pgN + 1);
528 return 1;
529 }
519 } 530 }
520 531
521 int vm_prev_pg(vm_t *vm) 532 int vm_prev_pg(vm_t *vm)
522 { 533 {
523 /* Do we need to get a updated pgN value first? */ 534 if ((vm->state).pgN <= 1) {
524 (vm->state).pgN -= 1; 535 /* first program -> move to last program of previous PGC */
525 if((vm->state).pgN == 0) { 536 if ((vm->state).pgc->prev_pgc_nr != 0 && set_PGC(vm, (vm->state).pgc->prev_pgc_nr) == 0) {
526 /* Check for previous PGCN ? */ 537 vm_jump_prog(vm, (vm->state).pgc->nr_of_programs);
527 (vm->state).pgN = 1; 538 return 1;
528 /* return 0; */ 539 }
529 } 540 return 0;
530 return vm_top_pg(vm); 541 } else {
542 vm_jump_prog(vm, (vm->state).pgN - 1);
543 return 1;
544 }
531 } 545 }
532 546
533 /* Get the current title and part from the current playing position. */ 547 /* Get the current title and part from the current playing position. */
534 /* returns S_ERR if not in the VTS_DOMAIN */ 548 /* returns S_ERR if not in the VTS_DOMAIN */
535 /* FIXME: Should we do some locking here ? */ 549 /* FIXME: Should we do some locking here ? */
2029 return pgcit; 2043 return pgcit;
2030 } 2044 }
2031 2045
2032 /* 2046 /*
2033 * $Log$ 2047 * $Log$
2048 * Revision 1.42 2003/01/13 13:33:45 mroi
2049 * slightly improved logic of program skipping:
2050 * previous program:
2051 * -> if PG > 1, jump to PG - 1
2052 * -> otherwise, if prev_PGC is set, jump to last PG of prev_PGC
2053 * -> otherwise fail
2054 * next program:
2055 * -> if PG < last_PG, jump to PG + 1
2056 * -> otherwise, if next_PGC is set, jump to first PG of next_PGC
2057 * -> otherwise, move to last Cell of current PG and ask the VM for the next Cell
2058 *
2034 * Revision 1.41 2003/01/06 19:59:28 mroi 2059 * Revision 1.41 2003/01/06 19:59:28 mroi
2035 * implement LinkNoLink 2060 * implement LinkNoLink
2036 * (in this whole lot of DVDs I watched with libdvdnav, Disney's 2061 * (in this whole lot of DVDs I watched with libdvdnav, Disney's
2037 * "Beauty an the Beast" deluxe is the first one to use LinkNoLink...) 2062 * "Beauty an the Beast" deluxe is the first one to use LinkNoLink...)
2038 * 2063 *