From b0c1dea56b830202e5fd994bec5654478250e2f9 Mon Sep 17 00:00:00 2001 From: Spencer Oliver Date: Thu, 5 Dec 2013 20:53:41 +0000 Subject: [PATCH] upnpsoap: fix some clients playing artwork instead of movie While playback on an Samsung E Series TV is ok, other clients such as VLC and vplayer (android) attempt to play the artwork rather than the movie. The issue was traced to minidlna serving the artwork res before the movie res. Other dlna server's were observed and found to the send the movie first then the artwork. Swapping the order seems to keep all tested clients happy. Signed-off-by: Spencer Oliver --- upnpsoap.c | 68 +++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/upnpsoap.c b/upnpsoap.c index 81bb823..e788cf0 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -846,40 +846,6 @@ callback(void *args, int argc, char **argv, char **azColName) if( track && atoi(track) && (passed_args->filter & FILTER_UPNP_ORIGINALTRACKNUMBER) ) { ret = strcatf(str, "<upnp:originalTrackNumber>%s</upnp:originalTrackNumber>", track); } - if( album_art && atoi(album_art) ) - { - /* Video and audio album art is handled differently */ - if( *mime == 'v' && (passed_args->filter & FILTER_RES) && !(passed_args->flags & FLAG_MS_PFS) ) { - ret = strcatf(str, "<res protocolInfo=\"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN\">" - "http://%s:%d/AlbumArt/%s-%s.jpg" - "</res>", - lan_addr[passed_args->iface].str, runtime_vars.port, album_art, detailID); - } else if( passed_args->filter & FILTER_UPNP_ALBUMARTURI ) { - ret = strcatf(str, "<upnp:albumArtURI"); - if( passed_args->filter & FILTER_UPNP_ALBUMARTURI_DLNA_PROFILEID ) { - ret = strcatf(str, " dlna:profileID=\"JPEG_TN\" xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\""); - } - ret = strcatf(str, ">http://%s:%d/AlbumArt/%s-%s.jpg</upnp:albumArtURI>", - lan_addr[passed_args->iface].str, runtime_vars.port, album_art, detailID); - } - } - if( (passed_args->flags & FLAG_MS_PFS) && *mime == 'i' ) { - if( passed_args->client == EMediaRoom && !album ) - ret = strcatf(str, "<upnp:album>%s</upnp:album>", "[No Keywords]"); - - /* EVA2000 doesn't seem to handle embedded thumbnails */ - if( !(passed_args->flags & FLAG_RESIZE_THUMBS) && tn && atoi(tn) ) { - ret = strcatf(str, "<upnp:albumArtURI>" - "http://%s:%d/Thumbnails/%s.jpg" - "</upnp:albumArtURI>", - lan_addr[passed_args->iface].str, runtime_vars.port, detailID); - } else { - ret = strcatf(str, "<upnp:albumArtURI>" - "http://%s:%d/Resized/%s.jpg?width=160,height=160" - "</upnp:albumArtURI>", - lan_addr[passed_args->iface].str, runtime_vars.port, detailID); - } - } if( passed_args->filter & FILTER_RES ) { ext = mime_to_ext(mime); add_res(size, duration, bitrate, sampleFrequency, nrAudioChannels, @@ -998,6 +964,40 @@ callback(void *args, int argc, char **argv, char **azColName) } } } + if( album_art && atoi(album_art) ) + { + /* Video and audio album art is handled differently */ + if( *mime == 'v' && (passed_args->filter & FILTER_RES) && !(passed_args->flags & FLAG_MS_PFS) ) { + ret = strcatf(str, "<res protocolInfo=\"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN\">" + "http://%s:%d/AlbumArt/%s-%s.jpg" + "</res>", + lan_addr[passed_args->iface].str, runtime_vars.port, album_art, detailID); + } else if( passed_args->filter & FILTER_UPNP_ALBUMARTURI ) { + ret = strcatf(str, "<upnp:albumArtURI"); + if( passed_args->filter & FILTER_UPNP_ALBUMARTURI_DLNA_PROFILEID ) { + ret = strcatf(str, " dlna:profileID=\"JPEG_TN\" xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\""); + } + ret = strcatf(str, ">http://%s:%d/AlbumArt/%s-%s.jpg</upnp:albumArtURI>", + lan_addr[passed_args->iface].str, runtime_vars.port, album_art, detailID); + } + } + if( (passed_args->flags & FLAG_MS_PFS) && *mime == 'i' ) { + if( passed_args->client == EMediaRoom && !album ) + ret = strcatf(str, "<upnp:album>%s</upnp:album>", "[No Keywords]"); + + /* EVA2000 doesn't seem to handle embedded thumbnails */ + if( !(passed_args->flags & FLAG_RESIZE_THUMBS) && tn && atoi(tn) ) { + ret = strcatf(str, "<upnp:albumArtURI>" + "http://%s:%d/Thumbnails/%s.jpg" + "</upnp:albumArtURI>", + lan_addr[passed_args->iface].str, runtime_vars.port, detailID); + } else { + ret = strcatf(str, "<upnp:albumArtURI>" + "http://%s:%d/Resized/%s.jpg?width=160,height=160" + "</upnp:albumArtURI>", + lan_addr[passed_args->iface].str, runtime_vars.port, detailID); + } + } ret = strcatf(str, "</item>"); } else if( strncmp(class, "container", 9) == 0 )