private void blowup() { LOG.logDebug("blowup running"); while (elementSource.hasNext()) { underlying.add(elementSource.next()); } }
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()];
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;
LOG.logWarn("mvhd duration is not in expected range");
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; cur2.getBox(Channels.newChannel(baos2)); } catch (IOException e) { LOG.logWarn(e.getMessage()); return null;
@Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); if (getVersion() == 1) { creationTime = DateHelper.convert(IsoTypeReader.readUInt64(content)); modificationTime = DateHelper.convert(IsoTypeReader.readUInt64(content)); timescale = IsoTypeReader.readUInt32(content); duration = content.getLong(); } else { creationTime = DateHelper.convert(IsoTypeReader.readUInt32(content)); modificationTime = DateHelper.convert(IsoTypeReader.readUInt32(content)); timescale = IsoTypeReader.readUInt32(content); duration = IsoTypeReader.readUInt32(content); } if (duration < -1) { LOG.logWarn("mdhd duration is not in expected range"); } language = IsoTypeReader.readIso639(content); IsoTypeReader.readUInt16(content); }
@Override public int size() { LOG.logDebug("potentially expensive size() call"); blowup(); return underlying.size(); } }
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; }
@Override public void _parseDetails(ByteBuffer content) { parseVersionAndFlags(content); if (getVersion() == 1) { creationTime = DateHelper.convert(IsoTypeReader.readUInt64(content)); modificationTime = DateHelper.convert(IsoTypeReader.readUInt64(content)); trackId = IsoTypeReader.readUInt32(content); IsoTypeReader.readUInt32(content); duration = content.getLong(); } else { creationTime = DateHelper.convert(IsoTypeReader.readUInt32(content)); modificationTime = DateHelper.convert(IsoTypeReader.readUInt32(content)); trackId = IsoTypeReader.readUInt32(content); IsoTypeReader.readUInt32(content); duration = content.getInt(); } // 196 if (duration < -1) { LOG.logWarn("tkhd duration is not in expected range"); } IsoTypeReader.readUInt32(content); IsoTypeReader.readUInt32(content); layer = IsoTypeReader.readUInt16(content); // 204 alternateGroup = IsoTypeReader.readUInt16(content); volume = IsoTypeReader.readFixedPoint88(content); IsoTypeReader.readUInt16(content); // 212 matrix = Matrix.fromByteBuffer(content); width = IsoTypeReader.readFixedPoint1616(content); // 248 height = IsoTypeReader.readFixedPoint1616(content); }
/** * Parses the raw content of the box. It surrounds the actual parsing * which is done */ public synchronized final void parseDetails() { LOG.logDebug("parsing details of " + this.getType()); if (content != null) { ByteBuffer content = this.content; isParsed = true; content.rewind(); _parseDetails(content); if (content.remaining() > 0) { deadBytes = content.slice(); } this.content = null; assert verify(content); } }
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; }
LOG.logDebug("Calculating chunk offsets for track_" + targetTrack.getTrackMetaData().getTrackId());
LOG.logError("I can only merge ESDescriptors"); return null;
LOG.logDebug("done with stbl for track_" + track.getTrackMetaData().getTrackId()); return stbl;
minf.addBox(stbl); mdia.addBox(minf); LOG.logDebug("done with trak for track_" + track.getTrackMetaData().getTrackId()); return trackBox;