Improves comments for streams

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

View File

@ -1,13 +1,25 @@
package net.knarcraft.ffmpegconverter.streams; package net.knarcraft.ffmpegconverter.streams;
/**
* This class represents an ffmpeg audio stream
*/
public class AudioStream extends StreamObject { public class AudioStream extends StreamObject {
private String language; //The audio language private String language;
private int channels; //Whether mono, stereo, etc private int channels;
private String title; //Titles exist private String title;
public AudioStream(String codec, int absoluteIndex, int relativeIndex, String language, String title, int channels) { /**
* Instantiates a new audio stream
* @param codecName <p>The codec of the audio stream.</p>
* @param absoluteIndex <p>The index of the audio stream.</p>
* @param relativeIndex <p>The index of the audio stream relative to other audio streams.</p>
* @param language <p>The language of the audio stream.</p>
* @param title <p>The title of the audio stream.</p>
* @param channels <p>The number of channels for the audio stream.</p>
*/
public AudioStream(String codecName, int absoluteIndex, int relativeIndex, String language, String title, int channels) {
this.codecType = "audio"; this.codecType = "audio";
this.codecName = codec; this.codecName = codecName;
this.absoluteIndex = absoluteIndex; this.absoluteIndex = absoluteIndex;
this.language = language; this.language = language;
this.title = title; this.title = title;
@ -15,14 +27,26 @@ public class AudioStream extends StreamObject {
this.channels = channels; this.channels = channels;
} }
/**
* Gets the language of the audio stream
* @return <p>The language of the audio stream.</p>
*/
public String getLanguage() { public String getLanguage() {
return this.language; return this.language;
} }
/**
* Gets the number of channels for the audio stream
* @return <p>The number of channels for the audio stream.</p>
*/
public int getChannels() { public int getChannels() {
return this.channels; return this.channels;
} }
/**
* Gets the title of the audio stream
* @return <p>The title of the audio stream.</p>
*/
public String getTitle() { public String getTitle() {
return this.title; return this.title;
} }

View File

@ -11,7 +11,7 @@ public abstract class StreamObject {
/** /**
* Gets the type of the stream codec (video/audio/subtitle) * Gets the type of the stream codec (video/audio/subtitle)
* @return codec type * @return <p>Codec type.</p>
*/ */
public String getCodecType() { public String getCodecType() {
return this.codecType; return this.codecType;
@ -19,7 +19,7 @@ public abstract class StreamObject {
/** /**
* Gets the name of the stream codec * Gets the name of the stream codec
* @return codec name * @return <p>Codec name.</p>
*/ */
public String getCodecName() { public String getCodecName() {
return this.codecName; return this.codecName;
@ -27,7 +27,7 @@ public abstract class StreamObject {
/** /**
* Gets the absolute index of a stream object * Gets the absolute index of a stream object
* @return absolute index * @return <p>Absolute index.</p>
*/ */
public int getAbsoluteIndex() { public int getAbsoluteIndex() {
return this.absoluteIndex; return this.absoluteIndex;
@ -35,7 +35,7 @@ public abstract class StreamObject {
/** /**
* Gets the relative index of a stream object (kth element of codec type) * Gets the relative index of a stream object (kth element of codec type)
* @return relative index * @return <p>Relative index.</p>
*/ */
public int getRelativeIndex() { public int getRelativeIndex() {
return this.relativeIndex; return this.relativeIndex;

View File

@ -5,10 +5,18 @@ package net.knarcraft.ffmpegconverter.streams;
*/ */
public class SubtitleStream extends StreamObject { public class SubtitleStream extends StreamObject {
final private String language; final private String language;
final private String title; //Title shown final private String title;
final private boolean isFullSubtitle; //Songs and signs will be false final private boolean isFullSubtitle;
final private boolean isImageSubtitle; 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) { public SubtitleStream(String codecName, int absoluteIndex, int relativeIndex, String language, String title) {
this.codecType = "subtitle"; this.codecType = "subtitle";
this.codecName = codecName; this.codecName = codecName;
@ -20,17 +28,49 @@ public class SubtitleStream extends StreamObject {
this.isImageSubtitle = isImageSubtitle(); 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) * 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() { private boolean isImageSubtitle() {
return codecName != null && getCodecName().equals("hdmv_pgs_subtitle"); return codecName != null && getCodecName().equals("hdmv_pgs_subtitle");
} }
/** /**
* Checks whether translates everything (as opposed to just songs and signs) * Checks whether the subtitle translates everything (as opposed to just songs and signs)
* @return True if the subtitles translate everything * @return <p>True if the subtitle translates everything.</p>
*/ */
private boolean isFullSubtitle() { private boolean isFullSubtitle() {
if (getTitle() == null) { if (getTitle() == null) {
@ -41,20 +81,4 @@ public class SubtitleStream extends StreamObject {
!titleLowercase.matches("songs?[ &\\/a-z]+signs?") && !titleLowercase.matches("songs?[ &\\/a-z]+signs?") &&
!titleLowercase.matches("forced"); !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;
}
} }

View File

@ -4,6 +4,13 @@ package net.knarcraft.ffmpegconverter.streams;
* An object representation of a video stream in a media file * An object representation of a video stream in a media file
*/ */
public class VideoStream extends StreamObject { public class VideoStream extends StreamObject {
/**
* Instantiates a new video stream
* @param codec <p>The name of the codec for the video stream.</p>
* @param absoluteIndex <p>The index of the video stream.</p>
* @param relativeIndex <p>The index of the video stream relative to other video streams.</p>
*/
public VideoStream(String codec, int absoluteIndex, int relativeIndex) { public VideoStream(String codec, int absoluteIndex, int relativeIndex) {
this.codecType = "video"; this.codecType = "video";
this.codecName = codec; this.codecName = codec;