private void replaceRefs(IntIntMap replaceSpec, int guid, ByteBuffer buf, Set<Integer> pmtPids) { if (guid == 0) { PATSection pat = PATSection.parsePAT(buf); for (int pids : pat.getPrograms().values()) { pmtPids.add(pids); } } else if (pmtPids.contains(guid)) { System.out.println(MainUtils.bold("PMT")); PSISection.parsePSI(buf); buf.getShort(); NIOUtils.skip(buf, buf.getShort() & 0xfff); while (buf.remaining() > 4) { byte streamType = buf.get(); MTSStreamType fromTag = MTSStreamType.fromTag(streamType); System.out.print((fromTag == null ? "UNKNOWN" : fromTag) + "(" + String.format("0x%02x", streamType) + "):\t"); int wn = buf.getShort() & 0xffff; int wasPid = wn & 0x1fff; int elementaryPid = replacePid(replaceSpec, wasPid); buf.putShort(buf.position() - 2, (short) ((elementaryPid & 0x1fff) | (wn & ~0x1fff))); NIOUtils.skip(buf, buf.getShort() & 0xfff); } } }
patPkt = pkt; PATSection pat = PATSection.parsePAT(pktRead); int[] values = pat.getPrograms().values(); for (int i = 0; i < values.length; i++) { int pmtPid = values[i];
PATSection pat = PATSection.parsePAT(tsBuf); IntIntMap programs = pat.getPrograms(); pmtPid = programs.values()[0]; printPat(pat); } else if (guid == pmtPid) {
PATSection pat = PATSection.parsePAT(tsBuf); IntIntMap programs = pat.getPrograms(); pmtPid = programs.values()[0]; printPat(pat); } else if (guid == pmtPid) {
/** * Parses PAT ( Program Association Table ) * * @param data * @deprecated Use org.jcodec.containers.mps.psi.PAT.parse method instead, * this method will not work correctly for streams with multiple * programs * @return Pid of the first PMT found in the PAT */ @Deprecated public static int parsePAT(ByteBuffer data) { PATSection pat = PATSection.parsePAT(data); if (pat.getPrograms().size() > 0) return pat.getPrograms().values()[0]; else return -1; }