Here are the changes that I made to the code to get thumbnails working. Sorry but the code that I have has been refactored so it will take someone to integrate. I'm experiencing health problems and I thought that I'd get this to some people sooner than latter.
Streaming from Windows 7 Ultimate, 8 GB memory,
Samsung 2012 ES6500 and EH5300 TVs.
Versions 1.72 and snapshot 1.80
Here is my problem and a solution to thumbnails not working on Samsung 2012 (ES &EH) models.
I noticed that the Samsung was not requesting the thumbnails. By running Samsung's AllShare software
which works as both a client and server I was able to determine the changes needed to get thumbnails
to work.
I'm posting my findings here to allow someone else to merge them into PMS because
1.) I'm new to the
opensource world and I don't know exactly how this process is to work. I.E. Code reviews? System and
unit test plan creation? Do they even exist?
2. I've refactored and cleaned up the original code too much to be able to implment it with the given
snapshot (1.80).
Finally, since I do not have my hands on DLNA standards I do not know if what I'm doing is proper. What
I mean is, even though what I've done is simple and works, there may be additional requirements that I
haven' implement. Specifically, for the <res> element, there may be a requirment to send the item's SIZE and
other attributes. My Samsung ignored them so I removed them as they were not necessary to get thumbnails to work.
The problem: Samsung doesn't recognize the <albumArt> element. It wants to see <res> for the video/music as
well as the thumbnail. Basically I added a switch to the Renderer.conf file. When selected the <res> element
would be used in the thumbnail rather than the <albumArt>. That a little bit else changed.
Changes:
SamsungAllShare.conf: added the following with the default as false so as not to change current user's functionality.
- Code: Select all
#Created ThumbnailAsResource for Samsung 2012 TVs to render thumbnails using the <res>
#element versus <albumArt> used by other devices.
ThumbnailAsResource=false
PMS.conf: Define the variable thumbnail_as_resource.
- Code: Select all
# --------------
# Samsung 2012+ TV require thumbnails to be sent as a resource
# Choose whether or not to send thumbnails as res or albumArt
# Default: false (for albumArt)
thumbnail_as_resource =
RendereConfiguration.java: 2 changes.
1. Added the following constant string
- Code: Select all
private static final String THUMBNAIL_AS_RESOURCE = "ThumbnailAsResource";
2. Added getter
- Code: Select all
/*
* getThumbNailAsResource() Samsung 2012 require the thumbnail response to be sent as a <res> element
* and not as <albumart>.
*/
public boolean getThumbNailAsResource() {
return getBoolean(THUMBNAIL_AS_RESOURCE, false);
}
And finally, the following is my refactored method between the "====".
The original
=================================================
- Code: Select all
/**
* appendThumbNail() Generate and append the response for the thumbnail
* DM 2/9/13 refactored this code
*
* @param mediaRenderer
* @param sb
*/
private void appendThumbNail(RendererConfiguration mediaRenderer, StringBuilder sb) {
String thumbURL = getThumbnailURL();
boolean isThumbnail = (!isFolder() && (getFormat() == null || (getFormat() != null && thumbURL != null)));
//
String elementToUse="upnp:albumArtURI";
if (isThumbnail) {
if (mediaRenderer.getThumbNailAsResource()) { // Generated thumbnail response as <albumArt> or <res>
elementToUse="res";
openTag(sb, elementToUse);
addAttribute(sb, "resolution", getMedia().getResolution());
} else {
openTag(sb, elementToUse);
addAttribute(sb, "xmlns:dlna", "urn:schemas-dlna-org:metadata-1-0/");
}
if (getThumbnailContentType().equals(PNG_TYPEMIME) && !mediaRenderer.isForceJPGThumbnails()) {
addAttribute(sb, "protocolInfo", "http-get:*:image/png:DLNA.ORG_PN=PNG_TN");
} else {
addAttribute(sb, "protocolInfo", "http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN");
}
endTag(sb);
sb.append(thumbURL);
closeTag(sb, elementToUse);
}
if ((isFolder() || mediaRenderer.isForceJPGThumbnails()) && thumbURL != null) {
openTag(sb, "res");
if (getThumbnailContentType().equals(PNG_TYPEMIME) && !mediaRenderer.isForceJPGThumbnails()) {
addAttribute(sb, "protocolInfo", "http-get:*:image/png:DLNA.ORG_PN=PNG_TN");
} else {
addAttribute(sb, "protocolInfo", "http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN");
}
endTag(sb);
sb.append(thumbURL);
closeTag(sb, "res");
}
}