comparison dvdnav.c @ 269:77e472cef5f8 src

implemented dvdnav_get_current_time() with obvious meaning
author nicodvb
date Sun, 08 Apr 2007 17:45:19 +0000
parents 21ba13a7b77a
children baec6f29fb76
comparison
equal deleted inserted replaced
268:5256576e85cd 269:77e472cef5f8
54 this->skip_still = 0; 54 this->skip_still = 0;
55 this->sync_wait = 0; 55 this->sync_wait = 0;
56 this->sync_wait_skip = 0; 56 this->sync_wait_skip = 0;
57 this->spu_clut_changed = 0; 57 this->spu_clut_changed = 0;
58 this->started = 0; 58 this->started = 0;
59 this->cur_cell_time = 0;
59 60
60 dvdnav_read_cache_clear(this->cache); 61 dvdnav_read_cache_clear(this->cache);
61 62
62 return DVDNAV_STATUS_OK; 63 return DVDNAV_STATUS_OK;
63 } 64 }
385 /* we received a block from the cache, copy it, so we can give it back */ 386 /* we received a block from the cache, copy it, so we can give it back */
386 memcpy(buf, block, DVD_VIDEO_LB_LEN); 387 memcpy(buf, block, DVD_VIDEO_LB_LEN);
387 dvdnav_free_cache_block(this, block); 388 dvdnav_free_cache_block(this, block);
388 } 389 }
389 return status; 390 return status;
391 }
392
393 int64_t dvdnav_get_current_time(dvdnav_t *this) {
394 int i;
395 int64_t tm=0;
396 dvd_state_t *state = &this->vm->state;
397
398 for(i=0; i<state->cellN-1; i++) {
399 if(!
400 (state->pgc->cell_playback[i].block_type == BLOCK_TYPE_ANGLE_BLOCK &&
401 state->pgc->cell_playback[i].block_mode != BLOCK_MODE_FIRST_CELL)
402 )
403 tm += dvdnav_convert_time(&state->pgc->cell_playback[i].playback_time);
404 }
405 tm += this->cur_cell_time;
406
407 return tm;
390 } 408 }
391 409
392 dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf, 410 dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
393 int32_t *event, int32_t *len) { 411 int32_t *event, int32_t *len) {
394 dvd_state_t *state; 412 dvd_state_t *state;
581 (this->position_current.cell_start != this->position_next.cell_start) ) { 599 (this->position_current.cell_start != this->position_next.cell_start) ) {
582 dvdnav_cell_change_event_t *cell_event = (dvdnav_cell_change_event_t *)*buf; 600 dvdnav_cell_change_event_t *cell_event = (dvdnav_cell_change_event_t *)*buf;
583 int32_t first_cell_nr, last_cell_nr, i; 601 int32_t first_cell_nr, last_cell_nr, i;
584 dvd_state_t *state = &this->vm->state; 602 dvd_state_t *state = &this->vm->state;
585 603
604 this->cur_cell_time = 0;
586 (*event) = DVDNAV_CELL_CHANGE; 605 (*event) = DVDNAV_CELL_CHANGE;
587 #ifdef LOG_DEBUG 606 #ifdef LOG_DEBUG
588 fprintf(MSG_OUT, "libdvdnav: CELL_CHANGE\n"); 607 fprintf(MSG_OUT, "libdvdnav: CELL_CHANGE\n");
589 #endif 608 #endif
590 (*len) = sizeof(dvdnav_cell_change_event_t); 609 (*len) = sizeof(dvdnav_cell_change_event_t);
781 (*event) = DVDNAV_NAV_PACKET; 800 (*event) = DVDNAV_NAV_PACKET;
782 #ifdef LOG_DEBUG 801 #ifdef LOG_DEBUG
783 fprintf(MSG_OUT, "libdvdnav: NAV_PACKET\n"); 802 fprintf(MSG_OUT, "libdvdnav: NAV_PACKET\n");
784 #endif 803 #endif
785 (*len) = 2048; 804 (*len) = 2048;
805 this->cur_cell_time = dvdnav_convert_time(&this->dsi.dsi_gi.c_eltm);
786 pthread_mutex_unlock(&this->vm_lock); 806 pthread_mutex_unlock(&this->vm_lock);
787 return DVDNAV_STATUS_OK; 807 return DVDNAV_STATUS_OK;
788 } 808 }
789 809
790 /* If we've got here, it must just be a normal block. */ 810 /* If we've got here, it must just be a normal block. */