Wasabi ExpressPlay SDK for Embedded Systems
1.23.0
|
#include "Atomix.h"
#include "Ts2Packet.h"
#include "Ts2Protection.h"
#include "Ts2Marlin.h"
#include "Ts2Config.h"
Go to the source code of this file.
Data Structures | |
struct | TS2_DoviSignalingInfo |
Dolby Vision signaling information. More... | |
struct | TS2_DoviStreamInfo |
Dolby Vision stream information. More... | |
struct | TS2_MarlinRightsInfoHandler |
Handler for the Marlin rights information found in a BBTS stream. More... | |
Macros | |
#define | TS2_INFINITE_PACKET_COUNT -1 |
#define | TS2_DEFAULT_MAX_CAT_PACKET_COUNT_FROM_KSM 100 |
#define | TS2_DEFAULT_PROGRAM_NUMBER 1 |
Typedefs | |
typedef struct TS2_StreamInfo | TS2_StreamInfo |
A TS2_StreamInfo object can be used to obtain information about a stream. More... | |
typedef struct TS2_BbtsParser | TS2_BbtsParser |
Enumerations | |
enum | TS2_CaSystem { TS2_UNKNOWN_CA, TS2_NO_CA, TS2_MARLIN_CA, TS2_MARLIN_BBTS_CA = TS2_MARLIN_CA } |
Conditional Access (CA) system identifiers. More... | |
enum | TS2_DoviSignaling { TS2_DOVI_SINGLE_PID, TS2_DOVI_DUAL_PID } |
Dolby Vision signaling type. More... | |
enum | TS2_BbtsParser_Status { TS2_BP_GOT_CONTENTID = (1<<0), TS2_BP_GOT_RIGHTSINFO = (1<<1) } |
Functions | |
TS2_EXPORT ATX_Result | TS2_StreamInfo_Create (ATX_InputStream *stream, ATX_Int32 max_packet_count, TS2_StreamInfo **info) |
Creates a TS2_StreamInfo object from which stream information can be queried. More... | |
TS2_EXPORT ATX_Result | TS2_StreamInfo_CreateEx (ATX_InputStream *stream, ATX_Int32 max_packet_count, ATX_UInt32 max_cat_packet_count_from_ksm, ATX_UInt32 user_program_number, TS2_StreamInfo **info) |
Creates a TS2_StreamInfo object from which stream information can be queried. More... | |
TS2_EXPORT ATX_Result | TS2_StreamInfo_UpdatePMT (TS2_StreamInfo *self, const ATX_Byte *pmt_table, ATX_Size pmt_len, ATX_UInt16 *ksmt_pid) |
Update stream info from the PMT. More... | |
TS2_EXPORT ATX_Result | TS2_StreamInfo_UpdateCAT (TS2_StreamInfo *self, const ATX_Byte *cat_table, ATX_Size cat_len, ATX_UInt16 *mrt_pid) |
Update stream info from the CAT. More... | |
TS2_EXPORT ATX_Result | TS2_StreamInfo_UpdateKSMT (TS2_StreamInfo *self, const ATX_Byte *ksm_table, ATX_Size ksm_len) |
Update stream info from the KSMT/ECM. More... | |
TS2_EXPORT ATX_Result | TS2_StreamInfo_UpdateMRT (TS2_StreamInfo *self, const ATX_Byte *mr_table, ATX_Size mr_len) |
Update stream info from the Marlin Rights Table. More... | |
TS2_EXPORT TS2_KSMT * | TS2_StreamInfo_GetKSMT (TS2_StreamInfo *self) |
Return the KSMT. More... | |
TS2_EXPORT TS2_PAT * | TS2_StreamInfo_GetPAT (TS2_StreamInfo *self) |
Return the PAT table. More... | |
TS2_EXPORT TS2_PMT * | TS2_StreamInfo_GetPMT (TS2_StreamInfo *self) |
Return the PMT table. More... | |
TS2_EXPORT TS2_CaSystem | TS2_StreamInfo_GetCaSystem (const TS2_StreamInfo *self) |
Returns the conditional access (CA) system found in the stream. More... | |
TS2_EXPORT TS2_TrafficProtectionSystem | TS2_StreamInfo_GetTrafficProtectionSystem (const TS2_StreamInfo *self, ATX_UInt32 *kdf_type) |
Returns the traffic protection system found in the mpeg2ts stream. More... | |
TS2_EXPORT const char * | TS2_StreamInfo_GetContentIdBase (const TS2_StreamInfo *self) |
returns the content id base found in the PMT or CAT. More... | |
TS2_EXPORT const char * | TS2_StreamInfo_GetContentId (const TS2_StreamInfo *self) |
Returns the first content ID found in the stream. More... | |
TS2_EXPORT const char * | TS2_StreamInfo_GetRightsIssuerUrl (const TS2_StreamInfo *self) |
Returns the first rights issuer URL found in the stream. More... | |
TS2_EXPORT const char * | TS2_StreamInfo_GetSilentRightsUrl (const TS2_StreamInfo *self) |
Returns the silent rights URL found in the stream. More... | |
TS2_EXPORT const char * | TS2_StreamInfo_GetPreviewRightsUrl (const TS2_StreamInfo *self) |
Returns the preview rights URL found in the stream. More... | |
TS2_EXPORT ATX_List * | TS2_StreamInfo_GetElementaryStreams (const TS2_StreamInfo *self) |
Returns a list of objects representing information about the elementary streams found in the stream. More... | |
TS2_EXPORT const TS2_DoviStreamInfo * | TS2_StreamInfo_GetDoviStreamInfo (const TS2_StreamInfo *self) |
Returns the Dolby Vision information about the elementary streams found in the stream. More... | |
TS2_EXPORT void | TS2_StreamInfo_Destroy (TS2_StreamInfo *self) |
Destroys the TS2_StreamInfo object. More... | |
TS2_EXPORT ATX_Result | TS2_DecryptingStream_Create (ATX_InputStream *protected_stream, TS2_CryptoInterface crypto, TS2_MarlinRightsInfoHandler *marlin_handler, ATX_InputStream **decrypting_stream) |
Creates an ATX_InputStream object that can be used to decrypt a BBTS stream to obtain an MPEG-2 TS stream. More... | |
TS2_EXPORT ATX_Result | TS2_AdaptiveAwareEncryptingStream_Create (ATX_InputStream *cleartext_stream, const char *content_id, const ATX_Byte *content_key, const ATX_Byte *common_iv, TS2_TrafficProtectionSystem protection, ATX_UInt32 crypto_period, const ATX_Byte *traffic_seed, ATX_Size seed_size, ATX_UInt32 first_segment_index, TS2_RotationPoints *rotation_points, ATX_UInt16 ksm_pid, const char *rights_issuer_url, const char *silent_rights_url, const char *preview_rights_url, const ATX_Byte *access_criteria, ATX_Size access_criteria_size, ATX_InputStream **encrypting_stream) |
Creates an ATX_InputStream object that can be used to encrypt an MPEG-2 TS stream to obtain a BBTS stream. More... | |
TS2_EXPORT ATX_Result | TS2_EncryptingStream_Create (ATX_InputStream *cleartext_stream, const char *content_id, const ATX_Byte *content_key, const ATX_Byte *common_iv, TS2_TrafficProtectionSystem protection, ATX_UInt32 crypto_period, const char *rights_issuer_url, const char *silent_rights_url, const char *preview_rights_url, ATX_Boolean skip_payload_unit_start, ATX_Boolean single_key_layer, const ATX_Byte *access_criteria, ATX_Size access_criteria_size, ATX_InputStream **encrypting_stream) |
Creates an ATX_InputStream object that can be used to encrypt an MPEG-2 TS stream to obtain a BBTS stream. More... | |
TS2_EXPORT ATX_Result | TS2_Stream_ResetSourceStream (ATX_InputStream *self, ATX_InputStream *source) |
TS2_EXPORT ATX_Result | TS2_Stream_ResetDrm (ATX_InputStream *self, const char *content_id, const ATX_Byte *content_key) |
TS2_EXPORT ATX_Result | TS2_Stream_ResetDrmEx (ATX_InputStream *self, const char *content_id, const ATX_Byte *content_key, const ATX_Byte *access_criteria, ATX_Size access_criteria_size) |
ATX_Result | TS2_BbtsParser_Create (TS2_BbtsParser **parser) |
Create parser. More... | |
void | TS2_BbtsParser_Destroy (TS2_BbtsParser *self) |
Destroy parser. More... | |
ATX_Result | TS2_BbtsParser_Update (TS2_BbtsParser *self, ATX_Byte *buffer, ATX_Size length, TS2_BbtsParser_Status *status) |
Update parser with new TS packets. More... | |
ATX_Result | TS2_BbtsParser_GetInfo (TS2_BbtsParser *self, TS2_StreamInfo **info) |
Get parsed stream info. More... | |
#define TS2_DEFAULT_MAX_CAT_PACKET_COUNT_FROM_KSM 100 |
#define TS2_DEFAULT_PROGRAM_NUMBER 1 |
#define TS2_INFINITE_PACKET_COUNT -1 |
typedef struct TS2_BbtsParser TS2_BbtsParser |
typedef struct TS2_StreamInfo TS2_StreamInfo |
A TS2_StreamInfo object can be used to obtain information about a stream.
enum TS2_CaSystem |
enum TS2_DoviSignaling |
TS2_EXPORT ATX_Result TS2_AdaptiveAwareEncryptingStream_Create | ( | ATX_InputStream * | cleartext_stream, |
const char * | content_id, | ||
const ATX_Byte * | content_key, | ||
const ATX_Byte * | common_iv, | ||
TS2_TrafficProtectionSystem | protection, | ||
ATX_UInt32 | crypto_period, | ||
const ATX_Byte * | traffic_seed, | ||
ATX_Size | seed_size, | ||
ATX_UInt32 | first_segment_index, | ||
TS2_RotationPoints * | rotation_points, | ||
ATX_UInt16 | ksm_pid, | ||
const char * | rights_issuer_url, | ||
const char * | silent_rights_url, | ||
const char * | preview_rights_url, | ||
const ATX_Byte * | access_criteria, | ||
ATX_Size | access_criteria_size, | ||
ATX_InputStream ** | encrypting_stream | ||
) |
Creates an ATX_InputStream object that can be used to encrypt an MPEG-2 TS stream to obtain a BBTS stream.
Use the ATX_InputStream methods to obtain information about the stream, read from it (to obtain the encrypted bytes), etc.
cleartext_stream | The cleartext MPEG-2 TS stream. |
content_id | A BBTS-compatible content ID. |
content_key | A 16-byte content key. |
common_iv | A 16-byte initialization vector. Can be NULL, in which case the IV will change for each ECM (KSM). |
protection | the traffic protection system. |
crypto_period | Crypto period in seconds, between 1 and 120. |
traffic_seed | Seed for the traffic key and IV. |
seed_size | Size of the traffic seed, in bytes. |
first_segment_index | Index of the first segment. |
rotation_points | Pointer to a TS2_RotationPoints object indicating where the ECMs (KSMs) are to be inserted. |
ksm_pid | PID for the KSM. |
rights_issuer_url | URI template for the rights issuer. |
silent_rights_url | URI template for silent rights acquisition. |
preview_rights_url | URI template for preview rights acquisition. |
access_criteria | Buffer containing access criteria block (Optional) |
access_criteria_size | Size of access_criteria buffer (Optional) |
encrypting_stream | Address of an ATX_InputStream pointer that will be set to refer to the newly-created ATX_InputStream. |
ATX_Result TS2_BbtsParser_Create | ( | TS2_BbtsParser ** | parser | ) |
Create parser.
The TS2_BbtsParser_Destroy must be called to release a successfully created parser object.
parser | pointer to the pointer to parser object returned |
void TS2_BbtsParser_Destroy | ( | TS2_BbtsParser * | self | ) |
Destroy parser.
Release all resources allocated by the parser object.
self | the parser object |
ATX_Result TS2_BbtsParser_GetInfo | ( | TS2_BbtsParser * | self, |
TS2_StreamInfo ** | info | ||
) |
Get parsed stream info.
self | the parser object |
info | pointer to where the pointer to the TS2_StreamInfo object is returned on success. The returned object is owned by the parser object and caller should not release it directly. |
ATX_Result TS2_BbtsParser_Update | ( | TS2_BbtsParser * | self, |
ATX_Byte * | buffer, | ||
ATX_Size | length, | ||
TS2_BbtsParser_Status * | status | ||
) |
Update parser with new TS packets.
The parser searches for the first sync byte and starts from there. If there are partial packets at the end, parser caches contents of the partial packets and concatenates them with data passed in subsequent calls.
self | the parser object |
buffer | pointer to the BBTS packets |
length | number of bytes in the buffer |
status | pointer to the status returned, as a bitfield of TS2_BbtsParser_Status constants. |
TS2_EXPORT ATX_Result TS2_DecryptingStream_Create | ( | ATX_InputStream * | protected_stream, |
TS2_CryptoInterface | crypto, | ||
TS2_MarlinRightsInfoHandler * | marlin_handler, | ||
ATX_InputStream ** | decrypting_stream | ||
) |
Creates an ATX_InputStream object that can be used to decrypt a BBTS stream to obtain an MPEG-2 TS stream.
Use the ATX_InputStream methods to obtain information about the stream, read from it (to obtain the decrypted bytes), etc.
protected_stream | The BBTS stream. |
crypto | Crypto interface that includes a resolver. |
marlin_handler | Optional (can be NULL) handler of Marlin rights information found in the protected stream. |
decrypting_stream | Address of an ATX_InputStream pointer that will be set to refer to the newly-created ATX_InputStream. |
TS2_EXPORT ATX_Result TS2_EncryptingStream_Create | ( | ATX_InputStream * | cleartext_stream, |
const char * | content_id, | ||
const ATX_Byte * | content_key, | ||
const ATX_Byte * | common_iv, | ||
TS2_TrafficProtectionSystem | protection, | ||
ATX_UInt32 | crypto_period, | ||
const char * | rights_issuer_url, | ||
const char * | silent_rights_url, | ||
const char * | preview_rights_url, | ||
ATX_Boolean | skip_payload_unit_start, | ||
ATX_Boolean | single_key_layer, | ||
const ATX_Byte * | access_criteria, | ||
ATX_Size | access_criteria_size, | ||
ATX_InputStream ** | encrypting_stream | ||
) |
Creates an ATX_InputStream object that can be used to encrypt an MPEG-2 TS stream to obtain a BBTS stream.
Use the ATX_InputStream methods to obtain information about the stream, read from it (to obtain the encrypted bytes), etc.
cleartext_stream | The cleartext MPEG-2 TS stream. |
content_id | A BBTS-compatible content ID. |
content_key | A 16-byte content key. |
common_iv | A 16-byte initialization vector. Can be NULL, in which case the IV will change for each ECM (KSM). If single_key_layer has the value ATX_TRUE, then this parameter is ignored and the IV will be 16 0x00 bytes. |
protection | the traffic protection system. |
crypto_period | Crypto period in seconds, between 1 and 120. |
rights_issuer_url | URI template for the rights issuer. |
silent_rights_url | URI template for silent rights acquisition. |
preview_rights_url | URI template for preview rights acquisition. |
skip_payload_unit_start | If ATX_TRUE, the encrypter will not encrypt packets that have the payload unit start indicator flag set. |
single_key_layer | If ATX_TRUE, the encrypter will use the single-key-layer mode. In this case, the common_iv parameter is ignored. |
access_criteria | Buffer containing access criteria block (Optional) |
access_criteria_size | Size of access_criteria buffer (Optional) |
encrypting_stream | Address of an ATX_InputStream pointer that will be set to refer to the newly-created ATX_InputStream. |
TS2_EXPORT ATX_Result TS2_Stream_ResetDrm | ( | ATX_InputStream * | self, |
const char * | content_id, | ||
const ATX_Byte * | content_key | ||
) |
TS2_EXPORT ATX_Result TS2_Stream_ResetDrmEx | ( | ATX_InputStream * | self, |
const char * | content_id, | ||
const ATX_Byte * | content_key, | ||
const ATX_Byte * | access_criteria, | ||
ATX_Size | access_criteria_size | ||
) |
TS2_EXPORT ATX_Result TS2_Stream_ResetSourceStream | ( | ATX_InputStream * | self, |
ATX_InputStream * | source | ||
) |
TS2_EXPORT ATX_Result TS2_StreamInfo_Create | ( | ATX_InputStream * | stream, |
ATX_Int32 | max_packet_count, | ||
TS2_StreamInfo ** | info | ||
) |
Creates a TS2_StreamInfo object from which stream information can be queried.
stream | The MPEG-2 TS or BBTS stream containing the information to be queried. The stream will not be reset after it is internally read to fetch requested info. |
max_packet_count | The maximum number of packets to read. Can be set to TS2_INFINITE_PACKET_COUNT. |
info | Address of a pointer to a TS2_StreamInfo, which this method will set to refer to the TS2_StreamInfo object it creates. |
TS2_EXPORT ATX_Result TS2_StreamInfo_CreateEx | ( | ATX_InputStream * | stream, |
ATX_Int32 | max_packet_count, | ||
ATX_UInt32 | max_cat_packet_count_from_ksm, | ||
ATX_UInt32 | user_program_number, | ||
TS2_StreamInfo ** | info | ||
) |
Creates a TS2_StreamInfo object from which stream information can be queried.
stream | The MPEG-2 TS or BBTS stream containing the information to be queried. The stream will not be reset after it is internally read to fetch requested info. |
max_packet_count | The maximum number of packets to read. Can be set to TS2_INFINITE_PACKET_COUNT. |
max_cat_packet_count_from_ksm | The maximum number of packets which will be searched after KSMT to find the CAT. If the CAT is not found within this specified offset, then an absent CAT is assumed in the stream |
user_program_number | selects specific program/AV-stream-pair in MPEG2-TS stream. |
info | Address of a pointer to a TS2_StreamInfo, which this method will set to refer to the TS2_StreamInfo object it creates. |
TS2_EXPORT void TS2_StreamInfo_Destroy | ( | TS2_StreamInfo * | self | ) |
Destroys the TS2_StreamInfo object.
self | The TS2_StreamInfo object. |
TS2_EXPORT TS2_CaSystem TS2_StreamInfo_GetCaSystem | ( | const TS2_StreamInfo * | self | ) |
Returns the conditional access (CA) system found in the stream.
self | The TS2_StreamInfo object. |
TS2_EXPORT const char* TS2_StreamInfo_GetContentId | ( | const TS2_StreamInfo * | self | ) |
Returns the first content ID found in the stream.
This method is only relevant if the CA system is TS2_MARLIN_CA.
self | The TS2_StreamInfo object. |
TS2_EXPORT const char* TS2_StreamInfo_GetContentIdBase | ( | const TS2_StreamInfo * | self | ) |
returns the content id base found in the PMT or CAT.
This method is only relevant if the CA system is TS2_MARLIN_CA
self | the TS2_StreamInfo object |
TS2_EXPORT const TS2_DoviStreamInfo* TS2_StreamInfo_GetDoviStreamInfo | ( | const TS2_StreamInfo * | self | ) |
Returns the Dolby Vision information about the elementary streams found in the stream.
self | The TS2_StreamInfo object. |
TS2_EXPORT ATX_List* TS2_StreamInfo_GetElementaryStreams | ( | const TS2_StreamInfo * | self | ) |
Returns a list of objects representing information about the elementary streams found in the stream.
self | The TS2_StreamInfo object. |
TS2_EXPORT TS2_KSMT* TS2_StreamInfo_GetKSMT | ( | TS2_StreamInfo * | self | ) |
Return the KSMT.
self | pointer to the stream info object |
TS2_EXPORT TS2_PAT* TS2_StreamInfo_GetPAT | ( | TS2_StreamInfo * | self | ) |
Return the PAT table.
self | pointer to the stream info object |
TS2_EXPORT TS2_PMT* TS2_StreamInfo_GetPMT | ( | TS2_StreamInfo * | self | ) |
Return the PMT table.
self | pointer to the stream info object |
TS2_EXPORT const char* TS2_StreamInfo_GetPreviewRightsUrl | ( | const TS2_StreamInfo * | self | ) |
Returns the preview rights URL found in the stream.
This method is only relevant if the CA system is TS2_MARLIN_CA.
self | The TS2_StreamInfo object. |
TS2_EXPORT const char* TS2_StreamInfo_GetRightsIssuerUrl | ( | const TS2_StreamInfo * | self | ) |
Returns the first rights issuer URL found in the stream.
This method is only relevant if the CA system is TS2_MARLIN_CA.
self | The TS2_StreamInfo object. |
TS2_EXPORT const char* TS2_StreamInfo_GetSilentRightsUrl | ( | const TS2_StreamInfo * | self | ) |
Returns the silent rights URL found in the stream.
This method is only relevant if the CA system is TS2_MARLIN_CA.
self | The TS2_StreamInfo object. |
TS2_EXPORT TS2_TrafficProtectionSystem TS2_StreamInfo_GetTrafficProtectionSystem | ( | const TS2_StreamInfo * | self, |
ATX_UInt32 * | kdf_type | ||
) |
Returns the traffic protection system found in the mpeg2ts stream.
self | the TS2_StreamInfo object |
kdf_type | pointer to where the key derivation function type is returned, one of TS2_KEY_DERIVATION_FUNCTION_* values |
TS2_EXPORT ATX_Result TS2_StreamInfo_UpdateCAT | ( | TS2_StreamInfo * | self, |
const ATX_Byte * | cat_table, | ||
ATX_Size | cat_len, | ||
ATX_UInt16 * | mrt_pid | ||
) |
Update stream info from the CAT.
The CAT must be a complete table. The Marlin Rights Table PID is returned in mrt_pid.
self | pointer to the stream info object |
cat_table | pointer to the CAT data |
cat_len | length of the cat_table in bytes |
mrt_pid | pointer to where the Marlin Rights Table PID is returned |
TS2_EXPORT ATX_Result TS2_StreamInfo_UpdateKSMT | ( | TS2_StreamInfo * | self, |
const ATX_Byte * | ksm_table, | ||
ATX_Size | ksm_len | ||
) |
Update stream info from the KSMT/ECM.
The KSM table must be complete.
self | pointer to the stream info object |
ksm_table | pointer to the KSM table data |
ksm_len | length of the ksm_table in bytes |
TS2_EXPORT ATX_Result TS2_StreamInfo_UpdateMRT | ( | TS2_StreamInfo * | self, |
const ATX_Byte * | mr_table, | ||
ATX_Size | mr_len | ||
) |
Update stream info from the Marlin Rights Table.
The MRT must be a complete table.
self | pointer to the stream info object |
mr_table | pointer to the KSM table data |
mr_len | length of the ksm_table in bytes |
TS2_EXPORT ATX_Result TS2_StreamInfo_UpdatePMT | ( | TS2_StreamInfo * | self, |
const ATX_Byte * | pmt_table, | ||
ATX_Size | pmt_len, | ||
ATX_UInt16 * | ksmt_pid | ||
) |
Update stream info from the PMT.
The PMT must be a complete table. KSM/ECM PID is returned in ksmt_pid.
self | pointer to the stream info object |
pmt_table | pointer to the PMT data |
pmt_len | length of the pmt data in bytes |
ksmt_pid | pointer to where the KSM/ECM PID is returned |