FileDocCategorySizeDatePackage
TextSampleEntry.javaAPI Docmp4parser 1.0-RC-179126Wed Dec 19 20:10:38 GMT 2012com.coremedia.iso.boxes.sampleentry

TextSampleEntry

public class TextSampleEntry extends SampleEntry
Entry type for timed text samples defined in the timed text specification (ISO/IEC 14496-17).

Fields Summary
public static final String
TYPE1
public static final String
TYPE_ENCRYPTED
private long
displayFlags
private int
horizontalJustification
private int
verticalJustification
private int[]
backgroundColorRgba
private BoxRecord
boxRecord
private StyleRecord
styleRecord
Constructors Summary
public TextSampleEntry(String type)


       
        super(type);
    
Methods Summary
public void_parseDetails(java.nio.ByteBuffer content)

        _parseReservedAndDataReferenceIndex(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);
        _parseChildBoxes(content);
    
public int[]getBackgroundColorRgba()

        return backgroundColorRgba;
    
public com.coremedia.iso.boxes.sampleentry.TextSampleEntry$BoxRecordgetBoxRecord()

        return boxRecord;
    
protected voidgetContent(java.nio.ByteBuffer byteBuffer)

        _writeReservedAndDataReferenceIndex(byteBuffer);
        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);

        _writeChildBoxes(byteBuffer);
    
protected longgetContentSize()

        long contentSize = 18;
        contentSize += boxRecord.getSize();
        contentSize += styleRecord.getSize();
        for (Box boxe : boxes) {
            contentSize += boxe.getSize();
        }
        return contentSize;
    
public intgetHorizontalJustification()

        return horizontalJustification;
    
public com.coremedia.iso.boxes.sampleentry.TextSampleEntry$StyleRecordgetStyleRecord()

        return styleRecord;
    
public intgetVerticalJustification()

        return verticalJustification;
    
public booleanisContinuousKaraoke()

        return (displayFlags & 0x00000800) == 0x00000800;
    
public booleanisFillTextRegion()

        return (displayFlags & 0x00040000) == 0x00040000;
    
public booleanisScrollDirection()

        return (displayFlags & 0x00000180) == 0x00000180;
    
public booleanisScrollIn()

        return (displayFlags & 0x00000020) == 0x00000020;
    
public booleanisScrollOut()

        return (displayFlags & 0x00000040) == 0x00000040;
    
public booleanisWriteTextVertically()

        return (displayFlags & 0x00020000) == 0x00020000;
    
public voidsetBackgroundColorRgba(int[] backgroundColorRgba)

        this.backgroundColorRgba = backgroundColorRgba;
    
public voidsetBoxRecord(com.coremedia.iso.boxes.sampleentry.TextSampleEntry$BoxRecord boxRecord)

        this.boxRecord = boxRecord;
    
public voidsetContinuousKaraoke(boolean continuousKaraoke)

        if (continuousKaraoke) {
            displayFlags |= 0x00000800;
        } else {
            displayFlags &= ~0x00000800;
        }
    
public voidsetFillTextRegion(boolean fillTextRegion)

        if (fillTextRegion) {
            displayFlags |= 0x00040000;
        } else {
            displayFlags &= ~0x00040000;
        }
    
public voidsetHorizontalJustification(int horizontalJustification)

        this.horizontalJustification = horizontalJustification;
    
public voidsetScrollDirection(boolean scrollOutIn)

        if (scrollOutIn) {
            displayFlags |= 0x00000180;
        } else {
            displayFlags &= ~0x00000180;
        }
    
public voidsetScrollIn(boolean scrollIn)

        if (scrollIn) {
            displayFlags |= 0x00000020;
        } else {
            displayFlags &= ~0x00000020;
        }
    
public voidsetScrollOut(boolean scrollOutIn)

        if (scrollOutIn) {
            displayFlags |= 0x00000040;
        } else {
            displayFlags &= ~0x00000040;
        }
    
public voidsetStyleRecord(com.coremedia.iso.boxes.sampleentry.TextSampleEntry$StyleRecord styleRecord)

        this.styleRecord = styleRecord;
    
public voidsetVerticalJustification(int verticalJustification)

        this.verticalJustification = verticalJustification;
    
public voidsetWriteTextVertically(boolean writeTextVertically)

        if (writeTextVertically) {
            displayFlags |= 0x00020000;
        } else {
            displayFlags &= ~0x00020000;
        }
    
public java.lang.StringtoString()

        return "TextSampleEntry";