[vlc-commits] v4l: measure time from start (fixes #7400)

Rémi Denis-Courmont git at videolan.org
Mon Sep 3 15:28:49 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Sep  3 16:28:45 2012 +0300| [c21bc6b1c6f58b9c6d7dbf279a91c5e8b6c15ba3] | committer: Rémi Denis-Courmont

v4l: measure time from start (fixes #7400)

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

 modules/access/v4l2/demux.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index 74c3a73..0bfe415 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -57,6 +57,7 @@ struct demux_sys_t
 
     es_out_id_t *es;
     vlc_v4l2_ctrl_t *controls;
+    mtime_t start;
 };
 
 static void *UserPtrThread (void *);
@@ -94,6 +95,7 @@ int DemuxOpen( vlc_object_t *obj )
     }
 
     sys->controls = ControlsInit (VLC_OBJECT(demux), fd);
+    sys->start = mdate ();
     demux->pf_demux = NULL;
     demux->pf_control = DemuxControl;
     demux->info.i_update = 0;
@@ -628,6 +630,8 @@ static void *ReadThread (void *data)
 
 static int DemuxControl( demux_t *demux, int query, va_list args )
 {
+    demux_sys_t *sys = demux->p_sys;
+
     switch( query )
     {
         /* Special for access_demux */
@@ -643,7 +647,7 @@ static int DemuxControl( demux_t *demux, int query, va_list args )
             return VLC_SUCCESS;
 
         case DEMUX_GET_TIME:
-            *va_arg( args, int64_t * ) = mdate();
+            *va_arg (args, int64_t *) = mdate() - sys->start;
             return VLC_SUCCESS;
 
         /* TODO implement others */



More information about the vlc-commits mailing list