Wasabi ExpressPlay SDK for Embedded Systems
1.10
Main Page
Modules
Data Structures
Files
File List
Globals
Client
ThirdParty
Ts2
Source
Ts2Descriptors.h
Go to the documentation of this file.
1
/*****************************************************************
2
|
3
| MPEG2 Transport Stream - Descriptors
4
|
5
| $Id: Ts2Descriptors.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_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_CA_DESCRIPTOR_TAG 9
33
34
/*----------------------------------------------------------------------
35
| types
36
+---------------------------------------------------------------------*/
37
typedef
struct
TS2_Descriptor
TS2_Descriptor
;
/* forward declaration */
38
39
struct
TS2_Descriptor
{
40
/* public */
41
ATX_UInt8
tag
;
42
ATX_UInt8
length
;
/* length of the fields */
43
ATX_Boolean
is_generic
;
44
45
/* internal */
46
void (*
Destroy
)(
TS2_Descriptor
*
self
);
47
ATX_Result (*
SerializeFields
)(
TS2_Descriptor
*
self
,
48
ATX_Byte* buffer);
49
};
50
51
typedef
struct
{
52
TS2_Descriptor
base
;
53
ATX_UInt8
flags
;
54
}
TS2_AudioStreamDescriptor
;
55
56
typedef
struct
{
57
TS2_Descriptor
base
;
58
ATX_UInt8
flags
;
59
/* following are optional, see flags */
60
ATX_UInt8
profile_and_level_indication
;
61
ATX_UInt8
optional_info
;
62
}
TS2_VideoStreamDescriptor
;
63
64
typedef
struct
{
65
TS2_Descriptor
base
;
66
ATX_UInt16
system_id
;
/* CA_system_ID 16 bit */
67
ATX_UInt16
pid
;
/* CA_PID 13 bit */
68
ATX_Byte*
private_data
;
/* size is TS2_CADescriptor_GetPrivateDataSize */
69
}
TS2_CADescriptor
;
70
71
typedef
struct
{
72
TS2_Descriptor
base
;
73
ATX_Byte*
data
;
/* size is TS2_GenericDescriptor_GetDataSize */
74
}
TS2_GenericDescriptor
;
75
76
77
typedef
enum
{
78
AS_GENERIC
= -1,
79
PMT_DESCRIPTOR
,
80
CAT_DESCRIPTOR
,
81
PMT_ES_DESCRIPTOR
,
82
CA_DESC_PRIVATE_DESCRIPTOR
,
83
KSM_ACCESS_CRITERIA_DESCRIPTOR
84
}
TS2_DescriptorType
;
85
86
/*----------------------------------------------------------------------
87
| functions
88
+---------------------------------------------------------------------*/
89
#ifdef __cplusplus
90
extern
"C"
{
91
#endif
92
93
ATX_Result
94
TS2_Descriptor_Parse
(
const
ATX_Byte* data,
95
ATX_Size* data_size,
/* in/out */
96
TS2_DescriptorType
desc_type,
/* what is the descriptor type / context for parsing */
97
ATX_Boolean as_generic,
/* whether to short-circuit regular parsing and force parsing as generic descriptor */
98
TS2_Descriptor
** desc);
99
107
ATX_Result
108
TS2_Descriptor_Serialize
(
TS2_Descriptor
*
self
,
109
ATX_Byte* buffer);
110
111
ATX_Size
112
TS2_DescriptorList_GetSize
(ATX_List* descs);
113
114
ATX_Result
115
TS2_DescriptorList_Serialize
(ATX_List* descs, ATX_Byte* buffer);
116
117
void
118
TS2_DescriptorList_Destroy
(ATX_List* descs);
119
120
ATX_Result
121
TS2_CADescriptor_Create
(ATX_UInt16 system_id,
122
ATX_UInt16 pid,
123
const
ATX_Byte* private_data,
124
ATX_Size private_data_size,
125
TS2_CADescriptor
** ca_desc);
126
127
#ifdef __cplusplus
128
}
129
#endif
130
131
/*----------------------------------------------------------------------
132
| helpers
133
+---------------------------------------------------------------------*/
138
#define TS2_Descriptor_Destroy(self) (self)->Destroy(self)
139
144
#define TS2_Descriptor_GetSize(self) ((self)->length + 2)
145
146
#define TS2_CADescriptor_GetPrivateDataSize(self) \
147
(ATX_Size)((self->base.length-4))
148
149
#define TS2_VideoStreamDescriptor_Mpeg1OnlyFlag(vdesc) ((vdesc)->flags & 0x04)
150
151
#endif
/* _TS2_DESCRIPTORS_H_ */