changeset 19892:2c361743ce69

don't seek until dvdnav_get_position() returns something meaningful (len > 0), or dvdnav may crash or complain.
author nicodvb
date Mon, 18 Sep 2006 21:12:22 +0000
parents 55a39486f4a8
children 9440915a76f1
files stream/stream_dvdnav.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_dvdnav.c	Mon Sep 18 18:54:38 2006 +0000
+++ b/stream/stream_dvdnav.c	Mon Sep 18 21:12:22 2006 +0000
@@ -51,6 +51,8 @@
 int osd_show_dvd_nav_ey;
 int dvd_nav_still=0;            /* are we on a still picture? */
 
+static int seek(stream_t *s, off_t newpos);
+
 dvdnav_priv_t * new_dvdnav_stream(char * filename) {
   char * title_str;
   dvdnav_priv_t *dvdnav_priv;
@@ -248,8 +250,13 @@
   uint32_t pos = 0, len = 0;
 
   status = dvdnav_get_position(priv->dvdnav, &pos, &len);
-  if(status == DVDNAV_STATUS_OK && len)
+  if(status == DVDNAV_STATUS_OK && len) {
     stream->end_pos = (off_t) len * 2048;
+    stream->seek = seek;
+  } else {
+    stream->seek = NULL;
+    stream->end_pos = 0;
+  }
 }