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 }
@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 }
@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); }