OSDN Git Service

add tstools.
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / esi.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Authors: Jean le Feuvre\r
5  *                              Copyright (c) 2005-200X ENST\r
6  *                                      All rights reserved\r
7  *\r
8  *  This file is part of GPAC / Elementary Stream Interface sub-project\r
9  *\r
10  *  GPAC is free software; you can redistribute it and/or modify\r
11  *  it under the terms of the GNU Lesser General Public License as published by\r
12  *  the Free Software Foundation; either version 2, or (at your option)\r
13  *  any later version.\r
14  *   \r
15  *  GPAC is distributed in the hope that it will be useful,\r
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
18  *  GNU Lesser General Public License for more details.\r
19  *   \r
20  *  You should have received a copy of the GNU Lesser General Public\r
21  *  License along with this library; see the file COPYING.  If not, write to\r
22  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
23  *\r
24  */\r
25 \r
26 #ifndef _GF_ESI_H_\r
27 #define _GF_ESI_H_\r
28 \r
29 #ifdef __cplusplus\r
30 extern "C" {\r
31 #endif\r
32 \r
33 #include <gpac/tools.h>\r
34 \r
35 /* ESI input control commands*/\r
36 enum\r
37 {\r
38         /*forces a data flush from interface to dest (caller) - used for non-threaded interfaces\r
39                 corresponding parameter: unused\r
40         */\r
41         GF_ESI_INPUT_DATA_FLUSH,\r
42         /*pulls a COMPLETE AU from the stream\r
43                 corresponding parameter: pointer to a GF_ESIPacket to fill. The indut data_len in the packet is used to indicate any padding in bytes\r
44         */\r
45         GF_ESI_INPUT_DATA_PULL,\r
46         /*releases the currently pulled AU from the stream - AU cannot be pulled after that, unless seek happens\r
47                 corresponding parameter: unused\r
48         */\r
49         GF_ESI_INPUT_DATA_RELEASE,\r
50 \r
51         /*destroys any allocated resource by the stream interface*/\r
52         GF_ESI_INPUT_DESTROY,\r
53 };\r
54 \r
55 /* ESI output control commands*/\r
56 enum\r
57 {\r
58         /*forces a data flush from interface to dest (caller) - used for non-threaded interfaces\r
59                 corresponding parameter: unused\r
60         */\r
61         GF_ESI_OUTPUT_DATA_DISPATCH\r
62 };\r
63         \r
64 /*\r
65         data packet flags\r
66 */\r
67 enum\r
68 {\r
69         GF_ESI_DATA_AU_START    =       1,\r
70         GF_ESI_DATA_AU_END              =       1<<1,\r
71         GF_ESI_DATA_AU_RAP              =       1<<2,\r
72         GF_ESI_DATA_HAS_CTS             =       1<<3,\r
73         GF_ESI_DATA_HAS_DTS             =       1<<4,\r
74         GF_ESI_DATA_ENCRYPTED   =       1<<5,\r
75 };\r
76 \r
77 typedef struct __data_packet_ifce\r
78 {\r
79         u32 flags;\r
80         char *data;\r
81         u32 data_len;\r
82         /*DTS, CTS/PTS and duration expressed in media timescale*/\r
83         u64 dts, cts;\r
84         u32 duration;\r
85         u32 pck_sn;\r
86         /*MPEG-4 stuff*/\r
87         u32 au_sn;\r
88         /*for packets using ISMACrypt/OMA/3GPP based crypto*/\r
89         u32 isma_bso;\r
90 } GF_ESIPacket;\r
91 \r
92 struct __esi_video_info\r
93 {\r
94         u32 width, height, par;\r
95         Double FPS;\r
96 };\r
97 struct __esi_audio_info\r
98 {\r
99         u32 sample_rate, nb_channels;\r
100 };\r
101 \r
102 enum\r
103 {\r
104         /*data can be pulled from this stream*/\r
105         GF_ESI_AU_PULL_CAP      =       1,\r
106         /*DTS is signaled for this stream*/\r
107         GF_ESI_SIGNAL_DTS =     1<<1,\r
108         /*no more data to expect from this stream*/\r
109         GF_ESI_STREAM_IS_OVER   =       1<<2,\r
110 };\r
111 \r
112 typedef struct __elementary_stream_ifce \r
113 {\r
114         /*misc caps of the stream*/\r
115         u32 caps;\r
116         /*matches PID for MPEG2, ES_ID for MPEG-4*/\r
117         u32 stream_id;\r
118         /*MPEG-TS program number if any*/\r
119         u16 program_number;\r
120         /*MPEG-4 ST/OTIs*/\r
121         u8 stream_type;\r
122         u8 object_type_indication;\r
123         /* MPEG-4 SL Config */\r
124         GF_SLConfig sl_config;\r
125         /*stream 4CC for non-mpeg codecs, 0 otherwise (stream is identified through StreamType/ObjectType)*/\r
126         u32 fourcc;\r
127         /*packed 3-char language code (4CC with last byte ' ')*/\r
128         u32 lang;\r
129         /*media timescale*/\r
130         u32 timescale;\r
131         /*duration in ms - 0 if unknown*/\r
132         Double duration;\r
133         /*average bit rate in bit/sec - 0 if unknown*/\r
134         u32 bit_rate;\r
135 \r
136         struct __esi_video_info info_video;\r
137         struct __esi_audio_info info_audio;\r
138 \r
139         /*input ES control from caller*/\r
140         GF_Err (*input_ctrl)(struct __elementary_stream_ifce *_self, u32 ctrl_type, void *param);\r
141         /*input user data of interface - usually set by interface owner*/\r
142         void *input_udta;\r
143 \r
144         /*output ES control of destination*/\r
145         GF_Err (*output_ctrl)(struct __elementary_stream_ifce *_self, u32 ctrl_type, void *param);\r
146         /*output user data of interface - usually set during interface setup*/\r
147         void *output_udta;\r
148 \r
149 } GF_ESInterface;\r
150 \r
151 typedef struct __service_ifce\r
152 {\r
153         u32 type;\r
154 \r
155         /*input service control from caller*/\r
156         GF_Err (*input_ctrl)(struct __service_ifce *_self, u32 ctrl_type, void *param);\r
157         /*input user data of interface - usually set by interface owner*/\r
158         void *input_udta;\r
159 \r
160         /*output service control of destination*/\r
161         GF_Err (*output_ctrl)(struct __service_ifce *_self, u32 ctrl_type, void *param);\r
162         /*output user data of interface - usually set during interface setup*/\r
163         void *output_udta;\r
164 \r
165         GF_ESInterface **streams;\r
166         u32 nb_streams;\r
167 } GF_ServiceInterface;\r
168 \r
169 \r
170 typedef struct __data_io\r
171 {\r
172         u32 (*read)(struct __data_io *_self, char *buffer, u32 nb_bytes);\r
173         u32 (*write)(struct __data_io *_self, char *buffer, u32 nb_bytes);\r
174         void *udta;\r
175 } GF_DataIO;\r
176 \r
177 \r
178 #ifdef __cplusplus\r
179 }\r
180 #endif\r
181 \r
182 #endif  //_GF_ESI_H_\r
183 \r