kopia lustrzana https://github.com/TeamNewPipe/NewPipe
checkstyle's amend
rodzic
b2d78d380b
commit
8120b6aaaa
|
@ -43,7 +43,8 @@ public class DataReader {
|
||||||
return readBuffer[readOffset++] & 0xFF;
|
return readBuffer[readOffset++] & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long skipBytes(long amount) throws IOException {
|
public long skipBytes(final long byteAmount) throws IOException {
|
||||||
|
long amount = byteAmount;
|
||||||
if (readCount < 0) {
|
if (readCount < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (readCount == 0) {
|
} else if (readCount == 0) {
|
||||||
|
@ -90,7 +91,10 @@ public class DataReader {
|
||||||
return read(buffer, 0, buffer.length);
|
return read(buffer, 0, buffer.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int read(final byte[] buffer, int offset, int count) throws IOException {
|
public int read(final byte[] buffer, final int off, final int c) throws IOException {
|
||||||
|
int offset = off;
|
||||||
|
int count = c;
|
||||||
|
|
||||||
if (readCount < 0) {
|
if (readCount < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,16 +464,16 @@ public class Mp4FromDashWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initChunkTables(final TablesInfo tables, final int firstCount,
|
private void initChunkTables(final TablesInfo tables, final int firstCount,
|
||||||
final int succesiveCount) {
|
final int successiveCount) {
|
||||||
// tables.stsz holds amount of samples of the track (total)
|
// tables.stsz holds amount of samples of the track (total)
|
||||||
int totalSamples = (tables.stsz - firstCount);
|
int totalSamples = (tables.stsz - firstCount);
|
||||||
float chunkAmount = totalSamples / (float) succesiveCount;
|
float chunkAmount = totalSamples / (float) successiveCount;
|
||||||
int remainChunkOffset = (int) Math.ceil(chunkAmount);
|
int remainChunkOffset = (int) Math.ceil(chunkAmount);
|
||||||
boolean remain = remainChunkOffset != (int) chunkAmount;
|
boolean remain = remainChunkOffset != (int) chunkAmount;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
tables.stsc = 1;
|
tables.stsc = 1;
|
||||||
if (firstCount != succesiveCount) {
|
if (firstCount != successiveCount) {
|
||||||
tables.stsc++;
|
tables.stsc++;
|
||||||
}
|
}
|
||||||
if (remain) {
|
if (remain) {
|
||||||
|
@ -488,15 +488,15 @@ public class Mp4FromDashWriter {
|
||||||
tables.stscBEntries[index++] = firstCount;
|
tables.stscBEntries[index++] = firstCount;
|
||||||
tables.stscBEntries[index++] = 1;
|
tables.stscBEntries[index++] = 1;
|
||||||
|
|
||||||
if (firstCount != succesiveCount) {
|
if (firstCount != successiveCount) {
|
||||||
tables.stscBEntries[index++] = 2;
|
tables.stscBEntries[index++] = 2;
|
||||||
tables.stscBEntries[index++] = succesiveCount;
|
tables.stscBEntries[index++] = successiveCount;
|
||||||
tables.stscBEntries[index++] = 1;
|
tables.stscBEntries[index++] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remain) {
|
if (remain) {
|
||||||
tables.stscBEntries[index++] = remainChunkOffset + 1;
|
tables.stscBEntries[index++] = remainChunkOffset + 1;
|
||||||
tables.stscBEntries[index++] = totalSamples % succesiveCount;
|
tables.stscBEntries[index++] = totalSamples % successiveCount;
|
||||||
tables.stscBEntries[index] = 1;
|
tables.stscBEntries[index] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -640,19 +640,20 @@ public class Mp4FromDashWriter {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] makeMdat(long refSize, final boolean is64) {
|
private byte[] makeMdat(final long refSize, final boolean is64) {
|
||||||
|
long size = refSize;
|
||||||
if (is64) {
|
if (is64) {
|
||||||
refSize += 16;
|
size += 16;
|
||||||
} else {
|
} else {
|
||||||
refSize += 8;
|
size += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(is64 ? 16 : 8)
|
ByteBuffer buffer = ByteBuffer.allocate(is64 ? 16 : 8)
|
||||||
.putInt(is64 ? 0x01 : (int) refSize)
|
.putInt(is64 ? 0x01 : (int) size)
|
||||||
.putInt(0x6D646174); // mdat
|
.putInt(0x6D646174); // mdat
|
||||||
|
|
||||||
if (is64) {
|
if (is64) {
|
||||||
buffer.putLong(refSize);
|
buffer.putLong(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer.array();
|
return buffer.array();
|
||||||
|
|
|
@ -282,7 +282,7 @@ public class OggFromWebMWriter implements Closeable {
|
||||||
0x03, // ¿¿¿???
|
0x03, // ¿¿¿???
|
||||||
0x76, 0x6f, 0x72, 0x62, 0x69, 0x73, // "vorbis" binary string
|
0x76, 0x6f, 0x72, 0x62, 0x69, 0x73, // "vorbis" binary string
|
||||||
0x00, 0x00, 0x00, 0x00, // writing application string size (not present)
|
0x00, 0x00, 0x00, 0x00, // writing application string size (not present)
|
||||||
0x00, 0x00, 0x00, 0x00, // additional tags count (zero means no tags)
|
0x00, 0x00, 0x00, 0x00 // additional tags count (zero means no tags)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,21 +148,25 @@ public class WebMWriter implements Closeable {
|
||||||
0x11, 0x4d, (byte) 0x9b, 0x74, (byte) 0xbe,
|
0x11, 0x4d, (byte) 0x9b, 0x74, (byte) 0xbe,
|
||||||
0x4d, (byte) 0xbb, (byte) 0x8b,
|
0x4d, (byte) 0xbb, (byte) 0x8b,
|
||||||
0x53, (byte) 0xab, (byte) 0x84, 0x15, 0x49, (byte) 0xa9, 0x66, 0x53,
|
0x53, (byte) 0xab, (byte) 0x84, 0x15, 0x49, (byte) 0xa9, 0x66, 0x53,
|
||||||
(byte) 0xac, (byte) 0x81, /*info offset*/ 0x43,
|
(byte) 0xac, (byte) 0x81,
|
||||||
|
/*info offset*/ 0x43,
|
||||||
0x4d, (byte) 0xbb, (byte) 0x8b, 0x53, (byte) 0xab,
|
0x4d, (byte) 0xbb, (byte) 0x8b, 0x53, (byte) 0xab,
|
||||||
(byte) 0x84, 0x16, 0x54, (byte) 0xae, 0x6b, 0x53, (byte) 0xac, (byte) 0x81,
|
(byte) 0x84, 0x16, 0x54, (byte) 0xae, 0x6b, 0x53, (byte) 0xac, (byte) 0x81,
|
||||||
/*tracks offset*/ 0x56,
|
/*tracks offset*/ 0x56,
|
||||||
0x4d, (byte) 0xbb, (byte) 0x8e, 0x53, (byte) 0xab, (byte) 0x84, 0x1f,
|
0x4d, (byte) 0xbb, (byte) 0x8e, 0x53, (byte) 0xab, (byte) 0x84, 0x1f,
|
||||||
0x43, (byte) 0xb6, 0x75, 0x53, (byte) 0xac, (byte) 0x84, /*cluster offset [2]*/ 0x00, 0x00, 0x00, 0x00,
|
0x43, (byte) 0xb6, 0x75, 0x53, (byte) 0xac, (byte) 0x84,
|
||||||
|
/*cluster offset [2]*/ 0x00, 0x00, 0x00, 0x00,
|
||||||
0x4d, (byte) 0xbb, (byte) 0x8e, 0x53, (byte) 0xab, (byte) 0x84, 0x1c, 0x53,
|
0x4d, (byte) 0xbb, (byte) 0x8e, 0x53, (byte) 0xab, (byte) 0x84, 0x1c, 0x53,
|
||||||
(byte) 0xbb, 0x6b, 0x53, (byte) 0xac, (byte) 0x84, /*cues offset [7]*/ 0x00, 0x00, 0x00, 0x00
|
(byte) 0xbb, 0x6b, 0x53, (byte) 0xac, (byte) 0x84,
|
||||||
|
/*cues offset [7]*/ 0x00, 0x00, 0x00, 0x00
|
||||||
});
|
});
|
||||||
|
|
||||||
/* info */
|
/* info */
|
||||||
listBuffer.add(new byte[]{
|
listBuffer.add(new byte[]{
|
||||||
0x15, 0x49, (byte) 0xa9, 0x66, (byte) 0x8e, 0x2a, (byte) 0xd7, (byte) 0xb1
|
0x15, 0x49, (byte) 0xa9, 0x66, (byte) 0x8e, 0x2a, (byte) 0xd7, (byte) 0xb1
|
||||||
});
|
});
|
||||||
listBuffer.add(encode(DEFAULT_TIMECODE_SCALE, true)); // this value MUST NOT exceed 4 bytes
|
// the segment duration MUST NOT exceed 4 bytes
|
||||||
|
listBuffer.add(encode(DEFAULT_TIMECODE_SCALE, true));
|
||||||
listBuffer.add(new byte[]{0x44, (byte) 0x89, (byte) 0x84,
|
listBuffer.add(new byte[]{0x44, (byte) 0x89, (byte) 0x84,
|
||||||
0x00, 0x00, 0x00, 0x00, // info.duration
|
0x00, 0x00, 0x00, 0x00, // info.duration
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,21 +16,6 @@
|
||||||
lines="278,310"/>
|
lines="278,310"/>
|
||||||
|
|
||||||
<!-- org.schabi.newpipe.streams -->
|
<!-- org.schabi.newpipe.streams -->
|
||||||
<suppress checks="FinalParameters"
|
|
||||||
files="DataReader.java"
|
|
||||||
lines="46,93"/>
|
|
||||||
|
|
||||||
<suppress checks="FinalParameters"
|
|
||||||
files="Mp4FromDashWriter.java"
|
|
||||||
lines="643"/>
|
|
||||||
|
|
||||||
<suppress checks="FinalParameters"
|
|
||||||
files="OggFromWebMWriter.java"
|
|
||||||
lines="380,422"/>
|
|
||||||
|
|
||||||
<suppress checks="FinalParameters"
|
|
||||||
files="WebMWriter.java"
|
|
||||||
lines="419,591"/>
|
|
||||||
<suppress checks="LineLength"
|
<suppress checks="LineLength"
|
||||||
files="WebMWriter.java"
|
files="WebMWriter.java"
|
||||||
lines="156,158"/>
|
lines="156,158"/>
|
||||||
|
|
Ładowanie…
Reference in New Issue