]> git.sesse.net Git - vlc/blobdiff - modules/access/tcp.c
Include the BlackMagic SDK stuff with <>.
[vlc] / modules / access / tcp.c
index 1ae0350cbb2d2bc23024ae9cd18a78dd58ad108b..7b111f0ca055c7d77c1d4450cf569626e1e91365 100644 (file)
@@ -29,7 +29,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_access.h>
 
 #include <vlc_network.h>
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
-vlc_module_begin();
-    set_shortname( _("TCP") );
-    set_description( _("TCP input") );
-    set_category( CAT_INPUT );
-    set_subcategory( SUBCAT_INPUT_ACCESS );
+vlc_module_begin ()
+    set_shortname( N_("TCP") )
+    set_description( N_("TCP input") )
+    set_category( CAT_INPUT )
+    set_subcategory( SUBCAT_INPUT_ACCESS )
 
     add_integer( "tcp-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
-                 CACHING_LONGTEXT, true );
+                 CACHING_LONGTEXT, true )
+        change_safe()
 
-    set_capability( "access", 0 );
-    add_shortcut( "tcp" );
-    set_callbacks( Open, Close );
-vlc_module_end();
+    set_capability( "access", 0 )
+    add_shortcut( "tcp" )
+    set_callbacks( Open, Close )
+vlc_module_end ()
 
 /*****************************************************************************
  * Local prototypes
@@ -79,7 +81,7 @@ static int Open( vlc_object_t *p_this )
     access_t     *p_access = (access_t *)p_this;
     access_sys_t *p_sys;
 
-    char         *psz_dup = strdup(p_access->psz_path);
+    char         *psz_dup = strdup(p_access->psz_location);
     char         *psz_parser = psz_dup;
 
     /* Parse server:port */
@@ -101,10 +103,14 @@ static int Open( vlc_object_t *p_this )
     *psz_parser++ = '\0';
 
     /* Init p_access */
-    access_InitFields( p_access ); \
-    ACCESS_SET_CALLBACKS( Read, NULL, Control, NULL ); \
-    MALLOC_ERR( p_access->p_sys, access_sys_t ); \
-    p_sys = p_access->p_sys; memset( p_sys, 0, sizeof( access_sys_t ) );
+    access_InitFields( p_access );
+    ACCESS_SET_CALLBACKS( Read, NULL, Control, NULL );
+    p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ) );
+    if( !p_sys )
+    {
+        free( psz_dup );
+        return VLC_ENOMEM;
+    }
 
     p_sys->fd = net_ConnectTCP( p_access, psz_dup, atoi( psz_parser ) );
     free( psz_dup );
@@ -134,7 +140,7 @@ static void Close( vlc_object_t *p_this )
 }
 
 /*****************************************************************************
- * Read: read on a file descriptor, checking b_die periodically
+ * Read: read on a file descriptor
  *****************************************************************************/
 static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
 {
@@ -159,9 +165,8 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
  *****************************************************************************/
 static int Control( access_t *p_access, int i_query, va_list args )
 {
-    bool   *pb_bool;
-    int          *pi_int;
-    int64_t      *pi_64;
+    bool    *pb_bool;
+    int64_t *pi_64;
 
     switch( i_query )
     {
@@ -180,15 +185,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
             *pb_bool = true;    /* FIXME */
             break;
 
-        /* */
-        case ACCESS_GET_MTU:
-            pi_int = (int*)va_arg( args, int * );
-            *pi_int = 0;
-            break;
-
         case ACCESS_GET_PTS_DELAY:
             pi_64 = (int64_t*)va_arg( args, int64_t * );
-            *pi_64 = (int64_t)var_GetInteger( p_access, "tcp-caching" ) * INT64_C(1000);
+            *pi_64 = var_GetInteger( p_access, "tcp-caching" ) * INT64_C(1000);
             break;
 
         /* */