diff --git a/modules/gui/wxwindows/playlist.cpp b/modules/gui/wxwindows/playlist.cpp index a95125384ef910d5d7fd22e71968c8ee552a5e32..4d83695ce0ed02578205394d6ab6058e451fd1db 100644 --- a/modules/gui/wxwindows/playlist.cpp +++ b/modules/gui/wxwindows/playlist.cpp @@ -1253,6 +1253,7 @@ void Playlist::OnMenuEvent( wxCommandEvent& event ) if( event.GetId() < FirstView_Event ) { event.Skip(); + vlc_object_release( p_playlist ); return; } else if( event.GetId() < LastView_Event ) @@ -1332,13 +1333,6 @@ wxMenu * Playlist::ViewMenu() wxU(_("All items, unsorted") ) ); p_view_menu->Append( FirstView_Event + VIEW_S_AUTHOR, wxU(_("Sorted by author") ) ); -#if 0 - for( int i = 0; i< p_playlist->i_views; i++ ) - { - p_view_menu->Append( FirstView_Event + p_playlist->pp_views[i]->i_id, - wxU( p_playlist->pp_views[i]->psz_name ) ); - } -#endif vlc_object_release( p_playlist); diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c index 2e46623401b6237a4bc23ca72e89cad383f4d9e2..2cfcfb76d0df836cd556924c6e1b243d5ae970c8 100644 --- a/modules/services_discovery/sap.c +++ b/modules/services_discovery/sap.c @@ -54,7 +54,8 @@ /* SAP is always on that port */ #define SAP_PORT 9875 -#define SAP_V4_ADDRESS "224.2.127.254" +//#define SAP_V4_ADDRESS "224.2.127.254" +#define SAP_V4_ADDRESS "0.0.0.0" #define ADD_SESSION 1 #define IPV6_ADDR_1 "FF0" /* Scope is inserted between them */ @@ -144,6 +145,13 @@ struct sdp_t char *psz_connection; char *psz_media; + /* o field */ + char *psz_username; + char *psz_network_type; + char *psz_address_type; + char *psz_address; + int i_session_id; + /* "computed" URI */ char *psz_uri; @@ -216,6 +224,7 @@ struct services_discovery_sys_t static void CacheSave( services_discovery_t *p_sd ); /* Helper functions */ static char *GetAttribute( sdp_t *p_sdp, const char *psz_search ); + static vlc_bool_t IsSameSession( sdp_t *p_sdp1, sdp_t *p_sdp2 ); static int InitSocket( services_discovery_t *p_sd, char *psz_address, int i_port ); #ifdef HAVE_ZLIB_H static int Decompress( unsigned char *psz_src, unsigned char **_dst, int i_len ); @@ -625,6 +634,7 @@ static int ParseSAP( services_discovery_t *p_sd, uint8_t *p_buffer, int i_read ) psz_sdp++; } + /* Parse SDP info */ p_sdp = ParseSDP( VLC_OBJECT(p_sd), psz_sdp ); @@ -655,8 +665,7 @@ static int ParseSAP( services_discovery_t *p_sd, uint8_t *p_buffer, int i_read ) { /* FIXME: slow */ /* FIXME: we create a new announce each time the sdp changes */ - if( !strcmp( p_sd->p_sys->pp_announces[i]->p_sdp->psz_sdp, - p_sdp->psz_sdp ) ) + if( IsSameSession( p_sd->p_sys->pp_announces[i]->p_sdp, p_sdp ) ) { if( b_need_delete ) { @@ -937,6 +946,11 @@ static sdp_t * ParseSDP( vlc_object_t *p_obj, char* psz_sdp ) { sdp_t *p_sdp; + if( psz_sdp == NULL ) + { + return VLC_EGENERIC; + } + if( psz_sdp[0] != 'v' || psz_sdp[1] != '=' ) { msg_Warn( p_obj, "bad SDP packet" ); @@ -958,7 +972,12 @@ static sdp_t * ParseSDP( vlc_object_t *p_obj, char* psz_sdp ) while( *psz_sdp != '\0' ) { char *psz_eol; - while( *psz_sdp == '\r' || *psz_sdp == '\n' || *psz_sdp == ' ' || *psz_sdp == '\t' ) + char *psz_eof; + char *psz_parse; + char *psz_sess_id; + + while( *psz_sdp == '\r' || *psz_sdp == '\n' || + *psz_sdp == ' ' || *psz_sdp == '\t' ) { psz_sdp++; } @@ -995,6 +1014,32 @@ static sdp_t * ParseSDP( vlc_object_t *p_obj, char* psz_sdp ) p_sdp->psz_sessionname = strdup( &psz_sdp[2] ); break; case ( 'o' ): + { + /* o field is <username> <session id> <version> + * <network type> <address type> <address> */ + +#define GET_FIELD( store ) \ + psz_eof = strchr( psz_parse, ' ' ); \ + if( psz_eof ) { *psz_eof=0; store = strdup( psz_parse ); } \ + else { store = strdup( psz_parse );}; psz_parse = psz_eof + 1 ; + + psz_parse = &psz_sdp[2]; + GET_FIELD( p_sdp->psz_username ); + GET_FIELD( psz_sess_id ); + + p_sdp->i_session_id = atoi( psz_sess_id ); + + FREE( psz_sess_id ); + + GET_FIELD( psz_sess_id ); + FREE( psz_sess_id ); + + GET_FIELD( p_sdp->psz_network_type ); + GET_FIELD( p_sdp->psz_address_type ); + GET_FIELD( p_sdp->psz_address ); + + break; + } case( 'i' ): case( 'u' ): case( 'e' ): @@ -1208,6 +1253,35 @@ static int RemoveAnnounce( services_discovery_t *p_sd, return VLC_SUCCESS; } +static vlc_bool_t IsSameSession( sdp_t *p_sdp1, sdp_t *p_sdp2 ) +{ + /* A session is identified by + * username, session_id, network type, address type and address */ + if( p_sdp1->psz_username && p_sdp2->psz_username && + p_sdp1->psz_network_type && p_sdp2->psz_network_type && + p_sdp1->psz_address_type && p_sdp2->psz_address_type && + p_sdp1->psz_address && p_sdp2->psz_address ) + { + if( + !strcmp( p_sdp1->psz_username , p_sdp2->psz_username ) && + !strcmp( p_sdp1->psz_network_type , p_sdp2->psz_network_type ) && + !strcmp( p_sdp1->psz_address_type , p_sdp2->psz_address_type ) && + !strcmp( p_sdp1->psz_address , p_sdp2->psz_address ) && + p_sdp1->i_session_id == p_sdp2->i_session_id ) + { + return VLC_TRUE; + } + else + { + return VLC_FALSE; + } + } + else + { + return VLC_FALSE; + } +} + static void CacheLoad( services_discovery_t *p_sd ) { diff --git a/src/playlist/item.c b/src/playlist/item.c index 8e6045691da61b1be4fe5372779e4f497e78585b..eec3214126e9b540b4e0c4233d41f0aa4b60bc97 100644 --- a/src/playlist/item.c +++ b/src/playlist/item.c @@ -271,12 +271,14 @@ static void GuessType( input_item_t *p_item) { "mms", ITEM_TYPE_NET }, { "rtsp", ITEM_TYPE_NET }, { "udp", ITEM_TYPE_NET }, + { "rtp", ITEM_TYPE_NET }, { "vcd", ITEM_TYPE_DISC }, { "v4l", ITEM_TYPE_CARD }, { "dshow", ITEM_TYPE_CARD }, { "pvr", ITEM_TYPE_CARD }, { "dvb", ITEM_TYPE_CARD }, { "qpsk", ITEM_TYPE_CARD }, + { "sdp", ITEM_TYPE_NET }, { NULL, 0 } };