ad service_id field, and pulled video/audio stream out of streaminfo

This commit is contained in:
Christian Schabesberger 2016-03-04 13:36:06 +01:00
parent d9cd928100
commit b1d2e64450
23 changed files with 230 additions and 126 deletions

View file

@ -13,6 +13,7 @@ import android.widget.ArrayAdapter;
import org.schabi.newpipe.extractor.MediaFormat;
import org.schabi.newpipe.extractor.StreamInfo;
import org.schabi.newpipe.extractor.VideoStream;
import java.util.List;
@ -75,7 +76,7 @@ class ActionBarHandler {
}
}
public void setupStreamList(final List<StreamInfo.VideoStream> videoStreams) {
public void setupStreamList(final List<VideoStream> videoStreams) {
if (activity != null) {
selectedVideoStream = 0;
@ -83,7 +84,7 @@ class ActionBarHandler {
// this array will be shown in the dropdown menu for selecting the stream/resolution.
String[] itemArray = new String[videoStreams.size()];
for (int i = 0; i < videoStreams.size(); i++) {
StreamInfo.VideoStream item = videoStreams.get(i);
VideoStream item = videoStreams.get(i);
itemArray[i] = MediaFormat.getNameById(item.format) + " " + item.resolution;
}
int defaultResolution = getDefaultResolution(videoStreams);
@ -108,13 +109,13 @@ class ActionBarHandler {
}
private int getDefaultResolution(final List<StreamInfo.VideoStream> videoStreams) {
private int getDefaultResolution(final List<VideoStream> videoStreams) {
String defaultResolution = defaultPreferences
.getString(activity.getString(R.string.default_resolution_key),
activity.getString(R.string.default_resolution_value));
for (int i = 0; i < videoStreams.size(); i++) {
StreamInfo.VideoStream item = videoStreams.get(i);
VideoStream item = videoStreams.get(i);
if (defaultResolution.equals(item.resolution)) {
return i;
}