From 57138ddd1a600f633a355377abddf72d86b9d247 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Fri, 20 Mar 2020 13:01:26 +0100 Subject: [PATCH] Improves comments for streams --- .../ffmpegconverter/streams/AudioStream.java | 34 ++++++++-- .../ffmpegconverter/streams/StreamObject.java | 8 +-- .../streams/SubtitleStream.java | 66 +++++++++++++------ .../ffmpegconverter/streams/VideoStream.java | 7 ++ 4 files changed, 85 insertions(+), 30 deletions(-) diff --git a/src/main/java/net/knarcraft/ffmpegconverter/streams/AudioStream.java b/src/main/java/net/knarcraft/ffmpegconverter/streams/AudioStream.java index afa4808..a467a28 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/streams/AudioStream.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/streams/AudioStream.java @@ -1,13 +1,25 @@ package net.knarcraft.ffmpegconverter.streams; +/** + * This class represents an ffmpeg audio stream + */ public class AudioStream extends StreamObject { - private String language; //The audio language - private int channels; //Whether mono, stereo, etc - private String title; //Titles exist + private String language; + private int channels; + private String title; - public AudioStream(String codec, int absoluteIndex, int relativeIndex, String language, String title, int channels) { + /** + * Instantiates a new audio stream + * @param codecName

The codec of the audio stream.

+ * @param absoluteIndex

The index of the audio stream.

+ * @param relativeIndex

The index of the audio stream relative to other audio streams.

+ * @param language

The language of the audio stream.

+ * @param title

The title of the audio stream.

+ * @param channels

The number of channels for the audio stream.

+ */ + public AudioStream(String codecName, int absoluteIndex, int relativeIndex, String language, String title, int channels) { this.codecType = "audio"; - this.codecName = codec; + this.codecName = codecName; this.absoluteIndex = absoluteIndex; this.language = language; this.title = title; @@ -15,14 +27,26 @@ public class AudioStream extends StreamObject { this.channels = channels; } + /** + * Gets the language of the audio stream + * @return

The language of the audio stream.

+ */ public String getLanguage() { return this.language; } + /** + * Gets the number of channels for the audio stream + * @return

The number of channels for the audio stream.

+ */ public int getChannels() { return this.channels; } + /** + * Gets the title of the audio stream + * @return

The title of the audio stream.

+ */ public String getTitle() { return this.title; } diff --git a/src/main/java/net/knarcraft/ffmpegconverter/streams/StreamObject.java b/src/main/java/net/knarcraft/ffmpegconverter/streams/StreamObject.java index 6415042..22a2cd1 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/streams/StreamObject.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/streams/StreamObject.java @@ -11,7 +11,7 @@ public abstract class StreamObject { /** * Gets the type of the stream codec (video/audio/subtitle) - * @return codec type + * @return

Codec type.

*/ public String getCodecType() { return this.codecType; @@ -19,7 +19,7 @@ public abstract class StreamObject { /** * Gets the name of the stream codec - * @return codec name + * @return

Codec name.

*/ public String getCodecName() { return this.codecName; @@ -27,7 +27,7 @@ public abstract class StreamObject { /** * Gets the absolute index of a stream object - * @return absolute index + * @return

Absolute index.

*/ public int getAbsoluteIndex() { return this.absoluteIndex; @@ -35,7 +35,7 @@ public abstract class StreamObject { /** * Gets the relative index of a stream object (kth element of codec type) - * @return relative index + * @return

Relative index.

*/ public int getRelativeIndex() { return this.relativeIndex; diff --git a/src/main/java/net/knarcraft/ffmpegconverter/streams/SubtitleStream.java b/src/main/java/net/knarcraft/ffmpegconverter/streams/SubtitleStream.java index 547cbdd..befe0bd 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/streams/SubtitleStream.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/streams/SubtitleStream.java @@ -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

The name of the codec for the subtitle stream.

+ * @param absoluteIndex

The index of the subtitle stream.

+ * @param relativeIndex

The index of the subtitle stream relative to other subtitle streams.

+ * @param language

The language of the subtitle stream.

+ * @param title

The title of the subtitle stream.

+ */ 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

The language of the subtitle stream.

+ */ + public String getLanguage() { + return this.language; + } + + /** + * Gets the title of the subtitle stream + * @return

The title of the subtitle stream.

+ */ + public String getTitle() { + return this.title; + } + + /** + * Gets whether the subtitle is an image subtitle + * @return

Whether the subtitles is an image subtitle.

+ */ + public boolean getIsImageSubtitle() { + return this.isImageSubtitle; + } + + /** + * Gets whether the subtitle is a full subtitle + * @return

Whether the subtitle is a full subtitle.

+ */ + 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

True if the subtitle is image based.

*/ 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

True if the subtitle translates everything.

*/ 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; - } } \ No newline at end of file diff --git a/src/main/java/net/knarcraft/ffmpegconverter/streams/VideoStream.java b/src/main/java/net/knarcraft/ffmpegconverter/streams/VideoStream.java index 847ed70..b4cf8d5 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/streams/VideoStream.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/streams/VideoStream.java @@ -4,6 +4,13 @@ package net.knarcraft.ffmpegconverter.streams; * An object representation of a video stream in a media file */ public class VideoStream extends StreamObject { + + /** + * Instantiates a new video stream + * @param codec

The name of the codec for the video stream.

+ * @param absoluteIndex

The index of the video stream.

+ * @param relativeIndex

The index of the video stream relative to other video streams.

+ */ public VideoStream(String codec, int absoluteIndex, int relativeIndex) { this.codecType = "video"; this.codecName = codec;