public static void main(String[] args) throws IOException { Movie movie = MovieCreator.build(DumpAmf0TrackToPropertyFile.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/example.f4v"); for (Track track : movie.getTracks()) { if (track.getHandler().equals("data") ) { long time = 0; Iterator<Sample> samples = track.getSamples().iterator(); Properties properties = new Properties(); File f = File.createTempFile(DumpAmf0TrackToPropertyFile.class.getSimpleName(), "" + track.getTrackMetaData().getTrackId()); for (long decodingTime : track.getSampleDurations()) { ByteBuffer sample = samples.next().asByteBuffer(); byte[] sampleBytes = new byte[sample.limit()]; sample.reset(); sample.get(sampleBytes); properties.put("" + time, new String(Base64.encodeBase64(sampleBytes, false, false))); time += decodingTime; } FileOutputStream fos = new FileOutputStream(f); System.err.println(properties); properties.store(fos, ""); } } }
ByteBuffer bb = sample.asByteBuffer(); while (bb.remaining() > 0) { int length = (int) IsoTypeReaderVariable.read(bb, hevc.getLengthSizeMinusOne() + 1);
public ByteBuffer asByteBuffer() { ByteBuffer sample = (ByteBuffer) clearSample.asByteBuffer().rewind(); ByteBuffer encSample = ByteBuffer.allocate(sample.limit());
public void writeTo(WritableByteChannel channel) throws IOException { ByteBuffer sample = (ByteBuffer) clearSample.asByteBuffer().rewind(); SampleEntry se = sampleEntries.get(index); KeyIdKeyPair keyIdKeyPair = keys.get(index);
ByteBuffer bb = sample.asByteBuffer(); while (bb.remaining() > 0) { int length = (int) IsoTypeReaderVariable.read(bb, lengthSize);
if (keys.get(index) != null) { Sample encSample = parent.get(index); final ByteBuffer encSampleBuffer = encSample.asByteBuffer(); encSampleBuffer.rewind(); final ByteBuffer decSampleBuffer = ByteBuffer.allocate(encSampleBuffer.limit());
public ByteBuffer asByteBuffer() { int spsPpsSize = 0; for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { spsPpsSize += len + bytes.limit(); } ByteBuffer data = ByteBuffer.allocate(l2i(orignalSample.getSize()) + spsPpsSize); for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } data.put(orignalSample.asByteBuffer()); return (ByteBuffer) data.rewind(); } };
if (subsampleIter.hasNext()) { SubSampleInformationBox.SubSampleEntry.SubsampleEntry xmlSubSampleEntry = subsampleIter.next(); ByteBuffer sample = track.getSamples().get(i).asByteBuffer(); xmlSamplePart = (ByteBuffer) sample.slice().limit(l2i(xmlSubSampleEntry.getSubsampleSize())); raf.getChannel().write(xmlSamplePart); xmlSamplePart = track.getSamples().get(i).asByteBuffer(); raf.getChannel().write(xmlSamplePart);
ByteBuffer sample = (ByteBuffer) origSample.asByteBuffer().rewind();
Sample s = createSampleObject(esdsStuff); byte[] data = new byte[l2i(s.getSize())]; s.asByteBuffer().get(data); decoderSpecificInfo.setData(data); decoderConfigDescriptor.setDecoderSpecificInfo(decoderSpecificInfo);
private AudioSampleEntry createAudioSampleEntry() throws IOException { ByteBuffer bb = samples.get(0).asByteBuffer(); BitReaderBuffer brb = new BitReaderBuffer(bb); int syncword = brb.readBits(16);
public void writeTo(WritableByteChannel channel) throws IOException { ByteBuffer sample = (ByteBuffer) clearSample.asByteBuffer().rewind(); SampleEntry se = sampleEntries.get(index); KeyIdKeyPair keyIdKeyPair = keys.get(index);
public ByteBuffer asByteBuffer() { ByteBuffer sample = (ByteBuffer) clearSample.asByteBuffer().rewind(); ByteBuffer encSample = ByteBuffer.allocate(sample.limit());
if (keys.get(index) != null) { Sample encSample = parent.get(index); final ByteBuffer encSampleBuffer = encSample.asByteBuffer(); encSampleBuffer.rewind(); final ByteBuffer decSampleBuffer = ByteBuffer.allocate(encSampleBuffer.limit());
public ByteBuffer asByteBuffer() { int spsPpsSize = 0; for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { spsPpsSize += len + bytes.limit(); } ByteBuffer data = ByteBuffer.allocate(l2i(orignalSample.getSize()) + spsPpsSize); for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } data.put(orignalSample.asByteBuffer()); return (ByteBuffer) data.rewind(); } };
ByteBuffer sample = (ByteBuffer) origSample.asByteBuffer().rewind();
Sample s = createSampleObject(esdsStuff); byte[] data = new byte[l2i(s.getSize())]; s.asByteBuffer().get(data); decoderSpecificInfo.setData(data); decoderConfigDescriptor.setDecoderSpecificInfo(decoderSpecificInfo);
private AudioSampleEntry createAudioSampleEntry() throws IOException { ByteBuffer bb = samples.get(0).asByteBuffer(); BitReaderBuffer brb = new BitReaderBuffer(bb); int syncword = brb.readBits(16);