Home | History | Annotate | Download | only in apple
      1 package com.coremedia.iso.boxes.apple;
      2 
      3 /**
      4  *
      5  */
      6 public final class AppleTrackNumberBox extends AbstractAppleMetaDataBox {
      7     public static final String TYPE = "trkn";
      8 
      9 
     10     public AppleTrackNumberBox() {
     11         super(TYPE);
     12     }
     13 
     14 
     15     /**
     16      * @param track the actual track number
     17      * @param of    number of tracks overall
     18      */
     19     public void setTrackNumber(byte track, byte of) {
     20         appleDataBox = new AppleDataBox();
     21         appleDataBox.setVersion(0);
     22         appleDataBox.setFlags(0);
     23         appleDataBox.setFourBytes(new byte[4]);
     24         appleDataBox.setData(new byte[]{0, 0, 0, track, 0, of, 0, 0});
     25     }
     26 
     27     public byte getTrackNumber() {
     28         return appleDataBox.getData()[3];
     29     }
     30 
     31     public byte getNumberOfTracks() {
     32         return appleDataBox.getData()[5];
     33     }
     34 
     35     public void setNumberOfTracks(byte numberOfTracks) {
     36         byte[] content = appleDataBox.getData();
     37         content[5] = numberOfTracks;
     38         appleDataBox.setData(content);
     39     }
     40 
     41     public void setTrackNumber(byte trackNumber) {
     42         byte[] content = appleDataBox.getData();
     43         content[3] = trackNumber;
     44         appleDataBox.setData(content);
     45     }
     46 
     47 
     48 }