Commit 7ef7ca63 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Fixed the udp SDPs. More spec compliant now.

* Removed the old SAP code. announce.? in modules/stream_out is 
  still required for SLP announces.
parent 2120e79e
This diff is collapsed.
/*****************************************************************************
* announce.h : Session announcement
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id$
*
* Authors: Clment Stenac <zorglub@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#if defined( UNDER_CE )
# include <winsock.h>
#elif defined( WIN32 )
# include <winsock2.h>
# include <ws2tcpip.h>
# define close closesocket
#else
# include <netdb.h> /* hostent ... */
# include <sys/socket.h>
# include <netinet/in.h>
# ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h> /* inet_ntoa(), inet_aton() */
# endif
#endif
#ifdef HAVE_SLP_H
# include <slp.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
/*****************************************************************************
* sap_session_t: SAP Session descriptor
*****************************************************************************/
struct sap_session_t2
{
char * psz_sdp;
module_t p_network;
unsigned int i_socket;
unsigned int i_calls;
int i_ip_version;
};
typedef struct sap_session_t2 sap_session_t2;
/*****************************************************************************
* slp_session_t: SLP Session descriptor
*****************************************************************************/
struct slp_session_t
{
char *psz_url;
char *psz_name;
};
typedef struct slp_session_t slp_session_t;
/*****************************************************************************
* Prototypes
*****************************************************************************/
sap_session_t2 * sout_SAPNew (sout_instance_t *, char * psz_sdp_arg,
int ip_version,
char * psz_v6_scope );
char * SDPGenerateUDP(char * ,char *);
void sout_SAPDelete (sout_instance_t *,sap_session_t2*);
void sout_SAPSend (sout_instance_t *,sap_session_t2 *);
int sout_SLPReg (sout_instance_t *,char *,char *);
int sout_SLPDereg (sout_instance_t *,char *,char *);
/*
VLC_EXPORT( sap_session_t *, sout_SAPNew, ( sout_instance_t *,char * , char * , int , char *) );
VLC_EXPORT( void, sout_SAPSend, ( sout_instance_t *,sap_session_t *) );
VLC_EXPORT( void, sout_SAPDelete, ( sout_instance_t *,sap_session_t * ) );
VLC_EXPORT( int, sout_SLPReg, (sout_instance_t*,char*,char*) );
VLC_EXPORT( int, sout_SLPDereg, (sout_instance_t*,char*,char*) );*/
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* sap.c : SAP announce handler * sap.c : SAP announce handler
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2004 VideoLAN * Copyright (C) 2002-2004 VideoLAN
* $Id: sap.c 7307 2004-04-07 23:13:03Z fenrir $ * $Id$
* *
* Authors: Clment Stenac <zorglub@videolan.org> * Authors: Clment Stenac <zorglub@videolan.org>
* *
...@@ -436,14 +436,19 @@ static int announce_SendSAPAnnounce( sap_handler_t *p_sap, ...@@ -436,14 +436,19 @@ static int announce_SendSAPAnnounce( sap_handler_t *p_sap,
static int SDPGenerate( sap_handler_t *p_sap, session_descriptor_t *p_session ) static int SDPGenerate( sap_handler_t *p_sap, session_descriptor_t *p_session )
{ {
int64_t i_sdp_id = mdate();
int i_sdp_version = 1 + p_sap->i_sessions + (rand()&0xfff);
/* see the lists in modules/stream_out/rtp.c for compliance stuff */
p_session->psz_sdp = (char *)malloc( p_session->psz_sdp = (char *)malloc(
sizeof("v=0\n" sizeof("v=0\r\n"
"o=- 12 12 IN IP4 127.0.0.1\n" /* FIXME */ "o=- 45383436098 45398 IN IP4 127.0.0.1\r\n" /* FIXME */
"s=\n" "s=\r\n"
"c=IN IP4 /\n" "t=0 0\r\n"
"m=video udp\n" "c=IN IP4 /\r\n"
"a=tool:VLC "VERSION"\n" "m=video udp\r\n"
"a=type:broadcast") "a=tool:"PACKAGE_STRING"\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 );
if( !p_session->psz_sdp ) if( !p_session->psz_sdp )
...@@ -452,13 +457,15 @@ static int SDPGenerate( sap_handler_t *p_sap, session_descriptor_t *p_session ) ...@@ -452,13 +457,15 @@ static int SDPGenerate( sap_handler_t *p_sap, session_descriptor_t *p_session )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
sprintf( p_session->psz_sdp, sprintf( p_session->psz_sdp,
"v=0\n" "v=0\r\n"
"o=- 12 12 IN IP4 127.0.0.1\n" "o=- "I64Fd" %d IN IP4 127.0.0.1\r\n"
"s=%s\n" "s=%s\r\n"
"c=IN IP4 %s/%d\n" "t=0 0\r\n"
"m=video %d udp %d\n" "c=IN IP4 %s/%d\r\n"
"a=tool:VLC "VERSION"\n" "m=video %d udp %d\r\n"
"a=type:broadcast\n", "a=tool:"PACKAGE_STRING"\r\n"
"a=type:broadcast\r\n",
i_sdp_id, i_sdp_version,
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 );
......
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