]> git.sesse.net Git - vlc/blobdiff - modules/access/dv.c
Remove mixing from audio mixers
[vlc] / modules / access / dv.c
index 20079512b45978fda690a23b9d10d63008af090b..a41906adf5b86a08f58c396170544bc43dcb9953 100644 (file)
 #include <vlc_access.h>
 
 #include <errno.h>
-#ifdef HAVE_SYS_TYPES_H
-#   include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#   include <sys/time.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#   include <fcntl.h>
-#endif
-
+#include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 #   include <unistd.h>
 #elif defined( WIN32 ) && !defined( UNDER_CE )
@@ -75,12 +66,10 @@ vlc_module_begin ()
     set_shortname( N_("DV") )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_ACCESS )
-    add_integer( "dv-caching", 60000 / 1000, NULL, CACHING_TEXT, CACHING_LONGTEXT, true )
+    add_integer( "dv-caching", 60000 / 1000, CACHING_TEXT, CACHING_LONGTEXT, true )
         change_safe()
     set_capability( "access", 0 )
-    add_shortcut( "dv" )
-    add_shortcut( "dv1394" )
-    add_shortcut( "raw1394" )
+    add_shortcut( "dv", "dv1394", "raw1394" )
     set_callbacks( Open, Close )
 vlc_module_end ()
 
@@ -142,11 +131,10 @@ static int Open( vlc_object_t *p_this )
 {
     access_t     *p_access = (access_t*)p_this;
     access_sys_t *p_sys;
-    char *psz_name = strdup( p_access->psz_path );
 
     struct raw1394_portinfo port_inf[ 16 ];
 
-    msg_Dbg( p_access, "opening device %s", psz_name );
+    msg_Dbg( p_access, "opening device" );
 
     /* Set up p_access */
     access_InitFields( p_access );
@@ -154,10 +142,7 @@ static int Open( vlc_object_t *p_this )
 
     p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
     if( !p_sys )
-    {
-        free( psz_name );
         return VLC_EGENERIC;
-    }
 
     p_sys->i_cards = 0;
     p_sys->i_node = 0;
@@ -176,42 +161,37 @@ static int Open( vlc_object_t *p_this )
     {
         msg_Err( p_access, "failed to open a Firewire (IEEE1394) connection" );
         Close( p_this );
-        free( psz_name );
         return VLC_EGENERIC;
     }
 
     p_sys->p_avc1394 = AVCOpen( p_access, p_sys->i_port );
     if( !p_sys->p_avc1394 )
     {
-        msg_Err( p_access, "no Digital Video Control device found on %s", psz_name );
+        msg_Err( p_access, "no Digital Video Control device found" );
         Close( p_this );
-        free( psz_name );
         return VLC_EGENERIC;
     }
 
     p_sys->p_raw1394 = raw1394_new_handle();
     if( !p_sys->p_raw1394 )
     {
-        msg_Err( p_access, "no Digital Video device found on %s", psz_name );
+        msg_Err( p_access, "no Digital Video device found" );
         Close( p_this );
-        free( psz_name );
         return VLC_EGENERIC;
     }
 
     p_sys->i_cards = raw1394_get_port_info( p_sys->p_raw1394, port_inf, 16 );
     if( p_sys->i_cards < 0 )
     {
-        msg_Err( p_access, "failed to get port info for %s", psz_name );
+        msg_Err( p_access, "failed to get port info" );
         Close( p_this );
-        free( psz_name );
         return VLC_EGENERIC;
     }
 
     if( raw1394_set_port( p_sys->p_raw1394, p_sys->i_port ) < 0 )
     {
-        msg_Err( p_access, "failed to set port info for %s", psz_name );
+        msg_Err( p_access, "failed to set port info" );
         Close( p_this );
-        free( psz_name );
         return VLC_EGENERIC;
     }
 
@@ -219,9 +199,8 @@ static int Open( vlc_object_t *p_this )
                 ISOCHRONOUS_QUEUE_LENGTH, ISOCHRONOUS_MAX_PACKET_SIZE,
                 p_sys->i_channel, RAW1394_DMA_PACKET_PER_BUFFER, -1 ) < 0 )
     {
-        msg_Err( p_access, "failed to init isochronous recv for %s", psz_name );
+        msg_Err( p_access, "failed to init isochronous recv" );
         Close( p_this );
-        free( psz_name );
         return VLC_EGENERIC;
     }
 
@@ -238,9 +217,8 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_ev = vlc_object_create( p_access, sizeof( event_thread_t ) );
     if( !p_sys->p_ev )
     {
-        msg_Err( p_access, "failed to create event thread for %s", psz_name );
+        msg_Err( p_access, "failed to create event thread" );
         Close( p_this );
-        free( psz_name );
         return VLC_EGENERIC;
     }
 
@@ -248,10 +226,9 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_ev->pp_last = &p_sys->p_ev->p_frame;
     p_sys->p_ev->p_access = p_access;
     vlc_mutex_init( &p_sys->p_ev->lock );
-    vlc_thread_create( p_sys->p_ev, "dv event thread handler",
+    vlc_thread_create( p_sys->p_ev,
                        Raw1394EventThread, VLC_THREAD_PRIORITY_OUTPUT );
 
-    free( psz_name );
     return VLC_SUCCESS;
 }
 
@@ -315,7 +292,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
 
         case ACCESS_GET_PTS_DELAY:
             *va_arg( args, int64_t * )
-                   = (int64_t)var_GetInteger( p_access, "dv-caching" ) * 1000;
+                   = var_GetInteger( p_access, "dv-caching" ) * 1000;
             break;
 
         /* */
@@ -366,11 +343,8 @@ static void* Raw1394EventThread( vlc_object_t *p_this )
     {
         while( ( result = poll( &(p_sys->raw1394_poll), 1, 200 ) ) < 0 )
         {
-            if( !( errno == EAGAIN || errno == EINTR ) )
-            {
-                perror( "error: raw1394 poll" );
-                msg_Err( p_access, "retrying device raw1394" );
-            }
+            if( errno != EINTR )
+                msg_Err( p_access, "poll error: %m" );
         }
         if( !vlc_object_alive (p_sys->p_ev) )
                 break;