Space reserving tweaks for huge video resolutions
* improve space reserving, allows write better 4K/8K video data * do not use cache dirs in the muxers, Android can force close NewPipe if the device is running out of storage. Is a aggressive cache cleaning >:/ * (for devs) webm & mkv are the same thing * calculate the final file size inside of the mission, instead getting from the UI * simplify ps algorithms constructors * [missing old commit message] simplify the loading of pending downloads
This commit is contained in:
parent
34b2b96158
commit
7b948f83c3
11 changed files with 608 additions and 550 deletions
|
|
@ -1,44 +1,44 @@
|
|||
package us.shandian.giga.postprocessing;
|
||||
|
||||
import org.schabi.newpipe.streams.WebMReader.TrackKind;
|
||||
import org.schabi.newpipe.streams.WebMReader.WebMTrack;
|
||||
import org.schabi.newpipe.streams.WebMWriter;
|
||||
import org.schabi.newpipe.streams.io.SharpStream;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author kapodamy
|
||||
*/
|
||||
class WebMMuxer extends Postprocessing {
|
||||
|
||||
WebMMuxer() {
|
||||
super(5 * 1024 * 1024/* 5 MiB */, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
int process(SharpStream out, SharpStream... sources) throws IOException {
|
||||
WebMWriter muxer = new WebMWriter(sources);
|
||||
muxer.parseSources();
|
||||
|
||||
// youtube uses a webm with a fake video track that acts as a "cover image"
|
||||
int[] indexes = new int[sources.length];
|
||||
|
||||
for (int i = 0; i < sources.length; i++) {
|
||||
WebMTrack[] tracks = muxer.getTracksFromSource(i);
|
||||
for (int j = 0; j < tracks.length; j++) {
|
||||
if (tracks[j].kind == TrackKind.Audio) {
|
||||
indexes[i] = j;
|
||||
i = sources.length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
muxer.selectTracks(indexes);
|
||||
muxer.build(out);
|
||||
|
||||
return OK_RESULT;
|
||||
}
|
||||
|
||||
}
|
||||
package us.shandian.giga.postprocessing;
|
||||
|
||||
import org.schabi.newpipe.streams.WebMReader.TrackKind;
|
||||
import org.schabi.newpipe.streams.WebMReader.WebMTrack;
|
||||
import org.schabi.newpipe.streams.WebMWriter;
|
||||
import org.schabi.newpipe.streams.io.SharpStream;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author kapodamy
|
||||
*/
|
||||
class WebMMuxer extends Postprocessing {
|
||||
|
||||
WebMMuxer() {
|
||||
super(true, true, ALGORITHM_WEBM_MUXER);
|
||||
}
|
||||
|
||||
@Override
|
||||
int process(SharpStream out, SharpStream... sources) throws IOException {
|
||||
WebMWriter muxer = new WebMWriter(sources);
|
||||
muxer.parseSources();
|
||||
|
||||
// youtube uses a webm with a fake video track that acts as a "cover image"
|
||||
int[] indexes = new int[sources.length];
|
||||
|
||||
for (int i = 0; i < sources.length; i++) {
|
||||
WebMTrack[] tracks = muxer.getTracksFromSource(i);
|
||||
for (int j = 0; j < tracks.length; j++) {
|
||||
if (tracks[j].kind == TrackKind.Audio) {
|
||||
indexes[i] = j;
|
||||
i = sources.length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
muxer.selectTracks(indexes);
|
||||
muxer.build(out);
|
||||
|
||||
return OK_RESULT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue