Commit c0bb3860 authored by Yoann Peronneau's avatar Yoann Peronneau

* Added group announcing support

parent 24549bc3
...@@ -245,6 +245,8 @@ struct session_descriptor_t ...@@ -245,6 +245,8 @@ struct session_descriptor_t
int i_ttl; int i_ttl;
int i_payload; /* SAP Payload type */ int i_payload; /* SAP Payload type */
char *psz_group;
sap_session_t *p_sap; /* If we have a sap session, remember it */ sap_session_t *p_sap; /* If we have a sap session, remember it */
char *psz_sdp; char *psz_sdp;
}; };
......
...@@ -56,6 +56,10 @@ ...@@ -56,6 +56,10 @@
#define NAME_LONGTEXT N_( \ #define NAME_LONGTEXT N_( \
"Name of the session that will be announced with SAP or SLP" ) "Name of the session that will be announced with SAP or SLP" )
#define GROUP_TEXT N_("Session groupname")
#define GROUP_LONGTEXT N_( \
"Name of the group that will be announced for the session" )
#define SAP_TEXT N_("SAP announcing") #define SAP_TEXT N_("SAP announcing")
#define SAP_LONGTEXT N_("Announce this session with SAP") #define SAP_LONGTEXT N_("Announce this session with SAP")
...@@ -84,8 +88,10 @@ vlc_module_begin(); ...@@ -84,8 +88,10 @@ vlc_module_begin();
URL_LONGTEXT, VLC_FALSE ); URL_LONGTEXT, VLC_FALSE );
add_bool( SOUT_CFG_PREFIX "sap", 0, NULL, SAP_TEXT, SAP_LONGTEXT, VLC_TRUE ); add_bool( SOUT_CFG_PREFIX "sap", 0, NULL, SAP_TEXT, SAP_LONGTEXT, VLC_TRUE );
add_string( SOUT_CFG_PREFIX "name", "", NULL, NAME_TEXT,NAME_LONGTEXT add_string( SOUT_CFG_PREFIX "name", "", NULL, NAME_TEXT, NAME_LONGTEXT,
, VLC_TRUE ); VLC_TRUE );
add_string( SOUT_CFG_PREFIX "group", "", NULL, GROUP_TEXT, GROUP_LONGTEXT,
VLC_TRUE );
add_bool( SOUT_CFG_PREFIX "sap-ipv6", 0, NULL, SAPv6_TEXT, SAPv6_LONGTEXT, add_bool( SOUT_CFG_PREFIX "sap-ipv6", 0, NULL, SAPv6_TEXT, SAPv6_LONGTEXT,
VLC_TRUE ); VLC_TRUE );
...@@ -100,8 +106,8 @@ vlc_module_end(); ...@@ -100,8 +106,8 @@ vlc_module_end();
*****************************************************************************/ *****************************************************************************/
static const char *ppsz_sout_options[] = { static const char *ppsz_sout_options[] = {
"access", "mux", "url", "access", "mux", "url",
"sap", "name", "sap-ipv6", "sap", "name", "sap-ipv6", "group",
"slp",NULL "slp", NULL
}; };
#define DEFAULT_IPV6_SCOPE '8' #define DEFAULT_IPV6_SCOPE '8'
...@@ -325,13 +331,21 @@ static int Open( vlc_object_t *p_this ) ...@@ -325,13 +331,21 @@ static int Open( vlc_object_t *p_this )
var_Get( p_stream, SOUT_CFG_PREFIX "name", &val ); var_Get( p_stream, SOUT_CFG_PREFIX "name", &val );
if( *val.psz_string ) if( *val.psz_string )
{ {
p_session->psz_name = val.psz_string; p_session->psz_name = strdup( val.psz_string );
} }
else else
{ {
free( val.psz_string );
p_session->psz_name = strdup( psz_url ); p_session->psz_name = strdup( psz_url );
} }
free( val.psz_string );
var_Get( p_stream, SOUT_CFG_PREFIX "group", &val );
if( *val.psz_string )
{
p_session->psz_group = strdup( val.psz_string );
}
free( val.psz_string );
var_Get( p_stream, SOUT_CFG_PREFIX "sap-ipv6", &val ); var_Get( p_stream, SOUT_CFG_PREFIX "sap-ipv6", &val );
p_method->i_ip_version = val.b_bool ? 6 : 4; p_method->i_ip_version = val.b_bool ? 6 : 4;
......
...@@ -164,6 +164,7 @@ session_descriptor_t * sout_AnnounceSessionCreate() ...@@ -164,6 +164,7 @@ session_descriptor_t * sout_AnnounceSessionCreate()
p_session->psz_name = NULL; p_session->psz_name = NULL;
p_session->psz_uri = NULL; p_session->psz_uri = NULL;
p_session->i_port = 0; p_session->i_port = 0;
p_session->psz_group = NULL;
} }
return p_session; return p_session;
...@@ -180,6 +181,7 @@ void sout_AnnounceSessionDestroy( session_descriptor_t *p_session ) ...@@ -180,6 +181,7 @@ void sout_AnnounceSessionDestroy( session_descriptor_t *p_session )
if( p_session ) if( p_session )
{ {
FREE( p_session->psz_name ); FREE( p_session->psz_name );
FREE( p_session->psz_group );
FREE( p_session->psz_uri ); FREE( p_session->psz_uri );
FREE( p_session->psz_sdp ); FREE( p_session->psz_sdp );
FREE( p_session ); FREE( p_session );
......
...@@ -490,7 +490,10 @@ static int SDPGenerate( sap_handler_t *p_sap, session_descriptor_t *p_session ) ...@@ -490,7 +490,10 @@ static int SDPGenerate( sap_handler_t *p_sap, session_descriptor_t *p_session )
"a=tool:"PACKAGE_STRING"\r\n" "a=tool:"PACKAGE_STRING"\r\n"
"a=type:broadcast\r\n") "a=type:broadcast\r\n")
+ strlen( p_session->psz_name ) + strlen( p_session->psz_name )
+ strlen( p_session->psz_uri ) + 300 ); + strlen( p_session->psz_uri ) + 300
+ ( p_session->psz_group ?
strlen( p_session->psz_group ) : 0 ) );
if( !p_session->psz_sdp ) if( !p_session->psz_sdp )
{ {
msg_Err( p_sap, "out of memory" ); msg_Err( p_sap, "out of memory" );
...@@ -509,6 +512,14 @@ static int SDPGenerate( sap_handler_t *p_sap, session_descriptor_t *p_session ) ...@@ -509,6 +512,14 @@ static int SDPGenerate( sap_handler_t *p_sap, session_descriptor_t *p_session )
p_session->psz_name, p_session->psz_name,
p_session->psz_uri, p_session->i_ttl, p_session->psz_uri, p_session->i_ttl,
p_session->i_port, p_session->i_payload ); p_session->i_port, p_session->i_payload );
if( p_session->psz_group )
{
sprintf( p_session->psz_sdp, "%sa=x-plgroup:%s\r\n",
p_session->psz_sdp,
p_session->psz_group );
}
msg_Dbg( p_sap, "Generated SDP (%i bytes):\n%s", strlen(p_session->psz_sdp), msg_Dbg( p_sap, "Generated SDP (%i bytes):\n%s", strlen(p_session->psz_sdp),
p_session->psz_sdp ); p_session->psz_sdp );
return VLC_SUCCESS; return VLC_SUCCESS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment