]> git.sesse.net Git - vlc/blobdiff - modules/access_output/udp.c
* Massive spelling corrections.
[vlc] / modules / access_output / udp.c
index f78ee2c8b75a7f1a1e1bef3f75b1904da8f2f246..883db293168456ab0ecadb35cb6554ef9d437978 100644 (file)
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
+#define SOUT_CFG_PREFIX "sout-udp-"
+
 #define CACHING_TEXT N_("Caching value (ms)")
 #define CACHING_LONGTEXT N_( \
-    "Allows you to modify the default caching value for udp streams. This " \
+    "Allows you to modify the default caching value for UDP streams. This " \
     "value should be set in millisecond units." )
 
+#define TTL_TEXT N_("Time To Live")
+#define TTL_LONGTEXT N_("Allows you to define the time to live of the " \
+                        "outgoing stream.")
+
+#define GROUP_TEXT N_("Group packets")
+#define GROUP_LONGTEXT N_("Packets can be sent one by one at the right time " \
+                          "or by groups. This allows you to give the number " \
+                          "of packets that will be sent at a time. It " \
+                          "helps reducing the scheduling load on " \
+                          "heavily-loaded systems." )
+#define LATE_TEXT N_("Late delay (ms)" )
+#define LATE_LONGTEXT N_("Late packets are dropped. This allows you to give " \
+                       "the time (in milliseconds) a packet is allowed to be" \
+                       " late.")
+#define RAW_TEXT N_("Raw write")
+#define RAW_LONGTEXT N_("If you enable this option, packets will be sent " \
+                       "directly, without trying to fill the MTU (ie, " \
+                       "without trying to make the biggest possible packets " \
+                       "in order to improve streaming)." )
+
 vlc_module_begin();
-    set_description( _("UDP stream ouput") );
-    add_integer( "udp-sout-caching", DEFAULT_PTS_DELAY / 1000, NULL,
-                 CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
+    set_description( _("UDP stream output") );
+    add_integer( SOUT_CFG_PREFIX "caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
+    add_integer( SOUT_CFG_PREFIX "ttl", 0, NULL,TTL_TEXT, TTL_LONGTEXT,
+                                 VLC_TRUE );
+    add_integer( SOUT_CFG_PREFIX "group", 1, NULL, GROUP_TEXT, GROUP_LONGTEXT,
+                                 VLC_TRUE );
+    add_integer( SOUT_CFG_PREFIX "late", 0, NULL, LATE_TEXT, LATE_LONGTEXT,
+                                 VLC_TRUE );
+    add_bool( SOUT_CFG_PREFIX "raw",  0, NULL, RAW_TEXT, RAW_LONGTEXT,
+                                 VLC_TRUE );
+
     set_capability( "sout access", 100 );
     add_shortcut( "udp" );
     add_shortcut( "rtp" ); // Will work only with ts muxer
@@ -76,6 +106,16 @@ vlc_module_end();
 /*****************************************************************************
  * Exported prototypes
  *****************************************************************************/
+
+static const char *ppsz_sout_options[] = {
+    "caching",
+    "ttl",
+    "group",
+    "late",
+    "raw",
+    NULL
+};
+
 static int  Write   ( sout_access_out_t *, block_t * );
 static int  WriteRaw( sout_access_out_t *, block_t * );
 static int  Seek    ( sout_access_out_t *, off_t  );
@@ -133,7 +173,8 @@ static int Open( vlc_object_t *p_this )
     network_socket_t    socket_desc;
 
     vlc_value_t         val;
-    char                *psz_val;
+
+    sout_ParseCfg( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );
 
     if( !( p_sys = p_access->p_sys =
                 malloc( sizeof( sout_access_out_sys_t ) ) ) )
@@ -200,11 +241,10 @@ static int Open( vlc_object_t *p_this )
     socket_desc.i_server_port   = i_dst_port;
     socket_desc.psz_bind_addr   = "";
     socket_desc.i_bind_port     = 0;
-    socket_desc.i_ttl           = 0;
-    if( ( psz_val = sout_cfg_find_value( p_access->p_cfg, "ttl" ) ) )
-    {
-        socket_desc.i_ttl = atoi( psz_val );
-    }
+
+    var_Get( p_access, SOUT_CFG_PREFIX "ttl", &val );
+    socket_desc.i_ttl = val.i_int;
+
     p_sys->p_thread->p_private = (void*)&socket_desc;
     if( !( p_network = module_Need( p_sys->p_thread, "network", NULL, 0 ) ) )
     {
@@ -215,27 +255,14 @@ static int Open( vlc_object_t *p_this )
 
     p_sys->p_thread->i_handle = socket_desc.i_handle;
 
-    var_Create( p_this, "udp-sout-caching",
-                VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
-    var_Get( p_this, "udp-sout-caching", &val );
-    p_sys->p_thread->i_caching = val.i_int * 1000;
-    if( ( psz_val = sout_cfg_find_value( p_access->p_cfg, "caching" ) ) )
-    {
-        p_sys->p_thread->i_caching = atoll( psz_val ) * 1000;
-    }
+    var_Get( p_access, SOUT_CFG_PREFIX "caching", &val );
+    p_sys->p_thread->i_caching = (int64_t)val.i_int * 1000;
 
-    p_sys->p_thread->i_group = 1;
-    if( ( psz_val = sout_cfg_find_value( p_access->p_cfg, "group" ) ) )
-    {
-        p_sys->p_thread->i_group = atoi( psz_val );
-    }
-
-    p_sys->p_thread->i_late = 0;
-    if( ( psz_val = sout_cfg_find_value( p_access->p_cfg, "late" ) ) )
-    {
-        p_sys->p_thread->i_late = atoll( psz_val ) * 1000;
-    }
+    var_Get( p_access, SOUT_CFG_PREFIX "group", &val );
+    p_sys->p_thread->i_group = val.i_int;
 
+    var_Get( p_access, SOUT_CFG_PREFIX "late", &val );
+    p_sys->p_thread->i_late = (int64_t)val.i_int * 1000;
 
     p_sys->i_mtu = socket_desc.i_mtu;
 
@@ -257,7 +284,8 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_sequence_number = rand()&0xffff;
     p_sys->i_ssrc            = rand()&0xffffffff;
 
-    if( sout_cfg_find( p_access->p_cfg, "raw" ) )
+    var_Get( p_access, SOUT_CFG_PREFIX "raw", &val );
+    if( val.b_bool )
     {
         p_access->pf_write = WriteRaw;
     }