]> git.sesse.net Git - vlc/blobdiff - modules/access/fake.c
Factorise the Video Control code. List all available controls in debug messages....
[vlc] / modules / access / fake.c
index d24bdb2161448420b719bc6b39c74a6c5e45a200..b4a2cb1c20a21481efe79bf2b6ca59db7f5a7351 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 
 #include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_access.h>
+#include <vlc_demux.h>
 
 /*****************************************************************************
  * Module descriptior
@@ -92,7 +90,6 @@ static int Open( vlc_object_t *p_this )
 {
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys;
-    vlc_value_t val;
     es_format_t fmt;
 
     /* Only when selected */
@@ -100,27 +97,18 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     /* Set up p_demux */
-    p_demux->pf_demux = Demux;
-    p_demux->pf_control = Control;
+    DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys;
     p_demux->info.i_update = 0;
     p_demux->info.i_title = 0;
     p_demux->info.i_seekpoint = 0;
-    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
-    memset( p_sys, 0, sizeof( demux_sys_t ) );
 
-    var_Create( p_demux, "fake-duration", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
-    var_Get( p_demux, "fake-duration", &val );
-    p_sys->i_duration = val.i_int * 1000;
-
-    var_Create( p_demux, "fake-fps", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
-    var_Get( p_demux, "fake-fps", &val );
-    p_sys->f_fps = val.f_float;
+    p_sys->i_duration =
+        (mtime_t)var_CreateGetInteger( p_demux, "fake-duration" ) * 1000;
+    p_sys->f_fps = var_CreateGetFloat( p_demux, "fake-fps" );
 
     /* Declare the elementary stream */
     es_format_Init( &fmt, VIDEO_ES, VLC_FOURCC('f','a','k','e') );
-    var_Create( p_demux, "fake-id", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
-    var_Get( p_demux, "fake-id", &val );
-    fmt.i_id = val.i_int;
+    fmt.i_id = var_CreateGetInteger( p_demux, "fake-id" );
     p_sys->p_es_video = es_out_Add( p_demux->out, &fmt );
 
     /* Update default_pts to a suitable value for access */
@@ -258,4 +246,3 @@ static int Demux( demux_t *p_demux )
 
     return 1;
 }
-