From 9b71828b97a46227f214b76cf99e53bb1884a7ee Mon Sep 17 00:00:00 2001 From: kapodamy Date: Tue, 14 Jan 2020 01:08:46 -0300 Subject: [PATCH] implement sgpd and sbgp boxes in audio tracks --- .../org/schabi/newpipe/streams/Mp4FromDashWriter.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java b/app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java index f94ebefb0..963d84b40 100644 --- a/app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java +++ b/app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java @@ -774,12 +774,12 @@ public class Mp4FromDashWriter { .array() ); - make_mdia(tracks[index].trak.mdia, tables, is64); + make_mdia(tracks[index].trak.mdia, tables, is64, tracks[index].kind == TrackKind.Audio); lengthFor(start); } - private void make_mdia(Mdia mdia, TablesInfo tablesInfo, boolean is64) throws IOException { + private void make_mdia(Mdia mdia, TablesInfo tablesInfo, boolean is64, boolean isAudio) throws IOException { int start_mdia = auxOffset(); auxWrite(new byte[]{0x00, 0x00, 0x00, 0x00, 0x6D, 0x64, 0x69, 0x61});// mdia auxWrite(mdia.mdhd); @@ -822,8 +822,10 @@ public class Mp4FromDashWriter { tablesInfo.stco = make(is64 ? 0x636F3634 : 0x7374636F, -1, is64 ? 2 : 1, tablesInfo.stco); } - auxWrite(make_sgpd()); - tablesInfo.sbgp = make_sbgp();// during simulation the returned offset is ignored + if (isAudio) { + auxWrite(make_sgpd()); + tablesInfo.sbgp = make_sbgp();// during simulation the returned offset is ignored + } lengthFor(start_stbl); lengthFor(start_minf);