#include <vlc_plugin.h>
#include <assert.h>
-#include <vlc_playlist.h>
#include <vlc_demux.h>
+#include <vlc_services_discovery.h>
#include <vlc_network.h>
#include <vlc_charset.h>
#define SAP_PARSE_TEXT N_( "Try to parse the announce" )
#define SAP_PARSE_LONGTEXT N_( \
"This enables actual parsing of the announces by the SAP module. " \
- "Otherwise, all announcements are parsed by the \"livedotcom\" " \
+ "Otherwise, all announcements are parsed by the \"live555\" " \
"(RTP/RTSP) module." )
#define SAP_STRICT_TEXT N_( "SAP Strict mode" )
#define SAP_STRICT_LONGTEXT N_( \
/* SAP annnounces must only contain one SDP */
sdp_t *p_sdp;
- int i_input_id;
+ input_item_t * p_item;
};
struct services_discovery_sys_t
{
p_sdp->psz_uri = NULL;
}
- if( p_sdp->i_media_type != 33 && p_sdp->i_media_type != 32 &&
- p_sdp->i_media_type != 14 )
- goto error;
-
+ switch (p_sdp->i_media_type)
+ { /* Should be in sync with modules/demux/rtp.c */
+ case 0: /* PCMU/8000 */
+ case 8: /* PCMA/8000 */
+ case 10: /* L16/44100/2 */
+ case 11: /* L16/44100 */
+ case 14: /* MPA/90000 */
+ case 32: /* MPV/90000 */
+ case 33: /* MP2/90000 */
+ break;
+ default:
+ goto error;
+ }
if( p_sdp->psz_uri == NULL ) goto error;
p_demux->p_sys = (demux_sys_t *)malloc( sizeof(demux_sys_t) );
psz_addr = var_CreateGetString( p_sd, "sap-addr" );
if( psz_addr && *psz_addr )
- {
InitSocket( p_sd, psz_addr, SAP_PORT );
- free( psz_addr );
- }
+ free( psz_addr );
if( p_sd->p_sys->i_fd == 0 )
{
input_thread_t *p_input;
input_item_t *p_parent_input;
- playlist_t *p_playlist = pl_Yield( p_demux );
p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT,
FIND_PARENT );
assert( p_input );
return VLC_EGENERIC;
}
+ /* This item hasn't been yield by input_GetItem
+ * don't release it */
p_parent_input = input_GetItem( p_input );
input_item_SetURI( p_parent_input, p_sdp->psz_uri );
p_parent_input->i_type = ITEM_TYPE_NET;
- if( p_playlist->status.p_item &&
- p_playlist->status.p_item->p_input == p_parent_input )
- {
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true,
- p_playlist->status.p_node, p_playlist->status.p_item );
- }
-
vlc_mutex_unlock( &p_parent_input->lock );
- vlc_object_release( p_input );
- vlc_object_release( p_playlist );
-
return VLC_SUCCESS;
}
p_sdp->psz_uri = NULL;
}
- if( p_sdp->psz_uri == NULL ) return VLC_EGENERIC;
+ if( p_sdp->psz_uri == NULL )
+ {
+ FreeSDP( p_sdp );
+ return VLC_EGENERIC;
+ }
for( i = 0 ; i< p_sd->p_sys->i_announces ; i++ )
{
p_sap->i_hash = i_hash;
p_sap->p_sdp = p_sdp;
- /* Create the actual playlist item here */
+ /* Released in RemoveAnnounce */
p_input = input_ItemNewWithType( VLC_OBJECT(p_sd),
p_sap->p_sdp->psz_uri,
p_sdp->psz_sessionname,
0, NULL, -1, ITEM_TYPE_NET );
- p_sap->i_input_id = p_input->i_id;
+ p_sap->p_item = p_input;
if( !p_input )
{
free( p_sap );
services_discovery_AddItem( p_sd, p_input, psz_value /* category name */ );
TAB_APPEND( p_sys->i_announces, p_sys->pp_announces, p_sap );
- vlc_gc_decref( p_input );
+
return p_sap;
}
p_announce->p_sdp = NULL;
}
- if( p_announce->i_input_id > -1 )
+ if( p_announce->p_item )
{
- playlist_DeleteFromInput( pl_Yield( p_sd ),
- p_announce->i_input_id, false );
- pl_Release( p_sd );
+ services_discovery_RemoveItem( p_sd, p_announce->p_item );
+ vlc_gc_decref( p_announce->p_item );
+ p_announce->p_item = NULL;
}
for( i = 0; i< p_sd->p_sys->i_announces; i++)