cCiCaPmt CreateCAPMT(const ProgramMapTable &pmt, const unsigned short *casids, uint cplm) { cCiCaPmt capmt(pmt.ProgramNumber(), cplm); // Add CA descriptors for the service desc_list_t gdesc = MPEGDescriptor::ParseOnlyInclude( pmt.ProgramInfo(), pmt.ProgramInfoLength(), DescriptorID::conditional_access); process_desc(capmt, casids, gdesc); // Add elementary streams + CA descriptors for (uint i = 0; i < pmt.StreamCount(); i++) { LOG(VB_DVBCAM, LOG_INFO, QString("DVBCam: Adding elementary stream: %1, pid(0x%2)") .arg(pmt.StreamDescription(i, "dvb")) .arg(pmt.StreamPID(i),0,16)); capmt.AddElementaryStream(pmt.StreamType(i), pmt.StreamPID(i)); desc_list_t desc = MPEGDescriptor::ParseOnlyInclude( pmt.StreamInfo(i), pmt.StreamInfoLength(i), DescriptorID::conditional_access); process_desc(capmt, casids, desc); } return capmt; }
QString ScanStreamData::GetSIStandard(QString guess) const { if (HasCachedMGT()) return "atsc"; if (HasCachedAnyNIT()) return "dvb"; QMutexLocker locker(&_cache_lock); pmt_cache_t::const_iterator it = _cached_pmts.begin(); for (; it != _cached_pmts.end(); ++it) { ProgramMapTable *pmt = *it; for (uint i = 0; (guess != "dvb") && (i < pmt->StreamCount()); i++) { if (StreamID::OpenCableVideo == pmt->StreamType(i)) return "opencable"; } desc_list_t descs = MPEGDescriptor::ParseOnlyInclude( pmt->ProgramInfo(), pmt->ProgramInfoLength(), DescriptorID::registration); for (uint i = 0; i < descs.size(); i++) { RegistrationDescriptor reg(descs[i]); if (reg.FormatIdentifierString() == "SCTE") return "opencable"; } } return "mpeg"; }
bool IPTVRecorder::ProcessTSPacket(const TSPacket& tspacket) { if (!_stream_data) return true; if (tspacket.TransportError() || tspacket.Scrambled()) return true; if (tspacket.HasAdaptationField()) _stream_data->HandleAdaptationFieldControl(&tspacket); if (tspacket.HasPayload()) { const unsigned int lpid = tspacket.PID(); // Pass or reject packets based on PID, and parse info from them if (lpid == _stream_data->VideoPIDSingleProgram()) { ProgramMapTable *pmt = _stream_data->PMTSingleProgram(); uint video_stream_type = pmt->StreamType(pmt->FindPID(lpid)); if (video_stream_type == StreamID::H264Video) _buffer_packets = !FindH264Keyframes(&tspacket); else if (StreamID::IsVideo(video_stream_type)) _buffer_packets = !FindMPEG2Keyframes(&tspacket); if ((video_stream_type != StreamID::H264Video) || _seen_sps) BufferedWrite(tspacket); } else if (_stream_data->IsAudioPID(lpid)) { _buffer_packets = !FindAudioKeyframes(&tspacket); BufferedWrite(tspacket); } else if (_stream_data->IsListeningPID(lpid)) _stream_data->HandleTSTables(&tspacket); else if (_stream_data->IsWritingPID(lpid)) BufferedWrite(tspacket); } return true; }