@Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException { ByteBuffer content = ByteBuffer.allocate(38); dataSource.read(content); content.position(6); dataReferenceIndex = IsoTypeReader.readUInt16(content); displayFlags = IsoTypeReader.readUInt32(content); horizontalJustification = IsoTypeReader.readUInt8(content); verticalJustification = IsoTypeReader.readUInt8(content); backgroundColorRgba = new int[4]; backgroundColorRgba[0] = IsoTypeReader.readUInt8(content); backgroundColorRgba[1] = IsoTypeReader.readUInt8(content); backgroundColorRgba[2] = IsoTypeReader.readUInt8(content); backgroundColorRgba[3] = IsoTypeReader.readUInt8(content); boxRecord = new BoxRecord(); boxRecord.parse(content); styleRecord = new StyleRecord(); styleRecord.parse(content); initContainer(dataSource, contentSize - 38, boxParser); }
@Override public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer byteBuffer = ByteBuffer.allocate(38); byteBuffer.position(6); IsoTypeWriter.writeUInt16(byteBuffer, dataReferenceIndex); IsoTypeWriter.writeUInt32(byteBuffer, displayFlags); IsoTypeWriter.writeUInt8(byteBuffer, horizontalJustification); IsoTypeWriter.writeUInt8(byteBuffer, verticalJustification); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[0]); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[1]); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[2]); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[3]); boxRecord.getContent(byteBuffer); styleRecord.getContent(byteBuffer); writableByteChannel.write((ByteBuffer) byteBuffer.rewind()); writeContainer(writableByteChannel); }
@Override public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer byteBuffer = ByteBuffer.allocate(38); byteBuffer.position(6); IsoTypeWriter.writeUInt16(byteBuffer, dataReferenceIndex); IsoTypeWriter.writeUInt32(byteBuffer, displayFlags); IsoTypeWriter.writeUInt8(byteBuffer, horizontalJustification); IsoTypeWriter.writeUInt8(byteBuffer, verticalJustification); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[0]); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[1]); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[2]); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[3]); boxRecord.getContent(byteBuffer); styleRecord.getContent(byteBuffer); writableByteChannel.write((ByteBuffer) byteBuffer.rewind()); writeContainer(writableByteChannel); }
@Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException { ByteBuffer content = ByteBuffer.allocate(38); dataSource.read(content); content.position(6); dataReferenceIndex = IsoTypeReader.readUInt16(content); displayFlags = IsoTypeReader.readUInt32(content); horizontalJustification = IsoTypeReader.readUInt8(content); verticalJustification = IsoTypeReader.readUInt8(content); backgroundColorRgba = new int[4]; backgroundColorRgba[0] = IsoTypeReader.readUInt8(content); backgroundColorRgba[1] = IsoTypeReader.readUInt8(content); backgroundColorRgba[2] = IsoTypeReader.readUInt8(content); backgroundColorRgba[3] = IsoTypeReader.readUInt8(content); boxRecord = new BoxRecord(); boxRecord.parse(content); styleRecord = new StyleRecord(); styleRecord.parse(content); initContainer(dataSource, contentSize - 38, boxParser); }
public TextTrackImpl() { super("subtitles"); tx3g = new TextSampleEntry("tx3g"); tx3g.setDataReferenceIndex(1); tx3g.setStyleRecord(new TextSampleEntry.StyleRecord()); tx3g.setBoxRecord(new TextSampleEntry.BoxRecord()); FontTableBox ftab = new FontTableBox(); ftab.setEntries(Collections.singletonList(new FontTableBox.FontRecord(1, "Serif"))); tx3g.addBox(ftab); trackMetaData.setCreationTime(new Date()); trackMetaData.setModificationTime(new Date()); trackMetaData.setTimescale(1000); // Text tracks use millieseconds }
public TextTrackImpl() { super("subtitles"); tx3g = new TextSampleEntry("tx3g"); tx3g.setDataReferenceIndex(1); tx3g.setStyleRecord(new TextSampleEntry.StyleRecord()); tx3g.setBoxRecord(new TextSampleEntry.BoxRecord()); FontTableBox ftab = new FontTableBox(); ftab.setEntries(Collections.singletonList(new FontTableBox.FontRecord(1, "Serif"))); tx3g.addBox(ftab); trackMetaData.setCreationTime(new Date()); trackMetaData.setModificationTime(new Date()); trackMetaData.setTimescale(1000); // Text tracks use millieseconds }