TSDuck v3.38-3675
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
io.tsduck.SectionFile Class Reference

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

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

Public Member Functions

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

Static Public Attributes

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

Protected Attributes

long nativeObject = 0
 The address of the underlying C++ object.
 

Detailed Description

A wrapper class for C++ SectionFile.

Constructor & Destructor Documentation

◆ SectionFile()

io.tsduck.SectionFile.SectionFile ( DuckContext  duck)
inline

Constructor.

Parameters
duckThe TSDuck execution context object to use.

Member Function Documentation

◆ delete()

native void io.tsduck.SectionFile.delete ( )

Delete the encapsulated C++ object.

Reimplemented from io.tsduck.NativeObject.

◆ binarySize()

native int io.tsduck.SectionFile.binarySize ( )

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()

native int io.tsduck.SectionFile.sectionsCount ( )

Get the total number of sections in the file.

Returns
The total number of sections in the file.

◆ tablesCount()

native int io.tsduck.SectionFile.tablesCount ( )

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()

native void io.tsduck.SectionFile.setCRCValidation ( int  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.

◆ fromBinary()

native boolean io.tsduck.SectionFile.fromBinary ( byte[]  data)

Load a binary section file from a memory buffer.

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

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

◆ toBinary()

native byte[] io.tsduck.SectionFile.toBinary ( )

Get the binary content of a section file.

Returns
A byte array containing the binary sections.

◆ loadBinary()

native boolean io.tsduck.SectionFile.loadBinary ( String  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()

native boolean io.tsduck.SectionFile.saveBinary ( String  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()

native boolean io.tsduck.SectionFile.loadXML ( String  file)

Load an XML file.

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

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

◆ saveXML()

native boolean io.tsduck.SectionFile.saveXML ( String  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()

native boolean io.tsduck.SectionFile.saveJSON ( String  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()

native String io.tsduck.SectionFile.toXML ( )

Serialize as XML text.

Returns
Complete XML document text, empty on error.

◆ toJSON()

native String io.tsduck.SectionFile.toJSON ( )

Serialize as JSON text.

Returns
Complete JSON document text, empty on error.

◆ reorganizeEITs() [1/2]

native void io.tsduck.SectionFile.reorganizeEITs ( int  year,
int  month,
int  day 
)

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.
See also
ETSI TS 101 211, section 4.1.4

◆ reorganizeEITs() [2/2]

void io.tsduck.SectionFile.reorganizeEITs ( )
inline

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 start time of the oldest event in the section file is used as "reference date".

See also
ETSI TS 101 211, section 4.1.4

Member Data Documentation

◆ nativeObject

long io.tsduck.NativeObject.nativeObject = 0
protectedinherited

The address of the underlying C++ object.

It is normally accessed by native methods only.


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