* Copyright (C) 2002-2004 the VideoLAN team
* $Id$
*
- * Authors: Clément Stenac <zorglub@videolan.org>
+ * Authors: Clément Stenac <zorglub@videolan.org>
*
* 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
*
* 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
#include <string.h> /* strerror() */
#include <vlc/vlc.h>
-#include <vlc/sout.h>
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
-
+#include <vlc_sout.h>
+#include "stream_output.h"
/****************************************************************************
* Sout-side functions
return VLC_ENOMEM;
}
vlc_object_yield( p_announce );
- msg_Dbg( p_sout,"Creation done" );
+ msg_Dbg( p_sout, "creation done" );
}
i_ret = announce_Register( p_announce, p_session, p_method );
*
* \param p_sout a sout instance structure
* \param psz_sdp the SDP to register
+ * \param psz_uri session URI (needed for SAP address auto detection
* \param p_method an announce method descriptor
* \return the new session descriptor structure
*/
session_descriptor_t *sout_AnnounceRegisterSDP( sout_instance_t *p_sout,
- const char *psz_sdp, announce_method_t *p_method )
+ const char *psz_sdp, const char *psz_uri,
+ announce_method_t *p_method )
{
session_descriptor_t *p_session;
announce_handler_t *p_announce = (announce_handler_t*)
if( p_method->i_type != METHOD_TYPE_SAP )
{
- msg_Warn( p_sout,"forcing SAP announcement");
+ msg_Warn( p_sout, "forcing SAP announcement");
}
p_session = sout_AnnounceSessionCreate();
p_session->psz_sdp = strdup( psz_sdp );
+ p_session->psz_uri = strdup( psz_uri );
announce_Register( p_announce, p_session, p_method );
vlc_object_release( p_announce );
FIND_ANYWHERE );
if( !p_announce )
{
- msg_Dbg( p_sout, "Unable to remove announce: no announce handler" );
+ msg_Dbg( p_sout, "unable to remove announce: no announce handler" );
return VLC_ENOOBJ;
}
i_ret = announce_UnRegister( p_announce, p_session );
session_descriptor_t *p_session;
p_session = (session_descriptor_t *)malloc( sizeof(session_descriptor_t));
+ if (p_session == NULL)
+ return NULL;
- if( p_session)
- {
- p_session->p_sap = NULL;
- p_session->psz_sdp = NULL;
- p_session->psz_name = NULL;
- p_session->psz_uri = NULL;
- p_session->i_port = 0;
- p_session->psz_group = NULL;
- }
-
+ memset (p_session, 0, sizeof (*p_session));
return p_session;
}
{
if( p_session )
{
- FREE( p_session->psz_name );
- FREE( p_session->psz_group );
- FREE( p_session->psz_uri );
- FREE( p_session->psz_sdp );
+ FREENULL( p_session->psz_name );
+ FREENULL( p_session->psz_group );
+ FREENULL( p_session->psz_uri );
+ FREENULL( p_session->psz_sdp );
free( p_session );
}
}
/**
* Create and initialize an announcement method structure
*
- * \param i_type METHOD_TYPE_SAP or METHOD_TYPE_SLP
+ * \param i_type METHOD_TYPE_SAP
* \return a new announce_method structure
*/
announce_method_t * sout_AnnounceMethodCreate( int i_type )
}
p_announce->p_sap = NULL;
-
- vlc_object_attach( p_announce, p_this->p_vlc);
-
+ vlc_object_attach( p_announce, p_this->p_libvlc);
return p_announce;
}
msg_Dbg( p_announce, "adding SAP session");
p_announce->p_sap->pf_add( p_announce->p_sap, p_session );
}
- else if( p_method->i_type == METHOD_TYPE_SLP )
- {
- msg_Dbg( p_announce, "SLP unsupported at the moment" );
- return VLC_EGENERIC;
- }
else
{
- msg_Dbg( p_announce, "Announce type unsupported" );
+ msg_Dbg( p_announce, "announce type unsupported" );
return VLC_EGENERIC;
}
return VLC_SUCCESS;;