TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
Transport stream scrambling using multiple algorithms. More...
#include <tsTSScrambling.h>
Public Member Functions | |
TSScrambling (const TSScrambling &other) | |
Copy constructor. | |
TSScrambling (Report &report=(ts::CerrReport::Instance()), uint8_t scrambling=SCRAMBLING_DVB_CSA2) | |
Default constructor. | |
TSScrambling (TSScrambling &&other) | |
Move constructor. | |
UString | algoName () const |
Get the scrambling algorithm name. | |
size_t | cwSize () const |
Get the required control word size in bytes. | |
bool | decrypt (TSPacket &pkt) |
Decrypt a TS packet with the CW corresponding to the parity in the packet. | |
void | defineArgs (Args &args) |
Add command line option definitions in an Args. | |
bool | encrypt (TSPacket &pkt) |
Encrypt a TS packet with the current parity and corresponding CW. | |
DVBCSA2::EntropyMode | entropyMode () const |
Get the entropy mode of DVB-CSA2. | |
bool | explicitScramblingType () const |
Check if a scrambling algorithm was specified on the command line. | |
size_t | fixedCWCount () const |
Get the number of fixed control words from the command line. | |
bool | hasFixedCW () const |
Check if fixed control words were loaded from the command line. | |
bool | loadArgs (DuckContext &duck, Args &args) |
Load arguments from command line. | |
void | rewindFixedCW () |
Restart the list of fixed control words from the beginning. | |
uint8_t | scramblingType () |
Get the current scrambling algorithm. | |
bool | setCW (const ByteBlock &cw, int parity) |
Set the control word for encrypt and decrypt. | |
bool | setEncryptParity (int parity) |
Set the parity of all subsequent encryptions. | |
void | setEntropyMode (DVBCSA2::EntropyMode mode) |
Force the entropy mode of DVB-CSA2. | |
bool | setScramblingType (uint8_t scrambling, bool overrideExplicit=true) |
Force the usage of a given algorithm. | |
bool | start () |
Start the scrambling session. | |
bool | stop () |
Stop the scrambling session. | |
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 = (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. |
void ts::TSScrambling::defineArgs | ( | Args & | args | ) |
Add command line option definitions in an Args.
[in,out] | args | Command line arguments to update. |
bool ts::TSScrambling::loadArgs | ( | DuckContext & | duck, |
Args & | args | ||
) |
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. |
|
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. |
DVBCSA2::EntropyMode ts::TSScrambling::entropyMode | ( | ) | const |
Get the entropy mode of DVB-CSA2.
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. |