Mercurial > libdvdnav.hg
comparison dvdnav.c @ 116:4d711d0518e9 src
new event DVDNAV_WAIT
author | mroi |
---|---|
date | Tue, 25 Feb 2003 14:08:16 +0000 |
parents | b527b7cbfb19 |
children | 545bd4fc0a16 |
comparison
equal
deleted
inserted
replaced
115:b527b7cbfb19 | 116:4d711d0518e9 |
---|---|
53 memset(&this->dsi,0,sizeof(this->dsi)); | 53 memset(&this->dsi,0,sizeof(this->dsi)); |
54 | 54 |
55 /* Set initial values of flags */ | 55 /* Set initial values of flags */ |
56 this->position_current.still = 0; | 56 this->position_current.still = 0; |
57 this->skip_still = 0; | 57 this->skip_still = 0; |
58 this->sync_wait = 0; | |
59 this->sync_wait_skip = 0; | |
58 this->spu_clut_changed = 0; | 60 this->spu_clut_changed = 0; |
59 this->started = 0; | 61 this->started = 0; |
60 | 62 |
61 dvdnav_read_cache_clear(this->cache); | 63 dvdnav_read_cache_clear(this->cache); |
62 | 64 |
400 vm_position_get(this->vm, &this->position_next); | 402 vm_position_get(this->vm, &this->position_next); |
401 | 403 |
402 #ifdef TRACE | 404 #ifdef TRACE |
403 fprintf(MSG_OUT, "libdvdnav: POS-NEXT "); | 405 fprintf(MSG_OUT, "libdvdnav: POS-NEXT "); |
404 vm_position_print(this->vm, &this->position_next); | 406 vm_position_print(this->vm, &this->position_next); |
405 fprintf(MSG_OUT, "libdvdnav: POS-CUR "); | 407 fprintf(MSG_OUT, "libdvdnav: POS-CUR "); |
406 vm_position_print(this->vm, &this->position_current); | 408 vm_position_print(this->vm, &this->position_current); |
407 #endif | 409 #endif |
408 | 410 |
409 /* did we hop? */ | 411 /* did we hop? */ |
410 if(this->position_current.hop_channel != this->position_next.hop_channel) { | 412 if(this->position_current.hop_channel != this->position_next.hop_channel) { |
446 } | 448 } |
447 this->position_current.hop_channel = this->position_next.hop_channel; | 449 this->position_current.hop_channel = this->position_next.hop_channel; |
448 /* Make blockN > vobu_length to do expected_nav */ | 450 /* Make blockN > vobu_length to do expected_nav */ |
449 this->vobu.vobu_length = 0; | 451 this->vobu.vobu_length = 0; |
450 this->vobu.blockN = 1; | 452 this->vobu.blockN = 1; |
451 pthread_mutex_unlock(&this->vm_lock); | 453 this->sync_wait = 0; |
454 pthread_mutex_unlock(&this->vm_lock); | |
455 return S_OK; | |
456 } | |
457 | |
458 /* Check the HIGHLIGHT flag */ | |
459 if(this->position_current.button != this->position_next.button) { | |
460 dvdnav_highlight_event_t hevent; | |
461 | |
462 (*event) = DVDNAV_HIGHLIGHT; | |
463 #ifdef LOG_DEBUG | |
464 fprintf(MSG_OUT, "libdvdnav: HIGHLIGHT\n"); | |
465 #endif | |
466 (*len) = sizeof(hevent); | |
467 hevent.display = 1; | |
468 hevent.buttonN = this->position_next.button; | |
469 memcpy(*buf, &(hevent), sizeof(hevent)); | |
470 this->position_current.button = this->position_next.button; | |
471 pthread_mutex_unlock(&this->vm_lock); | |
472 return S_OK; | |
473 } | |
474 | |
475 /* Check the WAIT flag */ | |
476 if(this->sync_wait) { | |
477 (*event) = DVDNAV_WAIT; | |
478 #ifdef LOG_DEBUG | |
479 fprintf(MSG_OUT, "libdvdnav: WAIT\n"); | |
480 #endif | |
481 (*len) = 0; | |
482 pthread_mutex_unlock(&this->vm_lock); | |
452 return S_OK; | 483 return S_OK; |
453 } | 484 } |
454 | 485 |
455 /* Check to see if we need to change the currently opened VOB */ | 486 /* Check to see if we need to change the currently opened VOB */ |
456 if((this->position_current.vts != this->position_next.vts) || | 487 if((this->position_current.vts != this->position_next.vts) || |
611 #endif | 642 #endif |
612 pthread_mutex_unlock(&this->vm_lock); | 643 pthread_mutex_unlock(&this->vm_lock); |
613 return S_OK; | 644 return S_OK; |
614 } | 645 } |
615 | 646 |
616 /* Check the HIGHLIGHT flag */ | |
617 if(this->position_current.button != this->position_next.button) { | |
618 dvdnav_highlight_event_t hevent; | |
619 | |
620 (*event) = DVDNAV_HIGHLIGHT; | |
621 #ifdef LOG_DEBUG | |
622 fprintf(MSG_OUT, "libdvdnav: HIGHLIGHT\n"); | |
623 #endif | |
624 (*len) = sizeof(hevent); | |
625 hevent.display = 1; | |
626 hevent.buttonN = this->position_next.button; | |
627 memcpy(*buf, &(hevent), sizeof(hevent)); | |
628 this->position_current.button = this->position_next.button; | |
629 pthread_mutex_unlock(&this->vm_lock); | |
630 return S_OK; | |
631 } | |
632 | |
633 /* Check the STILLFRAME flag */ | 647 /* Check the STILLFRAME flag */ |
634 if(this->position_current.still != 0) { | 648 if(this->position_current.still != 0) { |
635 dvdnav_still_event_t still_event; | 649 dvdnav_still_event_t still_event; |
636 | 650 |
637 (*event) = DVDNAV_STILL_FRAME; | 651 (*event) = DVDNAV_STILL_FRAME; |
654 #ifdef LOG_DEBUG | 668 #ifdef LOG_DEBUG |
655 fprintf(MSG_OUT, "libdvdnav: Still set to %x\n", this->position_next.still); | 669 fprintf(MSG_OUT, "libdvdnav: Still set to %x\n", this->position_next.still); |
656 #endif | 670 #endif |
657 this->position_current.still = this->position_next.still; | 671 this->position_current.still = this->position_next.still; |
658 | 672 |
659 if( this->position_current.still == 0 || this->skip_still ) { | 673 /* we are about to leave a cell, so a lot of state changes could occur; |
660 /* no active cell still -> get us to the next cell */ | 674 * under certain conditions, the application should get in sync with us before this, |
661 vm_get_next_cell(this->vm); | 675 * otherwise it might show stills or menus too shortly */ |
662 this->position_current.still = 0; /* still gets activated at end of cell */ | 676 if ((this->position_current.still || this->pci.hli.hl_gi.hli_ss) && !this->sync_wait_skip) { |
663 this->skip_still = 0; | 677 this->sync_wait = 1; |
678 } else { | |
679 if( this->position_current.still == 0 || this->skip_still ) { | |
680 /* no active cell still -> get us to the next cell */ | |
681 vm_get_next_cell(this->vm); | |
682 this->position_current.still = 0; /* still gets activated at end of cell */ | |
683 this->skip_still = 0; | |
684 this->sync_wait_skip = 0; | |
685 } | |
664 } | 686 } |
665 /* handle related state changes in next iteration */ | 687 /* handle related state changes in next iteration */ |
666 (*event) = DVDNAV_NOP; | 688 (*event) = DVDNAV_NOP; |
667 (*len) = 0; | 689 (*len) = 0; |
668 pthread_mutex_unlock(&this->vm_lock); | 690 pthread_mutex_unlock(&this->vm_lock); |
955 return this->position_next.still; | 977 return this->position_next.still; |
956 } | 978 } |
957 | 979 |
958 /* | 980 /* |
959 * $Log$ | 981 * $Log$ |
960 * Revision 1.41 2003/02/24 18:19:27 mroi | 982 * Revision 1.42 2003/02/25 14:08:14 mroi |
961 * fix seek detection | 983 * new event DVDNAV_WAIT |
962 * | 984 * |
963 * Revision 1.40 2003/02/20 15:32:15 mroi | 985 * Revision 1.40 2003/02/20 15:32:15 mroi |
964 * big libdvdnav cleanup, quoting the ChangeLog: | 986 * big libdvdnav cleanup, quoting the ChangeLog: |
965 * * some bugfixes | 987 * * some bugfixes |
966 * * code cleanup | 988 * * code cleanup |