Wasabi ExpressPlay SDK for Embedded Systems  1.10
Ts2Streams.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | MPEG2 Transport Stream - Streams
4 |
5 | $Id: Ts2Streams.h 296 2014-06-25 11:20:09Z 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 
35 /*----------------------------------------------------------------------
36 | types
37 +---------------------------------------------------------------------*/
43 
47 typedef enum {
51 } TS2_CaSystem;
52 
56 typedef struct {
57  void* instance;
58  void (*HandleInfo)(void* instance,
59  const TS2_MarlinRightsInfo* info);
61 
63 
64 typedef enum {
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif /* __cplusplus */
72 
73 /*----------------------------------------------------------------------
74 | TS2_StreamInfo_Create
75 +---------------------------------------------------------------------*/
90 TS2_EXPORT ATX_Result
91 TS2_StreamInfo_Create(ATX_InputStream* stream,
92  ATX_Int32 max_packet_count,
93  TS2_StreamInfo** info);
94 
95 
96 
97 /*----------------------------------------------------------------------
98 | TS2_StreamInfo_CreateEx
99 +---------------------------------------------------------------------*/
117 TS2_EXPORT ATX_Result
118 TS2_StreamInfo_CreateEx(ATX_InputStream* stream,
119  ATX_Int32 max_packet_count,
120  ATX_UInt32 max_cat_packet_count_from_ksm,
121  TS2_StreamInfo** info
122  );
123 
124 
135 TS2_EXPORT ATX_Result
137  const ATX_Byte* pmt_table,
138  ATX_Size pmt_len,
139  /* returns */
140  ATX_UInt16* ksmt_pid);
141 
152 TS2_EXPORT ATX_Result
154  const ATX_Byte* cat_table,
155  ATX_Size cat_len,
156  /* returns */
157  ATX_UInt16* mrt_pid);
158 
167 TS2_EXPORT ATX_Result
169  const ATX_Byte* ksm_table,
170  ATX_Size ksm_len);
171 
172 
181 TS2_EXPORT ATX_Result
183  const ATX_Byte* mr_table,
184  ATX_Size mr_len);
185 
192 
199 
206 
216 
226 TS2_StreamInfo_GetTrafficProtectionSystem(const TS2_StreamInfo* self, ATX_UInt32* kdf_type);
227 
235 TS2_EXPORT const char*
237 
245 TS2_EXPORT const char*
247 
255 TS2_EXPORT const char*
257 
265 TS2_EXPORT const char*
267 
275 TS2_EXPORT const char*
277 
287 TS2_EXPORT ATX_List*
289 
295 TS2_EXPORT void
297 
298 /*----------------------------------------------------------------------
299 | TS2_DecryptingStream
300 +---------------------------------------------------------------------*/
315 TS2_EXPORT ATX_Result
316 TS2_DecryptingStream_Create(ATX_InputStream* protected_stream,
317  TS2_CryptoInterface crypto,
318  TS2_MarlinRightsInfoHandler* marlin_handler,
319  ATX_InputStream** decrypting_stream);
320 
321 /*----------------------------------------------------------------------
322 | TS2_AdaptiveAwareEncryptingStream
323 +---------------------------------------------------------------------*/
352 TS2_EXPORT ATX_Result
353 TS2_AdaptiveAwareEncryptingStream_Create(ATX_InputStream* cleartext_stream,
354  const char* content_id,
355  const ATX_Byte* content_key,
356  const ATX_Byte* common_iv,
357  TS2_TrafficProtectionSystem protection,
358  ATX_UInt32 crypto_period,
359  const ATX_Byte* traffic_seed,
360  ATX_Size seed_size,
361  ATX_UInt32 first_segment_index,
362  TS2_RotationPoints* rotation_points,
363  ATX_UInt16 ksm_pid,
364  const char* rights_issuer_url,
365  const char* silent_rights_url,
366  const char* preview_rights_url,
367  const ATX_Byte* access_criteria,
368  ATX_Size access_criteria_size,
369  ATX_InputStream** encrypting_stream);
370 
371 /*----------------------------------------------------------------------
372 | TS2_EncryptingStream
373 +---------------------------------------------------------------------*/
404 TS2_EXPORT ATX_Result
405 TS2_EncryptingStream_Create(ATX_InputStream* cleartext_stream,
406  const char* content_id,
407  const ATX_Byte* content_key,
408  const ATX_Byte* common_iv,
409  TS2_TrafficProtectionSystem protection,
410  ATX_UInt32 crypto_period,
411  const char* rights_issuer_url,
412  const char* silent_rights_url,
413  const char* preview_rights_url,
414  ATX_Boolean skip_payload_unit_start,
415  ATX_Boolean single_key_layer,
416  const ATX_Byte* access_criteria,
417  ATX_Size access_criteria_size,
418  ATX_InputStream** encrypting_stream);
419 
420 /*----------------------------------------------------------------------
421 | common TS2_Stream methods
422 +---------------------------------------------------------------------*/
423 TS2_EXPORT ATX_Result
424 TS2_Stream_ResetSourceStream(ATX_InputStream* self,
425  ATX_InputStream* source);
426 
427 TS2_EXPORT ATX_Result
428 TS2_Stream_ResetDrm(ATX_InputStream* self,
429  const char* content_id,
430  const ATX_Byte* content_key);
431 
432 TS2_EXPORT ATX_Result
433 TS2_Stream_ResetDrmEx(ATX_InputStream* self,
434  const char* content_id,
435  const ATX_Byte* content_key,
436  const ATX_Byte* access_criteria,
437  ATX_Size access_criteria_size);
438 
439 
440 /*----------------------------------------------------------------------
441 | TS2_BbtsParser
442 +---------------------------------------------------------------------*/
448 ATX_Result
450 
455 void
457 
470 ATX_Result
472  ATX_Byte* buffer, ATX_Size length,
473  /* returns */
474  TS2_BbtsParser_Status *status);
475 
483 ATX_Result
485 
486 #ifdef __cplusplus
487 }
488 #endif /* __cplusplus */
489 
490 #endif /* _TS2_STREAMS_H_ */