TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
An XML file containing the description of TV channels and their networks. More...
#include <tsChannelFile.h>
Classes | |
class | Network |
Description of one network. More... | |
class | Service |
Description of one service. More... | |
class | TransportStream |
Description of one transport stream. More... | |
Public Types | |
using | NetworkPtr = std::shared_ptr< Network > |
Safe pointer to a Network object (thread-safe). | |
using | NetworkVector = std::vector< NetworkPtr > |
Vector of safe pointers to Network objects. | |
using | ServicePtr = std::shared_ptr< Service > |
Safe pointer to a Service object (thread-safe). | |
using | ServiceVector = std::vector< ServicePtr > |
Vector of safe pointers to Service objects. | |
using | TransportStreamPtr = std::shared_ptr< TransportStream > |
Safe pointer to a TransportStream object (thread-safe). | |
using | TransportStreamVector = std::vector< TransportStreamPtr > |
Vector of safe pointers to TransportStream objects. | |
Public Member Functions | |
ChannelFile ()=default | |
Default constructor. | |
void | clear () |
Clear all networks. | |
UString | fileDescription () const |
Get a description of the file from which the channel database was loaded. | |
UString | fileName () const |
Get the file name from which the channel database was loaded. | |
bool | load (const UString &fileName, Report &report=(ts::CerrReport::Instance())) |
Load an XML file. | |
bool | load (std::istream &strm, Report &report=(ts::CerrReport::Instance())) |
Load an XML file. | |
NetworkPtr | networkById (uint16_t id, TunerType type) const |
Get a network by id and type in the file. | |
NetworkPtr | networkByIndex (size_t index) const |
Get a network by index in the file. | |
size_t | networkCount () const |
Get the number of networks in the file. | |
NetworkPtr | networkGetOrCreate (uint16_t id, TunerType type) |
Get or create a network. | |
bool | parse (const UString &text, Report &report=(ts::CerrReport::Instance())) |
Parse an XML content. | |
bool | save (const UString &fileName, bool createDirectories=false, Report &report=(ts::CerrReport::Instance())) const |
Save an XML file. | |
bool | searchService (NetworkPtr &net, TransportStreamPtr &ts, ServicePtr &srv, const DeliverySystemSet &delsys, const UString &name, bool strict=true, Report &report=(ts::CerrReport::Instance())) const |
Search a service by name in any network of a given type of the file. | |
bool | searchService (NetworkPtr &net, TransportStreamPtr &ts, ServicePtr &srv, const UString &name, bool strict=true, Report &report=(ts::CerrReport::Instance())) const |
Search a service by name in any network of the file. | |
bool | serviceToTuning (ModulationArgs &tune, const DeliverySystemSet &delsys, const UString &name, bool strict=true, Report &report=(ts::CerrReport::Instance())) const |
Get tuner parameters from a service name in any network of a given type of the file. | |
bool | serviceToTuning (ModulationArgs &tune, const UString &name, bool strict=true, Report &report=(ts::CerrReport::Instance())) const |
Get tuner parameters from a service name in any network of the file. | |
void | setTweaks (const xml::Tweaks &tweaks) |
Set new parsing and formatting tweaks for XML files. | |
UString | toXML (Report &report=(ts::CerrReport::Instance())) const |
Serialize as XML text. | |
Static Public Member Functions | |
static UString | DefaultFileName () |
Default XML channel file name. | |
An XML file containing the description of TV channels and their networks.
The XML template for such files is in file tsduck.channels.model.xml
. This is a proprietary XML syntax from TSDuck which is used to replace the deprecated "zap" format from Linux tools such szap
or tzap
.
The default file location depends on the operating system:
%APPDATA%\tsduck\channels.xml
$HOME/
.tsduck.channels.xml
|
inline |
Set new parsing and formatting tweaks for XML files.
[in] | tweaks | XML tweaks. |
bool ts::ChannelFile::load | ( | const UString & | fileName, |
Report & | report = (ts::CerrReport::Instance()) |
||
) |
Load an XML file.
[in] | fileName | XML file name. If empty, use the default file name. |
[in,out] | report | Where to report errors. |
bool ts::ChannelFile::load | ( | std::istream & | strm, |
Report & | report = (ts::CerrReport::Instance()) |
||
) |
Load an XML file.
[in,out] | strm | A standard text stream in input mode. |
[in,out] | report | Where to report errors. |
bool ts::ChannelFile::parse | ( | const UString & | text, |
Report & | report = (ts::CerrReport::Instance()) |
||
) |
Parse an XML content.
[in] | text | XML file content. |
[in,out] | report | Where to report errors. |
bool ts::ChannelFile::save | ( | const UString & | fileName, |
bool | createDirectories = false , |
||
Report & | report = (ts::CerrReport::Instance()) |
||
) | const |
Save an XML file.
[in] | fileName | XML file name. |
[in] | createDirectories | If true, also create intermediate directories if necessary. |
[in,out] | report | Where to report errors. |
UString ts::ChannelFile::toXML | ( | Report & | report = (ts::CerrReport::Instance()) | ) | const |
Serialize as XML text.
[in,out] | report | Where to report errors. |
|
inline |
Get the file name from which the channel database was loaded.
UString ts::ChannelFile::fileDescription | ( | ) | const |
Get a description of the file from which the channel database was loaded.
Typically used in error or debug messages.
|
static |
Default XML channel file name.
|
inline |
Get the number of networks in the file.
NetworkPtr ts::ChannelFile::networkByIndex | ( | size_t | index | ) | const |
Get a network by index in the file.
[in] | index | Network index, from 0 to networkCount()-1. |
NetworkPtr ts::ChannelFile::networkById | ( | uint16_t | id, |
TunerType | type | ||
) | const |
NetworkPtr ts::ChannelFile::networkGetOrCreate | ( | uint16_t | id, |
TunerType | type | ||
) |
|
inline |
Search a service by name in any network of the file.
[out] | net | Returned network of the service. |
[out] | ts | Returned transport stream of the service. |
[out] | srv | Returned service. |
[in] | name | Service name. |
[in] | strict | If true, search exactly name. If false, the comparison is case-insensitive and spaces are ignored. If false, name can also be "major.minor" for ATSC services. |
[in,out] | report | Where to report errors. |
bool ts::ChannelFile::searchService | ( | NetworkPtr & | net, |
TransportStreamPtr & | ts, | ||
ServicePtr & | srv, | ||
const DeliverySystemSet & | delsys, | ||
const UString & | name, | ||
bool | strict = true , |
||
Report & | report = (ts::CerrReport::Instance()) |
||
) | const |
Search a service by name in any network of a given type of the file.
[out] | net | Returned network of the service. |
[out] | ts | Returned transport stream of the service. |
[out] | srv | Returned service. |
[in] | delsys | Search only for these delivery systems. If empty, search any network. |
[in] | name | Service name. |
[in] | strict | If true, search exactly name. If false, the comparison is case-insensitive and spaces are ignored. If false, name can also be "major.minor" for ATSC services. |
[in,out] | report | Where to report errors. |
|
inline |
Get tuner parameters from a service name in any network of the file.
[out] | tune | Returned modulation parameters. |
[in] | name | Service name. |
[in] | strict | If true, search exactly name. If false, the comparison is case-insensitive and spaces are ignored. If false, name can also be "major.minor" for ATSC services. |
[in,out] | report | Where to report errors. |
bool ts::ChannelFile::serviceToTuning | ( | ModulationArgs & | tune, |
const DeliverySystemSet & | delsys, | ||
const UString & | name, | ||
bool | strict = true , |
||
Report & | report = (ts::CerrReport::Instance()) |
||
) | const |
Get tuner parameters from a service name in any network of a given type of the file.
[out] | tune | Returned modulation parameters. Unmodified if the channel is not found. |
[in] | delsys | Search only for these delivery systems. If empty, search any network. |
[in] | name | Service name. |
[in] | strict | If true, search exactly name. If false, the comparison is case-insensitive and spaces are ignored. If false, name can also be "major.minor" for ATSC services. |
[in,out] | report | Where to report errors. |