]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/announce.c
* rtp, display: update p_sout->i_out_pace_nocontrol.
[vlc] / modules / stream_out / announce.c
index 0f44db097c5cc93e41136a7071b0488fd2e6ebfd..663ffc3ab1efd3fb56b1cfda812f7d1b60760a9b 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <errno.h>                                                 /* ENOMEM */
 #include <stdlib.h>                                                /* free() */
+
+#include <errno.h>                                                 /* ENOMEM */
 #include <stdio.h>                                              /* sprintf() */
-#include <string.h>                                            /* strerror() */
 
 #include <vlc/vlc.h>
 #include <vlc/sout.h>
@@ -220,7 +220,7 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout,
 
         /* Call the network module */
         p_sout->p_private = (void*) &socket_desc;
-        if( !( p_network = module_Need( p_sout, "network", "ipv4" ) ) )
+        if( !( p_network = module_Need(p_sout, "network", "ipv4", VLC_TRUE) ) )
         {
              msg_Warn( p_sout, "failed to open a connection (udp)" );
              return NULL;
@@ -260,7 +260,7 @@ sap_session_t * sout_SAPNew ( sout_instance_t *p_sout,
 
         /* Call the network module */
         p_sout->p_private = (void *) &socket_desc;
-        if( !( p_network = module_Need( p_sout, "network", "ipv6" ) ) )
+        if( !( p_network = module_Need(p_sout, "network", "ipv6", VLC_TRUE) ) )
         {
             msg_Warn( p_sout, "failed to open a connection (udp)" );
             return NULL;
@@ -359,7 +359,7 @@ void sout_SAPSend( sout_instance_t *p_sout, sap_session_t * p_sap )
                       "s=%s\n"
                       "u=VideoLAN\n"
                       "t=0 0\n"
-                      "m=audio %s udp 14\n"
+                      "m=video %s udp 33\n"
                       "c=IN IP4 %s/15\n"
                       "a=type:test\n",
              p_sap->psz_name, p_sap->psz_port, p_sap->psz_url );
@@ -396,8 +396,7 @@ void sout_SAPSend( sout_instance_t *p_sout, sap_session_t * p_sap )
     free( psz_head );
 }
 
-
-   
+#ifdef HAVE_SLP_H
 /*****************************************************************************
  * sout_SLPBuildName: Builds a service name according to SLP standard
  *****************************************************************************/
@@ -406,28 +405,29 @@ static char * sout_SLPBuildName(char *psz_url,char *psz_name)
     char *psz_service;
     unsigned int i_size;
 
-    /* name to build is: service:$(name).videolan://$(url) */
+    /* name to build is: service:vlc.services.videolan://$(url) */
 
-    i_size =  8 + strlen(psz_name) + 12 + strlen(psz_url) + 1;
+    i_size =  8 + 12 + 12 + 5 + strlen(psz_url) + 1;
 
     psz_service=(char *)malloc(i_size * sizeof(char));
 
-    snprintf( psz_service , i_size, 
-              "service:%s.videolan://%s",
-              psz_name,psz_url);
-    psz_service[i_size]='\0'; /* Just to make sure */    
+    snprintf( psz_service , i_size,
+              "service:vlc.services.videolan://udp:@%s",
+              psz_url);
+        /* How piggy  ! */
+
+    psz_service[i_size]='\0'; /* Just to make sure */
 
     return psz_service;
-    
+
 }
 
 /*****************************************************************************
  * sout_SLPReport: Reporting function. Unused at the moment but needed
  *****************************************************************************/
-#ifdef HAVE_SLP_H
 static void sout_SLPReport(SLPHandle slp_handle,SLPError slp_error,void* cookie)
 {
-}  
+}
 #endif
 
 /*****************************************************************************
@@ -437,19 +437,19 @@ int sout_SLPReg( sout_instance_t *p_sout, char * psz_url,
                                char * psz_name)
 {
 #ifdef HAVE_SLP_H
-    SLPHandle   slp_handle; 
+    SLPHandle   slp_handle;
     SLPError    slp_res;
     char *psz_service= sout_SLPBuildName(psz_url,psz_name);
-        
+
     if( SLPOpen( NULL, SLP_FALSE, &slp_handle ) != SLP_OK)
     {
         msg_Warn(p_sout,"Unable to initialize SLP");
         return -1;
-    } 
+    }
 
     msg_Info(p_sout , "Registering %s (name: %s) in SLP",
                       psz_service , psz_name);
-    
+
     slp_res = SLPReg ( slp_handle,
             psz_service,
             SLP_LIFETIME_MAXIMUM,
@@ -458,7 +458,7 @@ int sout_SLPReg( sout_instance_t *p_sout, char * psz_url,
             SLP_TRUE,
             sout_SLPReport,
             NULL );
-    
+
     if( slp_res != SLP_OK )
     {
         msg_Warn(p_sout,"Error while registering service: %i", slp_res );
@@ -481,24 +481,24 @@ int sout_SLPDereg( sout_instance_t *p_sout, char * psz_url,
 {
 #ifdef HAVE_SLP_H
 
-    SLPHandle   slp_handle; 
+    SLPHandle   slp_handle;
     SLPError    slp_res;
     char *psz_service= sout_SLPBuildName(psz_url,psz_name);
-        
+
     if( SLPOpen( NULL, SLP_FALSE, &slp_handle ) != SLP_OK)
     {
         msg_Warn(p_sout,"Unable to initialize SLP");
         return -1;
-    } 
+    }
 
     msg_Info(p_sout , "Unregistering %s from SLP",
                       psz_service);
-    
+
     slp_res = SLPDereg ( slp_handle,
             psz_service,
             sout_SLPReport,
             NULL );
-    
+
     if( slp_res != SLP_OK )
     {
         msg_Warn(p_sout,"Error while registering service: %i", slp_res );
@@ -508,6 +508,6 @@ int sout_SLPDereg( sout_instance_t *p_sout, char * psz_url,
     return 0;
 
 #else /* This function should never be called if this is false */
-    return -1; 
+    return -1;
 #endif
 }