X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fservices_discovery%2Fsap.c;h=ff84a13a4ab1743d859d00d2e628f25a58f6f0da;hb=a518149f3478fc8bc984b114a1821d0fd83cecab;hp=77c4d3946ec715ff253779342c7016f64867dd21;hpb=449fd28aaf007c6411251dae9d0dbfdc65b135d1;p=vlc diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c index 77c4d3946e..ff84a13a4a 100644 --- a/modules/services_discovery/sap.c +++ b/modules/services_discovery/sap.c @@ -30,7 +30,8 @@ # include "config.h" #endif -#include +#include +#include #include #include @@ -101,7 +102,7 @@ #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_( \ @@ -123,8 +124,8 @@ static void CloseDemux ( vlc_object_t * ); vlc_module_begin(); - set_shortname( _("SAP")); - set_description( _("SAP Announcements") ); + set_shortname( N_("SAP")); + set_description( N_("SAP Announcements") ); set_category( CAT_PLAYLIST ); set_subcategory( SUBCAT_PLAYLIST_SD ); @@ -151,9 +152,9 @@ vlc_module_begin(); set_callbacks( Open, Close ); add_submodule(); - set_description( _("SDP Descriptions parser") ); + set_description( N_("SDP Descriptions parser") ); add_shortcut( "sdp" ); - set_capability( "demux2", 51 ); + set_capability( "demux", 51 ); set_callbacks( OpenDemux, CloseDemux ); vlc_module_end(); @@ -393,10 +394,19 @@ static int OpenDemux( vlc_object_t *p_this ) { 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) ); @@ -674,7 +684,7 @@ static int Demux( demux_t *p_demux ) if( p_playlist->status.p_item && p_playlist->status.p_item->p_input == p_parent_input ) { - playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, + playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, p_playlist->status.p_node, p_playlist->status.p_item ); } @@ -807,7 +817,11 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf, 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++ ) { @@ -884,8 +898,7 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint16_t i_hash, psz_value = GetAttribute( p_sap->p_sdp->pp_attributes, p_sap->p_sdp->i_attributes, "tool" ); if( psz_value != NULL ) { - input_ItemAddInfo( p_input, _("Session"), _("Tool"), "%s", - psz_value ); + input_ItemAddInfo( p_input, _("Session"), _("Tool"), "%s", psz_value ); } if( strcmp( p_sdp->username, "-" ) ) { @@ -1223,7 +1236,7 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp) goto error; } - if ((sscanf (data, "%63s "I64Fu" "I64Fu" IN IP%u %1023s", + if ((sscanf (data, "%63s %"PRIu64" %"PRIu64" IN IP%u %1023s", p_sdp->username, &p_sdp->session_id, &p_sdp->session_version, &p_sdp->orig_ip_version, p_sdp->orig_host) != 5) @@ -1525,7 +1538,11 @@ static int RemoveAnnounce( services_discovery_t *p_sd, } if( p_announce->i_input_id > -1 ) - playlist_DeleteFromInput( pl_Get(p_sd), p_announce->i_input_id, false ); + { + playlist_DeleteFromInput( pl_Yield( p_sd ), + p_announce->i_input_id, pl_Unlocked ); + pl_Release( p_sd ); + } for( i = 0; i< p_sd->p_sys->i_announces; i++) {