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 <spen@spen-soft.co.uk>
This commit is contained in:
Spencer Oliver 2013-12-05 20:53:41 +00:00 committed by Justin Maggard
parent 2c33d4149d
commit b0c1dea56b

View File

@ -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, "&lt;upnp:originalTrackNumber&gt;%s&lt;/upnp:originalTrackNumber&gt;", 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, "&lt;res protocolInfo=\"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN\"&gt;"
"http://%s:%d/AlbumArt/%s-%s.jpg"
"&lt;/res&gt;",
lan_addr[passed_args->iface].str, runtime_vars.port, album_art, detailID);
} else if( passed_args->filter & FILTER_UPNP_ALBUMARTURI ) {
ret = strcatf(str, "&lt;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, "&gt;http://%s:%d/AlbumArt/%s-%s.jpg&lt;/upnp:albumArtURI&gt;",
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, "&lt;upnp:album&gt;%s&lt;/upnp:album&gt;", "[No Keywords]");
/* EVA2000 doesn't seem to handle embedded thumbnails */
if( !(passed_args->flags & FLAG_RESIZE_THUMBS) && tn && atoi(tn) ) {
ret = strcatf(str, "&lt;upnp:albumArtURI&gt;"
"http://%s:%d/Thumbnails/%s.jpg"
"&lt;/upnp:albumArtURI&gt;",
lan_addr[passed_args->iface].str, runtime_vars.port, detailID);
} else {
ret = strcatf(str, "&lt;upnp:albumArtURI&gt;"
"http://%s:%d/Resized/%s.jpg?width=160,height=160"
"&lt;/upnp:albumArtURI&gt;",
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, "&lt;res protocolInfo=\"http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN\"&gt;"
"http://%s:%d/AlbumArt/%s-%s.jpg"
"&lt;/res&gt;",
lan_addr[passed_args->iface].str, runtime_vars.port, album_art, detailID);
} else if( passed_args->filter & FILTER_UPNP_ALBUMARTURI ) {
ret = strcatf(str, "&lt;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, "&gt;http://%s:%d/AlbumArt/%s-%s.jpg&lt;/upnp:albumArtURI&gt;",
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, "&lt;upnp:album&gt;%s&lt;/upnp:album&gt;", "[No Keywords]");
/* EVA2000 doesn't seem to handle embedded thumbnails */
if( !(passed_args->flags & FLAG_RESIZE_THUMBS) && tn && atoi(tn) ) {
ret = strcatf(str, "&lt;upnp:albumArtURI&gt;"
"http://%s:%d/Thumbnails/%s.jpg"
"&lt;/upnp:albumArtURI&gt;",
lan_addr[passed_args->iface].str, runtime_vars.port, detailID);
} else {
ret = strcatf(str, "&lt;upnp:albumArtURI&gt;"
"http://%s:%d/Resized/%s.jpg?width=160,height=160"
"&lt;/upnp:albumArtURI&gt;",
lan_addr[passed_args->iface].str, runtime_vars.port, detailID);
}
}
ret = strcatf(str, "&lt;/item&gt;");
}
else if( strncmp(class, "container", 9) == 0 )