Wasabi ExpressPlay SDK for Embedded Systems  1.23.0
Ts2Descriptors.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | MPEG2 Transport Stream - Descriptors
4 |
5 | $Id: Ts2Descriptors.h 310 2016-06-07 23:26:47Z hwa $
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_DESCRIPTORS_H_
18 #define _TS2_DESCRIPTORS_H_
19 
20 /*----------------------------------------------------------------------
21 | includes
22 +---------------------------------------------------------------------*/
23 #include "Atomix.h"
24 
25 /*----------------------------------------------------------------------
26 | constants
27 +---------------------------------------------------------------------*/
28 #define TS2_DESCRIPTOR_HEADER_SIZE 2
29 
30 #define TS2_VIDEO_STREAM_DESCRIPTOR_TAG 2
31 #define TS2_AUDIO_STREAM_DESCRIPTOR_TAG 3
32 #define TS2_REGISTRATION_DESCRIPTOR_TAG 5
33 #define TS2_CA_DESCRIPTOR_TAG 9
34 #define TS2_DOVI_VIDEO_STREAM_DESCRIPTOR_TAG 176 /* 0xB0 */
35 
36 #define TS2_DOVI_FORMAT_IDENTIFIER 0x444F5649
37 
38 #define TS2_DOVI_FLAG_RPU_PRESENT 0x04
39 #define TS2_DOVI_FLAG_EL_PRESENT 0x02
40 #define TS2_DOVI_FLAG_BL_PRESENT 0x01
41 
42 #define TS2_DOVI_RPU_PRESENT(flag) ((flag & TS2_DOVI_FLAG_RPU_PRESENT) > 0)
43 #define TS2_DOVI_EL_PRESENT(flag) ((flag & TS2_DOVI_FLAG_EL_PRESENT) > 0)
44 #define TS2_DOVI_BL_PRESENT(flag) ((flag & TS2_DOVI_FLAG_BL_PRESENT) > 0)
45 
46 /*----------------------------------------------------------------------
47 | types
48 +---------------------------------------------------------------------*/
49 typedef struct TS2_Descriptor TS2_Descriptor; /* forward declaration */
50 
52  /* public */
53  ATX_UInt8 tag;
54  ATX_UInt8 length; /* length of the fields */
55  ATX_Boolean is_generic;
56 
57  /* internal */
58  void (*Destroy)(TS2_Descriptor* self);
59  ATX_Result (*SerializeFields)(TS2_Descriptor* self,
60  ATX_Byte* buffer);
61 };
62 
63 typedef struct {
65  ATX_UInt8 flags;
67 
68 typedef struct {
70  ATX_UInt8 flags;
71  /* following are optional, see flags */
73  ATX_UInt8 optional_info;
75 
76 typedef struct {
78  ATX_UInt16 system_id; /* CA_system_ID 16 bit */
79  ATX_UInt16 pid; /* CA_PID 13 bit */
80  ATX_Byte* private_data; /* size is TS2_CADescriptor_GetPrivateDataSize */
82 
83 typedef struct {
85  ATX_UInt32 format_identifier; /* format id 32 bit */
88 
89 typedef struct {
91  ATX_Byte version_major; /* version major 8 bit */
92  ATX_Byte version_minor; /* version minor 8 bit */
93  ATX_Byte profile; /* profile 7 bit */
94  ATX_Byte level; /* level 6 bit */
95  ATX_UInt8 flags;
96  ATX_UInt16 dependency_pid; /* if (!bl_present_flag) */
98 
99 typedef struct {
101  ATX_Byte* data; /* size is TS2_GenericDescriptor_GetDataSize */
103 
104 
105 typedef enum {
113 
114 /*----------------------------------------------------------------------
115 | functions
116 +---------------------------------------------------------------------*/
117 #ifdef __cplusplus
118 extern "C" {
119 #endif
120 
121 ATX_Result
122 TS2_Descriptor_Parse(const ATX_Byte* data,
123  ATX_Size* data_size, /* in/out */
124  TS2_DescriptorType desc_type, /* what is the descriptor type / context for parsing */
125  ATX_Boolean as_generic, /* whether to short-circuit regular parsing and force parsing as generic descriptor */
126  TS2_Descriptor** desc);
127 
135 ATX_Result
137  ATX_Byte* buffer);
138 
139 ATX_Size
140 TS2_DescriptorList_GetSize(ATX_List* descs);
141 
142 ATX_Result
143 TS2_DescriptorList_Serialize(ATX_List* descs, ATX_Byte* buffer);
144 
145 void
146 TS2_DescriptorList_Destroy(ATX_List* descs);
147 
148 ATX_Result
149 TS2_CADescriptor_Create(ATX_UInt16 system_id,
150  ATX_UInt16 pid,
151  const ATX_Byte* private_data,
152  ATX_Size private_data_size,
153  TS2_CADescriptor** ca_desc);
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 /*----------------------------------------------------------------------
160 | helpers
161 +---------------------------------------------------------------------*/
166 #define TS2_Descriptor_Destroy(self) (self)->Destroy(self)
167 
172 #define TS2_Descriptor_GetSize(self) ((self)->length + 2)
173 
174 #define TS2_CADescriptor_GetPrivateDataSize(self) \
175  (ATX_Size)((self->base.length - 4))
176 
177 #define TS2_RegistrationDescriptor_GetAdditionalInfoSize(self) \
178  (ATX_Size)((self->base.length - 4))
179 
180 #define TS2_VideoStreamDescriptor_Mpeg1OnlyFlag(vdesc) ((vdesc)->flags & 0x04)
181 
182 #endif /* _TS2_DESCRIPTORS_H_ */
Definition: Ts2Descriptors.h:109
Definition: Ts2Descriptors.h:106
ATX_Byte version_minor
Definition: Ts2Descriptors.h:92
ATX_Size TS2_DescriptorList_GetSize(ATX_List *descs)
Definition: Ts2Descriptors.h:111
ATX_Result(* SerializeFields)(TS2_Descriptor *self, ATX_Byte *buffer)
Definition: Ts2Descriptors.h:59
TS2_Descriptor base
Definition: Ts2Descriptors.h:100
ATX_Result TS2_Descriptor_Parse(const ATX_Byte *data, ATX_Size *data_size, TS2_DescriptorType desc_type, ATX_Boolean as_generic, TS2_Descriptor **desc)
ATX_Result TS2_CADescriptor_Create(ATX_UInt16 system_id, ATX_UInt16 pid, const ATX_Byte *private_data, ATX_Size private_data_size, TS2_CADescriptor **ca_desc)
ATX_UInt16 pid
Definition: Ts2Descriptors.h:79
ATX_UInt8 length
Definition: Ts2Descriptors.h:54
ATX_UInt8 optional_info
Definition: Ts2Descriptors.h:73
ATX_UInt16 system_id
Definition: Ts2Descriptors.h:78
ATX_Byte level
Definition: Ts2Descriptors.h:94
TS2_Descriptor base
Definition: Ts2Descriptors.h:64
Definition: Ts2Descriptors.h:83
ATX_Byte profile
Definition: Ts2Descriptors.h:93
ATX_Byte * additional_identification_info
Definition: Ts2Descriptors.h:86
ATX_UInt8 profile_and_level_indication
Definition: Ts2Descriptors.h:72
ATX_UInt8 tag
Definition: Ts2Descriptors.h:53
TS2_Descriptor base
Definition: Ts2Descriptors.h:90
void TS2_DescriptorList_Destroy(ATX_List *descs)
Definition: Ts2Descriptors.h:68
TS2_Descriptor base
Definition: Ts2Descriptors.h:77
ATX_UInt8 flags
Definition: Ts2Descriptors.h:70
ATX_Byte * private_data
Definition: Ts2Descriptors.h:80
Definition: Ts2Descriptors.h:108
Definition: Ts2Descriptors.h:89
ATX_Byte * data
Definition: Ts2Descriptors.h:101
TS2_Descriptor base
Definition: Ts2Descriptors.h:84
ATX_UInt32 format_identifier
Definition: Ts2Descriptors.h:85
Definition: Ts2Descriptors.h:99
ATX_Result TS2_DescriptorList_Serialize(ATX_List *descs, ATX_Byte *buffer)
Definition: Ts2Descriptors.h:63
ATX_UInt8 flags
Definition: Ts2Descriptors.h:65
ATX_UInt16 dependency_pid
Definition: Ts2Descriptors.h:96
Definition: Ts2Descriptors.h:51
Definition: Ts2Descriptors.h:107
ATX_Boolean is_generic
Definition: Ts2Descriptors.h:55
ATX_UInt8 flags
Definition: Ts2Descriptors.h:95
TS2_Descriptor base
Definition: Ts2Descriptors.h:69
ATX_Byte version_major
Definition: Ts2Descriptors.h:91
Definition: Ts2Descriptors.h:110
void(* Destroy)(TS2_Descriptor *self)
Definition: Ts2Descriptors.h:58
Definition: Ts2Descriptors.h:76
TS2_DescriptorType
Definition: Ts2Descriptors.h:105
ATX_Result TS2_Descriptor_Serialize(TS2_Descriptor *self, ATX_Byte *buffer)
Serialize the descriptor.