Add data to respective classes.
This commit is contained in:
parent
525e345ed8
commit
11eb4932f4
|
@ -502,7 +502,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
for (Map.Entry<String, ItagItem> entry : getItags(ADAPTIVE_FORMATS, ItagItem.ItagType.AUDIO).entrySet()) {
|
for (Map.Entry<String, ItagItem> entry : getItags(ADAPTIVE_FORMATS, ItagItem.ItagType.AUDIO).entrySet()) {
|
||||||
ItagItem itag = entry.getValue();
|
ItagItem itag = entry.getValue();
|
||||||
|
|
||||||
AudioStream audioStream = new AudioStream(entry.getKey(), itag.getMediaFormat(), itag.avgBitrate);
|
AudioStream audioStream = new AudioStream(entry.getKey(), itag.getMediaFormat(), itag.avgBitrate, itag.bitrate, itag.initStart, itag.initEnd, itag.indexStart, itag.indexEnd, itag.codec);
|
||||||
if (!Stream.containSimilarStream(audioStream, audioStreams)) {
|
if (!Stream.containSimilarStream(audioStream, audioStreams)) {
|
||||||
audioStreams.add(audioStream);
|
audioStreams.add(audioStream);
|
||||||
}
|
}
|
||||||
|
@ -542,7 +542,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
for (Map.Entry<String, ItagItem> entry : getItags(ADAPTIVE_FORMATS, ItagItem.ItagType.VIDEO_ONLY).entrySet()) {
|
for (Map.Entry<String, ItagItem> entry : getItags(ADAPTIVE_FORMATS, ItagItem.ItagType.VIDEO_ONLY).entrySet()) {
|
||||||
ItagItem itag = entry.getValue();
|
ItagItem itag = entry.getValue();
|
||||||
|
|
||||||
VideoStream videoStream = new VideoStream(entry.getKey(), itag.getMediaFormat(), itag.resolutionString, true);
|
VideoStream videoStream = new VideoStream(entry.getKey(), itag.getMediaFormat(), itag.resolutionString, true, itag.bitrate, itag.initStart, itag.initEnd, itag.indexStart, itag.indexEnd, itag.codec, itag.width, itag.height);
|
||||||
if (!Stream.containSimilarStream(videoStream, videoOnlyStreams)) {
|
if (!Stream.containSimilarStream(videoStream, videoOnlyStreams)) {
|
||||||
videoOnlyStreams.add(videoStream);
|
videoOnlyStreams.add(videoStream);
|
||||||
}
|
}
|
||||||
|
@ -950,19 +950,19 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
int bitrate = formatData.getInt("bitrate");
|
int bitrate = formatData.getInt("bitrate");
|
||||||
int averageBitrate = formatData.getInt("averageBitrate");
|
|
||||||
int width = formatData.getInt("width");
|
int width = formatData.getInt("width");
|
||||||
int height = formatData.getInt("height");
|
int height = formatData.getInt("height");
|
||||||
int initStart = formatData.getInt("initRange.start");
|
JsonObject initRange = formatData.getObject("initRange");
|
||||||
int initEnd = formatData.getInt("initRange.end");
|
JsonObject indexRange = formatData.getObject("indexRange");
|
||||||
int indexStart = formatData.getInt("indexRange.start");
|
int initStart = Integer.parseInt(initRange.getString("start"));
|
||||||
int indexEnd = formatData.getInt("indexRange.end");
|
int initEnd = Integer.parseInt(initRange.getString("end"));
|
||||||
|
int indexStart = Integer.parseInt(indexRange.getString("start"));
|
||||||
|
int indexEnd = Integer.parseInt(indexRange.getString("end"));
|
||||||
int fps = formatData.getInt("fps");
|
int fps = formatData.getInt("fps");
|
||||||
String mimeType = formatData.getString("mimeType", EMPTY_STRING);
|
String mimeType = formatData.getString("mimeType", EMPTY_STRING);
|
||||||
String codec = mimeType.contains("codecs") ? mimeType.split("\"")[1] : EMPTY_STRING;
|
String codec = mimeType.contains("codecs") ? mimeType.split("\"")[1] : EMPTY_STRING;
|
||||||
|
|
||||||
itagItem.bitrate = bitrate;
|
itagItem.bitrate = bitrate;
|
||||||
itagItem.avgBitrate =averageBitrate;
|
|
||||||
itagItem.width = width;
|
itagItem.width = width;
|
||||||
itagItem.height = height;
|
itagItem.height = height;
|
||||||
itagItem.initStart = initStart;
|
itagItem.initStart = initStart;
|
||||||
|
|
|
@ -25,6 +25,14 @@ import org.schabi.newpipe.extractor.MediaFormat;
|
||||||
public class AudioStream extends Stream {
|
public class AudioStream extends Stream {
|
||||||
public int average_bitrate = -1;
|
public int average_bitrate = -1;
|
||||||
|
|
||||||
|
// Fields for Dash
|
||||||
|
public int bitrate;
|
||||||
|
public int initStart;
|
||||||
|
public int initEnd;
|
||||||
|
public int indexStart;
|
||||||
|
public int indexEnd;
|
||||||
|
public String codec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new audio stream
|
* Create a new audio stream
|
||||||
* @param url the url
|
* @param url the url
|
||||||
|
@ -36,6 +44,23 @@ public class AudioStream extends Stream {
|
||||||
this.average_bitrate = averageBitrate;
|
this.average_bitrate = averageBitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new audio stream
|
||||||
|
* @param url the url
|
||||||
|
* @param format the format
|
||||||
|
* @param averageBitrate the average bitrate
|
||||||
|
*/
|
||||||
|
public AudioStream(String url, MediaFormat format, int averageBitrate, int bitrate, int initStart, int initEnd, int indexStart, int indexEnd, String codec) {
|
||||||
|
super(url, format);
|
||||||
|
this.average_bitrate = averageBitrate;
|
||||||
|
this.bitrate = bitrate;
|
||||||
|
this.initStart = initStart;
|
||||||
|
this.initEnd = initEnd;
|
||||||
|
this.indexStart = indexStart;
|
||||||
|
this.indexEnd = indexEnd;
|
||||||
|
this.codec = codec;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equalStats(Stream cmp) {
|
public boolean equalStats(Stream cmp) {
|
||||||
return super.equalStats(cmp) && cmp instanceof AudioStream &&
|
return super.equalStats(cmp) && cmp instanceof AudioStream &&
|
||||||
|
@ -49,4 +74,28 @@ public class AudioStream extends Stream {
|
||||||
public int getAverageBitrate() {
|
public int getAverageBitrate() {
|
||||||
return average_bitrate;
|
return average_bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBitrate() {
|
||||||
|
return bitrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitStart() {
|
||||||
|
return initStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitEnd() {
|
||||||
|
return initEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndexStart() {
|
||||||
|
return indexStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndexEnd() {
|
||||||
|
return indexEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodec() {
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,15 @@ public class VideoStream extends Stream {
|
||||||
public final String resolution;
|
public final String resolution;
|
||||||
public final boolean isVideoOnly;
|
public final boolean isVideoOnly;
|
||||||
|
|
||||||
|
// Fields for Dash
|
||||||
|
public int bitrate;
|
||||||
|
public int initStart;
|
||||||
|
public int initEnd;
|
||||||
|
public int indexStart;
|
||||||
|
public int indexEnd;
|
||||||
|
public int width;
|
||||||
|
public int height;
|
||||||
|
public String codec;
|
||||||
|
|
||||||
public VideoStream(String url, MediaFormat format, String resolution) {
|
public VideoStream(String url, MediaFormat format, String resolution) {
|
||||||
this(url, format, resolution, false);
|
this(url, format, resolution, false);
|
||||||
|
@ -37,6 +46,20 @@ public class VideoStream extends Stream {
|
||||||
this.isVideoOnly = isVideoOnly;
|
this.isVideoOnly = isVideoOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VideoStream(String url, MediaFormat format, String resolution, boolean isVideoOnly, int bitrate, int initStart, int initEnd, int indexStart, int indexEnd, String codec, int width, int height) {
|
||||||
|
super(url, format);
|
||||||
|
this.resolution = resolution;
|
||||||
|
this.isVideoOnly = isVideoOnly;
|
||||||
|
this.bitrate = bitrate;
|
||||||
|
this.initStart = initStart;
|
||||||
|
this.initEnd = initEnd;
|
||||||
|
this.indexStart = indexStart;
|
||||||
|
this.indexEnd = indexEnd;
|
||||||
|
this.codec = codec;
|
||||||
|
this.height = height;
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
public VideoStream(String url, String torrentUrl, MediaFormat format, String resolution) {
|
public VideoStream(String url, String torrentUrl, MediaFormat format, String resolution) {
|
||||||
this(url, torrentUrl, format, resolution, false);
|
this(url, torrentUrl, format, resolution, false);
|
||||||
}
|
}
|
||||||
|
@ -73,4 +96,36 @@ public class VideoStream extends Stream {
|
||||||
public boolean isVideoOnly() {
|
public boolean isVideoOnly() {
|
||||||
return isVideoOnly;
|
return isVideoOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBitrate() {
|
||||||
|
return bitrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitStart() {
|
||||||
|
return initStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitEnd() {
|
||||||
|
return initEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndexStart() {
|
||||||
|
return indexStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndexEnd() {
|
||||||
|
return indexEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodec() {
|
||||||
|
return codec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue