QString CableVirtualChannelTable::toString(void) const { QString str; str.append(QString("VCT Cable: channels(%1) tsid(0x%2) ") .arg(ChannelCount()).arg(TransportStreamID(), 0, 16)); str.append(QString("seclength(%3)\n").arg(Length())); for (uint i = 0; i < ChannelCount(); i++) { str.append(toString(i)).append("\n"); } if (0 != GlobalDescriptorsLength()) { str.append(QString("global descriptors length: %1\n") .arg(GlobalDescriptorsLength())); vector<const unsigned char*> desc = MPEGDescriptor::Parse(GlobalDescriptors(), GlobalDescriptorsLength()); str.append(QString("global descriptors 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 VirtualChannelTable::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 section_name = QString("%1VirtualChannelSection") .arg((TableID::TVCT == TableID()) ? "Terrestrial" : "Cable"); QString mapid; if (TableID::CVCT == TableID()) { uint sctemapid = (pesdata()[3]<<8) | pesdata()[4]; mapid = QString(" mapid=\"0x%1\"").arg(sctemapid,4,16,QChar('0')); } QString str = QString("%1<%2 tsid=\"0x%3\" channel_count=\"%4\"" "\n%5global_descriptors_length=\"%6\"%7" "\n%8%9>\n") .arg(indent_0) .arg(section_name) .arg(TransportStreamID(),4,16,QChar('0')) .arg(ChannelCount()) .arg(indent_1) .arg(GlobalDescriptorsLength()) .arg(mapid) .arg(indent_1) .arg(PSIPTable::XMLValues(indent_level + 1)); vector<const unsigned char*> gdesc = MPEGDescriptor::Parse(GlobalDescriptors(), GlobalDescriptorsLength()); for (uint i = 0; i < gdesc.size(); i++) { str += MPEGDescriptor(gdesc[i], 300) .toStringXML(indent_level + 1) + "\n"; } for (uint i = 0; i < ChannelCount(); i++) str += ChannelStringXML(indent_level + 1, i) + "\n"; return str + indent_0 + QString("</%1>").arg(section_name); }
QString VirtualChannelTable::toString(void) const { QString str; str.append(QString("%1 Virtual Channel Section\n%2" " channel_count(%3) tsid(0x%4)") .arg((TableID::TVCT == TableID()) ? "Terrestrial":"Cable") .arg(PSIPTable::toString()) .arg(ChannelCount()) .arg(TransportStreamID(),4,16,QChar('0'))); if (TableID::CVCT == TableID()) { uint sctemapid = (pesdata()[3]<<8) | pesdata()[4]; str.append(QString(" mapid(0x%1)").arg(sctemapid,0,16)); } str.append("\n"); for (uint i = 0; i < ChannelCount(); i++) str.append(ChannelString(i)); if (0 != GlobalDescriptorsLength()) { str.append(QString("global descriptors length(%1) ") .arg(GlobalDescriptorsLength())); vector<const unsigned char*> desc = MPEGDescriptor::Parse(GlobalDescriptors(), GlobalDescriptorsLength()); 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; }