Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
52a21e4
implement webm to ogg demuxer
kapodamy Sep 24, 2019
0cdfa6e
rewrite OggFromWebMWriter
kapodamy Sep 25, 2019
c891f2f
long-term downloads resume
kapodamy Sep 28, 2019
429ee7e
Mp4FromDashWriter fixes
kapodamy Sep 29, 2019
160a33e
misc changes
kapodamy Oct 1, 2019
d092e39
fallback for pending downloads directory
kapodamy Oct 1, 2019
9339fc8
update DownloadManager.java
kapodamy Oct 1, 2019
94e2314
update WebMWriter.java
kapodamy Oct 1, 2019
844f80a
update DownloadDialog.java
kapodamy Oct 2, 2019
f62a791
code cleanup
kapodamy Oct 10, 2019
ea1be11
Merge branch 'dev' into dl-last-features
kapodamy Nov 24, 2019
14de2f2
Merge branch 'dev' into dl-last-features
kapodamy Nov 26, 2019
773aa1e
implement webm to ogg demuxer
kapodamy Sep 24, 2019
dab5345
rewrite OggFromWebMWriter
kapodamy Sep 25, 2019
86dafdd
long-term downloads resume
kapodamy Sep 28, 2019
5707381
Mp4FromDashWriter fixes
kapodamy Sep 29, 2019
4292ca9
misc changes
kapodamy Oct 1, 2019
60d4c8a
fallback for pending downloads directory
kapodamy Oct 1, 2019
da052df
update DownloadManager.java
kapodamy Oct 1, 2019
8a992d4
update WebMWriter.java
kapodamy Oct 1, 2019
763995d
update DownloadDialog.java
kapodamy Oct 2, 2019
e6d9d8e
code cleanup
kapodamy Oct 10, 2019
3ca4614
Merge branch 'dev' into dl-last-features
kapodamy Nov 24, 2019
0033843
Merge branch 'dl-last-features' of https://github.com/kapodamy/NewPip…
kapodamy Nov 26, 2019
84ec320
commit
kapodamy Nov 26, 2019
aae8865
remove unused imports
kapodamy Dec 5, 2019
5a2cd93
remove netbeans editor-fold comments
kapodamy Dec 6, 2019
0393955
add missing change after updating NPE
kapodamy Dec 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dependencies {
exclude module: 'support-annotations'
})

implementation 'com.github.TeamNewPipe:NewPipeExtractor:5c420340ceb39'
implementation 'com.github.TeamNewPipe:NewPipeExtractor:b6d3252'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0'

Expand Down
36 changes: 26 additions & 10 deletions app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import icepick.Icepick;
import icepick.State;
import io.reactivex.disposables.CompositeDisposable;
import us.shandian.giga.get.MissionRecoveryInfo;
import us.shandian.giga.io.StoredDirectoryHelper;
import us.shandian.giga.io.StoredFileHelper;
import us.shandian.giga.postprocessing.Postprocessing;
Expand Down Expand Up @@ -762,12 +763,13 @@ private void continueSelectedDownload(@NonNull StoredFileHelper storage) {
}

Stream selectedStream;
Stream secondaryStream = null;
char kind;
int threads = threadsSeekBar.getProgress() + 1;
String[] urls;
MissionRecoveryInfo[] recoveryInfo;
String psName = null;
String[] psArgs = null;
String secondaryStreamUrl = null;
long nearLength = 0;

