]> git.sesse.net Git - vlc/commitdiff
Add bind and path aliases for standard streamoutput, so you can document
authorIlkka Ollakka <ileoo@videolan.org>
Fri, 14 Mar 2008 20:57:55 +0000 (22:57 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Mon, 17 Mar 2008 08:23:02 +0000 (10:23 +0200)
streaming (hopefully) more cleaner way like:

standard{access=http,bind=:8080,path=/myfile.ts}
equals to
standard{access=http,dst=:8080//myfile.ts}
(that extra / doesn't seem to harm and it's only visual flaw)

modules/stream_out/standard.c

index bfa13a5bf0ec2def3ec69b25bb7d3e92deac95e7..148f1537e2dcb93aa2275465042c8f82a3dffcfd 100644 (file)
 #define DEST_TEXT N_("Output destination")
 #define DEST_LONGTEXT N_( \
     "Destination (URL) to use for the stream." )
+#define BIND_TEXT N_("address to bind to (helper setting for dst)")
+#define BIND_LONGTEXT N_( \
+  "address:port to bind vlc to listening incoming streams "\
+  "helper setting for dst,dst=bind+'/'+path" )
+#define PATH_TEXT N_("filename for stream (helper setting for dst)")
+#define PATH_LONGTEXT N_( \
+  "Filename for stream "\
+  "helper setting for dst, dst=bind+'/'+path" )
 #define NAME_TEXT N_("Session name")
 #define NAME_LONGTEXT N_( \
   "This allows you to specify a name for the session, that will be announced "\
@@ -98,6 +106,10 @@ vlc_module_begin();
                 MUX_LONGTEXT, VLC_FALSE );
     add_string( SOUT_CFG_PREFIX "dst", "", NULL, DEST_TEXT,
                 DEST_LONGTEXT, VLC_FALSE );
+    add_string( SOUT_CFG_PREFIX "bind", "", NULL, BIND_TEXT,
+                BIND_LONGTEXT, VLC_FALSE );
+    add_string( SOUT_CFG_PREFIX "path", "", NULL, PATH_TEXT,
+                PATH_LONGTEXT, VLC_FALSE );
         change_unsafe();
 
     add_bool( SOUT_CFG_PREFIX "sap", VLC_FALSE, NULL, SAP_TEXT, SAP_LONGTEXT,
@@ -125,7 +137,8 @@ vlc_module_end();
  *****************************************************************************/
 static const char *ppsz_sout_options[] = {
     "access", "mux", "url", "dst",
-    "sap", "name", "group", "description", "url", "email", "phone", NULL
+    "sap", "name", "group", "description", "url", "email", "phone",
+    "bind", "path", NULL
 };
 
 #define DEFAULT_PORT 1234
@@ -152,6 +165,8 @@ static int Open( vlc_object_t *p_this )
     char *psz_mux;
     char *psz_access;
     char *psz_url;
+    char *psz_bind;
+    char *psz_path;
 
     vlc_value_t val;
 
@@ -171,8 +186,24 @@ static int Open( vlc_object_t *p_this )
     psz_mux = *val.psz_string ? val.psz_string : NULL;
     if( !*val.psz_string ) free( val.psz_string );
 
+    var_Get( p_stream, SOUT_CFG_PREFIX "bind", &val );
+    psz_bind = *val.psz_string ? val.psz_string : NULL;
+    if( !*val.psz_string ) free( val.psz_string);
+
+    var_Get( p_stream, SOUT_CFG_PREFIX "path", &val );
+    psz_path = *val.psz_string ? val.psz_string : NULL;
+    if( !*val.psz_string ) free( val.psz_string);
+
+    if( psz_bind ) psz_url = psz_bind;
+    if( psz_url && psz_path ) 
+    {
+        if( asprintf( &psz_url,"%s/%s",psz_url,psz_path ) == -1 )
+            psz_url = NULL;
+        free( psz_path );
+    }
+
     var_Get( p_stream, SOUT_CFG_PREFIX "dst", &val );
-    psz_url = *val.psz_string ? val.psz_string : NULL;
+    if( *val.psz_string ) psz_url = val.psz_string;
     if( !*val.psz_string ) free( val.psz_string );
 
     p_sys = p_stream->p_sys = malloc( sizeof( sout_stream_sys_t) );