[vlc-devel] [PATCH] DShow: correct elapsed time

Salah-Eddin Shaban salah at videolan.org
Sun Feb 12 18:29:45 CET 2017


Close #16977
---
 modules/access/dshow/access.h  | 1 +
 modules/access/dshow/dshow.cpp | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/access/dshow/access.h b/modules/access/dshow/access.h
index 97288cb..c748f49 100644
--- a/modules/access/dshow/access.h
+++ b/modules/access/dshow/access.h
@@ -76,5 +76,6 @@ struct access_sys_t
     int            i_height;
     int            i_chroma;
     bool           b_chroma; /* Force a specific chroma on the dshow input */
+    mtime_t        i_start;
 };
 
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index f5c60ef..c084ad4 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -754,6 +754,7 @@ static int DemuxOpen( vlc_object_t *p_this )
         p_stream->p_es = es_out_Add( p_demux->out, &fmt );
     }
 
+    p_sys->i_start = mdate();
     return VLC_SUCCESS;
 }
 
@@ -1932,6 +1933,8 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
     bool    *pb;
     int64_t *pi64;
 
+    access_sys_t *p_sys = ( access_sys_t * ) p_demux->p_sys;
+
     switch( i_query )
     {
     /* Special for access_demux */
@@ -1951,7 +1954,7 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
 
     case DEMUX_GET_TIME:
         pi64 = (int64_t*)va_arg( args, int64_t * );
-        *pi64 = mdate();
+        *pi64 = mdate() - p_sys->i_start;
         return VLC_SUCCESS;
 
     /* TODO implement others */
-- 
2.6.6



More information about the vlc-devel mailing list