Browse Source

upnp: fix browsing of certain servers

This is a partial revert of 785c6dfe. Some servers (notably PLEX, UMS,
and some TV sets) amend the exposed media type with additional subtypes
for further differentiation not relevant to VLC, so it is actually
correct to compare the beginning of the string only.

For instance "object.container" can turn into
"object.container.storageFolder" or "object.container.person.musicArtist"
so the plain strcmp will fail to recognize the container nature.

Fixes vlc-ios#1239

(cherry picked from commit 741f1f90cd)
pull/135/head
Felix Paul Kühne 5 years ago
parent
commit
584bf4f641
  1. 8
      modules/services_discovery/upnp.cpp

8
modules/services_discovery/upnp.cpp

@ -874,13 +874,13 @@ namespace
psz_album_artist = xml_getChildElementValue( itemElement, "upnp:albumArtist" );
psz_albumArt = xml_getChildElementValue( itemElement, "upnp:albumArtURI" );
const char *psz_media_type = xml_getChildElementValue( itemElement, "upnp:class" );
if (strcmp(psz_media_type, "object.item.videoItem") == 0)
if (strncmp(psz_media_type, "object.item.videoItem", 21) == 0)
media_type = VIDEO;
else if (strcmp(psz_media_type, "object.item.audioItem") == 0)
else if (strncmp(psz_media_type, "object.item.audioItem", 21) == 0)
media_type = AUDIO;
else if (strcmp(psz_media_type, "object.item.imageItem") == 0)
else if (strncmp(psz_media_type, "object.item.imageItem", 21) == 0)
media_type = IMAGE;
else if (strcmp(psz_media_type, "object.container") == 0)
else if (strncmp(psz_media_type, "object.container", 16 ) == 0)
media_type = CONTAINER;
else
return false;

Loading…
Cancel
Save