- /* FIXME: really check that psz_uri is a real IP address
- * FIXME: make a common function to obtain a canonical IP address */
- ipv = ( strchr( p_session->psz_uri, ':' ) != NULL) ? '6' : '4';
- if( *p_session->psz_uri == '[' )
- {
- char *ptr;
-
- strncpy( psz_uribuf, p_session->psz_uri + 1, sizeof( psz_uribuf ) );
- psz_uribuf[sizeof( psz_uribuf ) - 1] = '\0';
- ptr = strchr( psz_uribuf, '%' );
- if( ptr != NULL)
- *ptr = '\0';
- ptr = strchr( psz_uribuf, ']' );
- if( ptr != NULL)
- *ptr = '\0';
- psz_uri = psz_uribuf;
- }
- else
- psz_uri = p_session->psz_uri;
-
- /* see the lists in modules/stream_out/rtp.c for compliance stuff */
- if( asprintf( &psz_sdp,
- "v=0\r\n"
- "o=- "I64Fd" %d IN IP%c %s\r\n"
- "s=%s\r\n"
- "t=0 0\r\n"
- "c=IN IP%c %s/%d\r\n"
- "m=video %d udp %d\r\n"
- "a=tool:"PACKAGE_STRING"\r\n"
- "a=type:broadcast\r\n",
- i_sdp_id, i_sdp_version,
- ipv, p_addr->psz_machine,
- psz_name, ipv,
- psz_uri, p_session->i_ttl,
- p_session->i_port, p_session->i_payload ) == -1 )
- {
- free( psz_name );
- FREE( psz_group );
- return NULL;
- }
-
- free( psz_name );
-
- if( psz_group )
- {
- /* FIXME: this is illegal use of sprintf */
- sprintf( psz_sdp, "%sa=x-plgroup:%s\r\n", psz_sdp, psz_group );
- free( psz_group );
- }
-
- msg_Dbg( p_sap, "Generated SDP (%i bytes):\n%s", strlen(psz_sdp),
- psz_sdp );
- return psz_sdp;
-}
-
-static int CalculateRate( sap_handler_t *p_sap, sap_address_t *p_address )
-{
- int i_read;
- uint8_t buffer[SAP_MAX_BUFFER];
- int i_tot = 0;
- mtime_t i_temp;
- int i_rate;