1 package com.googlecode.mp4parser.boxes; 2 3 import com.googlecode.mp4parser.AbstractBox; 4 import com.googlecode.mp4parser.boxes.mp4.objectdescriptors.BitReaderBuffer; 5 import com.googlecode.mp4parser.boxes.mp4.objectdescriptors.BitWriterBuffer; 6 7 import java.nio.ByteBuffer; 8 9 public class AC3SpecificBox extends AbstractBox { 10 int fscod; 11 int bsid; 12 int bsmod; 13 int acmod; 14 int lfeon; 15 int bitRateCode; 16 int reserved; 17 18 public AC3SpecificBox() { 19 super("dac3"); 20 } 21 22 @Override 23 protected long getContentSize() { 24 return 3; 25 } 26 27 @Override 28 public void _parseDetails(ByteBuffer content) { 29 BitReaderBuffer brb = new BitReaderBuffer(content); 30 fscod = brb.readBits(2); 31 bsid = brb.readBits(5); 32 bsmod = brb.readBits(3); 33 acmod = brb.readBits(3); 34 lfeon = brb.readBits(1); 35 bitRateCode = brb.readBits(5); 36 reserved = brb.readBits(5); 37 } 38 39 @Override 40 protected void getContent(ByteBuffer byteBuffer) { 41 BitWriterBuffer bwb = new BitWriterBuffer(byteBuffer); 42 bwb.writeBits(fscod, 2); 43 bwb.writeBits(bsid, 5); 44 bwb.writeBits(bsmod, 3); 45 bwb.writeBits(acmod, 3); 46 bwb.writeBits(lfeon, 1); 47 bwb.writeBits(bitRateCode, 5); 48 bwb.writeBits(reserved, 5); 49 } 50 51 public int getFscod() { 52 return fscod; 53 } 54 55 public void setFscod(int fscod) { 56 this.fscod = fscod; 57 } 58 59 public int getBsid() { 60 return bsid; 61 } 62 63 public void setBsid(int bsid) { 64 this.bsid = bsid; 65 } 66 67 public int getBsmod() { 68 return bsmod; 69 } 70 71 public void setBsmod(int bsmod) { 72 this.bsmod = bsmod; 73 } 74 75 public int getAcmod() { 76 return acmod; 77 } 78 79 public void setAcmod(int acmod) { 80 this.acmod = acmod; 81 } 82 83 public int getLfeon() { 84 return lfeon; 85 } 86 87 public void setLfeon(int lfeon) { 88 this.lfeon = lfeon; 89 } 90 91 public int getBitRateCode() { 92 return bitRateCode; 93 } 94 95 public void setBitRateCode(int bitRateCode) { 96 this.bitRateCode = bitRateCode; 97 } 98 99 public int getReserved() { 100 return reserved; 101 } 102 103 public void setReserved(int reserved) { 104 this.reserved = reserved; 105 } 106 107 @Override 108 public String toString() { 109 return "AC3SpecificBox{" + 110 "fscod=" + fscod + 111 ", bsid=" + bsid + 112 ", bsmod=" + bsmod + 113 ", acmod=" + acmod + 114 ", lfeon=" + lfeon + 115 ", bitRateCode=" + bitRateCode + 116 ", reserved=" + reserved + 117 '}'; 118 } 119 } 120