Home | History | Annotate | Download | only in sampleentry
      1 package com.coremedia.iso.boxes.sampleentry;
      2 
      3 import com.coremedia.iso.IsoTypeReader;
      4 import com.coremedia.iso.IsoTypeWriter;
      5 
      6 import java.nio.ByteBuffer;
      7 
      8 /**
      9  * Created by IntelliJ IDEA.
     10  * User: magnus
     11  * Date: 2012-03-08
     12  * Time: 11:36
     13  * To change this template use File | Settings | File Templates.
     14  */
     15 public class SubtitleSampleEntry extends SampleEntry {
     16 
     17     public static final String TYPE1 = "stpp";
     18 
     19     public static final String TYPE_ENCRYPTED = ""; // This is not known!
     20 
     21     private String namespace;
     22     private String schemaLocation;
     23     private String imageMimeType;
     24 
     25     public SubtitleSampleEntry(String type) {
     26         super(type);
     27     }
     28 
     29     @Override
     30     protected long getContentSize() {
     31         long contentSize = 8 + namespace.length() + schemaLocation.length() + imageMimeType.length() + 3;
     32         return contentSize;
     33     }
     34 
     35     @Override
     36     public void _parseDetails(ByteBuffer content) {
     37         _parseReservedAndDataReferenceIndex(content);
     38         namespace = IsoTypeReader.readString(content);
     39         schemaLocation = IsoTypeReader.readString(content);
     40         imageMimeType = IsoTypeReader.readString(content);
     41         _parseChildBoxes(content);
     42     }
     43 
     44     @Override
     45     protected void getContent(ByteBuffer byteBuffer) {
     46         _writeReservedAndDataReferenceIndex(byteBuffer);
     47         IsoTypeWriter.writeUtf8String(byteBuffer, namespace);
     48         IsoTypeWriter.writeUtf8String(byteBuffer, schemaLocation);
     49         IsoTypeWriter.writeUtf8String(byteBuffer, imageMimeType);
     50     }
     51 
     52     public String getNamespace() {
     53         return namespace;
     54     }
     55 
     56     public void setNamespace(String namespace) {
     57         this.namespace = namespace;
     58     }
     59 
     60     public String getSchemaLocation() {
     61         return schemaLocation;
     62     }
     63 
     64     public void setSchemaLocation(String schemaLocation) {
     65         this.schemaLocation = schemaLocation;
     66     }
     67 
     68     public String getImageMimeType() {
     69         return imageMimeType;
     70     }
     71 
     72     public void setImageMimeType(String imageMimeType) {
     73         this.imageMimeType = imageMimeType;
     74     }
     75 }
     76 
     77