public void setAll(SpsData spsData, int nalRefIdc, int sliceType, int frameNum, int picParameterSetId, boolean fieldPicFlag, boolean bottomFieldFlagPresent, boolean bottomFieldFlag, boolean idrPicFlag, int idrPicId, int picOrderCntLsb, int deltaPicOrderCntBottom, int deltaPicOrderCnt0, int deltaPicOrderCnt1) { this.spsData = spsData; this.nalRefIdc = nalRefIdc; this.sliceType = sliceType; this.frameNum = frameNum; this.picParameterSetId = picParameterSetId; this.fieldPicFlag = fieldPicFlag; this.bottomFieldFlagPresent = bottomFieldFlagPresent; this.bottomFieldFlag = bottomFieldFlag; this.idrPicFlag = idrPicFlag; this.idrPicId = idrPicId; this.picOrderCntLsb = picOrderCntLsb; this.deltaPicOrderCntBottom = deltaPicOrderCntBottom; this.deltaPicOrderCnt0 = deltaPicOrderCnt0; this.deltaPicOrderCnt1 = deltaPicOrderCnt1; isComplete = true; hasSliceType = true; }
/** * Parses AVC configuration data. * * @param data A {@link ParsableByteArray}, whose position is set to the start of the AVC * configuration data to parse. * @return A parsed representation of the HEVC configuration data. * @throws ParserException If an error occurred parsing the data. */ public static AvcConfig parse(ParsableByteArray data) throws ParserException { try { data.skipBytes(4); // Skip to the AVCDecoderConfigurationRecord (defined in 14496-15) int nalUnitLengthFieldLength = (data.readUnsignedByte() & 0x3) + 1; if (nalUnitLengthFieldLength == 3) { throw new IllegalStateException(); } List<byte[]> initializationData = new ArrayList<>(); int numSequenceParameterSets = data.readUnsignedByte() & 0x1F; for (int j = 0; j < numSequenceParameterSets; j++) { initializationData.add(buildNalUnitForChild(data)); } int numPictureParameterSets = data.readUnsignedByte(); for (int j = 0; j < numPictureParameterSets; j++) { initializationData.add(buildNalUnitForChild(data)); } int width = Format.NO_VALUE; int height = Format.NO_VALUE; float pixelWidthAspectRatio = 1; if (numSequenceParameterSets > 0) { byte[] sps = initializationData.get(0); SpsData spsData = NalUnitUtil.parseSpsNalUnit(initializationData.get(0), nalUnitLengthFieldLength, sps.length); width = spsData.width; height = spsData.height; pixelWidthAspectRatio = spsData.pixelWidthAspectRatio; } return new AvcConfig(initializationData, nalUnitLengthFieldLength, width, height, pixelWidthAspectRatio); } catch (ArrayIndexOutOfBoundsException e) { throw new ParserException("Error parsing AVC config", e); } }
public void putSps(NalUnitUtil.SpsData spsData) { sps.append(spsData.seqParameterSetId, spsData); }