]> git.sesse.net Git - vlc/blobdiff - modules/misc/stats/demux.c
Restore LibVLC/VERSION at the end of the HTTP user agent
[vlc] / modules / misc / stats / demux.c
index f2e9aec56b92b9b3cac983c8f3c66315a34f5d78..20105b6d0761bdcec99d9d9ac728cd5ff0a02fe1 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
- * input_dummy.c: dummy input plugin, to manage "vlc:***" special options
+ * demux.c: stats demux plugin
  *****************************************************************************
- * Copyright (C) 2001, 2002 the VideoLAN team
- * $Id$
+ * Copyright (C) 2001-2008 the VideoLAN team
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
+ *          Pierre d'Herbemont <pdherbemont@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_interface.h>
 #include <vlc_access.h>
 #include <vlc_demux.h>
-#include <vlc_playlist.h>
 
 #include "stats.h"
 
@@ -63,6 +62,12 @@ int OpenDemux ( vlc_object_t *p_this )
     demux_t *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys;
 
+    p_demux->p_sys = NULL;
+
+    /* Only when selected */
+    if( *p_demux->psz_demux == '\0' )
+        return VLC_EGENERIC;
+
     msg_Dbg( p_demux, "Init Stat demux" );
 
     p_demux->pf_demux   = Demux;
@@ -103,13 +108,15 @@ static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
 
-    msg_Dbg( p_demux, "Demux" );
-
     block_t * p_block = stream_Block( p_demux->s, kBufferSize );
 
+    if( !p_block ) return 1;
+
     p_block->i_dts = p_block->i_pts =
         date_Increment( &p_sys->pts, kBufferSize );
 
+    msg_Dbg( p_demux, "demux got %d ms offset", (int)(mdate() - *(mtime_t *)p_block->p_buffer) / 1000 );
+
     //es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block->i_pts );
 
     es_out_Send( p_demux->out, p_sys->p_es, p_block );