[vlc-commits] dvdnav: provide test-and-clear-flags control

Rémi Denis-Courmont git at videolan.org
Sun Jan 28 15:18:29 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec 17 21:44:23 2017 +0200| [4866a55555bdf27984149e4d5aff5c733bd54283] | committer: Rémi Denis-Courmont

dvdnav: provide test-and-clear-flags control

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4866a55555bdf27984149e4d5aff5c733bd54283
---

 modules/access/dvdnav.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index b7a8d9d97c..aacdd9cc38 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -157,6 +157,7 @@ struct demux_sys_t
     input_title_t **title;
     int           cur_title;
     int           cur_seekpoint;
+    unsigned      updates;
 
     /* length of program group chain */
     mtime_t     i_pgc_length;
@@ -643,8 +644,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 }
             }
 
-            p_demux->info.i_update |=
-                INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
+            p_sys->updates |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
             p_sys->cur_title = i;
             p_sys->cur_seekpoint = 0;
             return VLC_SUCCESS;
@@ -673,10 +673,18 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 msg_Warn( p_demux, "cannot set title/chapter" );
                 return VLC_EGENERIC;
             }
-            p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
+            p_sys->updates |= INPUT_UPDATE_SEEKPOINT;
             p_sys->cur_seekpoint = i;
             return VLC_SUCCESS;
 
+        case DEMUX_TEST_AND_CLEAR_FLAGS:
+        {
+            unsigned *restrict flags = va_arg(args, unsigned *);
+            *flags &= p_sys->updates;
+            p_sys->updates &= ~*flags;
+            break;
+        }
+
         case DEMUX_GET_TITLE:
             *va_arg( args, int * ) = p_sys->cur_title;
             break;
@@ -763,8 +771,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                     return VLC_EGENERIC;
                 }
             }
-            p_demux->info.i_update |=
-                INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
+            p_sys->updates |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
             p_sys->cur_title = 0;
             p_sys->cur_seekpoint = 2;
             break;
@@ -981,7 +988,7 @@ static int Demux( demux_t *p_demux )
             if( i_title >= 0 && i_title < p_sys->i_title &&
                 p_sys->cur_title != i_title )
             {
-                p_demux->info.i_update |= INPUT_UPDATE_TITLE;
+                p_sys->updates |= INPUT_UPDATE_TITLE;
                 p_sys->cur_title = i_title;
             }
         }
@@ -1015,12 +1022,12 @@ static int Demux( demux_t *p_demux )
         {
             if( i_title >= 0 && i_title < p_sys->i_title )
             {
-                p_demux->info.i_update |= INPUT_UPDATE_TITLE;
+                p_sys->updates |= INPUT_UPDATE_TITLE;
                 p_sys->cur_title = i_title;
 
                 if( i_part >= 1 && i_part <= p_sys->title[i_title]->i_seekpoint )
                 {
-                    p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
+                    p_sys->updates |= INPUT_UPDATE_SEEKPOINT;
                     p_sys->cur_seekpoint = i_part - 1;
                 }
             }



More information about the vlc-commits mailing list