Improves comments for streams

This commit is contained in:
2020-03-20 13:01:26 +01:00
parent bf6542c22a
commit 57138ddd1a
4 changed files with 85 additions and 30 deletions

View File

@ -5,10 +5,18 @@ package net.knarcraft.ffmpegconverter.streams;
*/
public class SubtitleStream extends StreamObject {
final private String language;
final private String title; //Title shown
final private boolean isFullSubtitle; //Songs and signs will be false
final private String title;
final private boolean isFullSubtitle;
final private boolean isImageSubtitle;
/**
* Instantiates a new subtitle stream
* @param codecName <p>The name of the codec for the subtitle stream.</p>
* @param absoluteIndex <p>The index of the subtitle stream.</p>
* @param relativeIndex <p>The index of the subtitle stream relative to other subtitle streams.</p>
* @param language <p>The language of the subtitle stream.</p>
* @param title <p>The title of the subtitle stream.</p>
*/
public SubtitleStream(String codecName, int absoluteIndex, int relativeIndex, String language, String title) {
this.codecType = "subtitle";
this.codecName = codecName;
@ -20,17 +28,49 @@ public class SubtitleStream extends StreamObject {
this.isImageSubtitle = isImageSubtitle();
}
/**
* Gets the language of the subtitle stream
* @return <p>The language of the subtitle stream.</p>
*/
public String getLanguage() {
return this.language;
}
/**
* Gets the title of the subtitle stream
* @return <p>The title of the subtitle stream.</p>
*/
public String getTitle() {
return this.title;
}
/**
* Gets whether the subtitle is an image subtitle
* @return <p>Whether the subtitles is an image subtitle.</p>
*/
public boolean getIsImageSubtitle() {
return this.isImageSubtitle;
}
/**
* Gets whether the subtitle is a full subtitle
* @return <p>Whether the subtitle is a full subtitle.</p>
*/
public boolean getIsFullSubtitle() {
return this.isFullSubtitle;
}
/**
* Checks whether a subtitle is image based (as opposed to text based)
* @return True if the subtitle is image based
* @return <p>True if the subtitle is image based.</p>
*/
private boolean isImageSubtitle() {
return codecName != null && getCodecName().equals("hdmv_pgs_subtitle");
}
/**
* Checks whether translates everything (as opposed to just songs and signs)
* @return True if the subtitles translate everything
* Checks whether the subtitle translates everything (as opposed to just songs and signs)
* @return <p>True if the subtitle translates everything.</p>
*/
private boolean isFullSubtitle() {
if (getTitle() == null) {
@ -41,20 +81,4 @@ public class SubtitleStream extends StreamObject {
!titleLowercase.matches("songs?[ &\\/a-z]+signs?") &&
!titleLowercase.matches("forced");
}
public String getLanguage() {
return this.language;
}
public String getTitle() {
return this.title;
}
public boolean getIsImageSubtitle() {
return this.isImageSubtitle;
}
public boolean getIsFullSubtitle() {
return this.isFullSubtitle;
}
}