]> git.sesse.net Git - vlc/blobdiff - modules/access/fake.c
Fix invalid mix of closedir and free on Win32.
[vlc] / modules / access / fake.c
index 1afc7605ef234fb76b3aebe364f7d51cde31d28c..bfbfe998f70544ae00ea3a0959051a8490b961e5 100644 (file)
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -39,19 +39,19 @@ static void Close( vlc_object_t * );
 
 #define CACHING_TEXT N_("Caching value in ms")
 #define CACHING_LONGTEXT N_( \
-    "Allows you to modify the default caching value for fake streams. This " \
-    "value should be set in millisecond units." )
+    "Caching value for fake streams. This " \
+    "value should be set in milliseconds." )
 #define FPS_TEXT N_("Framerate")
 #define FPS_LONGTEXT N_( \
-    "Specifies the number of frames per second (eg. 24, 25, 29.97, 30).")
+    "Number of frames per second (eg. 24, 25, 29.97, 30).")
 #define ID_TEXT N_("ID")
 #define ID_LONGTEXT N_( \
-    "Allows you to set the ID of the fake elementary stream for use in " \
+    "Set the ID of the fake elementary stream for use in " \
     "#duplicate{} constructs (default 0).")
 #define DURATION_TEXT N_("Duration in ms")
 #define DURATION_LONGTEXT N_( \
-    "Specifies the duration of the fake streaming before faking an " \
-    "end-of-file (default 0 means the stream is unlimited).")
+    "Duration of the fake streaming before faking an " \
+    "end-of-file (default is 0, meaning that the stream is unlimited).")
 
 vlc_module_begin();
     set_shortname( _("Fake") );
@@ -92,7 +92,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 +99,17 @@ 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;
+    STANDARD_DEMUX_INIT; 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 = 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 */