summaryrefslogtreecommitdiff
path: root/isoparser/src/main/java/com/coremedia/iso/boxes/sampleentry/SubtitleSampleEntry.java
blob: 21d0cc41ada1119c83a16a445cd4453c74910133 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.coremedia.iso.boxes.sampleentry;

import com.coremedia.iso.IsoTypeReader;
import com.coremedia.iso.IsoTypeWriter;

import java.nio.ByteBuffer;

/**
 * Created by IntelliJ IDEA.
 * User: magnus
 * Date: 2012-03-08
 * Time: 11:36
 * To change this template use File | Settings | File Templates.
 */
public class SubtitleSampleEntry extends SampleEntry {

    public static final String TYPE1 = "stpp";

    public static final String TYPE_ENCRYPTED = ""; // This is not known!

    private String namespace;
    private String schemaLocation;
    private String imageMimeType;

    public SubtitleSampleEntry(String type) {
        super(type);
    }

    @Override
    protected long getContentSize() {
        long contentSize = 8 + namespace.length() + schemaLocation.length() + imageMimeType.length() + 3;
        return contentSize;
    }

    @Override
    public void _parseDetails(ByteBuffer content) {
        _parseReservedAndDataReferenceIndex(content);
        namespace = IsoTypeReader.readString(content);
        schemaLocation = IsoTypeReader.readString(content);
        imageMimeType = IsoTypeReader.readString(content);
        _parseChildBoxes(content);
    }

    @Override
    protected void getContent(ByteBuffer byteBuffer) {
        _writeReservedAndDataReferenceIndex(byteBuffer);
        IsoTypeWriter.writeUtf8String(byteBuffer, namespace);
        IsoTypeWriter.writeUtf8String(byteBuffer, schemaLocation);
        IsoTypeWriter.writeUtf8String(byteBuffer, imageMimeType);
    }

    public String getNamespace() {
        return namespace;
    }

    public void setNamespace(String namespace) {
        this.namespace = namespace;
    }

    public String getSchemaLocation() {
        return schemaLocation;
    }

    public void setSchemaLocation(String schemaLocation) {
        this.schemaLocation = schemaLocation;
    }

    public String getImageMimeType() {
        return imageMimeType;
    }

    public void setImageMimeType(String imageMimeType) {
        this.imageMimeType = imageMimeType;
    }
}