Adds a converter to embed subtitles
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good
This commit is contained in:
@ -1,5 +1,9 @@
|
||||
package net.knarcraft.ffmpegconverter.streams;
|
||||
|
||||
import net.knarcraft.ffmpegconverter.utility.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* An object representation of a subtitle stream in a media file
|
||||
*/
|
||||
@ -22,8 +26,8 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
|
||||
* @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(String codecName, int absoluteIndex, int relativeIndex, String language, String title,
|
||||
String file, boolean isInternalStream) {
|
||||
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;
|
||||
@ -33,6 +37,13 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
|
||||
this.isImageSubtitle = isImageSubtitle();
|
||||
this.isInternalStream = isInternalStream;
|
||||
this.file = file;
|
||||
|
||||
if (this.language == null || this.language.isEmpty()) {
|
||||
String possibleLanguage = FileUtil.getLanguage(file);
|
||||
if (possibleLanguage != null) {
|
||||
this.language = possibleLanguage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user