Пример #1
0
 protected SeekableByteChannel[][] getInputs(MovieBox movie) throws IOException {
   TrakBox[] tracks = movie.getTracks();
   SeekableByteChannel[][] result = new SeekableByteChannel[tracks.length][];
   for (int i = 0; i < tracks.length; i++) {
     DataRefBox drefs =
         NodeBox.findFirstPath(tracks[i], DataRefBox.class, Box.path("mdia.minf.dinf.dref"));
     if (drefs == null) {
       throw new RuntimeException("No data references");
     }
     List<Box> entries = drefs.getBoxes();
     SeekableByteChannel[] e = new SeekableByteChannel[entries.size()];
     SeekableByteChannel[] inputs = new SeekableByteChannel[entries.size()];
     for (int j = 0; j < e.length; j++) {
       inputs[j] = resolveDataRef(entries.get(j));
     }
     result[i] = inputs;
   }
   return result;
 }
Пример #2
0
  private void cleanDrefs(TrakBox trak) {
    MediaInfoBox minf = trak.getMdia().getMinf();
    DataInfoBox dinf = trak.getMdia().getMinf().getDinf();
    if (dinf == null) {
      dinf = new DataInfoBox();
      minf.add(dinf);
    }

    DataRefBox dref = dinf.getDref();
    if (dref == null) {
      dref = new DataRefBox();
      dinf.add(dref);
    }

    dref.getBoxes().clear();
    dref.add(AliasBox.createSelfRef());

    for (SampleEntry entry :
        NodeBox.findAll(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null)) {
      entry.setDrefInd((short) 1);
    }
  }