1 /* 2 * Copyright 2008 CoreMedia AG, Hamburg 3 * 4 * Licensed under the Apache License, Version 2.0 (the License); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an AS IS BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.coremedia.iso.boxes; 18 19 import com.coremedia.iso.IsoFile; 20 import com.coremedia.iso.IsoTypeReader; 21 import com.googlecode.mp4parser.AbstractBox; 22 23 import java.nio.ByteBuffer; 24 25 /** 26 * The Original Format Box contains the four-character-code of the original untransformed sample description. 27 * See ISO/IEC 14496-12 for details. 28 * 29 * @see ProtectionSchemeInformationBox 30 */ 31 32 public class OriginalFormatBox extends AbstractBox { 33 public static final String TYPE = "frma"; 34 35 private String dataFormat = " "; 36 OriginalFormatBox()37 public OriginalFormatBox() { 38 super("frma"); 39 } 40 getDataFormat()41 public String getDataFormat() { 42 return dataFormat; 43 } 44 45 setDataFormat(String dataFormat)46 public void setDataFormat(String dataFormat) { 47 assert dataFormat.length() == 4; 48 this.dataFormat = dataFormat; 49 } 50 getContentSize()51 protected long getContentSize() { 52 return 4; 53 } 54 55 @Override _parseDetails(ByteBuffer content)56 public void _parseDetails(ByteBuffer content) { 57 dataFormat = IsoTypeReader.read4cc(content); 58 } 59 60 @Override getContent(ByteBuffer byteBuffer)61 protected void getContent(ByteBuffer byteBuffer) { 62 byteBuffer.put(IsoFile.fourCCtoBytes(dataFormat)); 63 } 64 65 toString()66 public String toString() { 67 return "OriginalFormatBox[dataFormat=" + getDataFormat() + "]"; 68 } 69 } 70