TSDuck v3.40-4033
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
tsduck.SectionFile Class Reference

A wrapper class for C++ SectionFile. More...

Inheritance diagram for tsduck.SectionFile:
Collaboration diagram for tsduck.SectionFile:

Public Member Functions

 __init__ (self, duck)
 Constructor.
 
 binarySize (self)
 Get the size in bytes of all sections.
 
 clear (self)
 Clear the content of the SectionFile, erase all sections.
 
 delete (self)
 Explicitly free the underlying C++ object.
 
 fromBinary (self, data)
 Load a binary section file from a memory buffer.
 
 loadBinary (self, file)
 Load a binary section file.
 
 loadXML (self, file)
 Load an XML file.
 
 reorganizeEITs (self, year=0, month=0, day=0)
 Reorganize all EIT sections according to ETSI TS 101 211.
 
 saveBinary (self, file)
 Save a binary section file.
 
 saveJSON (self, file)
 Save a JSON file after automated XML-to-JSON conversion.
 
 saveXML (self, file)
 Save an XML file.
 
 sectionsCount (self)
 Get the total number of sections in the file.
 
 setCRCValidation (self, mode)
 Set the CRC32 processing mode when loading binary sections.
 
 tablesCount (self)
 Get the total number of full tables in the file.
 
 toBinary (self)
 Get the binary content of a section file.
 
 toJSON (self)
 Serialize as JSON text.
 
 toXML (self)
 Serialize as XML text.
 

Static Public Attributes

int CRC32_CHECK = 1
 Check that the value of the CRC32 of the section is correct and fail if it isn't.
 
int CRC32_COMPUTE = 2
 Recompute a fresh new CRC32 value based on the content of the section.
 
int CRC32_IGNORE = 0
 Ignore the section CRC32 when loading a binary section.
 

Detailed Description

A wrapper class for C++ SectionFile.

Constructor & Destructor Documentation

◆ __init__()

tsduck.SectionFile.__init__ (   self,
  duck 
)

Constructor.

Parameters
duckThe tsduck.DuckContext object to use.

Reimplemented from tsduck.NativeObject.

Member Function Documentation

◆ delete()

tsduck.SectionFile.delete (   self)

Explicitly free the underlying C++ object.

After this call, the object becomes unusable. Most usages are unpredictable but most likely will do nothing.

Returns
None.

Reimplemented from tsduck.NativeObject.

◆ clear()

tsduck.SectionFile.clear (   self)

Clear the content of the SectionFile, erase all sections.

Returns
None.

◆ binarySize()

tsduck.SectionFile.binarySize (   self)

Get the size in bytes of all sections.

This would be the size of the corresponding binary file.

Returns
The size in bytes of all sections.

◆ sectionsCount()

tsduck.SectionFile.sectionsCount (   self)

Get the total number of sections in the file.

Returns
The total number of sections in the file.

◆ tablesCount()

tsduck.SectionFile.tablesCount (   self)

Get the total number of full tables in the file.

Orphan sections are not included.

Returns
The total number of full tables in the file.

◆ setCRCValidation()

tsduck.SectionFile.setCRCValidation (   self,
  mode 
)

Set the CRC32 processing mode when loading binary sections.

Parameters
modeFor binary files, how to process the CRC32 of the input sections. Must be one of the CRC32_* values.
Returns
None

◆ fromBinary()

tsduck.SectionFile.fromBinary (   self,
  data 
)

Load a binary section file from a memory buffer.

The loaded sections are added to the content of this object.

Parameters
dataA bytearray containing the binary data to load.
Returns
True on success, False if some sections were incorrect or truncated.

◆ toBinary()

tsduck.SectionFile.toBinary (   self)

Get the binary content of a section file.

Returns
A bytearray containing the binary sections.

◆ loadBinary()

tsduck.SectionFile.loadBinary (   self,
  file 
)

Load a binary section file.

The loaded sections are added to the content of this object.

Parameters
fileBinary file name. If the file name is empty or "-", the standard input is used.
Returns
True on success, False on error.

◆ saveBinary()

tsduck.SectionFile.saveBinary (   self,
  file 
)

Save a binary section file.

Parameters
[in]fileBinary file name. If the file name is empty or "-", the standard output is used.
Returns
True on success, False on error.

◆ loadXML()

tsduck.SectionFile.loadXML (   self,
  file 
)

Load an XML file.

The loaded tables are added to the content of this object.

Parameters
fileXML file name. If the file name starts with "<?xml", this is considered as "inline XML content". If the file name is empty or "-", the standard input is used.
Returns
True on success, False on error.

◆ saveXML()

tsduck.SectionFile.saveXML (   self,
  file 
)

Save an XML file.

Parameters
[in]fileXML file name. If the file name is empty or "-", the standard output is used.
Returns
True on success, False on error.

◆ saveJSON()

tsduck.SectionFile.saveJSON (   self,
  file 
)

Save a JSON file after automated XML-to-JSON conversion.

Parameters
[in]fileJSON file name. If the file name is empty or "-", the standard output is used.
Returns
True on success, False on error.

◆ toXML()

tsduck.SectionFile.toXML (   self)

Serialize as XML text.

Returns
Complete XML document text, empty on error.

◆ toJSON()

tsduck.SectionFile.toJSON (   self)

Serialize as JSON text.

Returns
Complete JSON document text, empty on error.

◆ reorganizeEITs()

tsduck.SectionFile.reorganizeEITs (   self,
  year = 0,
  month = 0,
  day = 0 
)

Reorganize all EIT sections according to ETSI TS 101 211.

Only one EITp/f subtable is kept per service. It is split in two sections if two events (present and following) are specified. All EIT schedule are kept. But they are completely reorganized. All events are extracted and spread over new EIT sections according to ETSI TS 101 211 rules.

The "last midnight" according to which EIT segments are assigned is derived from parameters year, month and day. If any of them is out or range, the start time of the oldest event in the section file is used as "reference date".

Parameters
yearYear of the reference time for EIT schedule. This is the "last midnight" according to which EIT segments are assigned.
monthMonth (1..12) of the reference time for EIT schedule.
dayDay (1..31) of the reference time for EIT schedule.
Returns
None.
See also
ETSI TS 101 211, section 4.1.4

Member Data Documentation

◆ CRC32_IGNORE

int tsduck.SectionFile.CRC32_IGNORE = 0
static

Ignore the section CRC32 when loading a binary section.

This is the default.


The documentation for this class was generated from the following file: