Пример #1
0
    public void getBox(WritableByteChannel writableByteChannel) throws IOException {
      ByteBuffer bb = ByteBuffer.allocate(16);
      long size = getSize();
      if (isSmallBox(size)) {
        IsoTypeWriter.writeUInt32(bb, size);
      } else {
        IsoTypeWriter.writeUInt32(bb, 1);
      }
      bb.put(IsoFile.fourCCtoBytes("mdat"));
      if (isSmallBox(size)) {
        bb.put(new byte[8]);
      } else {
        IsoTypeWriter.writeUInt64(bb, size);
      }
      bb.rewind();
      writableByteChannel.write(bb);
      if (writableByteChannel instanceof GatheringByteChannel) {
        List<ByteBuffer> nuSamples = unifyAdjacentBuffers(samples);

        int STEPSIZE = 1024;
        for (int i = 0; i < Math.ceil((double) nuSamples.size() / STEPSIZE); i++) {
          List<ByteBuffer> sublist =
              nuSamples.subList(
                  i * STEPSIZE, // start
                  (i + 1) * STEPSIZE < nuSamples.size()
                      ? (i + 1) * STEPSIZE
                      : nuSamples.size()); // end
          ByteBuffer sampleArray[] = sublist.toArray(new ByteBuffer[sublist.size()]);
          do {
            ((GatheringByteChannel) writableByteChannel).write(sampleArray);
          } while (sampleArray[sampleArray.length - 1].remaining() > 0);
        }
        // System.err.println(bytesWritten);
      } else {
        for (ByteBuffer sample : samples) {
          sample.rewind();
          writableByteChannel.write(sample);
        }
      }
    }
Пример #2
0
 public void getBox(WritableByteChannel writableByteChannel) throws IOException {
   ByteBuffer bb = ByteBuffer.allocate(16);
   long size = getSize();
   if (isSmallBox(size)) {
     IsoTypeWriter.writeUInt32(bb, size);
   } else {
     IsoTypeWriter.writeUInt32(bb, 1);
   }
   bb.put(IsoFile.fourCCtoBytes("mdat"));
   if (isSmallBox(size)) {
     bb.put(new byte[8]);
   } else {
     IsoTypeWriter.writeUInt64(bb, size);
   }
   bb.rewind();
   writableByteChannel.write(bb);
   for (List<Sample> samples : chunkList) {
     for (Sample sample : samples) {
       sample.writeTo(writableByteChannel);
     }
   }
 }
Пример #3
0
 public TitleBox() {
   super(IsoFile.fourCCtoBytes(TYPE));
 }
 public AppleDataReferenceBox() {
   super(IsoFile.fourCCtoBytes(TYPE));
 }
Пример #5
0
 protected void getContent(IsoOutputStream isos) throws IOException {
   isos.write(IsoFile.fourCCtoBytes(classificationEntity));
   isos.writeUInt16(classificationTableIndex);
   isos.writeIso639(language);
   isos.writeStringZeroTerm(classificationInfo);
 }
Пример #6
0
 public ClassificationBox() {
   super(IsoFile.fourCCtoBytes(TYPE));
 }
 public MutableDrmInformationBox() {
   super(IsoFile.fourCCtoBytes(TYPE));
 }
 public TrackFragmentRandomAccessBox() {
   super(IsoFile.fourCCtoBytes(TYPE));
 }
 public AppleLosslessSpecificBox() {
   super(IsoFile.fourCCtoBytes("alac"));
 }