Fix requested changes.
This commit is contained in:
parent
0c0f2d74bc
commit
a7c9905183
|
@ -502,7 +502,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
for (Map.Entry<String, ItagItem> entry : getItags(ADAPTIVE_FORMATS, ItagItem.ItagType.AUDIO).entrySet()) {
|
||||
ItagItem itag = entry.getValue();
|
||||
|
||||
AudioStream audioStream = new AudioStream(entry.getKey(), itag.getMediaFormat(), itag.avgBitrate, itag.bitrate, itag.initStart, itag.initEnd, itag.indexStart, itag.indexEnd, itag.codec);
|
||||
AudioStream audioStream = new AudioStream(entry.getKey(), itag);
|
||||
if (!Stream.containSimilarStream(audioStream, audioStreams)) {
|
||||
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()) {
|
||||
ItagItem itag = entry.getValue();
|
||||
|
||||
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);
|
||||
VideoStream videoStream = new VideoStream(entry.getKey(), true, itag);
|
||||
if (!Stream.containSimilarStream(videoStream, videoOnlyStreams)) {
|
||||
videoOnlyStreams.add(videoStream);
|
||||
}
|
||||
|
@ -949,27 +949,19 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
+ deobfuscateSignature(cipher.get("s"));
|
||||
}
|
||||
|
||||
int bitrate = formatData.getInt("bitrate");
|
||||
int width = formatData.getInt("width");
|
||||
int height = formatData.getInt("height");
|
||||
JsonObject initRange = formatData.getObject("initRange");
|
||||
JsonObject indexRange = formatData.getObject("indexRange");
|
||||
int initStart = Integer.parseInt(initRange.getString("start", "-1"));
|
||||
int initEnd = Integer.parseInt(initRange.getString("end", "-1"));
|
||||
int indexStart = Integer.parseInt(indexRange.getString("start", "-1"));
|
||||
int indexEnd = Integer.parseInt(indexRange.getString("end", "-1"));
|
||||
int fps = formatData.getInt("fps");
|
||||
String mimeType = formatData.getString("mimeType", EMPTY_STRING);
|
||||
String codec = mimeType.contains("codecs") ? mimeType.split("\"")[1] : EMPTY_STRING;
|
||||
|
||||
itagItem.bitrate = bitrate;
|
||||
itagItem.width = width;
|
||||
itagItem.height = height;
|
||||
itagItem.initStart = initStart;
|
||||
itagItem.initEnd = initEnd;
|
||||
itagItem.indexStart = indexStart;
|
||||
itagItem.indexEnd = indexEnd;
|
||||
itagItem.fps = fps;
|
||||
itagItem.bitrate = formatData.getInt("bitrate");
|
||||
itagItem.width = formatData.getInt("width");
|
||||
itagItem.height = formatData.getInt("height");
|
||||
itagItem.initStart = Integer.parseInt(initRange.getString("start", "-1"));
|
||||
itagItem.initEnd = Integer.parseInt(initRange.getString("end", "-1"));
|
||||
itagItem.indexStart = Integer.parseInt(indexRange.getString("start", "-1"));
|
||||
itagItem.indexEnd = Integer.parseInt(indexRange.getString("end", "-1"));
|
||||
itagItem.fps = formatData.getInt("fps");
|
||||
itagItem.codec = codec;
|
||||
|
||||
urlAndItags.put(streamUrl, itagItem);
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.schabi.newpipe.extractor.stream;
|
|||
*/
|
||||
|
||||
import org.schabi.newpipe.extractor.MediaFormat;
|
||||
import org.schabi.newpipe.extractor.services.youtube.ItagItem;
|
||||
|
||||
public class AudioStream extends Stream {
|
||||
public int average_bitrate = -1;
|
||||
|
@ -50,15 +51,15 @@ public class AudioStream extends Stream {
|
|||
* @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;
|
||||
public AudioStream(String url, ItagItem itag) {
|
||||
super(url, itag.getMediaFormat());
|
||||
this.average_bitrate = itag.avgBitrate;
|
||||
this.bitrate = itag.bitrate;
|
||||
this.initStart = itag.initStart;
|
||||
this.initEnd = itag.initEnd;
|
||||
this.indexStart = itag.indexStart;
|
||||
this.indexEnd = itag.indexEnd;
|
||||
this.codec = itag.codec;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,20 +21,21 @@ package org.schabi.newpipe.extractor.stream;
|
|||
*/
|
||||
|
||||
import org.schabi.newpipe.extractor.MediaFormat;
|
||||
import org.schabi.newpipe.extractor.services.youtube.ItagItem;
|
||||
|
||||
public class VideoStream extends Stream {
|
||||
public final String resolution;
|
||||
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;
|
||||
private int bitrate;
|
||||
private int initStart;
|
||||
private int initEnd;
|
||||
private int indexStart;
|
||||
private int indexEnd;
|
||||
private int width;
|
||||
private int height;
|
||||
private String codec;
|
||||
|
||||
public VideoStream(String url, MediaFormat format, String resolution) {
|
||||
this(url, format, resolution, false);
|
||||
|
@ -46,18 +47,18 @@ public class VideoStream extends Stream {
|
|||
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;
|
||||
public VideoStream(String url, boolean isVideoOnly, ItagItem itag) {
|
||||
super(url, itag.getMediaFormat());
|
||||
this.resolution = itag.resolutionString;
|
||||
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;
|
||||
this.bitrate = itag.bitrate;
|
||||
this.initStart = itag.initStart;
|
||||
this.initEnd = itag.initEnd;
|
||||
this.indexStart = itag.indexStart;
|
||||
this.indexEnd = itag.indexEnd;
|
||||
this.codec = itag.codec;
|
||||
this.height = itag.height;
|
||||
this.width = itag.width;
|
||||
}
|
||||
|
||||
public VideoStream(String url, String torrentUrl, MediaFormat format, String resolution) {
|
||||
|
|
Loading…
Reference in New Issue