@Override public long getSize() { long s = getContainerSize(); long t = 8; return s + t + ((largeBox || (s + t + 8) >= (1L << 32)) ? 16 : 8); } }
@Override public long getSize() { long s = 28 + (soundVersion == 1 ? 16 : 0) + (soundVersion == 2 ? 36 : 0) + getContainerSize(); s += ((this.largeBox || (s + 8) >= (1L << 32)) ? 16 : 8); return s; }
@Override public long getSize() { long s = getContainerSize(); long t = 38; // bytes to container start return s + t + ((largeBox || (s + t) >= (1L << 32)) ? 16 : 8); }
private void parse() throws IOException { if (!readVariables()) { throw new IOException(); } audioSampleEntry = new AudioSampleEntry(type); audioSampleEntry.setChannelCount(channelCount); audioSampleEntry.setSampleRate(samplerate); audioSampleEntry.setDataReferenceIndex(1); audioSampleEntry.setSampleSize(16); audioSampleEntry.addBox(ddts); trackMetaData.setCreationTime(new Date()); trackMetaData.setModificationTime(new Date()); trackMetaData.setLanguage(lang); trackMetaData.setTimescale(samplerate); // Audio tracks always use samplerate as timescale }
public TextTrackImpl() { super("subtitles"); tx3g = new TextSampleEntry("tx3g"); tx3g.setDataReferenceIndex(1); tx3g.setStyleRecord(new TextSampleEntry.StyleRecord()); tx3g.setBoxRecord(new TextSampleEntry.BoxRecord()); FontTableBox ftab = new FontTableBox(); ftab.setEntries(Collections.singletonList(new FontTableBox.FontRecord(1, "Serif"))); tx3g.addBox(ftab); trackMetaData.setCreationTime(new Date()); trackMetaData.setModificationTime(new Date()); trackMetaData.setTimescale(1000); // Text tracks use millieseconds }
@Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException { ByteBuffer content = ByteBuffer.allocate(38); dataSource.read(content); content.position(6); dataReferenceIndex = IsoTypeReader.readUInt16(content); displayFlags = IsoTypeReader.readUInt32(content); horizontalJustification = IsoTypeReader.readUInt8(content); verticalJustification = IsoTypeReader.readUInt8(content); backgroundColorRgba = new int[4]; backgroundColorRgba[0] = IsoTypeReader.readUInt8(content); backgroundColorRgba[1] = IsoTypeReader.readUInt8(content); backgroundColorRgba[2] = IsoTypeReader.readUInt8(content); backgroundColorRgba[3] = IsoTypeReader.readUInt8(content); boxRecord = new BoxRecord(); boxRecord.parse(content); styleRecord = new StyleRecord(); styleRecord.parse(content); initContainer(dataSource, contentSize - 38, boxParser); }
public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("AmrSpecificBox[vendor=").append(getVendor()); buffer.append(";decoderVersion=").append(getDecoderVersion()); buffer.append(";modeSet=").append(getModeSet()); buffer.append(";modeChangePeriod=").append(getModeChangePeriod()); buffer.append(";framesPerSample=").append(getFramesPerSample()); buffer.append("]"); return buffer.toString(); } }
private SampleEntry mergeSampleEntry(SampleEntry se1, SampleEntry se2) { if (!se1.getType().equals(se2.getType())) { return null; } else if (se1 instanceof VisualSampleEntry && se2 instanceof VisualSampleEntry) { return mergeVisualSampleEntry((VisualSampleEntry) se1, (VisualSampleEntry) se2); } else if (se1 instanceof AudioSampleEntry && se2 instanceof AudioSampleEntry) { return mergeAudioSampleEntries((AudioSampleEntry) se1, (AudioSampleEntry) se2); } else { return null; } }
@Override public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer byteBuffer = ByteBuffer.allocate(38); byteBuffer.position(6); IsoTypeWriter.writeUInt16(byteBuffer, dataReferenceIndex); IsoTypeWriter.writeUInt32(byteBuffer, displayFlags); IsoTypeWriter.writeUInt8(byteBuffer, horizontalJustification); IsoTypeWriter.writeUInt8(byteBuffer, verticalJustification); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[0]); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[1]); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[2]); IsoTypeWriter.writeUInt8(byteBuffer, backgroundColorRgba[3]); boxRecord.getContent(byteBuffer); styleRecord.getContent(byteBuffer); writableByteChannel.write((ByteBuffer) byteBuffer.rewind()); writeContainer(writableByteChannel); }
public AC3TrackImpl(DataSource dataSource, String lang) throws IOException { super(dataSource.toString()); this.dataSource = dataSource; this.trackMetaData.setLanguage(lang); samples = readSamples(); audioSampleEntry = createAudioSampleEntry(); trackMetaData.setCreationTime(new Date()); trackMetaData.setModificationTime(new Date()); trackMetaData.setLanguage(lang); trackMetaData.setTimescale(audioSampleEntry.getSampleRate()); // Audio tracks always use samplerate as timescale trackMetaData.setVolume(1); }
@Override public String toString() { return "AudioSampleEntry{" + "bytesPerSample=" + bytesPerSample + ", bytesPerFrame=" + bytesPerFrame + ", bytesPerPacket=" + bytesPerPacket + ", samplesPerPacket=" + samplesPerPacket + ", packetSize=" + packetSize + ", compressionId=" + compressionId + ", soundVersion=" + soundVersion + ", sampleRate=" + sampleRate + ", sampleSize=" + sampleSize + ", channelCount=" + channelCount + ", boxes=" + getBoxes() + '}'; }
@Override public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer bb = ByteBuffer.allocate(8); bb.position(6); IsoTypeWriter.writeUInt16(bb, dataReferenceIndex); writableByteChannel.write((ByteBuffer) bb.rewind()); writeContainer(writableByteChannel); }
@Override public long getSize() { long s = getContainerSize(); long t = 78; return s + t + ((largeBox || (s + t + 8) >= (1L << 32)) ? 16 : 8); }
@Override public long getSize() { long s = getContainerSize(); long t = 8; // bytes to container start return s + t + ((largeBox || (s + t) >= (1L << 32)) ? 16 : 8); } }
public String toString() { return "MpegSampleEntry" + getBoxes(); }
@Override public int hashCode() { ByteArrayOutputStream baos1 = new ByteArrayOutputStream(); try { this.getBox(Channels.newChannel(baos1)); } catch (IOException e) { throw new RuntimeException(e); } return Arrays.hashCode(baos1.toByteArray()); }
@Override public int hashCode() { ByteArrayOutputStream baos1 = new ByteArrayOutputStream(); try { this.getBox(Channels.newChannel(baos1)); } catch (IOException e) { throw new RuntimeException(e); } return Arrays.hashCode(baos1.toByteArray()); } }
@Override public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer byteBuffer = ByteBuffer.allocate(8); byteBuffer.position(6); IsoTypeWriter.writeUInt16(byteBuffer, dataReferenceIndex); writableByteChannel.write((ByteBuffer) byteBuffer.rewind()); writableByteChannel.write(ByteBuffer.wrap(vc1Content)); }
@Override public void parse(ReadableByteChannel dataSource, ByteBuffer header, long contentSize, BoxParser boxParser) throws IOException { ByteBuffer bb = ByteBuffer.allocate(8); dataSource.read(bb); bb.position(6);// ignore 6 reserved bytes; dataReferenceIndex = IsoTypeReader.readUInt16(bb); initContainer(dataSource, contentSize - 8, boxParser); }
public void getBox(WritableByteChannel writableByteChannel) throws IOException { writableByteChannel.write(getHeader()); ByteBuffer byteBuffer = ByteBuffer.allocate(8); byteBuffer.position(6); IsoTypeWriter.writeUInt16(byteBuffer, dataReferenceIndex); writableByteChannel.write(byteBuffer); }