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

Commit

Permalink
Detect embedded ASS/SSA subtitles (thanks leroy!)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raptor399 committed Jan 30, 2012
1 parent f009197 commit 8d3f0de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/main/java/net/pms/dlna/DLNAMediaSubtitle.java
Expand Up @@ -102,6 +102,23 @@ public String getSubType() {
return "-";
}

/**
* Returns whether or not the subtitles are embedded.
*
* @return True if the subtitles are embedded, false otherwise.
* @since 1.51.0
*/
public boolean isEmbedded() {
switch (type) {
case ASS:
// No file available means the subtitles are embedded
return (file == null);
case EMBEDDED:
return true;
}
return false;
}

public String toString() {
return "Sub: " + getSubType() + " / lang: " + getLang() + " / flavor: " + flavor + " / ID: " + getId() + " / FILE: " + (file != null ? file.getAbsolutePath() : "-");
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/pms/dlna/DLNAResource.java
Expand Up @@ -536,9 +536,10 @@ public void addChild(DLNAResource child) {
}

boolean hasEmbeddedSubs = false;

if (child.getMedia() != null) {
for (DLNAMediaSubtitle s : child.getMedia().getSubtitlesCodes()) {
hasEmbeddedSubs |= s.getSubType().equals("Embedded");
hasEmbeddedSubs = (hasEmbeddedSubs || s.isEmbedded());
}
}

Expand Down

0 comments on commit 8d3f0de

Please sign in to comment.