summaryrefslogtreecommitdiff
path: root/isoparser/src/main/java/com/googlecode/mp4parser/boxes/AC3SpecificBox.java
blob: a3006cdfbb89c6fdb9bc1cdc2fd15b9117a094d0 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package com.googlecode.mp4parser.boxes;

import com.googlecode.mp4parser.AbstractBox;
import com.googlecode.mp4parser.boxes.mp4.objectdescriptors.BitReaderBuffer;
import com.googlecode.mp4parser.boxes.mp4.objectdescriptors.BitWriterBuffer;

import java.nio.ByteBuffer;

public class AC3SpecificBox extends AbstractBox {
    int fscod;
    int bsid;
    int bsmod;
    int acmod;
    int lfeon;
    int bitRateCode;
    int reserved;

    public AC3SpecificBox() {
        super("dac3");
    }

    @Override
    protected long getContentSize() {
        return 3;
    }

    @Override
    public void _parseDetails(ByteBuffer content) {
        BitReaderBuffer brb = new BitReaderBuffer(content);
        fscod = brb.readBits(2);
        bsid = brb.readBits(5);
        bsmod = brb.readBits(3);
        acmod = brb.readBits(3);
        lfeon = brb.readBits(1);
        bitRateCode = brb.readBits(5);
        reserved = brb.readBits(5);
    }

    @Override
    protected void getContent(ByteBuffer byteBuffer) {
        BitWriterBuffer bwb = new BitWriterBuffer(byteBuffer);
        bwb.writeBits(fscod, 2);
        bwb.writeBits(bsid, 5);
        bwb.writeBits(bsmod, 3);
        bwb.writeBits(acmod, 3);
        bwb.writeBits(lfeon, 1);
        bwb.writeBits(bitRateCode, 5);
        bwb.writeBits(reserved, 5);
    }

    public int getFscod() {
        return fscod;
    }

    public void setFscod(int fscod) {
        this.fscod = fscod;
    }

    public int getBsid() {
        return bsid;
    }

    public void setBsid(int bsid) {
        this.bsid = bsid;
    }

    public int getBsmod() {
        return bsmod;
    }

    public void setBsmod(int bsmod) {
        this.bsmod = bsmod;
    }

    public int getAcmod() {
        return acmod;
    }

    public void setAcmod(int acmod) {
        this.acmod = acmod;
    }

    public int getLfeon() {
        return lfeon;
    }

    public void setLfeon(int lfeon) {
        this.lfeon = lfeon;
    }

    public int getBitRateCode() {
        return bitRateCode;
    }

    public void setBitRateCode(int bitRateCode) {
        this.bitRateCode = bitRateCode;
    }

    public int getReserved() {
        return reserved;
    }

    public void setReserved(int reserved) {
        this.reserved = reserved;
    }

    @Override
    public String toString() {
        return "AC3SpecificBox{" +
                "fscod=" + fscod +
                ", bsid=" + bsid +
                ", bsmod=" + bsmod +
                ", acmod=" + acmod +
                ", lfeon=" + lfeon +
                ", bitRateCode=" + bitRateCode +
                ", reserved=" + reserved +
                '}';
    }
}