Skip to content
Commits on Source (2)
......@@ -485,6 +485,9 @@ int64_t dvdnav_get_current_time(dvdnav_t *this) {
int64_t tm=0;
dvd_state_t *state = &this->vm->state;
if(! state->pgc)
return 0;
for(i=0; i<state->cellN-1; i++) {
if(!
(state->pgc->cell_playback[i].block_type == BLOCK_TYPE_ANGLE_BLOCK &&
......@@ -517,6 +520,12 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
this->started = 1;
}
if (!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
return DVDNAV_STATUS_ERR;
}
state = &(this->vm->state);
(*event) = DVDNAV_NOP;
(*len) = 0;
......
......@@ -343,6 +343,12 @@ dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) {
}
pthread_mutex_lock(&this->vm_lock);
if(!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
return DVDNAV_STATUS_ERR;
}
button = this->vm->state.HL_BTNN_REG >> 10;
if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) {
......@@ -394,6 +400,13 @@ dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) {
dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *this, int32_t button, vm_cmd_t *cmd)
{
pthread_mutex_lock(&this->vm_lock);
if(!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
return DVDNAV_STATUS_ERR;
}
/* make the VM execute the appropriate code and probably
* schedule a jump */
#ifdef BUTTON_TESTING
......
......@@ -269,6 +269,12 @@ dvdnav_status_t dvdnav_go_up(dvdnav_t *this) {
/* A nice easy function... delegate to the VM */
int retval;
pthread_mutex_lock(&this->vm_lock);
if (!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
return DVDNAV_STATUS_ERR;
}
retval = vm_jump_up(this->vm);
pthread_mutex_unlock(&this->vm_lock);
......
......@@ -172,6 +172,9 @@ int set_PGN(vm_t *vm) {
int new_pgN = 0;
int dummy, part = 0;
if ((vm->state).pgc == NULL)
return 0;
while(new_pgN < (vm->state).pgc->nr_of_programs
&& (vm->state).cellN >= (vm->state).pgc->program_map[new_pgN])
new_pgN++;
......@@ -280,6 +283,10 @@ int get_PGCN(vm_t *vm) {
pgcit_t *pgcit;
int pgcN = 1;
if ((vm->state).pgc == NULL) {
return 0; /* error */
}
pgcit = get_PGCIT(vm);
if (pgcit) {
......
......@@ -216,8 +216,8 @@ link_t play_Cell(vm_t *vm) {
}
#endif
break;
case 2: /* ?? */
case 3: /* ?? */
case 2: /* reserved */
case 3: /* reserved */
default:
fprintf(MSG_OUT, "libdvdnav: Invalid? Cell block_mode (%d), block_type (%d)\n",
(vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode,
......@@ -304,8 +304,8 @@ link_t play_Cell_post(vm_t *vm) {
(vm->state).cellN++;
}
break;
case 2: /* ?? */
case 3: /* ?? */
case 2: /* reserved */
case 3: /* reserved */
default:
fprintf(MSG_OUT, "libdvdnav: Invalid? Cell block_mode (%d), block_type (%d)\n",
(vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode,
......