]> git.sesse.net Git - vlc/blobdiff - modules/access/dc1394.c
test if access dc1394 is right earlier in the probing process to avoid side effect...
[vlc] / modules / access / dc1394.c
index 3b9654ccf610e24a0c87b4702485501c1162dbe4..9fa05aa8f5dd7bf0ff7e99c02b41636b97d8ba1e 100644 (file)
@@ -30,7 +30,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_input.h>
 #include <vlc_vout.h>
 #include <vlc_demux.h>
@@ -62,12 +63,12 @@ static void Close( vlc_object_t * );
 static void OpenAudioDev( demux_t *p_demux );
 static inline void CloseAudioDev( demux_t *p_demux );
 
-vlc_module_begin();
-    set_description( _("dc1394 input") );
-    set_capability( "access_demux", 10 );
-    add_shortcut( "dc1394" );
-    set_callbacks( Open, Close );
-vlc_module_end();
+vlc_module_begin ()
+    set_description( N_("dc1394 input") )
+    set_capability( "access_demux", 10 )
+    add_shortcut( "dc1394" )
+    set_callbacks( Open, Close )
+vlc_module_end ()
 
 typedef struct __dc_camera
 {
@@ -217,6 +218,9 @@ static int Open( vlc_object_t *p_this )
     int i_aspect;
     int result = 0;
 
+    if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
+        return VLC_EGENERIC;
+
     /* Set up p_demux */
     p_demux->pf_demux = Demux;
     p_demux->pf_control = Control;
@@ -224,13 +228,9 @@ static int Open( vlc_object_t *p_this )
     p_demux->info.i_title = 0;
     p_demux->info.i_seekpoint = 0;
 
-    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
+    p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
     if( !p_sys )
-    {
-        msg_Err( p_demux, "not enough memory available" );
         return VLC_ENOMEM;
-    }
-    memset( p_sys, 0, sizeof( demux_sys_t ) );
     memset( &fmt, 0, sizeof( es_format_t ) );
 
     /* DEFAULTS */
@@ -750,7 +750,7 @@ static block_t *GrabAudio( demux_t *p_demux )
         i_correct += buf_info.bytes;
 
     p_block->i_pts = p_block->i_dts =
-                        mdate() - I64C(1000000) * (mtime_t)i_correct /
+                        mdate() - INT64_C(1000000) * (mtime_t)i_correct /
                         2 / p_sys->channels / p_sys->i_sample_rate;
     return p_block;
 }
@@ -837,9 +837,6 @@ static int process_options( demux_t *p_demux )
     char *state = NULL;
     float rate_f;
 
-    if( strncmp(p_demux->psz_access, "dc1394", 6) != 0 )
-        return VLC_EGENERIC;
-
     psz_dup = strdup( p_demux->psz_path );
     psz_parser = psz_dup;
     for( token = strtok_r( psz_parser,":",&state); token;