Transport stream scrambling using multiple algorithms. More...
Public Member Functions | |
TSScrambling (const TSScrambling &other) | |
Copy constructor. More... | |
TSScrambling (Report &report=(*(static_cast< ts::Report * >(ts::CerrReport::Instance()))), uint8_t scrambling=SCRAMBLING_DVB_CSA2) | |
Default constructor. More... | |
TSScrambling (TSScrambling &&other) | |
Move constructor. More... | |
UString | algoName () const |
Get the scrambling algorithm name. More... | |
size_t | cwSize () const |
Get the required control word size in bytes. More... | |
bool | decrypt (TSPacket &pkt) |
Decrypt a TS packet with the CW corresponding to the parity in the packet. More... | |
virtual void | defineArgs (Args &args) override |
Add command line option definitions in an Args. More... | |
bool | encrypt (TSPacket &pkt) |
Encrypt a TS packet with the current parity and corresponding CW. More... | |
bool | explicitScramblingType () const |
Check if a scrambling algorithm was specified on the command line. More... | |
size_t | fixedCWCount () const |
Get the number of fixed control words from the command line. More... | |
bool | hasFixedCW () const |
Check if fixed control words were loaded from the command line. More... | |
virtual bool | loadArgs (DuckContext &duck, Args &args) override |
Load arguments from command line. More... | |
void | rewindFixedCW () |
Restart the list of fixed control words from the beginning. More... | |
uint8_t | scramblingType () |
Get the current scrambling algorithm. More... | |
bool | setCW (const ByteBlock &cw, int parity) |
Set the control word for encrypt and decrypt. More... | |
bool | setEncryptParity (int parity) |
Set the parity of all subsequent encryptions. More... | |
void | setEntropyMode (DVBCSA2::EntropyMode mode) |
Force the entropy mode of DVB-CSA2. More... | |
bool | setScramblingType (uint8_t scrambling, bool overrideExplicit=true) |
Force the usage of a given algorithm. More... | |
bool | start () |
Start the scrambling session. More... | |
bool | stop () |
Stop the scrambling session. More... | |
Transport stream scrambling using multiple algorithms.
Include command line arguments processing.
The scrambling type is indicated by a constant as present in a scrambling_descriptor. Currently, SCRAMBLING_DVB_CSA2, SCRAMBLING_DVB_CISSA1 and SCRAMBLING_ATIS_IIF_IDSA are supported as standard scrambling algorithms. Additionally, the non-standard algorithms are also supported: SCRAMBLING_DUCK_AES_CBC, SCRAMBLING_DUCK_AES_CTR.
With fixed control words from the command line:
ts::TSScrambling::TSScrambling | ( | Report & | report = (*(static_cast< ts::Report * >(ts::CerrReport::Instance()))) , |
uint8_t | scrambling = SCRAMBLING_DVB_CSA2 |
||
) |
Default constructor.
[in,out] | report | Where to report error and information. |
[in] | scrambling | Scrambling type. |
ts::TSScrambling::TSScrambling | ( | const TSScrambling & | other | ) |
Copy constructor.
[in] | other | Other instance to copy. Only the configuration parameters, typically from the command line, are copied. The state of other is not copied. |
ts::TSScrambling::TSScrambling | ( | TSScrambling && | other | ) |
Move constructor.
[in,out] | other | Other instance to copy. Unmodified. Only the configuration parameters, typically from the command line, are copied. The state of other is not copied. |
|
overridevirtual |
Add command line option definitions in an Args.
[in,out] | args | Command line arguments to update. |
Implements ts::ArgsSupplierInterface.
|
overridevirtual |
Load arguments from command line.
Args error indicator is set in case of incorrect arguments.
[in,out] | duck | TSDuck execution context. |
[in,out] | args | Command line arguments. |
Implements ts::ArgsSupplierInterface.
|
inline |
Check if fixed control words were loaded from the command line.
|
inline |
Get the number of fixed control words from the command line.
void ts::TSScrambling::rewindFixedCW | ( | ) |
Restart the list of fixed control words from the beginning.
Ignored if no control words were loaded from the command line.
|
inline |
Get the scrambling algorithm name.
|
inline |
Get the required control word size in bytes.
bool ts::TSScrambling::setScramblingType | ( | uint8_t | scrambling, |
bool | overrideExplicit = true |
||
) |
Force the usage of a given algorithm.
[in] | scrambling | Scrambling type. |
[in] | overrideExplicit | If true, always set the scrambling type. If false, ignore it if an explicit type was set on the command line. |
|
inline |
Get the current scrambling algorithm.
|
inline |
Check if a scrambling algorithm was specified on the command line.
void ts::TSScrambling::setEntropyMode | ( | DVBCSA2::EntropyMode | mode | ) |
Force the entropy mode of DVB-CSA2.
By default, use settings from the command line.
[in] | mode | DVB-CSA2 entropy mode. |
bool ts::TSScrambling::start | ( | ) |
Start the scrambling session.
Reinitialize list of CW's, open files, etc.
bool ts::TSScrambling::stop | ( | ) |
Stop the scrambling session.
Close files, etc.
bool ts::TSScrambling::setCW | ( | const ByteBlock & | cw, |
int | parity | ||
) |
Set the control word for encrypt and decrypt.
[in] | cw | The control word to use. |
[in] | parity | Use the parity of this integer value (odd or even). |
bool ts::TSScrambling::setEncryptParity | ( | int | parity | ) |
Set the parity of all subsequent encryptions.
[in] | parity | Use the parity of this integer value (odd or even). |
bool ts::TSScrambling::encrypt | ( | TSPacket & | pkt | ) |
Encrypt a TS packet with the current parity and corresponding CW.
[in,out] | pkt | The packet to encrypt. |
bool ts::TSScrambling::decrypt | ( | TSPacket & | pkt | ) |
Decrypt a TS packet with the CW corresponding to the parity in the packet.
[in,out] | pkt | The packet to decrypt. |