Makes getting any stream info much easier
Adds some methods for parsing Strings as other objects without resulting in exceptions. Adds a class for representing all possible stream info tags. Makes streams parse data themselves, after receiving all tags set for the stream. Changes Java version to Java 16
This commit is contained in:
@ -2,14 +2,14 @@ package net.knarcraft.ffmpegconverter.streams;
|
||||
|
||||
import net.knarcraft.ffmpegconverter.utility.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An object representation of a subtitle stream in a media file
|
||||
*/
|
||||
public class SubtitleStream extends AbstractStream implements StreamObject {
|
||||
|
||||
final private String title;
|
||||
final private String file;
|
||||
final private boolean isFullSubtitle;
|
||||
final private boolean isImageSubtitle;
|
||||
@ -18,22 +18,15 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
|
||||
/**
|
||||
* 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 streamInfo <p>All info about the 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>
|
||||
* @param file <p>The file containing the subtitle.</p>
|
||||
* @param isInternalStream <p>Whether this subtitle stream is in the video file itself</p>
|
||||
*/
|
||||
public SubtitleStream(@Nullable String codecName, int absoluteIndex, int relativeIndex, @Nullable String language,
|
||||
@Nullable String title, @NotNull String file, boolean isInternalStream) {
|
||||
this.codecName = codecName;
|
||||
this.absoluteIndex = absoluteIndex;
|
||||
this.language = language;
|
||||
this.title = title;
|
||||
public SubtitleStream(@NotNull Map<StreamTag, String> streamInfo, int relativeIndex,
|
||||
@NotNull String file, boolean isInternalStream) {
|
||||
super(streamInfo, relativeIndex);
|
||||
this.isFullSubtitle = isFullSubtitle();
|
||||
this.relativeIndex = relativeIndex;
|
||||
this.isImageSubtitle = isImageSubtitle();
|
||||
this.isInternalStream = isInternalStream;
|
||||
this.file = file;
|
||||
@ -46,15 +39,6 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title of the subtitle stream
|
||||
*
|
||||
* @return <p>The title of the subtitle stream.</p>
|
||||
*/
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the file name of the file containing this subtitle
|
||||
*
|
||||
@ -120,4 +104,9 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
|
||||
!titleLowercase.contains("signs only");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull StreamType getStreamType() {
|
||||
return StreamType.SUBTITLE;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user