// more download logic: select muxer, subtitle converter, etc.
Expand All @@ -778,18 +780,20 @@ private void continueSelectedDownload(@NonNull StoredFileHelper storage) {

if (selectedStream.getFormat() == MediaFormat.M4A) {
psName = Postprocessing.ALGORITHM_M4A_NO_DASH;
} else if (selectedStream.getFormat() == MediaFormat.WEBMA_OPUS) {
psName = Postprocessing.ALGORITHM_OGG_FROM_WEBM_DEMUXER;
}
break;
case R.id.video_button:
kind = 'v';
selectedStream = videoStreamsAdapter.getItem(selectedVideoIndex);

SecondaryStreamHelper<AudioStream> secondaryStream = videoStreamsAdapter
SecondaryStreamHelper<AudioStream> secondary = videoStreamsAdapter
.getAllSecondary()
.get(wrappedVideoStreams.getStreamsList().indexOf(selectedStream));

if (secondaryStream != null) {
secondaryStreamUrl = secondaryStream.getStream().getUrl();
if (secondary != null) {
secondaryStream = secondary.getStream();

if (selectedStream.getFormat() == MediaFormat.MPEG_4)
psName = Postprocessing.ALGORITHM_MP4_FROM_DASH_MUXER;
Expand All @@ -801,8 +805,8 @@ private void continueSelectedDownload(@NonNull StoredFileHelper storage) {

// set nearLength, only, if both sizes are fetched or known. This probably
// does not work on slow networks but is later updated in the downloader
if (secondaryStream.getSizeInBytes() > 0 && videoSize > 0) {
nearLength = secondaryStream.getSizeInBytes() + videoSize;
if (secondary.getSizeInBytes() > 0 && videoSize > 0) {
nearLength = secondary.getSizeInBytes() + videoSize;
}
}
break;
Expand All @@ -824,13 +828,25 @@ private void continueSelectedDownload(@NonNull StoredFileHelper storage) {
return;
}

if (secondaryStreamUrl == null) {
urls = new String[]{selectedStream.getUrl()};
if (secondaryStream == null) {
urls = new String[]{
selectedStream.getUrl()
};
recoveryInfo = new MissionRecoveryInfo[]{
new MissionRecoveryInfo(selectedStream)
};
} else {
urls = new String[]{selectedStream.getUrl(), secondaryStreamUrl};
urls = new String[]{
selectedStream.getUrl(), secondaryStream.getUrl()
};
recoveryInfo = new MissionRecoveryInfo[]{
new MissionRecoveryInfo(selectedStream), new MissionRecoveryInfo(secondaryStream)
};
}

DownloadManagerService.startMission(context, urls, storage, kind, threads, currentInfo.getUrl(), psName, psArgs, nearLength);
DownloadManagerService.startMission(
context, urls, storage, kind, threads, currentInfo.getUrl(), psName, psArgs, nearLength, recoveryInfo
);

dismiss();
}
Expand Down
13 changes: 5 additions & 8 deletions app/src/main/java/org/schabi/newpipe/streams/Mp4DashReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
public class Mp4DashReader {

// <editor-fold defaultState="collapsed" desc="Constants">
private static final int ATOM_MOOF = 0x6D6F6F66;
private static final int ATOM_MFHD = 0x6D666864;
private static final int ATOM_TRAF = 0x74726166;
Expand Down Expand Up @@ -50,7 +49,7 @@ public class Mp4DashReader {
private static final int HANDLER_VIDE = 0x76696465;
private static final int HANDLER_SOUN = 0x736F756E;
private static final int HANDLER_SUBT = 0x73756274;
// </editor-fold>


private final DataReader stream;

Expand Down Expand Up @@ -293,7 +292,8 @@ public Mp4DashChunk getNextChunk(boolean infoOnly) throws IOException {
return null;
}

// <editor-fold defaultState="collapsed" desc="Utils">


private long readUint() throws IOException {
return stream.readInt() & 0xffffffffL;
}
Expand Down Expand Up @@ -392,9 +392,7 @@ private Box untilAnyBox(Box ref) throws IOException {
return readBox();
}

// </editor-fold>

// <editor-fold defaultState="collapsed" desc="Box readers">

private Moof parse_moof(Box ref, int trackId) throws IOException {
Moof obj = new Moof();
Expand Down Expand Up @@ -795,9 +793,8 @@ private byte[] parse_stbl(Box ref) throws IOException {
return readFullBox(b);
}

// </editor-fold>

// <editor-fold defaultState="collapsed" desc="Helper classes">

class Box {

int type;
Expand Down Expand Up @@ -1013,5 +1010,5 @@ public class Mp4DashSample {
public TrunEntry info;
public byte[] data;
}
//</editor-fold>

}
Loading