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

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


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

mkv: provide test-and-clear-flags control

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

 modules/demux/mkv/demux.hpp           |  2 ++
 modules/demux/mkv/mkv.cpp             | 12 ++++++++++--
 modules/demux/mkv/virtual_segment.cpp |  4 ++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
index 0fed033858..c9cfe557c9 100644
--- a/modules/demux/mkv/demux.hpp
+++ b/modules/demux/mkv/demux.hpp
@@ -340,6 +340,7 @@ public:
         ,meta(NULL)
         ,i_current_title(0)
         ,i_current_seekpoint(0)
+        ,i_updates(0)
         ,p_current_vsegment(NULL)
         ,dvd_interpretor( *this )
         ,f_duration(-1.0)
@@ -366,6 +367,7 @@ public:
     std::vector<input_title_t*>      titles; // matroska editions
     size_t                           i_current_title;
     size_t                           i_current_seekpoint;
+    unsigned                         i_updates;
 
     std::vector<matroska_stream_c*>  streams;
     std::vector<attachment_c*>       stored_attachments;
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 570ad0870f..c8edf421d1 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -379,7 +379,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 if( VLC_SUCCESS ==
                     Seek( p_demux, static_cast<int64_t>( p_sys->titles[i_idx]->seekpoint[0]->i_time_offset ), -1, NULL) )
                 {
-                    p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT|INPUT_UPDATE_TITLE;
+                    p_sys->i_updates |= INPUT_UPDATE_SEEKPOINT|INPUT_UPDATE_TITLE;
                     p_sys->i_current_seekpoint = 0;
                     p_sys->f_duration = (float) p_sys->titles[i_idx]->i_length / 1000.f;
                     return VLC_SUCCESS;
@@ -401,13 +401,21 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 int i_ret = Seek( p_demux, static_cast<int64_t>( p_sys->titles[p_sys->i_current_title]->seekpoint[i_skp]->i_time_offset ), -1, NULL);
                 if( i_ret == VLC_SUCCESS )
                 {
-                    p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
+                    p_sys->i_updates |= INPUT_UPDATE_SEEKPOINT;
                     p_sys->i_current_seekpoint = i_skp;
                 }
                 return i_ret;
             }
             return VLC_EGENERIC;
 
+        case DEMUX_TEST_AND_CLEAR_FLAGS:
+        {
+            unsigned *restrict flags = va_arg( args, unsigned * );
+            *flags &= p_sys->i_updates;
+            p_sys->i_updates &= ~*flags;
+            break;
+        }
+
         case DEMUX_GET_TITLE:
             *va_arg( args, int * ) = p_sys->i_current_title;
             return VLC_SUCCESS;
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index c597d2b724..8bcea134a6 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -467,7 +467,7 @@ bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux )
             p_current_vchapter = p_cur_vchapter;
             if ( p_cur_vchapter->i_seekpoint_num > 0 )
             {
-                demux.info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
+                sys.i_updates |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
                 sys.i_current_title = i_sys_title;
                 sys.i_current_seekpoint = p_cur_vchapter->i_seekpoint_num - 1;
             }
@@ -524,7 +524,7 @@ bool virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date,
         p_sys->i_mk_chapter_time = i_mk_time_offset - p_vchapter->segment.i_mk_start_time /* + VLC_TS_0 */;
         if ( p_vchapter->p_chapter && p_vchapter->i_seekpoint_num > 0 )
         {
-            demuxer.info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
+            p_sys->i_updates |= INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
             p_sys->i_current_title = i_sys_title;
             p_sys->i_current_seekpoint = p_vchapter->i_seekpoint_num - 1;
         }



More information about the vlc-commits mailing list