public long getSize() { int spsPpsSize = 0; for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { spsPpsSize += len + bytes.limit(); } return orignalSample.getSize() + spsPpsSize; }
AvcConfigurationBox avcConfigurationBox = new AvcConfigurationBox(); avcConfigurationBox.setSequenceParameterSets(new ArrayList<ByteBuffer>(spsIdToSpsBytes.values())); avcConfigurationBox.setPictureParameterSets(new ArrayList<ByteBuffer>(ppsIdToPpsBytes.values())); avcConfigurationBox.setAvcLevelIndication(firstSeqParameterSet.level_idc); avcConfigurationBox.setAvcProfileIndication(firstSeqParameterSet.profile_idc); avcConfigurationBox.setBitDepthLumaMinus8(firstSeqParameterSet.bit_depth_luma_minus8); avcConfigurationBox.setBitDepthChromaMinus8(firstSeqParameterSet.bit_depth_chroma_minus8); avcConfigurationBox.setChromaFormat(firstSeqParameterSet.chroma_format_idc.getId()); avcConfigurationBox.setConfigurationVersion(1); avcConfigurationBox.setLengthSizeMinusOne(3); avcConfigurationBox.setProfileCompatibility( (firstSeqParameterSet.constraint_set_0_flag ? 128 : 0) + (firstSeqParameterSet.constraint_set_1_flag ? 64 : 0) +
).getSequenceParameterSets().get(0))); ).getPictureParameterSets().get(0))); int lengthSize = ((AvcConfigurationBox) Path.getPath(trackBox, "mdia/minf/stbl/stsd/avc1/avcC")).getLengthSizeMinusOne() + 1; for (Sample sample : sl) { ByteBuffer bb = sample.asByteBuffer();
if ("avc1".equals(codecName)) { AvcConfigurationBox avc1 = vse.getBoxes(AvcConfigurationBox.class).get(0); avcLevel = avc1.getAvcLevelIndication(); log.debug("AVC level: {}", avcLevel); avcProfile = avc1.getAvcProfileIndication(); log.debug("AVC Profile: {}", avcProfile); AvcDecoderConfigurationRecord avcC = avc1.getavcDecoderConfigurationRecord(); if (avcC != null) { long videoConfigContentSize = avcC.getContentSize();
List<ByteBuffer> spsbytes = avcConfigurationBox.getSequenceParameterSets(); byte[] CodecInit = new byte[3]; CodecInit[0] = spsbytes.get(0).get(1);
final int len = avcC.getLengthSizeMinusOne() + 1; final ByteBuffer buf = ByteBuffer.allocate(len);
public AvcNalUnitStorageBox(AvcConfigurationBox avcConfigurationBox) { super(TYPE); this.avcDecoderConfigurationRecord = avcConfigurationBox.getavcDecoderConfigurationRecord(); }
if ("avc1".equals(codecName)) { AvcConfigurationBox avc1 = vse.getBoxes(AvcConfigurationBox.class).get(0); avcLevel = avc1.getAvcLevelIndication(); log.debug("AVC level: {}", avcLevel); avcProfile = avc1.getAvcProfileIndication(); log.debug("AVC Profile: {}", avcProfile); AvcDecoderConfigurationRecord avcC = avc1.getavcDecoderConfigurationRecord(); if (avcC != null) { long videoConfigContentSize = avcC.getContentSize();
SeqParameterSet sps = null; try { sps = SeqParameterSet.read(avcC.getSequenceParameterSets().get(0).array()); } catch (IOException e) { e.printStackTrace();
if (box instanceof AvcConfigurationBox) { AvcConfigurationBox avcC = (AvcConfigurationBox) (configurationBox = box); nalLengthSizes.put(sampleEntry, avcC.getLengthSizeMinusOne() + 1); subSampleEncryption= true; } else if (box instanceof HevcConfigurationBox) {
public AvcNalUnitStorageBox(AvcConfigurationBox avcConfigurationBox) { super(TYPE); this.avcDecoderConfigurationRecord = avcConfigurationBox.getavcDecoderConfigurationRecord(); }
AvcConfigurationBox avcConfigurationBox = new AvcConfigurationBox(); avcConfigurationBox.setSequenceParameterSets(new ArrayList<ByteBuffer>(spsIdToSpsBytes.values())); avcConfigurationBox.setPictureParameterSets(new ArrayList<ByteBuffer>(ppsIdToPpsBytes.values())); avcConfigurationBox.setAvcLevelIndication(sps.level_idc); avcConfigurationBox.setAvcProfileIndication(sps.profile_idc); avcConfigurationBox.setBitDepthLumaMinus8(sps.bit_depth_luma_minus8); avcConfigurationBox.setBitDepthChromaMinus8(sps.bit_depth_chroma_minus8); avcConfigurationBox.setChromaFormat(sps.chroma_format_idc.getId()); avcConfigurationBox.setConfigurationVersion(1); avcConfigurationBox.setLengthSizeMinusOne(3); avcConfigurationBox.setProfileCompatibility( (sps.constraint_set_0_flag ? 128 : 0) + (sps.constraint_set_1_flag ? 64 : 0) +
public void writeTo(WritableByteChannel channel) throws IOException { for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), (ByteBuffer) buf.rewind(), len); channel.write((ByteBuffer) buf.rewind()); channel.write(bytes); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { IsoTypeWriterVariable.write(bytes.limit(), (ByteBuffer) buf.rewind(), len); channel.write((ByteBuffer) buf.rewind()); channel.write((bytes)); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), (ByteBuffer) buf.rewind(), len); channel.write((ByteBuffer) buf.rewind()); channel.write((bytes)); } orignalSample.writeTo(channel); }
final int len = avcC.getLengthSizeMinusOne() + 1; final ByteBuffer buf = ByteBuffer.allocate(len);
AvcConfigurationBox avcConfigurationBox = new AvcConfigurationBox(); avcConfigurationBox.setSequenceParameterSets(new ArrayList<ByteBuffer>(spsIdToSpsBytes.values())); avcConfigurationBox.setPictureParameterSets(new ArrayList<ByteBuffer>(ppsIdToPpsBytes.values())); avcConfigurationBox.setAvcLevelIndication(firstSeqParameterSet.level_idc); avcConfigurationBox.setAvcProfileIndication(firstSeqParameterSet.profile_idc); avcConfigurationBox.setBitDepthLumaMinus8(firstSeqParameterSet.bit_depth_luma_minus8); avcConfigurationBox.setBitDepthChromaMinus8(firstSeqParameterSet.bit_depth_chroma_minus8); avcConfigurationBox.setChromaFormat(firstSeqParameterSet.chroma_format_idc.getId()); avcConfigurationBox.setConfigurationVersion(1); avcConfigurationBox.setLengthSizeMinusOne(3); avcConfigurationBox.setProfileCompatibility( (firstSeqParameterSet.constraint_set_0_flag ? 128 : 0) + (firstSeqParameterSet.constraint_set_1_flag ? 64 : 0) +
public ByteBuffer asByteBuffer() { int spsPpsSize = 0; for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { spsPpsSize += len + bytes.limit(); } ByteBuffer data = ByteBuffer.allocate(l2i(orignalSample.getSize()) + spsPpsSize); for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } data.put(orignalSample.asByteBuffer()); return (ByteBuffer) data.rewind(); } };
if (box instanceof AvcConfigurationBox) { AvcConfigurationBox avcC = (AvcConfigurationBox) (configurationBox = box); nalLengthSizes.put(sampleEntry, avcC.getLengthSizeMinusOne() + 1); subSampleEncryption= true; } else if (box instanceof HevcConfigurationBox) {
public long getSize() { int spsPpsSize = 0; for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { spsPpsSize += len + bytes.limit(); } return orignalSample.getSize() + spsPpsSize; }
public void writeTo(WritableByteChannel channel) throws IOException { for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), (ByteBuffer) buf.rewind(), len); channel.write((ByteBuffer) buf.rewind()); channel.write(bytes); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { IsoTypeWriterVariable.write(bytes.limit(), (ByteBuffer) buf.rewind(), len); channel.write((ByteBuffer) buf.rewind()); channel.write((bytes)); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), (ByteBuffer) buf.rewind(), len); channel.write((ByteBuffer) buf.rewind()); channel.write((bytes)); } orignalSample.writeTo(channel); }
public ByteBuffer asByteBuffer() { int spsPpsSize = 0; for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { spsPpsSize += len + bytes.limit(); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { spsPpsSize += len + bytes.limit(); } ByteBuffer data = ByteBuffer.allocate(l2i(orignalSample.getSize()) + spsPpsSize); for (ByteBuffer bytes : avcC.getSequenceParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } for (ByteBuffer bytes : avcC.getSequenceParameterSetExts()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } for (ByteBuffer bytes : avcC.getPictureParameterSets()) { IsoTypeWriterVariable.write(bytes.limit(), data, len); data.put(bytes); } data.put(orignalSample.asByteBuffer()); return (ByteBuffer) data.rewind(); } };