]> git.sesse.net Git - vlc/commitdiff
Suppress sap-source-filter and compute The Right Value(tm) automatically
authorRémi Denis-Courmont <rem@videolan.org>
Fri, 10 Nov 2006 17:40:03 +0000 (17:40 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Fri, 10 Nov 2006 17:40:03 +0000 (17:40 +0000)
-- Cette ligne, et les suivantes ci-dessous, seront ignorées--

M    src/libvlc.h
M    src/stream_output/sap.c

src/libvlc.h
src/stream_output/sap.c

index ee6c3d7faf8430d6904eb3c0478f158f487ff071..e76a7f042225bda6c2e504a98aebcfef20928e64 100644 (file)
@@ -753,11 +753,6 @@ static const char *ppsz_clock_descriptions[] =
     "When the SAP flow control is disabled, " \
     "this lets you set the fixed interval between SAP announcements." )
 
-#define ANN_SAP_SFILTER_TEXT N_("Use SAP source filter")
-#define ANN_SAP_SFILTER_LONGTEXT N_( \
-    "When this is disabled, SAP announcements do not include a " \
-    "source-filter parameter and source-specific multicast is not used.")
-
 /*****************************************************************************
  * Advanced
  ****************************************************************************/
@@ -1557,8 +1552,7 @@ vlc_module_begin();
                                ANN_SAPCTRL_LONGTEXT, VLC_TRUE );
     add_integer( "sap-interval", 5, NULL, ANN_SAPINTV_TEXT,
                                ANN_SAPINTV_LONGTEXT, VLC_TRUE );
-    add_bool( "sap-source-filter", VLC_TRUE, NULL, ANN_SAP_SFILTER_TEXT,
-              ANN_SAP_SFILTER_LONGTEXT, VLC_TRUE );
+
     set_subcategory( SUBCAT_SOUT_VOD );
 
 /* CPU options */
index 8abd8d37d555ed1f7022f5b6e19b39e7b54718b3..709fea4a11884d5729bb1d232fe3885357516969 100644 (file)
@@ -78,7 +78,7 @@ static void RunThread( vlc_object_t *p_this);
 static int CalculateRate( sap_handler_t *p_sap, sap_address_t *p_address );
 static char *SDPGenerate( sap_handler_t *p_sap,
                           const session_descriptor_t *p_session,
-                          const sap_address_t *p_addr );
+                          const sap_address_t *p_addr, vlc_bool_t b_ssm );
 
 static int announce_SendSAPAnnounce( sap_handler_t *p_sap,
                                      sap_session_t *p_session );
@@ -235,7 +235,7 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
 {
     int i_header_size, i;
     char *psz_head, psz_addr[NI_MAXNUMERICHOST];
-    vlc_bool_t b_ipv6 = VLC_FALSE;
+    vlc_bool_t b_ipv6 = VLC_FALSE, b_ssm = VLC_FALSE;
     sap_session_t *p_sap_session;
     mtime_t i_hash;
     struct addrinfo hints, *res;
@@ -291,8 +291,13 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
             memcpy( a6->s6_addr + 2, "\x00\x00\x00\x00\x00\x00"
                    "\x00\x00\x00\x00\x00\x02\x7f\xfe", 14 );
             if( IN6_IS_ADDR_MULTICAST( a6 ) )
-                 /* force flags to zero, preserve scope */
+            {
+                /* force flags to zero, preserve scope */
                 a6->s6_addr[1] &= 0xf;
+
+                /* SSM <=> ff3x::/32 */
+                b_ssm = (GetDWLE (a6->s6_addr) & 0xfff0ffff) == 0xff300000;
+            }
             else
                 /* Unicast IPv6 - assume global scope */
                 memcpy( a6->s6_addr, "\xff\x0e", 2 );
@@ -324,8 +329,13 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
                 ipv4 = 0;
             else
             /* other addresses => 224.2.127.254 */
+            {
                 ipv4 = 0xe0027ffe;
 
+                /* SSM: 232.0.0.0/8 */
+                b_ssm = (ipv4 >> 24) == 232;
+            }
+
             if( ipv4 == 0 )
             {
                 msg_Err( p_sap, "Out-of-scope multicast address "
@@ -468,7 +478,7 @@ static int announce_SAPAnnounceAdd( sap_handler_t *p_sap,
     if( p_session->psz_sdp == NULL )
     {
         p_session->psz_sdp = SDPGenerate( p_sap, p_session,
-                                          p_sap_session->p_address );
+                                          p_sap_session->p_address, b_ssm );
         if( p_session->psz_sdp == NULL )
         {
             vlc_mutex_unlock( &p_sap->object_lock );
@@ -584,7 +594,7 @@ static int announce_SendSAPAnnounce( sap_handler_t *p_sap,
 
 static char *SDPGenerate( sap_handler_t *p_sap,
                           const session_descriptor_t *p_session,
-                          const sap_address_t *p_addr )
+                          const sap_address_t *p_addr, vlc_bool_t b_ssm )
 {
     int64_t i_sdp_id = mdate();
     int     i_sdp_version = 1 + p_sap->i_sessions + (rand()&0xfff);
@@ -615,7 +625,7 @@ static char *SDPGenerate( sap_handler_t *p_sap,
         psz_uri = p_session->psz_uri;
 
     char *sfilter = NULL;
-    if (var_CreateGetBool (p_sap, "sap-source-filter"))
+    if (b_ssm)
     {
         if (asprintf (&sfilter, "a=source-filter: incl IN IP%c * %s\r\n",
                       ipv, p_addr->psz_machine) == -1)