Skip to content
This repository has been archived by the owner on Feb 9, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Improvement for stream or transcode decision logic (thanks, StreamHD!)
  • Loading branch information
Raptor399 committed Jan 3, 2012
1 parent c87afe6 commit ad8d98c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/main/java/net/pms/dlna/DLNAResource.java
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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()));
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/pms/dlna/FileTranscodeVirtualFolder.java
Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/net/pms/formats/Format.java
Expand Up @@ -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();
Expand Down

0 comments on commit ad8d98c

Please sign in to comment.