changeset 25830:32acf35f74e1

add a new state flag to dvdnav in order to notify if something has changed in the current stream (being title, chapter, audio layer or SPU one)
author ben
date Sat, 26 Jan 2008 16:17:44 +0000
parents c0b5ff39e928
children 9463ef1a0e63
files stream/stream_dvdnav.c stream/stream_dvdnav.h
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_dvdnav.c	Sat Jan 26 13:10:47 2008 +0000
+++ b/stream/stream_dvdnav.c	Sat Jan 26 16:17:44 2008 +0000
@@ -30,6 +30,7 @@
   NAV_FLAG_WAIT_READ            = 1 << 5,  /* suspend read from stream */
   NAV_FLAG_VTS_DOMAIN           = 1 << 6,  /* vts domain */
   NAV_FLAG_SPU_SET              = 1 << 7,  /* spu_clut is valid */
+  NAV_FLAG_STREAM_CHANGE        = 1 << 8,  /* title, chapter, audio or SPU */
 } dvdnav_state_t;
 
 typedef struct {
@@ -198,6 +199,7 @@
         uint32_t nextstill;
 
         priv->state &= ~NAV_FLAG_WAIT_SKIP;
+        priv->state |= NAV_FLAG_STREAM_CHANGE;
         if(ev->pgc_length)
           priv->duration = ev->pgc_length/90;
 
@@ -233,6 +235,11 @@
       }
       case DVDNAV_VTS_CHANGE: {
         priv->state &= ~NAV_FLAG_WAIT_SKIP;
+        priv->state |= NAV_FLAG_STREAM_CHANGE;
+        break;
+      }
+      case DVDNAV_SPU_STREAM_CHANGE: {
+        priv->state |= NAV_FLAG_STREAM_CHANGE;
         break;
       }
     }
@@ -899,9 +906,22 @@
     return 0;
   if (clear)
     priv->state &= ~NAV_FLAG_CELL_CHANGED;
+  if (clear) priv->state |= NAV_FLAG_STREAM_CHANGE;
   return 1;
 }
 
+/* Notify if something has changed in stream
+ * Can be related to title, chapter, audio or SPU
+ */
+int mp_dvdnav_stream_has_changed (stream_t *stream) {
+  dvdnav_priv_t *priv = stream->priv;
+
+  if (!(priv->state & NAV_FLAG_STREAM_CHANGE))
+    return 0;
+
+  priv->state &= ~NAV_FLAG_STREAM_CHANGE;
+  return 1;
+}
 
 const stream_info_t stream_info_dvdnav = {
   "DVDNAV stream",
--- a/stream/stream_dvdnav.h	Sat Jan 26 13:10:47 2008 +0000
+++ b/stream/stream_dvdnav.h	Sat Jan 26 16:17:44 2008 +0000
@@ -27,5 +27,6 @@
 int mp_dvdnav_skip_wait (stream_t *stream);
 void mp_dvdnav_read_wait (stream_t *stream, int mode, int automode);
 int mp_dvdnav_cell_has_changed (stream_t *stream, int clear);
+int mp_dvdnav_stream_has_changed (stream_t *stream);
 
 #endif /* MPLAYER_STREAM_DVDNAV_H */