Adds some extra abstraction to streams
This commit is contained in:
parent
58dcb7fd35
commit
2404d85468
@ -0,0 +1,25 @@
|
|||||||
|
package net.knarcraft.ffmpegconverter.streams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An object representation of a stream in a media file
|
||||||
|
*/
|
||||||
|
public abstract class AbstractStream implements StreamObject {
|
||||||
|
int absoluteIndex;
|
||||||
|
int relativeIndex;
|
||||||
|
String codecName;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCodecName() {
|
||||||
|
return this.codecName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAbsoluteIndex() {
|
||||||
|
return this.absoluteIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRelativeIndex() {
|
||||||
|
return this.relativeIndex;
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,7 @@ package net.knarcraft.ffmpegconverter.streams;
|
|||||||
/**
|
/**
|
||||||
* This class represents an ffmpeg audio stream
|
* This class represents an ffmpeg audio stream
|
||||||
*/
|
*/
|
||||||
public class AudioStream extends StreamObject {
|
public class AudioStream extends AbstractStream implements StreamObject {
|
||||||
private final String language;
|
private final String language;
|
||||||
private final int channels;
|
private final int channels;
|
||||||
private final String title;
|
private final String title;
|
||||||
@ -19,7 +19,6 @@ public class AudioStream extends StreamObject {
|
|||||||
* @param channels <p>The number of channels for 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) {
|
public AudioStream(String codecName, int absoluteIndex, int relativeIndex, String language, String title, int channels) {
|
||||||
this.codecType = "audio";
|
|
||||||
this.codecName = codecName;
|
this.codecName = codecName;
|
||||||
this.absoluteIndex = absoluteIndex;
|
this.absoluteIndex = absoluteIndex;
|
||||||
this.language = language;
|
this.language = language;
|
||||||
|
@ -1,47 +1,26 @@
|
|||||||
package net.knarcraft.ffmpegconverter.streams;
|
package net.knarcraft.ffmpegconverter.streams;
|
||||||
|
|
||||||
/**
|
public interface StreamObject {
|
||||||
* An object representation of a stream in a media file
|
|
||||||
*/
|
|
||||||
public abstract class StreamObject {
|
|
||||||
int absoluteIndex;
|
|
||||||
int relativeIndex;
|
|
||||||
String codecName;
|
|
||||||
String codecType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the type of the stream codec (video/audio/subtitle)
|
|
||||||
*
|
|
||||||
* @return <p>Codec type.</p>
|
|
||||||
*/
|
|
||||||
public String getCodecType() {
|
|
||||||
return this.codecType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of the stream codec
|
* Gets the name of the stream codec
|
||||||
*
|
*
|
||||||
* @return <p>Codec name.</p>
|
* @return <p>Codec name.</p>
|
||||||
*/
|
*/
|
||||||
String getCodecName() {
|
String getCodecName();
|
||||||
return this.codecName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the absolute index of a stream object
|
* Gets the absolute index of a stream object
|
||||||
*
|
*
|
||||||
* @return <p>Absolute index.</p>
|
* @return <p>Absolute index.</p>
|
||||||
*/
|
*/
|
||||||
public int getAbsoluteIndex() {
|
int getAbsoluteIndex();
|
||||||
return this.absoluteIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 <p>Relative index.</p>
|
* @return <p>Relative index.</p>
|
||||||
*/
|
*/
|
||||||
public int getRelativeIndex() {
|
int getRelativeIndex();
|
||||||
return this.relativeIndex;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ package net.knarcraft.ffmpegconverter.streams;
|
|||||||
/**
|
/**
|
||||||
* An object representation of a subtitle stream in a media file
|
* An object representation of a subtitle stream in a media file
|
||||||
*/
|
*/
|
||||||
public class SubtitleStream extends StreamObject {
|
public class SubtitleStream extends AbstractStream implements StreamObject {
|
||||||
final private String language;
|
final private String language;
|
||||||
final private String title;
|
final private String title;
|
||||||
final private String file;
|
final private String file;
|
||||||
@ -22,7 +22,6 @@ public class SubtitleStream extends StreamObject {
|
|||||||
*/
|
*/
|
||||||
public SubtitleStream(String codecName, int absoluteIndex, int relativeIndex, String language, String title,
|
public SubtitleStream(String codecName, int absoluteIndex, int relativeIndex, String language, String title,
|
||||||
String file) {
|
String file) {
|
||||||
this.codecType = "subtitle";
|
|
||||||
this.codecName = codecName;
|
this.codecName = codecName;
|
||||||
this.absoluteIndex = absoluteIndex;
|
this.absoluteIndex = absoluteIndex;
|
||||||
this.language = language;
|
this.language = language;
|
||||||
|
@ -3,7 +3,7 @@ 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 AbstractStream implements StreamObject {
|
||||||
private final int width;
|
private final int width;
|
||||||
private final int height;
|
private final int height;
|
||||||
|
|
||||||
@ -17,7 +17,6 @@ public class VideoStream extends StreamObject {
|
|||||||
* @param height <p>The height of the video stream.</p>
|
* @param height <p>The height of the video stream.</p>
|
||||||
*/
|
*/
|
||||||
public VideoStream(String codec, int absoluteIndex, int relativeIndex, int width, int height) {
|
public VideoStream(String codec, int absoluteIndex, int relativeIndex, int width, int height) {
|
||||||
this.codecType = "video";
|
|
||||||
this.codecName = codec;
|
this.codecName = codec;
|
||||||
this.absoluteIndex = absoluteIndex;
|
this.absoluteIndex = absoluteIndex;
|
||||||
this.relativeIndex = relativeIndex;
|
this.relativeIndex = relativeIndex;
|
||||||
|
Loading…
Reference in New Issue
Block a user