public static int[] addAll(int[] array1, int[] array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } int[] joinedArray = new int[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; }
public static <T> void shiftLeft(T[] array, int from) { shiftLeft(array, from, array.length); }
public static <T> void shiftRight(T[] array, int to) { shiftRight(array, 0, to); }
private static void appendTimeToSamples(TrakBox trakBox1, TrakBox trakBox2) { TimeToSampleBox stts1 = trakBox1.getStts(); TimeToSampleBox stts2 = trakBox2.getStts(); TimeToSampleBox sttsNew = TimeToSampleBox.createTimeToSampleBox((TimeToSampleEntry[]) addAllObj(stts1.getEntries(), stts2.getEntries())); NodeBox.findFirstPath(trakBox1, NodeBox.class, Box.path("mdia.minf.stbl")).replace("stts", sttsNew); }
protected byte[][] getSameSizeBuffer(int[][] buffer) { if (byteBuffer == null || byteBuffer.length != buffer.length || byteBuffer[0].length != buffer[0].length) byteBuffer = ArrayUtil.create2D(buffer[0].length, buffer.length); return byteBuffer; }
public static long[] addAllLong(long[] array1, long[] array2) { if (array1 == null) { return cloneLong(array2); } else if (array2 == null) { return cloneLong(array1); } long[] joinedArray = new long[array1.length + array2.length]; arraycopy(array1, 0, joinedArray, 0, array1.length); arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; }
public static int[] addAllInt(int[] array1, int[] array2) { if (array1 == null) { return cloneInt(array2); } else if (array2 == null) { return cloneInt(array1); } int[] joinedArray = new int[array1.length + array2.length]; arraycopy(array1, 0, joinedArray, 0, array1.length); arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; }
public static Object[] addAllObj(Object[] array1, Object[] array2) { if (array1 == null) { return cloneObj(array2); } else if (array2 == null) { return cloneObj(array1); } Object[] joinedArray = (Object[]) Array.newInstance(array1.getClass().getComponentType(), array1.length + array2.length); arraycopy(array1, 0, joinedArray, 0, array1.length); arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; }
private static void appendChunkOffsets(TrakBox trakBox1, TrakBox trakBox2) { ChunkOffsetsBox stco1 = trakBox1.getStco(); ChunkOffsets64Box co641 = trakBox1.getCo64(); ChunkOffsetsBox stco2 = trakBox2.getStco(); ChunkOffsets64Box co642 = trakBox2.getCo64(); long[] off1 = stco1 == null ? co641.getChunkOffsets() : stco1.getChunkOffsets(); long[] off2 = stco2 == null ? co642.getChunkOffsets() : stco2.getChunkOffsets(); NodeBox stbl1 = NodeBox.findFirstPath(trakBox1, NodeBox.class, Box.path("mdia.minf.stbl")); stbl1.removeChildren("stco", "co64"); stbl1.add(co641 == null && co642 == null ? ChunkOffsetsBox.createChunkOffsetsBox(ArrayUtil.addAllLong(off1, off2)) : ChunkOffsets64Box.createChunkOffsets64Box(ArrayUtil.addAllLong(off1, off2))); }
private static void appendSampleSizes(TrakBox trakBox1, TrakBox trakBox2) { SampleSizesBox stsz1 = trakBox1.getStsz(); SampleSizesBox stsz2 = trakBox2.getStsz(); if (stsz1.getDefaultSize() != stsz2.getDefaultSize()) throw new IllegalArgumentException("Can't append to track that has different default sample size"); SampleSizesBox stszr; if (stsz1.getDefaultSize() > 0) { stszr = SampleSizesBox.createSampleSizesBox(stsz1.getDefaultSize(), stsz1.getCount() + stsz2.getCount()); } else { stszr = SampleSizesBox.createSampleSizesBox2(addAllInt(stsz1.getSizes(), stsz2.getSizes())); } NodeBox.findFirstPath(trakBox1, NodeBox.class, Box.path("mdia.minf.stbl")).replace("stsz", stszr); }
private static void appendSampleToChunk(TrakBox trakBox1, TrakBox trakBox2, int off) { SampleToChunkBox stsc1 = trakBox1.getStsc(); SampleToChunkBox stsc2 = trakBox2.getStsc(); SampleToChunkEntry[] orig = stsc2.getSampleToChunk(); SampleToChunkEntry[] shifted = new SampleToChunkEntry[orig.length]; for (int i = 0; i < orig.length; i++) { shifted[i] = new SampleToChunkEntry(orig[i].getFirst() + stsc1.getSampleToChunk().length, orig[i].getCount(), orig[i].getEntry() + off); } NodeBox.findFirstPath(trakBox1, NodeBox.class, Box.path("mdia.minf.stbl")).replace("stsc", SampleToChunkBox.createSampleToChunkBox((SampleToChunkEntry[]) ArrayUtil.addAllObj(stsc1.getSampleToChunk(), shifted))); }
public static long[] addAll(long[] array1, long[] array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } long[] joinedArray = new long[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; }
public static <T> void shiftLeft(T[] array, int from) { shiftLeft(array, from, array.length); }
public static <T> void shiftRight(T[] array, int to) { shiftRight(array, 0, to); }
public static int[] addAll(int[] array1, int[] array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } int[] joinedArray = new int[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; }
public static long[] addAll(long[] array1, long[] array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } long[] joinedArray = new long[array1.length + array2.length]; System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; }
public static Object[] addAll(Object[] array1, Object[] array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } Object[] joinedArray = (Object[]) Array.newInstance(array1.getClass().getComponentType(), array1.length + array2.length); System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; }
public static Object[] addAll(Object[] array1, Object[] array2) { if (array1 == null) { return clone(array2); } else if (array2 == null) { return clone(array1); } Object[] joinedArray = (Object[]) Array.newInstance(array1.getClass().getComponentType(), array1.length + array2.length); System.arraycopy(array1, 0, joinedArray, 0, array1.length); System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); return joinedArray; }