Wasabi ExpressPlay SDK for Embedded Systems  1.23.0
Ts2Streams.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | MPEG2 Transport Stream - Streams
4 |
5 | $Id: Ts2Streams.h 363 2018-07-23 08:41:38Z jebaseelir $
6 | Original author: Julien Boeuf
7 |
8 | This software is provided to you pursuant to your agreement
9 | with Intertrust Technologies Corporation ("Intertrust").
10 | This software may be used only in accordance with the terms
11 | of the agreement.
12 |
13 | Copyright (c) 2010-2014 by Intertrust. All rights reserved.
14 |
15 ****************************************************************/
16 
17 #ifndef _TS2_STREAMS_H_
18 #define _TS2_STREAMS_H_
19 
20 /*----------------------------------------------------------------------
21 | includes
22 +---------------------------------------------------------------------*/
23 #include "Atomix.h"
24 #include "Ts2Packet.h"
25 #include "Ts2Protection.h"
26 #include "Ts2Marlin.h"
27 #include "Ts2Config.h"
28 
29 /*----------------------------------------------------------------------
30 | constants
31 +---------------------------------------------------------------------*/
32 #define TS2_INFINITE_PACKET_COUNT -1
33 #define TS2_DEFAULT_MAX_CAT_PACKET_COUNT_FROM_KSM 100
34 #define TS2_DEFAULT_PROGRAM_NUMBER 1
35 
36 /*----------------------------------------------------------------------
37 | types
38 +---------------------------------------------------------------------*/
44 
48 typedef enum {
52  /* To ensure backward compatibility */
54 } TS2_CaSystem;
55 
59 typedef enum {
63 
67 typedef struct {
68  ATX_UInt16 pid;
69  ATX_Byte version_major;
70  ATX_Byte version_minor;
71  ATX_Byte profile;
72  ATX_Byte level;
73  ATX_Boolean rpu_present;
74  ATX_Boolean el_present;
75  ATX_Boolean bl_present;
77 
81 typedef struct {
82  ATX_Boolean sdr_compatible;
85  TS2_DoviSignalingInfo secondary; /* only use with dual pid signaling */
87 
91 typedef struct {
92  void* instance;
93  void (*HandleInfo)(void* instance,
94  const TS2_MarlinRightsInfo* info);
96 
98 
99 typedef enum {
103 
104 #ifdef __cplusplus
105 extern "C" {
106 #endif /* __cplusplus */
107 
108 /*----------------------------------------------------------------------
109 | TS2_StreamInfo_Create
110 +---------------------------------------------------------------------*/
125 TS2_EXPORT ATX_Result
126 TS2_StreamInfo_Create(ATX_InputStream* stream,
127  ATX_Int32 max_packet_count,
128  TS2_StreamInfo** info);
129 
130 
131 
132 /*----------------------------------------------------------------------
133 | TS2_StreamInfo_CreateEx
134 +---------------------------------------------------------------------*/
153 TS2_EXPORT ATX_Result
154 TS2_StreamInfo_CreateEx(ATX_InputStream* stream,
155  ATX_Int32 max_packet_count,
156  ATX_UInt32 max_cat_packet_count_from_ksm,
157  ATX_UInt32 user_program_number,
158  TS2_StreamInfo** info
159  );
160 
161 
172 TS2_EXPORT ATX_Result
174  const ATX_Byte* pmt_table,
175  ATX_Size pmt_len,
176  /* returns */
177  ATX_UInt16* ksmt_pid);
178 
189 TS2_EXPORT ATX_Result
191  const ATX_Byte* cat_table,
192  ATX_Size cat_len,
193  /* returns */
194  ATX_UInt16* mrt_pid);
195 
204 TS2_EXPORT ATX_Result
206  const ATX_Byte* ksm_table,
207  ATX_Size ksm_len);
208 
209 
218 TS2_EXPORT ATX_Result
220  const ATX_Byte* mr_table,
221  ATX_Size mr_len);
222 
229 
236 
243 
253 
263 TS2_StreamInfo_GetTrafficProtectionSystem(const TS2_StreamInfo* self, ATX_UInt32* kdf_type);
264 
272 TS2_EXPORT const char*
274 
282 TS2_EXPORT const char*
284 
292 TS2_EXPORT const char*
294 
302 TS2_EXPORT const char*
304 
312 TS2_EXPORT const char*
314 
324 TS2_EXPORT ATX_List*
326 
336 
342 TS2_EXPORT void
344 
345 /*----------------------------------------------------------------------
346 | TS2_DecryptingStream
347 +---------------------------------------------------------------------*/
362 TS2_EXPORT ATX_Result
363 TS2_DecryptingStream_Create(ATX_InputStream* protected_stream,
364  TS2_CryptoInterface crypto,
365  TS2_MarlinRightsInfoHandler* marlin_handler,
366  ATX_InputStream** decrypting_stream);
367 
368 /*----------------------------------------------------------------------
369 | TS2_AdaptiveAwareEncryptingStream
370 +---------------------------------------------------------------------*/
399 TS2_EXPORT ATX_Result
400 TS2_AdaptiveAwareEncryptingStream_Create(ATX_InputStream* cleartext_stream,
401  const char* content_id,
402  const ATX_Byte* content_key,
403  const ATX_Byte* common_iv,
404  TS2_TrafficProtectionSystem protection,
405  ATX_UInt32 crypto_period,
406  const ATX_Byte* traffic_seed,
407  ATX_Size seed_size,
408  ATX_UInt32 first_segment_index,
409  TS2_RotationPoints* rotation_points,
410  ATX_UInt16 ksm_pid,
411  const char* rights_issuer_url,
412  const char* silent_rights_url,
413  const char* preview_rights_url,
414  const ATX_Byte* access_criteria,
415  ATX_Size access_criteria_size,
416  ATX_InputStream** encrypting_stream);
417 
418 /*----------------------------------------------------------------------
419 | TS2_EncryptingStream
420 +---------------------------------------------------------------------*/
451 TS2_EXPORT ATX_Result
452 TS2_EncryptingStream_Create(ATX_InputStream* cleartext_stream,
453  const char* content_id,
454  const ATX_Byte* content_key,
455  const ATX_Byte* common_iv,
456  TS2_TrafficProtectionSystem protection,
457  ATX_UInt32 crypto_period,
458  const char* rights_issuer_url,
459  const char* silent_rights_url,
460  const char* preview_rights_url,
461  ATX_Boolean skip_payload_unit_start,
462  ATX_Boolean single_key_layer,
463  const ATX_Byte* access_criteria,
464  ATX_Size access_criteria_size,
465  ATX_InputStream** encrypting_stream);
466 
467 /*----------------------------------------------------------------------
468 | common TS2_Stream methods
469 +---------------------------------------------------------------------*/
470 TS2_EXPORT ATX_Result
471 TS2_Stream_ResetSourceStream(ATX_InputStream* self,
472  ATX_InputStream* source);
473 
474 TS2_EXPORT ATX_Result
475 TS2_Stream_ResetDrm(ATX_InputStream* self,
476  const char* content_id,
477  const ATX_Byte* content_key);
478 
479 TS2_EXPORT ATX_Result
480 TS2_Stream_ResetDrmEx(ATX_InputStream* self,
481  const char* content_id,
482  const ATX_Byte* content_key,
483  const ATX_Byte* access_criteria,
484  ATX_Size access_criteria_size);
485 
486 
487 /*----------------------------------------------------------------------
488 | TS2_BbtsParser
489 +---------------------------------------------------------------------*/
495 ATX_Result
497 
502 void
504 
517 ATX_Result
519  ATX_Byte* buffer, ATX_Size length,
520  /* returns */
521  TS2_BbtsParser_Status *status);
522 
530 ATX_Result
532 
533 #ifdef __cplusplus
534 }
535 #endif /* __cplusplus */
536 
537 #endif /* _TS2_STREAMS_H_ */
Dolby Vision signaling information.
Definition: Ts2Streams.h:67
TS2_EXPORT ATX_Result TS2_Stream_ResetSourceStream(ATX_InputStream *self, ATX_InputStream *source)
Definition: Ts2Tables.h:86
Definition: Ts2Marlin.h:45
TS2_EXPORT TS2_KSMT * TS2_StreamInfo_GetKSMT(TS2_StreamInfo *self)
Return the KSMT.
ATX_Result TS2_BbtsParser_Create(TS2_BbtsParser **parser)
Create parser.
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 st...
ATX_Byte version_minor
Definition: Ts2Streams.h:70
Definition: Ts2Streams.h:100
Definition: Ts2Streams.h:49
TS2_EXPORT TS2_PAT * TS2_StreamInfo_GetPAT(TS2_StreamInfo *self)
Return the PAT table.
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.
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.
Definition: Ts2Streams.h:101
TS2_DoviSignalingInfo primary
Definition: Ts2Streams.h:84
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.
Definition: Ts2Streams.h:61
ATX_Byte level
Definition: Ts2Streams.h:72
Definition: Ts2Streams.h:50
ATX_UInt16 pid
Definition: Ts2Streams.h:68
Handler for the Marlin rights information found in a BBTS stream.
Definition: Ts2Streams.h:91
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 const char * TS2_StreamInfo_GetContentIdBase(const TS2_StreamInfo *self)
returns the content id base found in the PMT or CAT.
TS2_EXPORT const char * TS2_StreamInfo_GetSilentRightsUrl(const TS2_StreamInfo *self)
Returns the silent rights URL found in the stream.
struct TS2_RotationPoints TS2_RotationPoints
A TS2_RotationPoints object can be used to specify "rotation points" indicating where in the Transpor...
Definition: Ts2Utils.h:34
Definition: Ts2Iec62455.h:111
TS2_EXPORT TS2_PMT * TS2_StreamInfo_GetPMT(TS2_StreamInfo *self)
Return the PMT table.
TS2_DoviSignaling
Dolby Vision signaling type.
Definition: Ts2Streams.h:59
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.
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...
TS2_CaSystem
Conditional Access (CA) system identifiers.
Definition: Ts2Streams.h:48
#define TS2_EXPORT
Definition: Ts2Config.h:67
void * instance
Definition: Ts2Streams.h:92
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.
ATX_Boolean bl_present
Definition: Ts2Streams.h:75
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 st...
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.
Clients of the MPEG-2 TS SDK API must implement the following interface (TS2_CryptoInterface) to prov...
Definition: Ts2Protection.h:118
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 st...
TS2_EXPORT void TS2_StreamInfo_Destroy(TS2_StreamInfo *self)
Destroys the TS2_StreamInfo object.
ATX_Byte version_major
Definition: Ts2Streams.h:69
TS2_BbtsParser_Status
Definition: Ts2Streams.h:99
TS2_EXPORT ATX_Result TS2_Stream_ResetDrm(ATX_InputStream *self, const char *content_id, const ATX_Byte *content_key)
Definition: Ts2Streams.h:53
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.
ATX_Result TS2_BbtsParser_GetInfo(TS2_BbtsParser *self, TS2_StreamInfo **info)
Get parsed stream info.
TS2_EXPORT const char * TS2_StreamInfo_GetRightsIssuerUrl(const TS2_StreamInfo *self)
Returns the first rights issuer URL found in the stream.
Dolby Vision stream information.
Definition: Ts2Streams.h:81
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.
ATX_Boolean el_present
Definition: Ts2Streams.h:74
void TS2_BbtsParser_Destroy(TS2_BbtsParser *self)
Destroy parser.
ATX_Boolean rpu_present
Definition: Ts2Streams.h:73
TS2_DoviSignalingInfo secondary
Definition: Ts2Streams.h:85
TS2_TrafficProtectionSystem
Definition: Ts2Protection.h:334
TS2_EXPORT TS2_CaSystem TS2_StreamInfo_GetCaSystem(const TS2_StreamInfo *self)
Returns the conditional access (CA) system found in the stream.
Definition: Ts2Streams.h:60
ATX_Byte profile
Definition: Ts2Streams.h:71
TS2_EXPORT const char * TS2_StreamInfo_GetPreviewRightsUrl(const TS2_StreamInfo *self)
Returns the preview rights URL found in the stream.
TS2_EXPORT const char * TS2_StreamInfo_GetContentId(const TS2_StreamInfo *self)
Returns the first content ID found in the stream.
ATX_Result TS2_BbtsParser_Update(TS2_BbtsParser *self, ATX_Byte *buffer, ATX_Size length, TS2_BbtsParser_Status *status)
Update parser with new TS packets.
struct TS2_StreamInfo TS2_StreamInfo
A TS2_StreamInfo object can be used to obtain information about a stream.
Definition: Ts2Streams.h:43
Definition: Ts2Tables.h:91
struct TS2_BbtsParser TS2_BbtsParser
Definition: Ts2Streams.h:97
Definition: Ts2Streams.h:51
ATX_Boolean sdr_compatible
Definition: Ts2Streams.h:82
TS2_DoviSignaling signaling_type
Definition: Ts2Streams.h:83