1 package com.googlecode.mp4parser.boxes.apple; 2 3 import com.coremedia.iso.IsoTypeReader; 4 import com.coremedia.iso.IsoTypeWriter; 5 import com.googlecode.mp4parser.AbstractFullBox; 6 7 import java.nio.ByteBuffer; 8 9 public class BaseMediaInfoAtom extends AbstractFullBox { 10 public static final String TYPE = "gmin"; 11 12 short graphicsMode = 64; 13 int opColorR = 32768; 14 int opColorG = 32768; 15 int opColorB = 32768; 16 short balance; 17 short reserved; 18 BaseMediaInfoAtom()19 public BaseMediaInfoAtom() { 20 super(TYPE); 21 } 22 23 @Override getContentSize()24 protected long getContentSize() { 25 return 16; 26 } 27 28 @Override getContent(ByteBuffer byteBuffer)29 protected void getContent(ByteBuffer byteBuffer) { 30 writeVersionAndFlags(byteBuffer); 31 byteBuffer.putShort(graphicsMode); 32 IsoTypeWriter.writeUInt16(byteBuffer, opColorR); 33 IsoTypeWriter.writeUInt16(byteBuffer,opColorG ); 34 IsoTypeWriter.writeUInt16(byteBuffer,opColorB ); 35 byteBuffer.putShort(balance); 36 byteBuffer.putShort(reserved); 37 } 38 39 @Override _parseDetails(ByteBuffer content)40 protected void _parseDetails(ByteBuffer content) { 41 parseVersionAndFlags(content); 42 graphicsMode = content.getShort(); 43 opColorR = IsoTypeReader.readUInt16(content); 44 opColorG = IsoTypeReader.readUInt16(content); 45 opColorB = IsoTypeReader.readUInt16(content); 46 balance = content.getShort(); 47 reserved = content.getShort(); 48 49 } 50 getGraphicsMode()51 public short getGraphicsMode() { 52 return graphicsMode; 53 } 54 setGraphicsMode(short graphicsMode)55 public void setGraphicsMode(short graphicsMode) { 56 this.graphicsMode = graphicsMode; 57 } 58 getOpColorR()59 public int getOpColorR() { 60 return opColorR; 61 } 62 setOpColorR(int opColorR)63 public void setOpColorR(int opColorR) { 64 this.opColorR = opColorR; 65 } 66 getOpColorG()67 public int getOpColorG() { 68 return opColorG; 69 } 70 setOpColorG(int opColorG)71 public void setOpColorG(int opColorG) { 72 this.opColorG = opColorG; 73 } 74 getOpColorB()75 public int getOpColorB() { 76 return opColorB; 77 } 78 setOpColorB(int opColorB)79 public void setOpColorB(int opColorB) { 80 this.opColorB = opColorB; 81 } 82 getBalance()83 public short getBalance() { 84 return balance; 85 } 86 setBalance(short balance)87 public void setBalance(short balance) { 88 this.balance = balance; 89 } 90 getReserved()91 public short getReserved() { 92 return reserved; 93 } 94 setReserved(short reserved)95 public void setReserved(short reserved) { 96 this.reserved = reserved; 97 } 98 99 @Override toString()100 public String toString() { 101 return "BaseMediaInfoAtom{" + 102 "graphicsMode=" + graphicsMode + 103 ", opColorR=" + opColorR + 104 ", opColorG=" + opColorG + 105 ", opColorB=" + opColorB + 106 ", balance=" + balance + 107 ", reserved=" + reserved + 108 '}'; 109 } 110 } 111