LOG.logError(this.getType() + ": remaining differs " + content.remaining() + " vs. " + bb.remaining()); return false; byte v2 = bb.get(j); if (v1 != v2) { LOG.logError(String.format("%s: buffers differ at %d: %2X/%2X", this.getType(), i, v1, v2)); byte[] b1 = new byte[content.remaining()]; byte[] b2 = new byte[bb.remaining()];
private SampleDescriptionBox mergeStsds(SampleDescriptionBox stsd1, SampleDescriptionBox stsd2) throws IOException { ByteArrayOutputStream curBaos = new ByteArrayOutputStream(); ByteArrayOutputStream refBaos = new ByteArrayOutputStream(); try { stsd1.getBox(Channels.newChannel(curBaos)); stsd2.getBox(Channels.newChannel(refBaos)); } catch (IOException e) { LOG.logError(e.getMessage()); return null; } byte[] cur = curBaos.toByteArray(); byte[] ref = refBaos.toByteArray(); if (!Arrays.equals(ref, cur)) { SampleEntry se = mergeSampleEntry(stsd1.getBoxes(SampleEntry.class).get(0), stsd2.getBoxes(SampleEntry.class).get(0)); if (se != null) { stsd1.setBoxes(Collections.<Box>singletonList(se)); } else { throw new IOException("Cannot merge " + stsd1.getBoxes(SampleEntry.class).get(0) + " and " + stsd2.getBoxes(SampleEntry.class).get(0)); } } return stsd1; }
public synchronized ByteBuffer asByteBuffer() { ByteBuffer b; final int chunkNumber = getChunkForSample(index); SoftReference<ByteBuffer> chunkBufferSr = cache[chunkNumber]; final int chunkStartSample = chunkNumsStartSampleNum[chunkNumber] - 1; int sampleInChunk = index - chunkStartSample; long[] sampleOffsetsWithinChunk = sampleOffsetsWithinChunks[l2i(chunkNumber)]; long offsetWithInChunk = sampleOffsetsWithinChunk[sampleInChunk]; ByteBuffer chunkBuffer; if (chunkBufferSr == null || (chunkBuffer = chunkBufferSr.get()) == null) { try { chunkBuffer = topLevel.getByteBuffer( chunkOffsets[l2i(chunkNumber)], sampleOffsetsWithinChunk[sampleOffsetsWithinChunk.length - 1] + ssb.getSampleSizeAtIndex(chunkStartSample + sampleOffsetsWithinChunk.length - 1) ); cache[chunkNumber] = new SoftReference<ByteBuffer>(chunkBuffer); } catch (IOException e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); LOG.logError(sw.toString()); throw new IndexOutOfBoundsException(e.getMessage()); } } b = (ByteBuffer) ((ByteBuffer) chunkBuffer.duplicate().position(l2i(offsetWithInChunk))).slice().limit(l2i(ssb.getSampleSizeAtIndex(index))); return b; }
vse.setHorizresolution(vse1.getHorizresolution()); } else { LOG.logError("Horizontal Resolution differs"); return null; vse.setDepth(vse1.getDepth()); } else { LOG.logError("Depth differs"); return null; vse.setFrameCount(vse1.getFrameCount()); } else { LOG.logError("frame count differs"); return null; vse.setHeight(vse1.getHeight()); } else { LOG.logError("height differs"); return null; vse.setWidth(vse1.getWidth()); } else { LOG.logError("width differs"); return null; vse.setVertresolution(vse1.getVertresolution()); } else { LOG.logError("vert resolution differs"); return null;
ase.setBytesPerFrame(ase1.getBytesPerFrame()); } else { LOG.logError("BytesPerFrame differ"); return null; ase.setBytesPerSample(ase1.getBytesPerSample()); } else { LOG.logError("BytesPerSample differ"); return null; ase.setPacketSize(ase1.getPacketSize()); } else { LOG.logError("ChannelCount differ"); return null;
LOG.logError("I can only merge ESDescriptors"); return null;