update WebMWriter.java

This commit is contained in:
kapodamy 2020-07-03 20:51:45 -03:00
parent 452977abdf
commit b2d78d380b
1 changed files with 6 additions and 3 deletions

View File

@ -408,9 +408,10 @@ public class WebMWriter implements Closeable {
} }
} }
private long makeCluster(final SharpStream stream, final long timecode, final long offset, private long makeCluster(final SharpStream stream, final long timecode, final long offsetStart,
final boolean create) throws IOException { final boolean create) throws IOException {
ClusterInfo cluster; ClusterInfo cluster;
long offset = offsetStart;
if (offset > 0) { if (offset > 0) {
// save the size of the previous cluster (maximum 256 MiB) // save the size of the previous cluster (maximum 256 MiB)
@ -418,6 +419,8 @@ public class WebMWriter implements Closeable {
cluster.size = (int) (written - offset - CLUSTER_HEADER_SIZE); cluster.size = (int) (written - offset - CLUSTER_HEADER_SIZE);
} }
offset = written;
if (create) { if (create) {
/* cluster */ /* cluster */
dump(new byte[]{0x1f, 0x43, (byte) 0xb6, 0x75}, stream); dump(new byte[]{0x1f, 0x43, (byte) 0xb6, 0x75}, stream);
@ -435,11 +438,11 @@ public class WebMWriter implements Closeable {
dump(encode(timecode, true), stream); dump(encode(timecode, true), stream);
} }
return written; return offset;
} }
private void makeEBML(final SharpStream stream) throws IOException { private void makeEBML(final SharpStream stream) throws IOException {
// deafult values // default values
dump(new byte[]{ dump(new byte[]{
0x1A, 0x45, (byte) 0xDF, (byte) 0xA3, 0x01, 0x00, 0x00, 0x00, 0x1A, 0x45, (byte) 0xDF, (byte) 0xA3, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1F, 0x42, (byte) 0x86, (byte) 0x81, 0x01, 0x00, 0x00, 0x00, 0x1F, 0x42, (byte) 0x86, (byte) 0x81, 0x01,