diff options
Diffstat (limited to 'src/input/libdvdnav/navigation.c')
-rw-r--r-- | src/input/libdvdnav/navigation.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/input/libdvdnav/navigation.c b/src/input/libdvdnav/navigation.c index 3832ab382..1fe90f697 100644 --- a/src/input/libdvdnav/navigation.c +++ b/src/input/libdvdnav/navigation.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: navigation.c,v 1.10 2004/03/16 11:43:38 mroi Exp $ + * $Id: navigation.c,v 1.11 2004/06/20 16:59:13 mroi Exp $ * */ @@ -60,8 +60,8 @@ dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *this, int32_t *titles) { 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 @@ dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *this, int32_t title, int32_ 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 @@ dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int32_t *title, int32_ 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 @@ dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int32_t title, int32_t part) { 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); |