Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improvement for stream or transcode decision logic (thanks, StreamHD!)

  • Loading branch information...
commit ad8d98c7d7c022042f6f539a2393e79e2c0fa99b 1 parent c87afe6
@Raptor399 Raptor399 authored
View
22 src/main/java/net/pms/dlna/DLNAResource.java
@@ -542,14 +542,27 @@ public void addChild(DLNAResource child) {
}
}
+ boolean hasSubsToTranscode = false;
+
+ if (!PMS.getConfiguration().isMencoderDisableSubs()) {
+ hasSubsToTranscode = (PMS.getConfiguration().getUseSubtitles() && child.isSrtFile()) || hasEmbeddedSubs;
+ }
+
+ boolean isIncompatible = false;
+
+ // FIXME: Remove PS3 specific logic to support other renderers
+ if (!parserV2 && !child.getExt().ps3compatible()) {
+ isIncompatible = true;
+ }
+
// Force transcoding if
// 1- MediaInfo support detected the file was not matched with supported codec configs and no SkipTranscode extension forced by user
// or 2- ForceTranscode extension forced by user
// or 3- FFmpeg support and the file is not ps3 compatible (need to remove this ?) and no SkipTranscode extension forced by user
// or 4- There's some sub files or embedded subs to deal with and no SkipTranscode extension forced by user
- if (forceTranscode || !isSkipTranscode() && (forceTranscodeV2 || (!parserV2 && !child.getExt().ps3compatible()) || (PMS.getConfiguration().getUseSubtitles() && child.isSrtFile()) || hasEmbeddedSubs)) {
- child.setPlayer(pl);
- LOGGER.trace("Switching " + child.getName() + " to player: " + pl.toString());
+ if (forceTranscode || !isSkipTranscode() && (forceTranscodeV2 || isIncompatible || hasSubsToTranscode)) {
+ child.setPlayer(pl);
+ LOGGER.trace("Switching " + child.getName() + " to player " + pl.toString() + " for transcoding");
}
if (child.getExt().isVideo()) {
@@ -580,6 +593,7 @@ public void addChild(DLNAResource child) {
}
}
} else if (!child.getExt().ps3compatible() && !child.isFolder()) {
+ // FIXME: Remove PS3 specific logic to support other renderers
getChildren().remove(child);
}
}
@@ -589,6 +603,8 @@ public void addChild(DLNAResource child) {
newChild.setExt(newChild.getExt().getSecondaryFormat());
newChild.first = child;
child.second = newChild;
+
+ // FIXME: Remove PS3 specific logic to support other renderers
if (!newChild.getExt().ps3compatible() && newChild.getExt().getProfiles().size() > 0) {
newChild.setPlayer(PMS.get().getPlayer(newChild.getExt().getProfiles().get(0), newChild.getExt()));
}
View
2  src/main/java/net/pms/dlna/FileTranscodeVirtualFolder.java
@@ -106,6 +106,8 @@ public void resolve() {
// meskibob: I think it'd be a good idea to add a "Stream" option (for PS3 compatible containers) to the #Transcode# folder in addition to the current options already in there.
DLNAResource justStreamed = (DLNAResource) ref.clone();
+
+ // FIXME: Remove PS3 specific logic to support other renderers
if (justStreamed.getExt() != null && (justStreamed.getExt().ps3compatible() || justStreamed.isSkipTranscode())) {
justStreamed.setId(null);
justStreamed.setPlayer(null);
View
12 src/main/java/net/pms/formats/Format.java
@@ -67,6 +67,18 @@ public void setType(int type) {
}
public abstract String[] getId();
+
+ /**
+ * Returns whether or not a format can be handled by the PS3 natively.
+ * This means the format can be streamed to PS3 instead of having to be
+ * transcoded.
+ * <p>
+ * FIXME: There are many more renderers; mere PS3 compatibility doesn't
+ * cut it any more. Come up with a better solution, for example a
+ * RendererConfiguration.isStreamable(Format f).
+ *
+ * @return True if the format can be handled by PS3, false otherwise.
+ */
public abstract boolean ps3compatible();
public abstract boolean transcodable();
public abstract ArrayList<Class<? extends Player>> getProfiles();
Please sign in to comment.
Something went wrong with that request. Please try again.