-
-/************************************************************************
- * Announce handler functions (private)
- ************************************************************************/
-
-/**
- * Create the announce handler object
- *
- * \param p_this a vlc_object structure
- * \return the new announce handler or NULL on error
- */
-static announce_handler_t *announce_HandlerCreate( vlc_object_t *p_this )
-{
- announce_handler_t *p_announce;
-
- p_announce = vlc_object_create( p_this, VLC_OBJECT_ANNOUNCE );
-
- if( !p_announce )
- return NULL;
-
- p_announce->p_sap = NULL;
- vlc_object_attach( p_announce, p_this->p_libvlc);
-
- return p_announce;
-}
-
-/**
- * Destroy a announce handler object
- *
- * \param p_announce the announce handler to destroy
- * \return VLC_SUCCESS or an error
- */
-int announce_HandlerDestroy( announce_handler_t *p_announce )
-{
- if( p_announce->p_sap )
- SAP_Destroy( p_announce->p_sap );
-
- /* Free the structure */
- vlc_object_release( p_announce );
-
- return VLC_SUCCESS;
-}
-
-/* Register an announce */
-static int announce_Register( announce_handler_t *p_announce,
- session_descriptor_t *p_session,
- announce_method_t *p_method )
-{
- if (p_method == NULL)
- return VLC_EGENERIC;
-
- msg_Dbg( p_announce, "registering announce");
- if( p_method == &sap_method )
- {
- /* Do we already have a SAP announce handler ? */
- if( !p_announce->p_sap )
- {
- sap_handler_t *p_sap = SAP_Create (VLC_OBJECT(p_announce));
- msg_Dbg( p_announce, "creating SAP announce handler");
- if( !p_sap )
- {
- msg_Err( p_announce, "SAP handler creation failed" );
- return VLC_ENOOBJ;
- }
- p_announce->p_sap = p_sap;
- }
- /* this will set p_session->p_sap for later deletion */
- msg_Dbg( p_announce, "adding SAP session");
- SAP_Add( p_announce->p_sap, p_session );
- }
- else
- {
- msg_Err( p_announce, "announce type unsupported" );
- return VLC_EGENERIC;
- }
- return VLC_SUCCESS;
-}
-
-
-/* Unregister an announce */
-static int announce_UnRegister( announce_handler_t *p_announce,
- session_descriptor_t *p_session )
-{
- msg_Dbg( p_announce, "unregistering announce" );
- SAP_Del( p_announce->p_sap, p_session );
- return VLC_SUCCESS;
-}