3 * Copyright (C) 2013 Edward Hervey
6 * Edward Hervey <edward@collabora.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
24 #ifndef GST_WFD_TS_SECTION_H
25 #define GST_WFD_TS_SECTION_H
28 //#include "gstwfdtsdescriptor.h"
32 typedef struct _GstWFDTSSection GstWFDTSSection;
34 #define GST_TYPE_WFD_TS_SECTION (gst_wfd_ts_section_get_type())
35 #define GST_WFD_TS_SECTION(section) ((GstWFDTSSection*) section)
37 #define GST_WFD_TS_SECTION_TYPE(section) (GST_WFD_TS_SECTION (section)->section_type)
39 GType gst_wfd_ts_section_get_type (void);
42 * GstWFDTSSectionType:
43 * @GST_WFD_TS_SECTION_UNKNOWN: Unknown section type
44 * @GST_WFD_TS_SECTION_PAT: Program Association Table (ISO/IEC 13818-1)
45 * @GST_WFD_TS_SECTION_PMT: Program Map Table (ISO/IEC 13818-1)
46 * @GST_WFD_TS_SECTION_CAT: Conditional Access Table (ISO/IEC 13818-1)
47 * @GST_WFD_TS_SECTION_TSDT: Transport Stream Description Table (ISO/IEC 13818-1)
48 * @GST_WFD_TS_SECTION_EIT: Event Information Table (EN 300 468)
49 * @GST_WFD_TS_SECTION_NIT: Network Information Table (ISO/IEC 13818-1 / EN 300 468)
50 * @GST_WFD_TS_SECTION_BAT: Bouquet Association Table ((EN 300 468)
51 * @GST_WFD_TS_SECTION_SDT: Service Description Table (EN 300 468)
52 * @GST_WFD_TS_SECTION_TDT: Time and Date Table (EN 300 468)
53 * @GST_WFD_TS_SECTION_TOT: Time Offset Table (EN 300 468)
54 * @GST_WFD_TS_SECTION_ATSC_TVCT: ATSC Terrestrial Virtual Channel Table (A65)
55 * @GST_WFD_TS_SECTION_ATSC_CVCT: ATSC Cable Virtual Channel Table (A65)
56 * @GST_WFD_TS_SECTION_ATSC_MGT: ATSC Master Guide Table (A65)
57 * @GST_WFD_TS_SECTION_ATSC_ETT: ATSC Extended Text Table (A65)
58 * @GST_WFD_TS_SECTION_ATSC_EIT: ATSC Event Information Table (A65)
59 * @GST_WFD_TS_SECTION_ATSC_STT: ATSC System Time Table (A65)
61 * Types of #GstWFDTSSection that the library handles.
64 GST_WFD_TS_SECTION_UNKNOWN = 0,
65 GST_WFD_TS_SECTION_PAT,
66 GST_WFD_TS_SECTION_PMT,
67 GST_WFD_TS_SECTION_CAT,
68 GST_WFD_TS_SECTION_TSDT,
69 GST_WFD_TS_SECTION_EIT,
70 GST_WFD_TS_SECTION_NIT,
71 GST_WFD_TS_SECTION_BAT,
72 GST_WFD_TS_SECTION_SDT,
73 GST_WFD_TS_SECTION_TDT,
74 GST_WFD_TS_SECTION_TOT,
75 GST_WFD_TS_SECTION_ATSC_TVCT,
76 GST_WFD_TS_SECTION_ATSC_CVCT,
77 GST_WFD_TS_SECTION_ATSC_MGT,
78 GST_WFD_TS_SECTION_ATSC_ETT,
79 GST_WFD_TS_SECTION_ATSC_EIT,
80 GST_WFD_TS_SECTION_ATSC_STT
81 } GstWFDTSSectionType;
84 * GstWFDTSSectionTableID:
86 * Values for a #GstWFDTSSection table_id
88 * These are the registered ITU H.222.0 | ISO/IEC 13818-1 table_id variants.
90 * see also #GstWFDTSSectionATSCTableID, #GstWFDTSSectionDVBTableID, and
91 * #GstWFDTSSectionSCTETableID
94 /* ITU H.222.0 / IEC 13818-1 */
95 GST_MTS_TABLE_ID_PROGRAM_ASSOCIATION = 0x00,
96 GST_MTS_TABLE_ID_CONDITIONAL_ACCESS = 0x01,
97 GST_MTS_TABLE_ID_TS_PROGRAM_MAP = 0x02,
98 GST_MTS_TABLE_ID_TS_DESCRIPTION = 0x03,
99 GST_MTS_TABLE_ID_14496_SCENE_DESCRIPTION = 0x04,
100 GST_MTS_TABLE_ID_14496_OBJET_DESCRIPTOR = 0x05,
101 GST_MTS_TABLE_ID_METADATA = 0x06,
102 GST_MTS_TABLE_ID_IPMP_CONTROL_INFORMATION = 0x07,
104 /* 0x08 - 0x39 : ITU H.222.0 | ISO/IEC 13818-1 reserved */
106 /* IEC 13818-6 (DSM-CC) */
107 GST_MTS_TABLE_ID_DSM_CC_MULTIPROTO_ENCAPSULATED_DATA = 0x3A,
108 GST_MTS_TABLE_ID_DSM_CC_U_N_MESSAGES = 0x3B,
109 GST_MTS_TABLE_ID_DSM_CC_DOWNLOAD_DATA_MESSAGES = 0x3C,
110 GST_MTS_TABLE_ID_DSM_CC_STREAM_DESCRIPTORS = 0x3D,
111 GST_MTS_TABLE_ID_DSM_CC_PRIVATE_DATA = 0x3E,
112 GST_MTS_TABLE_ID_DSM_CC_ADDRESSABLE_SECTIONS = 0x3F,
115 GST_MTS_TABLE_ID_UNSET = 0xFF
117 } GstWFDTSSectionTableID;
119 typedef gboolean (*GstWFDTSPacketizeFunc) (GstWFDTSSection *section);
123 * @section_type: The type of section
124 * @pid: The pid on which this section was found
125 * @table_id: The table id of this section
126 * @subtable_extension: This meaning differs per section. See the documentation
127 * of the parsed section type for the meaning of this field
128 * @version_number: Version of the section.
129 * @current_next_indicator: Applies to current/next stream or not
130 * @section_number: Number of the section (if multiple)
131 * @last_section_number: Number of the last expected section (if multiple)
134 * Mpeg-TS Section Information (SI) (ISO/IEC 13818-1)
136 struct _GstWFDTSSection
139 GstMiniObject parent;
142 GstWFDTSSectionType section_type;
147 guint16 subtable_extension;
148 guint8 version_number;
150 gboolean current_next_indicator;
152 guint8 section_number;
153 guint8 last_section_number;
158 /* data: Points to beginning of section data
159 * i.e. the first byte is the table_id field */
161 /* section_length: length of data (including final CRC if present) */
162 gsize section_length;
163 /* cached_parsed: cached copy of parsed section */
164 gpointer *cached_parsed;
165 /* destroy_parsed: function to clear cached_parsed */
166 GDestroyNotify destroy_parsed;
167 /* offset: offset of the section within the container stream */
169 /* short_section: TRUE if section_syntax_indicator == 0
170 * FIXME : Maybe make public later on when allowing creation of
171 * sections to that people can create private short sections ? */
172 gboolean short_section;
173 GstWFDTSPacketizeFunc packetizer;
175 /* Padding for future extension */
176 gpointer _gst_reserved[GST_PADDING];
179 GBytes *gst_wfd_ts_section_get_data (GstWFDTSSection *section);
182 #define GST_TYPE_MPEGTS_PAT_PROGRAM (gst_wfd_ts_pat_program_get_type())
184 typedef struct _GstMpegtsPatProgram GstMpegtsPatProgram;
186 * GstMpegtsPatProgram:
187 * @program_number: the program number
188 * @network_or_program_map_PID: the network of program map PID
190 * A program entry from a Program Association Table (ITU H.222.0, ISO/IEC 13818-1).
192 struct _GstMpegtsPatProgram
194 guint16 program_number;
195 guint16 network_or_program_map_PID;
198 GPtrArray *gst_wfd_ts_section_get_pat (GstWFDTSSection *section);
199 GType gst_wfd_ts_pat_program_get_type (void);
201 GPtrArray *gst_wfd_ts_pat_new (void);
202 GstMpegtsPatProgram *gst_wfd_ts_pat_program_new (void);
203 GstWFDTSSection *gst_wfd_ts_section_from_pat (GPtrArray * programs,
208 GPtrArray *gst_wfd_ts_section_get_cat (GstWFDTSSection *section);
211 typedef struct _GstWFDTSPMTStream GstWFDTSPMTStream;
212 typedef struct _GstWFDTSPMT GstWFDTSPMT;
213 #define GST_TYPE_WFD_TS_PMT (gst_wfd_ts_pmt_get_type())
214 #define GST_TYPE_WFD_TS_PMT_STREAM (gst_wfd_ts_pmt_stream_get_type())
217 * GstMpegtsStreamType:
218 * @GST_WFD_TS_STREAM_TYPE_RESERVED_00: ITU-T | ISO/IEC Reserved
219 * @GST_WFD_TS_STREAM_TYPE_VIDEO_MPEG1: ISO/IEC 11172-2 Video
220 * @GST_WFD_TS_STREAM_TYPE_VIDEO_MPEG2: Rec. ITU-T H.262 | ISO/IEC 13818-2
221 * Video or ISO/IEC 11172-2 constrained parameter video stream
222 * @GST_WFD_TS_STREAM_TYPE_AUDIO_MPEG1: ISO/IEC 11172-3 Audio
223 * @GST_WFD_TS_STREAM_TYPE_AUDIO_MPEG2: ISO/IEC 13818-3 Audio
224 * @GST_WFD_TS_STREAM_TYPE_PRIVATE_SECTIONS: private sections
225 * @GST_WFD_TS_STREAM_TYPE_PRIVATE_PES_PACKETS: PES packets containing private data
226 * @GST_WFD_TS_STREAM_TYPE_MHEG: ISO/IEC 13522 MHEG
227 * @GST_WFD_TS_STREAM_TYPE_DSM_CC: Annex A DSM-CC
228 * @GST_WFD_TS_STREAM_TYPE_H_222_1: Rec. ITU-T H.222.1
229 * @GST_WFD_TS_STREAM_TYPE_DSMCC_A: ISO/IEC 13818-6 type A
230 * @GST_WFD_TS_STREAM_TYPE_DSMCC_B: ISO/IEC 13818-6 type B
231 * @GST_WFD_TS_STREAM_TYPE_DSMCC_C: ISO/IEC 13818-6 type C
232 * @GST_WFD_TS_STREAM_TYPE_DSMCC_D: ISO/IEC 13818-6 type D
233 * @GST_WFD_TS_STREAM_TYPE_AUXILIARY: auxiliary streams
234 * @GST_WFD_TS_STREAM_TYPE_AUDIO_AAC_ADTS: ISO/IEC 13818-7 Audio with ADTS
236 * @GST_WFD_TS_STREAM_TYPE_VIDEO_MPEG4: ISO/IEC 14496-2 Visual
237 * @GST_WFD_TS_STREAM_TYPE_AUDIO_AAC_LATM: ISO/IEC 14496-3 Audio with the LATM
238 * transport syntax as defined in ISO/IEC 14496-3
239 * @GST_WFD_TS_STREAM_TYPE_SL_FLEXMUX_PES_PACKETS: ISO/IEC 14496-1
240 * SL-packetized stream or FlexMux stream carried in PES packets
241 * @GST_WFD_TS_STREAM_TYPE_SL_FLEXMUX_SECTIONS: ISO/IEC 14496-1 SL-packetized
242 * stream or FlexMux stream carried in ISO/IEC 14496_sections
243 * @GST_WFD_TS_STREAM_TYPE_SYNCHRONIZED_DOWNLOAD: ISO/IEC 13818-6 Synchronized
245 * @GST_WFD_TS_STREAM_TYPE_METADATA_PES_PACKETS: Metadata carried in PES packets
246 * @GST_WFD_TS_STREAM_TYPE_METADATA_SECTIONS: Metadata carried in metadata_sections
247 * @GST_WFD_TS_STREAM_TYPE_METADATA_DATA_CAROUSEL: Metadata carried in ISO/IEC
248 * 13818-6 Data Carousel
249 * @GST_WFD_TS_STREAM_TYPE_METADATA_OBJECT_CAROUSEL: Metadata carried in
250 * ISO/IEC 13818-6 Object Carousel
251 * @GST_WFD_TS_STREAM_TYPE_METADATA_SYNCHRONIZED_DOWNLOAD: Metadata carried in
252 * ISO/IEC 13818-6 Synchronized Download Protocol
253 * @GST_WFD_TS_STREAM_TYPE_MPEG2_IPMP: IPMP stream (defined in ISO/IEC 13818-11,
255 * @GST_WFD_TS_STREAM_TYPE_VIDEO_H264: AVC video stream conforming to one or
256 * more profiles defined in Annex A of Rec. ITU-T H.264 | ISO/IEC 14496-10 or
257 * AVC video sub-bitstream of SVC as defined in 2.1.78 or MVC base view
258 * sub-bitstream, as defined in 2.1.85, or AVC video sub-bitstream of MVC, as
260 * @GST_WFD_TS_STREAM_TYPE_AUDIO_AAC_CLEAN: ISO/IEC 14496-3 Audio, without
261 * using any additional transport syntax, such as DST, ALS and SLS
262 * @GST_WFD_TS_STREAM_TYPE_MPEG4_TIMED_TEXT: ISO/IEC 14496-17 Text
263 * @GST_WFD_TS_STREAM_TYPE_VIDEO_RVC: Auxiliary video stream as defined in
265 * @GST_WFD_TS_STREAM_TYPE_VIDEO_H264_SVC_SUB_BITSTREAM: SVC video sub-bitstream
266 * of an AVC video stream conforming to one or more profiles defined in Annex G
267 * of Rec. ITU-T H.264 | ISO/IEC 14496-10
268 * @GST_WFD_TS_STREAM_TYPE_VIDEO_H264_MVC_SUB_BITSTREAM: MVC video sub-bitstream
269 * of an AVC video stream conforming to one or more profiles defined in Annex H
270 * of Rec. ITU-T H.264 | ISO/IEC 14496-10
271 * @GST_WFD_TS_STREAM_TYPE_VIDEO_JP2K: Video stream conforming to one or more
272 * profiles as defined in Rec. ITU-T T.800 | ISO/IEC 15444-1
273 * @GST_WFD_TS_STREAM_TYPE_VIDEO_MPEG2_STEREO_ADDITIONAL_VIEW: Additional view
274 * Rec. ITU-T H.262 | ISO/IEC 13818-2 video stream for service-compatible
275 * stereoscopic 3D services
276 * @GST_WFD_TS_STREAM_TYPE_VIDEO_H264_STEREO_ADDITIONAL_VIEW: Additional view
277 * Rec. ITU-T H.264 | ISO/IEC 14496-10 video stream conforming to one or more
278 * profiles defined in Annex A for service-compatible stereoscopic 3D services
279 * @GST_WFD_TS_STREAM_TYPE_IPMP_STREAM: IPMP stream
281 * Type of mpeg-ts stream type.
283 * These values correspond to the base standard registered types. Depending
284 * on the variant of mpeg-ts being used (Bluray, ATSC, DVB, ...), other
285 * types might also be used, but will not conflict with these.
287 * Corresponds to table 2-34 of ITU H.222.0 | ISO/IEC 13818-1
290 GST_WFD_TS_STREAM_TYPE_RESERVED_00 = 0x00,
291 GST_WFD_TS_STREAM_TYPE_VIDEO_MPEG1 = 0x01,
292 GST_WFD_TS_STREAM_TYPE_VIDEO_MPEG2 = 0x02,
293 GST_WFD_TS_STREAM_TYPE_AUDIO_MPEG1 = 0x03,
294 GST_WFD_TS_STREAM_TYPE_AUDIO_MPEG2 = 0x04,
295 GST_WFD_TS_STREAM_TYPE_PRIVATE_SECTIONS = 0x05,
296 GST_WFD_TS_STREAM_TYPE_PRIVATE_PES_PACKETS = 0x06,
297 GST_WFD_TS_STREAM_TYPE_MHEG = 0x07,
298 GST_WFD_TS_STREAM_TYPE_DSM_CC = 0x08,
299 GST_WFD_TS_STREAM_TYPE_H_222_1 = 0x09,
300 GST_WFD_TS_STREAM_TYPE_DSMCC_A = 0x0a,
301 GST_WFD_TS_STREAM_TYPE_DSMCC_B = 0x0b,
302 GST_WFD_TS_STREAM_TYPE_DSMCC_C = 0x0c,
303 GST_WFD_TS_STREAM_TYPE_DSMCC_D = 0x0d,
304 GST_WFD_TS_STREAM_TYPE_AUXILIARY = 0x0e,
305 GST_WFD_TS_STREAM_TYPE_AUDIO_AAC_ADTS = 0x0f,
306 GST_WFD_TS_STREAM_TYPE_VIDEO_MPEG4 = 0x10,
307 GST_WFD_TS_STREAM_TYPE_AUDIO_AAC_LATM = 0x11,
308 GST_WFD_TS_STREAM_TYPE_SL_FLEXMUX_PES_PACKETS = 0x12,
309 GST_WFD_TS_STREAM_TYPE_SL_FLEXMUX_SECTIONS = 0x13,
310 GST_WFD_TS_STREAM_TYPE_SYNCHRONIZED_DOWNLOAD = 0x14,
311 GST_WFD_TS_STREAM_TYPE_METADATA_PES_PACKETS = 0x15,
312 GST_WFD_TS_STREAM_TYPE_METADATA_SECTIONS = 0x16,
313 GST_WFD_TS_STREAM_TYPE_METADATA_DATA_CAROUSEL = 0x17,
314 GST_WFD_TS_STREAM_TYPE_METADATA_OBJECT_CAROUSEL = 0x18,
315 GST_WFD_TS_STREAM_TYPE_METADATA_SYNCHRONIZED_DOWNLOAD = 0x19,
316 GST_WFD_TS_STREAM_TYPE_MPEG2_IPMP = 0x1a,
317 GST_WFD_TS_STREAM_TYPE_VIDEO_H264 = 0x1b,
318 GST_WFD_TS_STREAM_TYPE_AUDIO_AAC_CLEAN = 0x1c,
319 GST_WFD_TS_STREAM_TYPE_MPEG4_TIMED_TEXT = 0x1d,
320 GST_WFD_TS_STREAM_TYPE_VIDEO_RVC = 0x1e,
321 GST_WFD_TS_STREAM_TYPE_VIDEO_H264_SVC_SUB_BITSTREAM = 0x1f,
322 GST_WFD_TS_STREAM_TYPE_VIDEO_H264_MVC_SUB_BITSTREAM = 0x20,
323 GST_WFD_TS_STREAM_TYPE_VIDEO_JP2K = 0x21,
324 GST_WFD_TS_STREAM_TYPE_VIDEO_MPEG2_STEREO_ADDITIONAL_VIEW = 0x22,
325 GST_WFD_TS_STREAM_TYPE_VIDEO_H264_STEREO_ADDITIONAL_VIEW = 0x23,
326 GST_WFD_TS_STREAM_TYPE_VIDEO_HEVC = 0x24,
327 /* 0x24 - 0x7e : Rec. ITU-T H.222.0 | ISO/IEC 13818-1 Reserved */
328 GST_WFD_TS_STREAM_TYPE_IPMP_STREAM = 0x7f
329 /* 0x80 - 0xff : User Private (or defined in other specs) */
330 } GstMpegtsStreamType;
334 * @stream_type: the type of stream. See #GstMpegtsStreamType
335 * @pid: the PID of the stream
336 * @descriptors: (element-type GstMpegtsDescriptor): the descriptors of the
339 * An individual stream definition.
341 struct _GstWFDTSPMTStream
346 GPtrArray *descriptors;
351 * @pcr_pid: PID of the stream containing PCR
352 * @descriptors: (element-type GstMpegtsDescriptor): array of #GstMpegtsDescriptor
353 * @streams: (element-type GstWFDTSPMTStream): Array of #GstWFDTSPMTStream
355 * Program Map Table (ISO/IEC 13818-1).
357 * The program_number is contained in the subtable_extension field of the
358 * container #GstWFDTSSection.
363 guint16 program_number;
365 GPtrArray *descriptors;
369 GType gst_wfd_ts_pmt_get_type (void);
370 GType gst_wfd_ts_pmt_stream_get_type (void);
372 GstWFDTSPMT *gst_wfd_ts_pmt_new (void);
373 GstWFDTSPMTStream *gst_wfd_ts_pmt_stream_new (void);
374 const GstWFDTSPMT *gst_wfd_ts_section_get_pmt (GstWFDTSSection *section);
375 GstWFDTSSection *gst_wfd_ts_section_from_pmt (GstWFDTSPMT *pmt, guint16 pid);
379 GPtrArray *gst_wfd_ts_section_get_tsdt (GstWFDTSSection *section);
384 #define gst_wfd_ts_section_ref(section) ((GstWFDTSSection*) gst_mini_object_ref (GST_MINI_OBJECT_CAST (section)))
385 #define gst_wfd_ts_section_unref(section) (gst_mini_object_unref (GST_MINI_OBJECT_CAST (section)))
387 GstMessage *gst_message_new_wfd_ts_section (GstObject *parent, GstWFDTSSection *section);
388 gboolean gst_wfd_ts_section_send_event (GstWFDTSSection * section, GstElement * element);
389 GstWFDTSSection *gst_event_parse_wfd_ts_section (GstEvent * event);
391 GstWFDTSSection *gst_message_parse_wfd_ts_section (GstMessage *message);
393 GstWFDTSSection *gst_wfd_ts_section_new (guint16 pid,
397 guint8 *gst_wfd_ts_section_packetize (GstWFDTSSection * section, gsize * output_size);
400 void gst_wfd_ts_initialize (void);
405 #endif /* GST_WFD_TS_SECTION_H */