Mercurial > libdvdnav.hg
changeset 248:5124cfd4725d src
fix some error conditions (fixes dvdnav_title_part_play())
author | mroi |
---|---|
date | Sun, 20 Jun 2004 16:49:08 +0000 |
parents | 84f652524ecb |
children | 5d643668f1e3 |
files | navigation.c |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/navigation.c Sun Jun 20 16:47:37 2004 +0000 +++ b/navigation.c Sun Jun 20 16:49:08 2004 +0000 @@ -60,8 +60,8 @@ printerr("Passed a NULL pointer."); return DVDNAV_STATUS_ERR; } - if(!this->started) { - printerr("Virtual DVD machine not started."); + if (!this->vm->vmgi) { + printerr("Bad VM state."); return DVDNAV_STATUS_ERR; } @@ -75,8 +75,8 @@ printerr("Passed a NULL pointer."); return DVDNAV_STATUS_ERR; } - if(!this->started) { - printerr("Virtual DVD machine not started."); + if (!this->vm->vmgi) { + printerr("Bad VM state."); return DVDNAV_STATUS_ERR; } if ((title < 1) || (title > vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts) ) { @@ -103,6 +103,11 @@ pthread_mutex_unlock(&this->vm_lock); return DVDNAV_STATUS_ERR; } + if (!this->started) { + printerr("Virtual DVD machine not started."); + pthread_mutex_unlock(&this->vm_lock); + return DVDNAV_STATUS_ERR; + } if (!this->vm->state.pgc) { printerr("No current PGC."); pthread_mutex_unlock(&this->vm_lock); @@ -150,6 +155,11 @@ pthread_mutex_unlock(&this->vm_lock); return DVDNAV_STATUS_ERR; } + if (!this->started) { + /* don't report an error but be nice */ + vm_start(this->vm); + this->started = 1; + } if (!this->vm->state.pgc) { printerr("No current PGC."); pthread_mutex_unlock(&this->vm_lock);