Mercurial > libdvdnav.hg
diff dvdnav.c @ 116:4d711d0518e9 src
new event DVDNAV_WAIT
author | mroi |
---|---|
date | Tue, 25 Feb 2003 14:08:16 +0000 |
parents | b527b7cbfb19 |
children | 545bd4fc0a16 |
line wrap: on
line diff
--- a/dvdnav.c Mon Feb 24 18:19:27 2003 +0000 +++ b/dvdnav.c Tue Feb 25 14:08:16 2003 +0000 @@ -55,6 +55,8 @@ /* Set initial values of flags */ this->position_current.still = 0; this->skip_still = 0; + this->sync_wait = 0; + this->sync_wait_skip = 0; this->spu_clut_changed = 0; this->started = 0; @@ -402,7 +404,7 @@ #ifdef TRACE fprintf(MSG_OUT, "libdvdnav: POS-NEXT "); vm_position_print(this->vm, &this->position_next); - fprintf(MSG_OUT, "libdvdnav: POS-CUR "); + fprintf(MSG_OUT, "libdvdnav: POS-CUR "); vm_position_print(this->vm, &this->position_current); #endif @@ -448,10 +450,39 @@ /* Make blockN > vobu_length to do expected_nav */ this->vobu.vobu_length = 0; this->vobu.blockN = 1; + this->sync_wait = 0; pthread_mutex_unlock(&this->vm_lock); return S_OK; } + /* Check the HIGHLIGHT flag */ + if(this->position_current.button != this->position_next.button) { + dvdnav_highlight_event_t hevent; + + (*event) = DVDNAV_HIGHLIGHT; +#ifdef LOG_DEBUG + fprintf(MSG_OUT, "libdvdnav: HIGHLIGHT\n"); +#endif + (*len) = sizeof(hevent); + hevent.display = 1; + hevent.buttonN = this->position_next.button; + memcpy(*buf, &(hevent), sizeof(hevent)); + this->position_current.button = this->position_next.button; + pthread_mutex_unlock(&this->vm_lock); + return S_OK; + } + + /* Check the WAIT flag */ + if(this->sync_wait) { + (*event) = DVDNAV_WAIT; +#ifdef LOG_DEBUG + fprintf(MSG_OUT, "libdvdnav: WAIT\n"); +#endif + (*len) = 0; + pthread_mutex_unlock(&this->vm_lock); + return S_OK; + } + /* Check to see if we need to change the currently opened VOB */ if((this->position_current.vts != this->position_next.vts) || (this->position_current.domain != this->position_next.domain)) { @@ -613,23 +644,6 @@ return S_OK; } - /* Check the HIGHLIGHT flag */ - if(this->position_current.button != this->position_next.button) { - dvdnav_highlight_event_t hevent; - - (*event) = DVDNAV_HIGHLIGHT; -#ifdef LOG_DEBUG - fprintf(MSG_OUT, "libdvdnav: HIGHLIGHT\n"); -#endif - (*len) = sizeof(hevent); - hevent.display = 1; - hevent.buttonN = this->position_next.button; - memcpy(*buf, &(hevent), sizeof(hevent)); - this->position_current.button = this->position_next.button; - pthread_mutex_unlock(&this->vm_lock); - return S_OK; - } - /* Check the STILLFRAME flag */ if(this->position_current.still != 0) { dvdnav_still_event_t still_event; @@ -656,11 +670,19 @@ #endif this->position_current.still = this->position_next.still; - if( this->position_current.still == 0 || this->skip_still ) { - /* no active cell still -> get us to the next cell */ - vm_get_next_cell(this->vm); - this->position_current.still = 0; /* still gets activated at end of cell */ - this->skip_still = 0; + /* we are about to leave a cell, so a lot of state changes could occur; + * under certain conditions, the application should get in sync with us before this, + * otherwise it might show stills or menus too shortly */ + if ((this->position_current.still || this->pci.hli.hl_gi.hli_ss) && !this->sync_wait_skip) { + this->sync_wait = 1; + } else { + if( this->position_current.still == 0 || this->skip_still ) { + /* no active cell still -> get us to the next cell */ + vm_get_next_cell(this->vm); + this->position_current.still = 0; /* still gets activated at end of cell */ + this->skip_still = 0; + this->sync_wait_skip = 0; + } } /* handle related state changes in next iteration */ (*event) = DVDNAV_NOP; @@ -957,8 +979,8 @@ /* * $Log$ - * Revision 1.41 2003/02/24 18:19:27 mroi - * fix seek detection + * Revision 1.42 2003/02/25 14:08:14 mroi + * new event DVDNAV_WAIT * * Revision 1.40 2003/02/20 15:32:15 mroi * big libdvdnav cleanup, quoting the ChangeLog: