public void write(SeekableByteChannel output) throws IOException { ByteBuffer bb = ByteBuffer.allocate(16); write(bb); bb.flip(); output.write(bb); }
private void writeHeader(Header header, SeekableByteChannel out) throws IOException { ByteBuffer bb = ByteBuffer.allocate(16); header.write(bb); bb.flip(); out.write(bb); }
public void write(SeekableByteChannel output) throws IOException { ByteBuffer bb = ByteBuffer.allocate(16); write(bb); bb.flip(); output.write(bb); }
public void writeChannel(SeekableByteChannel output) throws IOException { ByteBuffer bb = ByteBuffer.allocate(16); write(bb); bb.flip(); output.write(bb); }
public MP4Muxer(SeekableByteChannel output, FileTypeBox ftyp) throws IOException { this.out = output; ByteBuffer buf = ByteBuffer.allocate(1024); ftyp.write(buf); new Header("wide", 8).write(buf); new Header("mdat", 1).write(buf); mdatOffset = buf.position(); buf.putLong(0); buf.flip(); output.write(buf); }
public MP4Muxer(SeekableByteChannel output, FileTypeBox ftyp) throws IOException { this.tracks = new ArrayList<AbstractMP4MuxerTrack>(); this.out = output; ByteBuffer buf = ByteBuffer.allocate(1024); ftyp.write(buf); Header.createHeader("wide", 8).write(buf); Header.createHeader("mdat", 1).write(buf); mdatOffset = buf.position(); buf.putLong(0); buf.flip(); output.write(buf); }
public MP4Muxer(SeekableByteChannel output, FileTypeBox ftyp) throws IOException { this.out = output; ByteBuffer buf = ByteBuffer.allocate(1024); ftyp.write(buf); new Header("wide", 8).write(buf); new Header("mdat", 1).write(buf); mdatOffset = buf.position(); buf.putLong(0); buf.flip(); output.write(buf); }
public void write(ByteBuffer buf) { ByteBuffer dup = buf.duplicate(); NIOUtils.skip(buf, 8); doWrite(buf); header.setBodySize(buf.position() - dup.position() - 8); Assert.assertEquals(header.headerSize(), 8); header.write(dup); }
public void write(ByteBuffer buf) { ByteBuffer dup = buf.duplicate(); NIOUtils.skip(buf, 8); doWrite(buf); header.setBodySize(buf.position() - dup.position() - 8); Assert.assertEquals(header.headerSize(), 8); header.write(dup); }
public void write(ByteBuffer buf) { ByteBuffer dup = buf.duplicate(); NIOUtils.skip(buf, 8); doWrite(buf); header.setBodySize(buf.position() - dup.position() - 8); Assert.assertEquals(header.headerSize(), 8); header.write(dup); }
public WebOptimizedMP4Muxer(SeekableByteChannel output, Brand brand, int headerSize) throws IOException { super(output, brand); headerPos = output.position() - 24; output.position(headerPos); header = ByteBuffer.allocate(headerSize); output.write(header); header.clear(); new Header("wide", 8).write(output); new Header("mdat", 1).write(output); mdatOffset = output.position(); NIOUtils.writeLong(output, 0); }
public WebOptimizedMP4Muxer(SeekableByteChannel output, Brand brand, int headerSize) throws IOException { super(output, brand); headerPos = output.position() - 24; output.position(headerPos); header = ByteBuffer.allocate(headerSize); output.write(header); header.clear(); new Header("wide", 8).write(output); new Header("mdat", 1).write(output); mdatOffset = output.position(); NIOUtils.writeLong(output, 0); }
@Override public void storeHeader(MovieBox movie) throws IOException { long mdatEnd = out.position(); long mdatSize = mdatEnd - mdatOffset + 8; out.position(mdatOffset); NIOUtils.writeLong(out, mdatSize); out.position(headerPos); try { movie.write(header); header.flip(); int rem = header.capacity() - header.limit(); if (rem < 8) { header.duplicate().putInt(header.capacity()); } out.write(header); if (rem >= 8) new Header("free", rem).write(out); } catch (ArrayIndexOutOfBoundsException e) { Logger.warn("Could not web-optimize, header is bigger then allocated space."); new Header("free", header.remaining()).write(out); out.position(mdatEnd); MP4Util.writeMovie(out, movie); } } }
@Override public void storeHeader(MovieBox movie) throws IOException { long mdatEnd = out.position(); long mdatSize = mdatEnd - mdatOffset + 8; out.position(mdatOffset); NIOUtils.writeLong(out, mdatSize); out.position(headerPos); try { movie.write(header); header.flip(); int rem = header.capacity() - header.limit(); if (rem < 8) { header.duplicate().putInt(header.capacity()); } out.write(header); if (rem >= 8) new Header("free", rem).write(out); } catch (ArrayIndexOutOfBoundsException e) { Logger.warn("Could not web-optimize, header is bigger then allocated space."); new Header("free", header.remaining()).write(out); out.position(mdatEnd); MP4Util.writeMovie(out, movie); } } }