Commit f31b2a68 authored by FireMasterK's avatar FireMasterK
Browse files

use getters/setters.

parent d4945ac5
......@@ -8,7 +8,7 @@ import static org.schabi.newpipe.extractor.services.youtube.ItagItem.ItagType.*;
public class ItagItem {
/**
* List can be found here https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L360
* List can be found here https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L1046
*/
private static final ItagItem[] ITAG_LIST = {
/////////////////////////////////////////////////////
......@@ -156,13 +156,76 @@ public class ItagItem {
public int fps = -1;
// Fields for Dash
public int bitrate;
public int width;
public int height;
public int initStart;
public int initEnd;
public int indexStart;
public int indexEnd;
public String codec;
private int bitrate;
private int width;
private int height;
private int initStart;
private int initEnd;
private int indexStart;
private int indexEnd;
private String codec;
public int getBitrate() {
return bitrate;
}
public void setBitrate(int bitrate) {
this.bitrate = bitrate;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getInitStart() {
return initStart;
}
public void setInitStart(int initStart) {
this.initStart = initStart;
}
public int getInitEnd() {
return initEnd;
}
public void setInitEnd(int initEnd) {
this.initEnd = initEnd;
}
public int getIndexStart() {
return indexStart;
}
public void setIndexStart(int indexStart) {
this.indexStart = indexStart;
}
public int getIndexEnd() {
return indexEnd;
}
public void setIndexEnd(int indexEnd) {
this.indexEnd = indexEnd;
}
public String getCodec() {
return codec;
}
public void setCodec(String codec) {
this.codec = codec;
}
}
......@@ -954,15 +954,15 @@ public class YoutubeStreamExtractor extends StreamExtractor {
String mimeType = formatData.getString("mimeType", EMPTY_STRING);
String codec = mimeType.contains("codecs") ? mimeType.split("\"")[1] : EMPTY_STRING;
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.setBitrate(formatData.getInt("bitrate"));
itagItem.setWidth(formatData.getInt("width"));
itagItem.setHeight(formatData.getInt("height"));
itagItem.setInitStart(Integer.parseInt(initRange.getString("start", "-1")));
itagItem.setInitEnd(Integer.parseInt(initRange.getString("end", "-1")));
itagItem.setIndexStart(Integer.parseInt(indexRange.getString("start", "-1")));
itagItem.setIndexEnd(Integer.parseInt(indexRange.getString("end", "-1")));
itagItem.fps = formatData.getInt("fps");
itagItem.codec = codec;
itagItem.setCodec(codec);
urlAndItags.put(streamUrl, itagItem);
}
......
......@@ -52,12 +52,12 @@ public class AudioStream extends Stream {
*/
public AudioStream(String url, ItagItem itag) {
this(url, itag.getMediaFormat(), 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;
this.bitrate = itag.getBitrate();
this.initStart = itag.getInitStart();
this.initEnd = itag.getInitEnd();
this.indexStart = itag.getIndexStart();
this.indexEnd = itag.getIndexEnd();
this.codec = itag.getCodec();
}
@Override
......
......@@ -42,21 +42,19 @@ public class VideoStream extends Stream {
}
public VideoStream(String url, MediaFormat format, String resolution, boolean isVideoOnly) {
super(url, format);
this.resolution = resolution;
this.isVideoOnly = isVideoOnly;
this(url, null, format, resolution, isVideoOnly);
}
public VideoStream(String url, boolean isVideoOnly, ItagItem itag) {
this(url, itag.getMediaFormat(), itag.resolutionString, isVideoOnly);
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;
this.bitrate = itag.getBitrate();
this.initStart = itag.getInitStart();
this.initEnd = itag.getInitEnd();
this.indexStart = itag.getIndexStart();
this.indexEnd = itag.getIndexEnd();
this.codec = itag.getCodec();
this.height = itag.getHeight();
this.width = itag.getWidth();
}
public VideoStream(String url, String torrentUrl, MediaFormat format, String resolution) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment