1 /***************************************************************** 2 | 3 | Copyright 2002-2008 Axiomatic Systems, LLC 4 | 5 | $Id: OdafAtom.java 196 2008-10-14 22:59:31Z bok $ 6 | 7 | This file is part of Bento4/AP4 (MP4 Atom Processing Library). 8 | 9 | Unless you have obtained Bento4 under a difference license, 10 | this version of Bento4 is Bento4|GPL. 11 | Bento4|GPL is free software; you can redistribute it and/or modify 12 | it under the terms of the GNU General Public License as published by 13 | the Free Software Foundation; either version 2, or (at your option) 14 | any later version. 15 | 16 | Bento4|GPL is distributed in the hope that it will be useful, 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | GNU General Public License for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with Bento4|GPL; see the file COPYING. If not, write to the 23 | Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 24 | 02111-1307, USA. 25 | 26 ****************************************************************/ 27 28 package com.axiosys.bento4.dcf; 29 30 import java.io.DataOutputStream; 31 import java.io.IOException; 32 import java.io.RandomAccessFile; 33 34 import com.axiosys.bento4.Atom; 35 36 public class OdafAtom extends Atom { 37 // members 38 private boolean selectiveEncryption; 39 private int keyIndicatorLength; 40 private int ivLength; 41 OdafAtom(int size, RandomAccessFile source)42 public OdafAtom(int size, RandomAccessFile source) throws IOException { 43 super(Atom.TYPE_ODAF, size, true, source); 44 byte s = source.readByte(); 45 selectiveEncryption = ((s&0x80) != 0); 46 keyIndicatorLength = source.readByte(); 47 ivLength = source.readByte(); 48 } 49 writeFields(DataOutputStream stream)50 protected void writeFields(DataOutputStream stream) throws IOException { 51 throw new RuntimeException("Not implemented yet"); 52 53 } 54 getIvLength()55 public int getIvLength() { 56 return ivLength; 57 } 58 getKeyIndicatorLength()59 public int getKeyIndicatorLength() { 60 return keyIndicatorLength; 61 } 62 getSelectiveEncryption()63 public boolean getSelectiveEncryption() { 64 return selectiveEncryption; 65 } 66 toString(String indentation)67 public String toString(String indentation) { 68 StringBuffer result = new StringBuffer(super.toString(indentation)); 69 result.append("\n" + indentation + " selective_encryption = " + selectiveEncryption); 70 result.append("\n" + indentation + " key_indicator_length = " + keyIndicatorLength); 71 result.append("\n" + indentation + " iv_ength = " + ivLength); 72 return result.toString(); 73 } 74 75 } 76