QString EventInformationTable::toString(void) const { QString str; str.append(QString("Event Information Table\n")); str.append(((PSIPTable*)(this))->toString()); str.append(QString(" pid(0x%1) sourceID(%2) eventCount(%3)\n") .arg(tsheader()->PID()).arg(SourceID()).arg(EventCount())); for (uint i = 0; i < EventCount(); i++) { str.append(QString(" Event #%1 ID(%2) start_time(%3) length(%4 sec)\n") .arg(i,2,10).arg(EventID(i)) .arg(StartTimeGPS(i).toString(Qt::LocalDate)) .arg(LengthInSeconds(i))); str.append(QString(" ETM_loc(%1) Title(%2)\n"). arg(ETMLocation(i)).arg(title(i).toString())); if (0 != DescriptorsLength(i)) { vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(i), DescriptorsLength(i)); for (uint j=0; j<desc.size(); j++) str.append(QString("%1\n") .arg(MPEGDescriptor(desc[j]).toString())); } } return str; }
QString TerrestrialVirtualChannelTable::ChannelString(uint chan) const { QString str; str.append(QString(" Channel #%1 ").arg(chan)); str.append(QString("name(%1) %2-%3 ").arg(ShortChannelName(chan)) .arg(MajorChannel(chan)).arg(MinorChannel(chan))); str.append(QString("mod(%1) ").arg(ModulationModeString(chan))); str.append(QString("cTSID(0x%1)\n") .arg(ChannelTransportStreamID(chan),4,16,QChar('0'))); str.append(QString(" pnum(%1) ").arg(ProgramNumber(chan))); str.append(QString("ETM_loc(%1) ").arg(ETMlocation(chan))); str.append(QString("access_ctrl(%1) ").arg(IsAccessControlled(chan))); str.append(QString("hidden(%1) ").arg(IsHidden(chan))); str.append(QString("hide_guide(%1) ").arg(IsHiddenInGuide(chan))); str.append(QString("service_type(%1)\n").arg(ServiceTypeString(chan))); str.append(QString(" source_id(%1)\n").arg(SourceID(chan))); if (0 != DescriptorsLength(chan)) { str.append(QString(" descriptors length(%1) ") .arg(DescriptorsLength(chan))); vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(chan), DescriptorsLength(chan)); str.append(QString("count:%1\n").arg(desc.size())); for (uint i = 0; i < desc.size(); i++) { str.append(QString(" %1\n") .arg(MPEGDescriptor(desc[i]).toString())); } } return str; }
QString SCTESystemTimeTable::toStringXML(uint indent_level) const { QString indent_0 = xml_indent(indent_level); QString indent_1 = xml_indent(indent_level + 1); QString str = indent_0 + QString("<SCTESystemTimeSection system_time=\"%1\" " "gps_utc_offset=\"%2\"\n%3utc_time_desc=\"%4\" psip=\"scte\"") .arg(SystemTimeRaw()).arg(GPSUTCOffset()) .arg(indent_1) .arg(SystemTimeUTC().toString(Qt::ISODate)); if (!DescriptorsLength()) return str + " />"; str += ">\n"; vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(), DescriptorsLength()); for (uint i = 0; i < desc.size(); i++) { str += MPEGDescriptor(desc[i], 300) .toStringXML(indent_level + 1) + "\n"; } return str + indent_0 + "</SCTESystemTimeSection>"; }
QString CableVirtualChannelTable::toString(int chan) const { static QString modnames[6] = { QObject::tr("[Reserved]"), QObject::tr("Analog"), QObject::tr("SCTE mode 1"), QObject::tr("SCTE mode 2"), QObject::tr("ATSC 8-VSB"), QObject::tr("ATSC 16-VSB"), }; static QString servicenames[5] = { QObject::tr("[Reserved]"), QObject::tr("Analog"), QObject::tr("ATSC TV"), QObject::tr("ATSC Audio"), QObject::tr("ATSC Data"), }; QString str; str.append(QString("Channel #%1 ").arg(chan)); str.append(QString("name(%1) %2-%3 ").arg(ShortChannelName(chan)) .arg(MajorChannel(chan)).arg(MinorChannel(chan))); if (ModulationMode(chan) > 5) str.append(QString("mod(UNKNOWN %1) ").arg(ModulationMode(chan))); else str.append(QString("mod(%1) ").arg(modnames[ModulationMode(chan)])); str.append(QString("cTSID(0x%1)\n") .arg(ChannelTransportStreamID(chan), 0, 16)); str.append(QString(" pnum(%1) ").arg(ProgramNumber(chan))); str.append(QString("ETM_loc(%1) ").arg(ETMlocation(chan))); str.append(QString("access_ctrl(%1) ").arg(IsAccessControlled(chan))); str.append(QString("hidden(%1)\n").arg(IsHidden(chan))); str.append(QString("path_select(%1) ").arg(IsPathSelect(chan))); str.append(QString("out_of_band(%1) ").arg(IsOutOfBand(chan))); str.append(QString("hide_guide(%1) ").arg(IsHiddenInGuide(chan))); if (ServiceType(chan) > 4) str.append(QString("service_type(UNKNOWN %1) ").arg(ServiceType(chan))); else str.append(QString("service_type(%1) ").arg(servicenames[ServiceType(chan)])); str.append(QString("source_id(%1)\n").arg(SourceID(chan))); if (0 != DescriptorsLength(chan)) { str.append(QString(" descriptors length(%1) ") .arg(DescriptorsLength(chan))); vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(chan), DescriptorsLength(chan)); str.append(QString("count(%1)\n").arg(desc.size())); for (uint i = 0; i < desc.size(); i++) str.append(QString(" %1\n") .arg(MPEGDescriptor(desc[i]).toString())); } return str; }
void EventInformationTable::Parse(void) const { _ptrs.clear(); _ptrs.push_back(const_cast<unsigned char*>(psipdata()) + 2); for (uint i = 0; i < EventCount(); i++) _ptrs.push_back(_ptrs[i] + 12 + TitleLength(i) + DescriptorsLength(i)); }
void VirtualChannelTable::Parse(void) const { _ptrs.clear(); _ptrs.push_back(const_cast<unsigned char*>(psipdata()) + 2); for (uint i = 0; i < ChannelCount(); i++) _ptrs.push_back(_ptrs[i] + 32 + DescriptorsLength(i)); }
QString VirtualChannelTable::GetExtendedChannelName(uint i) const { if ((i >= ChannelCount()) || DescriptorsLength(i) == 0) return QString::null; vector<const unsigned char*> parsed = MPEGDescriptor::Parse(Descriptors(i), DescriptorsLength(i)); const unsigned char* desc = MPEGDescriptor::Find(parsed, DescriptorID::extended_channel_name); if (!desc) return QString::null; return ExtendedChannelNameDescriptor(desc).LongChannelNameString(); }
QString ShortVirtualChannelTable::toStringXML(uint indent_level) const { QString indent_0 = xml_indent(indent_level); QString indent_1 = xml_indent(indent_level + 1); QString str = indent_0 + QString("<ShortVirtualChannelSection vct_id=\"%1\" ").arg(ID()); str += QString("transmission_medium=\"%1\" ").arg(TransmissionMedium()); str += "\n" + indent_1; str += QString("table_subtype=\"%1\" table_subtype_desc=\"%2\"") .arg(TableSubtype()).arg(TableSubtypeString()); str += "\n" + indent_1 + PSIPTable::XMLValues(indent_level + 1) + ">\n"; if (kDefinedChannelsMap == TableSubtype()) str += DefinedChannelsMap().toStringXML(indent_level + 1) + "\n"; else if (kVirtualChannelMap == TableSubtype()) str += VirtualChannelMap().toStringXML(indent_level + 1) + "\n"; else if (kInverseChannelMap == TableSubtype()) str += InverseChannelMap().toStringXML(indent_level + 1) + "\n"; vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(), DescriptorsLength()); for (uint i = 0; i < desc.size(); i++) { str += MPEGDescriptor(desc[i], 300) .toStringXML(indent_level + 1) + "\n"; } return str + indent_0 + "</ShortVirtualChannelSection>"; }
QString CarrierDefinitionSubtable::toStringXML(uint indent_level) const { QString indent_0 = xml_indent(indent_level); QString indent_1 = xml_indent(indent_level + 1); QString str = indent_0 + QString("<CarrierDefinition descriptors_count=\"%2\" ") .arg(DescriptorsCount()); str += QString("number_of_carriers=\"%1\"").arg(NumberOfCarriers()); str += "\n" + indent_1; str += QString("spacing_unit=\"%1\" spacing_unit_hz=\"%2\"") .arg(SpacingUnit()).arg(SpacingUnitHz()); str += "\n" + indent_1; str += QString("frequency_spacing=\"%1\" frequency_spacing_hz=\"%2\"") .arg(FrequencySpacing()).arg(FrequencySpacingHz()); str += "\n" + indent_1; str += QString("frequency_unit=\"%1\" frequency_unit_hz=\"%2\"") .arg(FrequencyUnit()).arg(FrequencyUnitHz()); str += "\n" + indent_1; str += QString("first_carrier_frequency=\"%1\" " "first_carrier_frequency_hz=\"%2\">\n") .arg(FirstCarrierFrequency()) .arg(FirstCarrierFrequencyHz()); vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(), DescriptorsLength()); for (uint i = 0; i < desc.size(); i++) { str += MPEGDescriptor(desc[i], 300) .toStringXML(indent_level + 1) + "\n"; } return str + indent_0 + "</CarrierDefinition>"; }
QString SCTENetworkInformationTable::toStringXML(uint indent_level) const { QString indent_0 = xml_indent(indent_level); QString indent_1 = xml_indent(indent_level + 1); QString str = indent_0 + "<SCTENetworkInformationSection psip=\"scte\" "; str += QString("transmission_medium=\"%1\" ").arg(TransmissionMedium()); str += QString("first_index=\"%1\" ").arg(FirstIndex()); str += "\n" + indent_1; str += QString("number_of_records=\"%1\" ").arg(NumberOfRecords()); str += QString("table_subtype=\"%1\"").arg(TableSubtype()); str += PSIPTable::XMLValues(indent_level + 1) + ">\n"; if (kCarrierDefinitionSubtable == TableSubtype()) { for (uint i = 0; i < NumberOfRecords(); i++) str += CarrierDefinition(i).toStringXML(indent_level + 1) + "\n"; } else if (kModulationModeSubtable == TableSubtype()) { for (uint i = 0; i < NumberOfRecords(); i++) str += ModulationMode(i).toStringXML(indent_level + 1) + "\n"; } vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(), DescriptorsLength()); for (uint i = 0; i < desc.size(); i++) { str += MPEGDescriptor(desc[i], 300) .toStringXML(indent_level + 1) + "\n"; } return str + indent_0 + "</SCTENetworkInformationSection>"; }
QString ModulationModeSubtable::toStringXML(uint indent_level) const { QString indent_0 = xml_indent(indent_level); QString indent_1 = xml_indent(indent_level + 1); QString str = indent_0 + QString("<ModulationMode descriptors_count=\"%2\"") .arg(DescriptorsCount()); str += "\n" + indent_1; str += QString("transmission_system=\"%1\" transmission_system_desc=\"%2\"") .arg(TransmissionSystem()).arg(TransmissionSystemString()); str += "\n" + indent_1; str += QString("inner_coding_mode=\"%1\" inner_coding_mode_desc=\"%2\"") .arg(InnerCodingMode()).arg(InnerCodingModeString()); str += "\n" + indent_1; str += QString("split_bitstream_mode=\"%1\" ") .arg(xml_bool_to_string(SplitBitstreamMode())); str += QString("symbol_rate=\"%1\"").arg(SymbolRate()); vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(), DescriptorsLength()); if (desc.empty()) return str + " />"; str += ">\n"; for (uint i = 0; i < desc.size(); i++) { str += MPEGDescriptor(desc[i], 300) .toStringXML(indent_level + 1) + "\n"; } return str + indent_0 + "</ModulationMode>"; }
QString VirtualChannelTable::ChannelStringXML( uint indent_level, uint chan) const { QString indent_0 = xml_indent(indent_level); QString indent_1 = xml_indent(indent_level + 1); QString str = QString("%1<Channel %2\n%3descriptors_length=\"%4\">\n") .arg(indent_0) .arg(XMLChannelValues(indent_level + 1, chan)) .arg(indent_1) .arg(DescriptorsLength(chan)); vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(chan), DescriptorsLength(chan)); for (uint i = 0; i < desc.size(); i++) { str += MPEGDescriptor(desc[i], 300) .toStringXML(indent_level + 1) + "\n"; } return str + indent_0 + "</Channel>"; }
QString VirtualChannelMapSubtable::toStringXML(uint indent_level) const { QString indent_0 = xml_indent(indent_level); QString indent_1 = xml_indent(indent_level + 1); QString indent_2 = xml_indent(indent_level + 2); QString str = indent_0 + "<DefinedChannelsMap "; str += QString("number_of_vc_records=\"%1\"") .arg(NumberOfVCRecords()); str += "\n" + indent_1; str += QString("descriptors_included=\"%1\" ") .arg(xml_bool_to_string(DescriptorsIncluded())); str += QString("splice=\"%1\" ") .arg(xml_bool_to_string(Splice())); str += "\n" + indent_1; str += QString("activation_time=\"%1\" actication_time_desc=\"%2\"") .arg(ActivationTimeRaw()) .arg(ActivationTimeUTC().toString(Qt::ISODate)); str += ">\n"; for (uint i = 0; i < NumberOfVCRecords(); i++) { str += indent_1 + "<Channel "; str += QString("virtual_channel_number=\"%1\" ") .arg(VirtualChannelNumber(i)); str += "\n" + indent_2; str += QString("application_virtual_channel=\"%1\" ") .arg(xml_bool_to_string(ApplicationVirtualChannel(i))); str += QString("path_select=\"%1\" ").arg(PathSelect(i)); str += "\n" + indent_2; str += QString("transport_type=\"%1\" transport_type_desc=\"%2\" ") .arg(TransportType(i)).arg(TransportTypeString(i)); str += "\n" + indent_2; str += QString("channel_type=\"%1\" channel_type_desc=\"%2\" ") .arg(ChannelType(i)).arg(ChannelTypeString(i)); if (ApplicationVirtualChannel(i)) str += QString("application_id=\"%1\" ").arg(ApplicationID(i)); else str += QString("source_id=\"%1\" ").arg(SourceID(i)); str += "\n" + indent_2; if (kMPEG2Transport == TransportType(i)) { str += QString("cds_reference=\"%1\" ").arg(CDSReference(i)); str += QString("program_number=\"%1\" ").arg(ProgramNumber(i)); str += QString("mms_reference=\"%1\" ").arg(MMSReference(i)); } else { str += QString("cds_reference=\"%1\" ").arg(CDSReference(i)); str += QString("scrampled=\"%1\" ").arg(Scrambled(i)); str += "\n" + indent_2; str += QString("video_standard=\"%1\" video_standard_desc=\"%2\" ") .arg(VideoStandard(i)).arg(VideoStandardString(i)); } if (!DescriptorsIncluded()) { str += "/>\n"; continue; } str += "\n" + indent_2; str += QString("descriptors_count=\"%1\"").arg(DescriptorsCount(i)); str += ">\n"; vector<const unsigned char*> desc = MPEGDescriptor::Parse(Descriptors(i), DescriptorsLength(i)); for (uint i = 0; i < desc.size(); i++) { str += MPEGDescriptor(desc[i], 300) .toStringXML(indent_level + 2) + "\n"; } str += indent_1 + "</Channel>"; } return str + indent_0 + "</DefinedChannelsMap>"; }