Esempio n. 1
0
QString MasterGuideTable::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 =
        QString("%1<MasterGuideSection table_count=\"%2\" "
                "global_descriptors_length=\"%3\"\n%4%5>\n")
        .arg(indent_0)
        .arg(TableCount())
        .arg(GlobalDescriptorsLength())
        .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";
    }

    if (_ptrs.size() < TableCount())
        LOG(VB_GENERAL, LOG_ERR, "MasterGuideTable::toStringXML(): Table count mismatch");

    for (uint i = 0; i < TableCount() && i < _ptrs.size(); i++)
    {
        str += QString(
            "%1<Table pid=\"0x%2\" version=\"%3\""
            "\n%4type=\"0x%5\" type_desc=\"%6\""
            "\n%7number_bytes=\"%8\" table_descriptors_length=\"%9\"")
            .arg(indent_1)
            .arg(TablePID(i),4,16,QChar('0'))
            .arg(TableVersion(i))
            .arg(indent_1)
            .arg(TableType(i),4,16,QChar('0'))
            .arg(TableClassString(i))
            .arg(indent_2)
            .arg(TableDescriptorsBytes(i))
            .arg(TableDescriptorsLength(i));

        vector<const unsigned char*> desc =
            MPEGDescriptor::Parse(
                TableDescriptors(i), TableDescriptorsLength(i));
        str += (desc.empty()) ? " />\n" : ">\n";
        for (uint i = 0; i < desc.size(); i++)
        {
            str += MPEGDescriptor(desc[i], 300)
                .toStringXML(indent_level + 2) + "\n";
        }

        if (!desc.empty())
            str += indent_1 + "</Table>\n";
    }

    return str + "</MasterGuideSection>";
}
Esempio n. 2
0
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;
}
Esempio n. 3
0
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;
}
Esempio n. 4
0
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;
}
Esempio n. 5
0
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>";
}
Esempio n. 6
0
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>";
}
Esempio n. 7
0
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>";
}
Esempio n. 8
0
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>";
}
Esempio n. 9
0
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>";
} 
Esempio n. 10
0
QString MasterGuideTable::toString(void) const
{
    QString str;
    str.append(QString("Master Guide Section\n%1"
                       "      table_count(%2)\n")
               .arg(PSIPTable::toString())
               .arg(TableCount()));

    if (_ptrs.size() < TableCount())
        LOG(VB_GENERAL, LOG_ERR, "MasterGuideTable::toString(): Table count mismatch");

    for (uint i = 0; i < TableCount() && i < _ptrs.size(); i++)
    {
        str.append(QString("  Table #%1 ").arg(i, 2, 10));
        str.append(QString("pid(0x%1) ver(%2) ")
                   .arg(TablePID(i), 0, 16).arg(TableVersion(i), 2, 10));
        str.append(QString("size(%1) desc_len(%2) type: %4 %3 \n")
                   .arg(TableDescriptorsBytes(i), 4, 10)
                   .arg(TableDescriptorsLength(i))
                   .arg(TableClassString(i)).arg(TableType(i)));
        if (0 != TableDescriptorsLength(i))
        {
            vector<const unsigned char*> desc =
                MPEGDescriptor::Parse(TableDescriptors(i),
                                      TableDescriptorsLength(i));
            for (uint i = 0; i < desc.size(); i++)
                str.append(QString("  %1\n")
                           .arg(MPEGDescriptor(desc[i]).toString()));
        }
    }
    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;
}
Esempio n. 11
0
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;
}
Esempio n. 12
0
QString MasterGuideTable::toString(void) const
{
    QString str;
    str.append(QString("MGT: tables(%1)\n").arg(TableCount()));
    for (uint i = 0; i < TableCount(); i++)
    {
        str.append(QString("Table #%1 ").arg(i, 2, 10));
        str.append(QString("pid(0x%1) ver(%2) ")
                   .arg(TablePID(i), 0, 16).arg(TableVersion(i), 2, 10));
        str.append(QString("size(%1) desc_len(%2) type: %4 %3 \n")
                   .arg(TableDescriptorsBytes(i), 4, 10)
                   .arg(TableDescriptorsLength(i))
                   .arg(TableClassString(i)).arg(TableType(i)));
        if (0 != TableDescriptorsLength(i))
        {
            vector<const unsigned char*> desc =
                MPEGDescriptor::Parse(TableDescriptors(i),
                                      TableDescriptorsLength(i));
            for (uint i = 0; i < desc.size(); i++)
                str.append(QString("  %1\n")
                           .arg(MPEGDescriptor(desc[i]).toString()));
        }
    }
    if (0 != GlobalDescriptorsLength())
    {
        str.append(QString("Global descriptors length: %1\n")
                   .arg(GlobalDescriptorsLength()));
        vector<const unsigned char*> desc =
            MPEGDescriptor::Parse(GlobalDescriptors(),
                                  GlobalDescriptorsLength());
        for (uint i = 0; i < desc.size(); i++)
            str.append(QString(" %1\n")
                       .arg(MPEGDescriptor(desc[i]).toString()));
    }
    return str;
}
Esempio n. 13
0
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);
}
Esempio n. 14
0
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>";
}
Esempio n. 15
0
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;
}
Esempio n. 16
0
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>";
}