1 /* 2 * Copyright 2011 castLabs, Berlin 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.googlecode.mp4parser.boxes.ultraviolet; 18 19 import com.coremedia.iso.IsoTypeReader; 20 import com.coremedia.iso.Utf8; 21 import com.googlecode.mp4parser.AbstractFullBox; 22 23 import java.nio.ByteBuffer; 24 25 /** 26 * AssetInformationBox as defined Common File Format Spec. 27 */ 28 public class AssetInformationBox extends AbstractFullBox { 29 String apid = ""; 30 String profileVersion = "0000"; 31 AssetInformationBox()32 public AssetInformationBox() { 33 super("ainf"); 34 } 35 36 @Override getContentSize()37 protected long getContentSize() { 38 return Utf8.utf8StringLengthInBytes(apid) + 9; 39 } 40 41 42 @Override getContent(ByteBuffer byteBuffer)43 protected void getContent(ByteBuffer byteBuffer) { 44 writeVersionAndFlags(byteBuffer); 45 byteBuffer.put(Utf8.convert(profileVersion), 0, 4); 46 byteBuffer.put(Utf8.convert(apid)); 47 byteBuffer.put((byte) 0); 48 } 49 50 51 @Override _parseDetails(ByteBuffer content)52 public void _parseDetails(ByteBuffer content) { 53 parseVersionAndFlags(content); 54 profileVersion = IsoTypeReader.readString(content, 4); 55 apid = IsoTypeReader.readString(content); 56 content = null; 57 } 58 getApid()59 public String getApid() { 60 return apid; 61 } 62 setApid(String apid)63 public void setApid(String apid) { 64 this.apid = apid; 65 } 66 getProfileVersion()67 public String getProfileVersion() { 68 return profileVersion; 69 } 70 setProfileVersion(String profileVersion)71 public void setProfileVersion(String profileVersion) { 72 assert profileVersion != null && profileVersion.length() == 4; 73 this.profileVersion = profileVersion; 74 } 75 } 76