Mercurial > libdvdnav.hg
comparison vm.c @ 110:ac50954e1345 src
patch from Marco Z«ählke for reporting correct title number
author | mroi |
---|---|
date | Sat, 23 Nov 2002 11:05:45 +0000 |
parents | f41eae322bd1 |
children | 0c1f0c7eec1d |
comparison
equal
deleted
inserted
replaced
109:f41eae322bd1 | 110:ac50954e1345 |
---|---|
535 /* returns S_ERR if not in the VTS_DOMAIN */ | 535 /* returns S_ERR if not in the VTS_DOMAIN */ |
536 /* FIXME: Should we do some locking here ? */ | 536 /* FIXME: Should we do some locking here ? */ |
537 int vm_get_current_title_part(vm_t *vm, int *title_result, int *part_result) | 537 int vm_get_current_title_part(vm_t *vm, int *title_result, int *part_result) |
538 { | 538 { |
539 vts_ptt_srpt_t *vts_ptt_srpt; | 539 vts_ptt_srpt_t *vts_ptt_srpt; |
540 int title=0, part=0; | 540 int title=0, part=0, ttn=0; |
541 int found = 0; | 541 int found = 0; |
542 int16_t pgcN, pgN; | 542 int16_t pgcN, pgN; |
543 | 543 |
544 if((!vm) || (!vm->vtsi) ) | 544 if((!vm) || (!vm->vtsi) ) |
545 return S_ERR; | 545 return S_ERR; |
556 vts_ptt_srpt = vm->vtsi->vts_ptt_srpt; | 556 vts_ptt_srpt = vm->vtsi->vts_ptt_srpt; |
557 pgcN = get_PGCN(vm); | 557 pgcN = get_PGCN(vm); |
558 pgN = vm->state.pgN; | 558 pgN = vm->state.pgN; |
559 printf("VTS_PTT_SRPT - PGC: %3i PG: %3i\n", | 559 printf("VTS_PTT_SRPT - PGC: %3i PG: %3i\n", |
560 pgcN, pgN); | 560 pgcN, pgN); |
561 for(title=0;( (title < vts_ptt_srpt->nr_of_srpts) && (found == 0) );title++) { | 561 |
562 for(part=0;((part < vts_ptt_srpt->title[title].nr_of_ptts) && (found == 0));part++) { | 562 for(ttn=0;( (ttn < vts_ptt_srpt->nr_of_srpts) && (found == 0) );ttn++) { |
563 if ( (vts_ptt_srpt->title[title].ptt[part].pgcn == pgcN) && | 563 for(part=0;((part < vts_ptt_srpt->title[ttn].nr_of_ptts) && (found == 0));part++) { |
564 (vts_ptt_srpt->title[title].ptt[part].pgn == pgN ) ) { | 564 if ( (vts_ptt_srpt->title[ttn].ptt[part].pgcn == pgcN) && |
565 (vts_ptt_srpt->title[ttn].ptt[part].pgn == pgN ) ) { | |
565 found = 1; | 566 found = 1; |
566 break; | 567 break; |
567 } | 568 } |
568 } | 569 } |
569 if (found != 0) break; | 570 if (found != 0) break; |
570 } | 571 } |
572 ttn++; | |
573 part++; | |
574 for(title=0; title < vm->vmgi->tt_srpt->nr_of_srpts; title++){ | |
575 if( (vm->vmgi->tt_srpt->title[title].vts_ttn == ttn) && | |
576 (vm->vmgi->tt_srpt->title[title].title_set_nr == vm->state.vtsN)){ | |
577 found = 1; | |
578 break; | |
579 } | |
580 } | |
571 title++; | 581 title++; |
572 part++; | 582 |
573 if (found == 1) { | 583 if (found == 1) { |
574 fprintf(MSG_OUT, "libdvdnav: ************ this chapter FOUND!\n"); | 584 fprintf(MSG_OUT, "libdvdnav: ************ this chapter FOUND!\n"); |
575 fprintf(MSG_OUT, "libdvdnav: VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n", | 585 fprintf(MSG_OUT, "libdvdnav: VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n", |
576 title, part, | 586 title, part, |
577 vts_ptt_srpt->title[title-1].ptt[part-1].pgcn , | 587 vts_ptt_srpt->title[ttn-1].ptt[part-1].pgcn , |
578 vts_ptt_srpt->title[title-1].ptt[part-1].pgn ); | 588 vts_ptt_srpt->title[ttn-1].ptt[part-1].pgn ); |
579 } else { | 589 } else { |
580 fprintf(MSG_OUT, "libdvdnav: ************ this chapter NOT FOUND!\n"); | 590 fprintf(MSG_OUT, "libdvdnav: ************ this chapter NOT FOUND!\n"); |
581 return S_ERR; | 591 return S_ERR; |
582 } | 592 } |
583 *title_result = title; | 593 *title_result = title; |
2017 return pgcit; | 2027 return pgcit; |
2018 } | 2028 } |
2019 | 2029 |
2020 /* | 2030 /* |
2021 * $Log$ | 2031 * $Log$ |
2032 * Revision 1.39 2002/11/23 11:05:45 mroi | |
2033 * patch from Marco Zühlke for reporting correct title number | |
2034 * | |
2022 * Revision 1.38 2002/11/22 17:14:26 mroi | 2035 * Revision 1.38 2002/11/22 17:14:26 mroi |
2023 * warning: ugly fix ahead! (see comment in the code for details) | 2036 * warning: ugly fix ahead! (see comment in the code for details) |
2024 * But I hate it when DVDs do not work with libdvdnav and after checking a bunch of | 2037 * But I hate it when DVDs do not work with libdvdnav and after checking a bunch of |
2025 * other DVDs it seems that this fix is unlikely to break anything else, so I | 2038 * other DVDs it seems that this fix is unlikely to break anything else, so I |
2026 * decided to commit it. "Back to the Future" menus are working fine now. | 2039 * decided to commit it. "Back to the Future" menus are working fine now. |