source: svn/trunk/zasc/app_c/DST_Parser.h @ 45

Last change on this file since 45 was 2, checked in by jglee, 11 years ago

first commit

File size: 38.9 KB
Line 
1#ifndef __DST_PARSER_H__
2#define __DST_PARSER_H__
3
4#include "DST_Common.h"
5
6/* macros */
7#if 0
8___Definitions___()
9#endif
10
11/*
12 * Section syntax macro definitions
13 */
14
15#define SECTION_TID           0              /* TID index                    */
16#define SECTION_LEN_HI        1              /* length hi index              */
17#define SECTION_LEN_LO        2              /* length lo index              */
18#define SECTION_TID_EXT_HI        3              /* Table ID extension high index*/
19#define SECTION_TID_EXT_LO    4              /* Table ID extension low index */
20#define SECTION_VERSION       5              /* version number index         */
21#define SECTION_NUM           6              /* section number index         */
22#define SECTION_NUM_LAST      7              /* last section number index    */
23#define SECTION_HEADER_LENGTH 8                          /* number of bytes in section header */
24
25#define SECTION_LEN_MASK      0x0FFF         /* length bit mask              */
26#define SECTION_VERSION_MASK  0x3E           /* version number bit mask      */
27#define SECTION_VERSION_SHIFT 1                  /* version number bit shift     */
28#define SECTION_CNI_MASK      0x01           /* current next indicator mask      */
29
30#define PID_MASK                          0x1FFF                 /* Mask for various places a PID is used */
31#define PSIMODE_EAGER_FLAG              8
32
33#define MAX_PSI_MPEG_DATA       4096
34#define MAX_PSI_SECTIONS        256
35
36
37#define get_table_id(p)                                 (p[0])
38#define get_section_syntax_indicator(p) (p[1] >> 7)
39#define get_private_indicator(p)                ((p[1] >> 6) & 0x1)
40#define get_section_length(p)                   (((p[1] & 0x0F) << 8) | p[2])
41#define get_section_number(p)                   (p[6])
42#define get_last_section_number(p)              (p[7])
43
44/*
45 * Assigned PID's
46 */
47#define PAT_PID 0x0000
48#define EIT_PID 0x0012
49#define DIT_PID 0x001E
50#define SIT_PID 0x001F
51
52/*
53 * Table ID's
54 */
55#define PROGRAM_ASSOCIATION_SECTION     0
56#define CA_SECTION 1
57#define TS_PROGRAM_MAP_SECTION 2
58#define DIT_SECTION 0x7E
59#define SIT_SECTION 0x7F
60
61#define MAX_ECM_SECTION_SIZE    4096
62#define TS_ECM_SECTION_ID                       0x82
63#define TS_EMM_SECTION_ID                       0x84
64
65#define COMMON_EMM_TABLE_EXTENSION_ID   0x0000
66
67/***************************** PAT ********************************/
68
69/*
70 * MPEG descriptor types (Table 2-39)
71 */
72#define video_stream_tag                                        0x02
73#define audio_stream_tag                                        0x03
74#define hierarchy_tag                                           0x04
75#define registration_tag                                        0x05
76#define data_stream_alignment_tag                       0x06
77#define target_background_grid_tag                      0x07
78#define video_window_tag                                        0x08
79#define CA_tag                                                          0x09
80#define ISO_639_language_tag                            0x0A
81#define system_clock_tag                                        0x0B
82#define multiplex_buffer_utilization_tag        0x0C
83#define copyright_tag                                           0x0D
84#define maximum_bitrate_tag                             0x0E
85#define private_data_indicator_tag                      0x0F
86#define smoothing_buffer_tag                            0x10
87#define STD_tag                                                         0x11
88#define IBP_tag                                                         0x12
89
90/*
91 * DVB/ARIB descriptor types
92 */
93#define network_name_tag                                        0x40
94#define service_list_tag                                        0x41
95#define DVB_ARIB_stuffing_tag                           0x42
96#define satellite_delivery_system_tag           0x43
97#define cable_delivery_system_tag                       0x44
98#define buquet_name_tag                                         0x47
99#define service_tag                                                     0x48
100#define country_availability_tag                        0x49
101#define linkage_tag                                                     0x4A
102#define nvod_reference_tag                                      0x4B
103#define DVB_time_shifted_service_tag            0x4C
104#define short_event_tag                                         0x4D
105#define extended_event_tag                                      0x4E
106#define time_shifted_event_tag                          0x4F
107#define component__tag                                          0x50
108#define mosaic_tag                                                      0x51
109#define stream_identifier_tag                           0x52
110#define ca_identifier_tag                                       0x53
111#define content_tag                                                     0x54
112#define parental_rating_tag                                     0x55
113#define local_time_offset_tag                           0x58
114#define partial_transport_stream_tag            0x63
115
116/*
117 * ATSC descriptor types
118 */
119#define ATSC_stuffing_tag                                       0x80
120#define AC3_audio_stream_tag                            0x81
121#define program_identifier_tag                          0x85
122#define caption_service_tag                                     0x86
123#define content_advisory_tag                            0x87
124#define extended_channel_name_tag                       0xA0
125#define service_location_tag                            0xA1
126#define ATSC_time_shifted_service_tag           0xA2
127#define component_name_tag                                      0xA3
128#define dcc_departing_request_tag                       0xA8
129#define dcc_arriving_request_tag                0xA9
130#define redistribution_control_tag              0xAA
131
132
133/*
134 * ARIB descriptor types
135 */
136#define heirarchical_transmission_tag           0xC0
137#define digital_copy_control_tag                        0xC1
138#define netowkr_identification_tag                      0xC2
139#define partial_ts_time_tag                                     0xC3
140#define audio_component_tag                                     0xC4
141#define hyperlink_tag                                           0xC5
142#define target_area_tag                                         0xC6
143#define data_control_tag                                        0xC7
144#define video_decode_control_tag                        0xC8
145#define download_control_tag                            0xC9
146#define ca_emm_ts_tag                                           0xCA
147#define ca_contrat_information_tag                      0xCB
148#define ca_service_tag                                          0xCC
149#define basic_local_even_tag                            0xD0
150#define reference_tag                                           0xD1
151#define node_relation_tag                                       0xD2
152#define shore_node_tag                                          0xD3
153#define stc_reference_tag                                       0xD4
154#define emergency_information_tag                       0xFC
155#define data_component_tag                                      0xFD
156#define system_management_tag                           0xFE
157
158
159/*
160 * MPEG stream types in the PMT (Table 2-29)
161 * NOT to be confused with stream ID's found in PES headers
162 */
163#define StreamType_MPEG1Video   1
164#define StreamType_MPEG2Video   2
165#define StreamType_MPEG1Audio   3
166#define StreamType_MPEG2Audio   4
167#define StreamType_MPEG2PrivateSection  5
168#define StreamType_MPEG2PESPrivateData  6
169#define StreamType_MHEG                 7
170#define StreamType_AnnexADSMCC  8
171#define StreamType_H222_1               9
172#define StreamType_DSMCCTypeA   10
173#define StreamType_DSMCCTypeB   11
174#define StreamType_DSMCCTypeC   12
175#define StreamType_DSMCCTypeD   13
176#define StreamType_MPEG2Auxiliary 14
177#define StreamType_MPEG4Audio   0x11
178#define StreamType_MPEG4Video   0x1B
179#define StreamType_AACAudio             15
180#define StreamType_DC2Video             0x80
181#define StreamType_AC3Audio             0x81
182
183typedef enum {
184    DVB_TID_network_information_section_actual = 0x40,
185    DVB_TID_network_information_section_other  = 0x41,
186    DVB_TID_service_description_section_actual = 0x42,
187        /* 0x43 ~ 0x45 is reserved. */
188
189    DVB_TID_service_description_section_other  = 0x46,
190        /* 0x47 ~ 0x49 is reserved. */
191
192    DVB_TID_bouquet_association_section = 0x4A,
193        /* 0x4B ~ 0x4D is reserved. */
194
195    DVB_TID_event_information_section_actual_present = 0x4E,
196    DVB_TID_event_information_section_other_present = 0x4F,
197    DVB_TID_event_information_section_actual_schedule = 0x50,
198        /* 0x50 ~ 0x5F is EIT, actual, schedule */
199       
200    DVB_TID_event_information_section_other_schedule = 0x60,
201        /* 0x60 ~ 0x6F is EIT, other, schedule */
202
203    DVB_TID_time_date_section = 0x70,
204    DVB_TID_running_status_section = 0x71,
205    DVB_TID_stuffing_section = 0x72,
206    DVB_TID_time_offset_section = 0x73,
207    DVB_TID_application_information_section = 0x74,
208    DVB_TID_container_section = 0x75,
209    DVB_TID_related_content_section = 0x76,
210    DVB_TID_content_identifier_section = 0x77,
211    DVB_TID_MPE_FEC_section = 0x78,
212    DVB_TID_resolution_notification_section = 0x79,
213        /* 0x79 ~ 0x7D is reserved. */
214
215    DVB_TID_discontinuity_information_section = 0x7E,
216    DVB_TID_selection_information_section = 0x7F,
217
218        /* 0x80 ~ 0xFE is user-defined. */
219    DVB_TID_broadcaster_information_section = 0xC4,
220    DVB_TID_common_data_section = 0xC8,
221
222        /* 0xFF is reserved. */
223} DVB_TID_t;
224
225
226typedef enum {
227    /*
228     * Mandatory tables for DVB-SI;
229     *     NIT(actual), SDT (actual), EIT (actual/present), TDT
230     */
231    DVB_PID_NIT = 0x10,
232    DVB_PID_SDT = 0x11,
233    DVB_PID_EIT = 0x12,
234    DVB_PID_TDT = 0x14,
235
236    /*
237     * Optional tables for DVB-SI;
238     *     NIT(other), BAT, SDT (other), EIT (other, actual/schedule), RST, TOT, ST
239     */
240   
241    DVB_PID_BAT = 0x11,
242    DVB_PID_RST = 0x13,
243    DVB_PID_TOT = 0x14,
244
245    DVB_PID_BIT = 0x24,
246    DVB_PID_CDT = 0x29,
247
248    ARIB_PID_HEIT = DVB_PID_EIT,
249    ARIB_PID_MEIT = 0x26,
250    ARIB_PID_LEIT = 0x27,
251   
252} DVB_PID_t;
253
254#if 0
255___Descriptors___()
256#endif
257
258typedef enum {
259    DVB_TAG_network_name_descriptor = 0x40,
260    DVB_TAG_service_list_descriptor = 0x41,
261    DVB_TAG_stuffing_descriptor = 0x42,
262    DVB_TAG_satellite_delivery_system_descriptor = 0x43,
263    DVB_TAG_cable_delivery_system_descriptor = 0x44,
264    DVB_TAG_VBI_data_descriptor = 0x45,
265    DVB_TAG_VBI_teletext_descriptor = 0x46,
266    DVB_TAG_bouquet_name_descriptor = 0x47,
267    DVB_TAG_service_descriptor = 0x48,
268    DVB_TAG_country_availability_descriptor = 0x49,
269    DVB_TAG_linkage_descriptor = 0x4A,
270    DVB_TAG_NVOD_reference_descriptor = 0x4B,
271    DVB_TAG_time_shifted_service_descriptor = 0x4C,
272    DVB_TAG_short_event_descriptor = 0x4D,
273    DVB_TAG_extended_event_descriptor = 0x4E,
274    DVB_TAG_time_shifted_event_descriptor = 0x4F,
275    DVB_TAG_component_descriptor = 0x50,
276    DVB_TAG_mosaic_descriptor = 0x51,
277    DVB_TAG_stream_identifier_descriptor = 0x52,
278    DVB_TAG_CA_identifier_descriptor = 0x53,
279    DVB_TAG_content_descriptor = 0x54,
280    DVB_TAG_parental_rating_descriptor = 0x55,
281    DVB_TAG_teletext_descriptor = 0x56,
282    DVB_TAG_telephone_descriptor = 0x57,
283    DVB_TAG_local_time_offset_descriptor = 0x58,
284    DVB_TAG_subtitling_descriptor = 0x59,
285    DVB_TAG_terrestrial_delivery_system_descriptor = 0x5A,
286    DVB_TAG_multilingual_network_name_descriptor = 0x5B,
287    DVB_TAG_multilingual_bouquet_name_descriptor = 0x5C,
288    DVB_TAG_multilingual_service_name_descriptor = 0x5D,
289    DVB_TAG_multilingual_component_descriptor = 0x5E,
290    DVB_TAG_private_data_specifier_descriptor = 0x5F,
291    DVB_TAG_service_move_descriptor = 0x60,
292    DVB_TAG_short_smoothing_buffer_descriptor = 0x61,
293    DVB_TAG_frequency_list_descriptor = 0x62,
294    DVB_TAG_partial_transport_stream_descriptor = 0x63,
295    DVB_TAG_data_broadcast_descriptor = 0x64,
296    DVB_TAG_scrambling_descriptor = 0x65,
297    DVB_TAG_data_broadcast_id_descriptor = 0x66,
298    DVB_TAG_transport_stream_descriptor = 0x67,
299    DVB_TAG_DSNG_descriptor = 0x68,
300    DVB_TAG_PDC_descriptor = 0x69,
301    DVB_TAG_AC3_descriptor = 0x6A,
302    DVB_TAG_ancillary_data_descriptor = 0x6B,
303    DVB_TAG_cell_list_descriptor = 0x6C,
304    DVB_TAG_cell_frequency_link_descriptor = 0x6D,
305    DVB_TAG_announcement_support_descriptor = 0x6E,
306    DVB_TAG_application_signalling_descriptor = 0x6F,
307    DVB_TAG_adaptation_field_data_descriptor = 0x70,
308    DVB_TAG_service_identifier_descriptor = 0x71,
309    DVB_TAG_service_availability_descriptor = 0x72,
310    DVB_TAG_default_authority_descriptor = 0x73,
311    DVB_TAG_related_content_descriptor = 0x74,
312    DVB_TAG_TVA_id_descriptor = 0x75,
313    DVB_TAG_content_identifier_descriptor = 0x76,
314    DVB_TAG_time_slice_fec_identifier_descriptor = 0x77,
315    DVB_TAG_ECM_repetition_rate_descriptor = 0x78,
316    DVB_TAG_S2_satellite_delivery_system_descriptor = 0x79,
317    DVB_TAG_enhanced_AC3_descriptor = 0x7A,
318    DVB_TAG_DTS_descriptor = 0x7B,
319    DVB_TAG_AAC_descriptor = 0x7C,
320    DVB_TAG_XAIT_location_descriptor = 0x7D,
321    DVB_TAG_FTA_content_management_descriptor = 0x7E,
322    DVB_TAG_extension_descriptor = 0x7F,
323   
324    ARIB_TAG_hierarchical_transmission_descriptor       = 0xC0,
325    ARIB_TAG_digital_copy_control_descriptor            = 0xC1,
326    ARIB_TAG_network_identification_descriptor          = 0xC2,
327    ARIB_TAG_partial_transport_stream_time_descriptor   = 0xC3,
328    ARIB_TAG_audio_component_descriptor                 = 0xC4,
329    ARIB_TAG_hyperlink_descriptor                       = 0xC5,
330    ARIB_TAG_target_region_descriptor                   = 0xC6,
331    ARIB_TAG_data_content_descriptor                    = 0xC7,
332    ARIB_TAG_video_decode_control_descriptor            = 0xC8,
333    ARIB_TAG_download_content_descriptor                = 0xC9,
334    ARIB_TAG_ca_emm_ts_descriptor                       = 0xCA,
335    ARIB_TAG_ca_contract_information_descriptor         = 0xCB,
336    ARIB_TAG_ca_service_descriptor                      = 0xCC,
337    ARIB_TAG_ts_information_descriptor                  = 0xCD,
338    ARIB_TAG_extended_broadcaster_descriptor            = 0xCE,
339    ARIB_TAG_logo_transmission_descriptor               = 0xCF,
340    ARIB_TAG_basic_local_event_descriptor               = 0xD0,
341    ARIB_TAG_reference_descriptor                       = 0xD1,
342    ARIB_TAG_node_relation_descriptor                   = 0xD2,
343    ARIB_TAG_short_node_information_descriptor          = 0xD3,
344    ARIB_TAG_stc_reference_descriptor                   = 0xD4,
345    ARIB_TAG_series_descriptor                          = 0xD5,
346    ARIB_TAG_event_group_descriptor                     = 0xD6,
347    ARIB_TAG_si_parameter_descriptor                    = 0xD7,
348    ARIB_TAG_broadcaster_name_descriptor                = 0xD8,
349    ARIB_TAG_component_group_descriptor                 = 0xD9,
350    ARIB_TAG_si_prime_ts_descriptor                     = 0xDA,
351    ARIB_TAG_board_information_descriptor               = 0xDB,
352    ARIB_TAG_ldt_linkage_descriptor                     = 0xDC,
353    ARIB_TAG_connected_transmission_descriptor          = 0xDD,
354    ARIB_TAG_content_availability_descriptor            = 0xDE,
355    ARIB_TAG_service_group_descriptor                   = 0xE0,
356    ARIB_TAG_carousel_compatible_composite_descriptor   = 0xF7,
357    ARIB_TAG_conditional_playback_descriptor            = 0xF8,
358    ARIB_TAG_cable_ts_division_system_descriptor        = 0xF9,
359    ARIB_TAG_terrestrial_delivery_system_descriptor     = 0xFA,
360    ARIB_TAG_partial_reception_descriptor               = 0xFB,
361    ARIB_TAG_emergency_information_descriptor           = 0xFC,
362    ARIB_TAG_data_component_descriptor                  = 0xFD,
363    ARIB_TAG_system_management_descriptor               = 0xFE
364
365} dvb_descriptor_tag_t;
366
367
368#if 0
369___PAT___()
370#endif
371/*
372 * This represents one program within the Program Association Table
373 */
374typedef struct MPEG_PAT_program {
375        DS_U16          program_number;
376        DS_U16          program_map_PID;
377} MPEG_PAT_program;
378
379/*
380 * This contains all interesting fieldsin a Program Association Table.
381 * All sections in a multi-section PAT are included in this
382 * one structure.
383 */
384typedef struct pat_t {
385        DS_U16                          transport_stream_id;
386        DS_U8                           version_number;
387        bool                            current_next_indicator;
388        DS_U8                           section_number;
389        DS_U8                           last_section_number;
390        bool                            isWholePAT;                             /* FALSE if only a singe section of a PAT */
391        DS_U16                          numPrograms;
392        bool                            networkPIDPresent;              /* TRUE if network_pid is valid */
393        DS_U16                          network_PID;
394        MPEG_PAT_program        *programs;
395} pat_t, *patPtr_t;
396
397
398typedef struct pat_t MPEG_PAT;
399
400
401#if 0
402___Network_Information_Table___()
403#endif
404
405typedef struct tag_dvb_service_t {
406    DS_U16  service_id;
407    DS_U8   service_type;
408   
409} dvb_service_t;
410
411typedef struct tag_dvb_service_list_descriptor_t {
412    DS_U16  numServices;
413    dvb_service_t *p_service;
414   
415} dvb_service_list_descriptor_t;
416
417typedef struct tag_arib_transmission_type_t
418{
419    DS_U8   transmission_type_info;
420    DS_U8   number_of_service;
421    DS_U16 *service_id;
422   
423} arib_transmission_type_t;
424
425typedef struct tag_arib_ts_information_descriptor_t
426{
427    DS_U8   remote_control_key_id;
428   
429    DS_U8   ts_name_length;
430    DS_U8  *ts_name;
431   
432    DS_U8   transmission_type_count;
433    arib_transmission_type_t *transmission_type;
434   
435} arib_ts_information_descriptor_t;
436
437typedef struct tag_dvb_transport_stream_t {
438    DS_U16  transport_stream_id;
439    DS_U16  original_network_id;
440    DS_U16  transport_descriptor_length;
441    DS_U8  *transport_descriptors;
442   
443    dvb_service_list_descriptor_t *p_service_list;
444    arib_ts_information_descriptor_t *p_ts_info;
445   
446} transport_stream_t;
447
448typedef struct tag_dvb_nit_t {
449    DS_U16  network_id;
450    DS_U8   version_number;
451    DS_U8   section_number;
452    DS_U8   last_section_number;
453   
454    DS_U8   network_name_length;
455    DS_U8  *p_network_name;
456
457    DS_U16  system_management_id;
458    bool b_system_management_id;
459   
460    DS_U16  network_descriptor_length;
461    DS_U8  *network_descriptors;
462   
463    DS_U16  num_transport_stream;
464    transport_stream_t *transport_streams;
465   
466} dvb_nit_t;
467
468typedef dvb_nit_t DVB_NIT;
469
470
471#if 0
472___Broadcaster_Information_Table___()
473#endif
474
475typedef struct tag_arib_extended_broadcaster_descriptor_t
476{
477        DS_U8   broadcaster_type;
478        DS_U16  terrestrial_broadcaster_id;
479        DS_U8   num_affiliation_id;
480        DS_U8   num_broadcaster_id;
481        DS_U8   *affiliation_id;
482        DS_U16  *origin_network_id;
483        DS_U8   *broadcaster_id;
484} arib_extended_broadcaster_descriptor_t;
485
486typedef struct tag_arib_table_description_t
487{
488        DS_U8   table_id;
489        DS_U8   table_description_length;
490        DS_U8   *table_description_byte;
491} arib_table_description_t;
492
493typedef struct tag_arib_si_parameter_descriptor_t
494{
495        DS_U8   parameter_version;
496        DS_U16  update_time;
497        DS_U16  numTable;
498        arib_table_description_t        *table_description;
499} arib_si_parameter_descriptor_t;
500
501typedef struct tag_arib_broadcaster_t
502{
503    DS_U8       broadcaster_id;
504    DS_U16  broadcaster_descriptor_length;
505        DS_U8   *broadcaster_descriptors;
506
507        arib_extended_broadcaster_descriptor_t *p_ex_broad;
508        arib_si_parameter_descriptor_t *p_si_parameter;
509       
510//   DS_U8   broadcaster_name_length;
511//   DS_U8  *p_broadcaster_name;
512
513//       arib_si_prime_ts_descriptor_t *p_si_prime_ts;
514} broadcaster_t;
515
516typedef struct tag_dvb_bit_t
517{
518    DS_U16  original_network_id;
519    DS_U8   version_number;
520    DS_U8   section_number;
521    DS_U8   last_section_number;
522
523        DS_U16  first_descriptor_length;
524        DS_U8   *first_descriptors;
525
526        arib_si_parameter_descriptor_t *p_si_parameter;
527//      dvb_service_list_descriptor_t *p_service_list;
528//      bool    b_service_list;
529
530        DS_U16  num_broadcaster;
531        broadcaster_t *broadcaster;
532} dvb_bit_t;
533
534typedef dvb_bit_t DVB_BIT;
535
536
537#if 0
538___Time_Offset_Table___()
539#endif
540
541typedef struct tag_dvb_local_time_t {
542    DS_U32  country_code;
543    DS_U8   country_region_id;
544   
545    bool local_time_offset_polarity;
546    DS_U16  local_time_offset;
547   
548    DS_U16  time_of_change_date;    /* Date in MJD format. */
549    DS_U32  time_of_change_time;    /* Time in BCD format. */
550    DS_U16  next_time_offset;
551   
552} dvb_local_time_t;
553
554typedef struct tag_dvb_local_time_offset_descriptor_t {
555    DS_U8   i_num_local_time;
556    dvb_local_time_t *p_local_time;
557   
558} dvb_local_time_offset_descriptor_t;
559
560typedef struct tag_dvb_tot_t {
561    DS_U16  date;       /* Current date in MJD format. See annex C of ETSI 300 468. */
562    DS_U32  time;       /* Current time in BCD format. 12:35:00 becomes 0x123500 */
563
564    dvb_local_time_offset_descriptor_t *p_lto;
565
566    DS_U16  descriptor_length;
567    DS_U8  *descriptors;
568} dvb_tot_t;
569
570typedef dvb_tot_t DVB_TOT;
571
572
573#if 0
574___Service_Description_Table___()
575#endif
576
577typedef struct tag_dvb_service_descriptor_t {
578    DS_U8   service_type;
579   
580    DS_U8   i_provider_name_length;
581    DS_U8  *p_provider_name;
582   
583    DS_U8   i_service_name_length;
584    DS_U8  *p_service_name;
585   
586} dvb_service_descriptor_t;
587
588typedef struct tag_arib_logo_transmission_descriptor_t
589{
590        DS_U8   logo_transmission_type;
591        DS_U16  logo_id;
592        DS_U16  logo_version;
593        DS_U16  download_data_id;
594        DS_U8   *logo_char;
595} arib_logo_transmission_descriptor_t;
596
597
598typedef struct tag_dvb_sdt_service_t {
599    DS_U16  service_id;
600    DS_U8   EIT_user_defined_flags;
601    bool EIT_schedule_flag;
602    bool EIT_present_following_flag;
603    DS_U8   running_status;
604    bool free_CA_mode;
605   
606    DS_U16  descriptor_length;
607    DS_U8  *descriptors;
608   
609    dvb_service_descriptor_t *p_service_desc;
610    arib_logo_transmission_descriptor_t *logo_tx_desc;
611   
612} dvb_sdt_service_t;
613
614typedef struct tag_dvb_sdt_t {
615    DS_U16  transport_stream_id;
616    DS_U8   version_number;
617    DS_U8   section_number;
618    DS_U8   last_section_number;
619    DS_U16  original_network_id;
620   
621    DS_U16  numServices;
622    dvb_sdt_service_t *services;
623   
624} dvb_sdt_t;
625
626typedef dvb_sdt_t DVB_SDT;
627
628#if 0
629___PMT___()
630#endif
631/***************************** PMT ********************************/
632
633typedef enum {
634        FRAMERATE_23_976    = 1,        /* ATSC */
635        FRAMERATE_24        = 2,        /* ATSC */
636        FRAMERATE_25        = 3,
637        FRAMERATE_29_97     = 4,        /* ATSC */
638        FRAMERATE_30        = 5,        /* ATSC */
639        FRAMERATE_50        = 6,
640        FRAMERATE_59_94     = 7,        /* ATSC */
641        FRAMERATE_60        = 8         /* ATSC */
642} MPEG_FRAME_RATE;
643
644typedef enum {
645        CHROMA_4_2_0 = 1,               /* ATSC specified */
646        CHROMA_4_2_2 = 2,
647        CHROMA_4_4_4 = 3
648} MPEG_CHROMA_FORMAT;
649
650/* video_stream_descriptor */
651typedef struct VideoStreamDescriptor {
652        bool                            multiple_frame_rate_flag;
653        MPEG_FRAME_RATE         frame_rate_code;
654        bool                            MPEG_1_only_flag;
655        bool                            constrained_parameter_flag;
656        bool                            still_picture_flag;
657        DS_U8                           profile_and_level_indication;
658        MPEG_CHROMA_FORMAT      chroma_format;
659        bool                            frame_rate_extension_flag;
660} VideoStreamDescriptor;
661
662/* Video Decode Control Descriptor (ARIB only) */
663typedef struct VideoDecodeControlDescriptor {
664        bool                            valid;                                  /* TRUE if this descriptor exists in PMT */
665        bool                            still_picture_flag;
666        bool                            sequence_end_code_flag;
667        DS_U8                           video_decode_format;
668} VideoDecodeControlDescriptor;
669
670typedef struct tag_CA_descriptor {
671    DS_U16              CA_system_ID;
672    DS_U16              CA_PID;
673    DS_U8               private_data_length;
674    DS_U8              *p_private_data;
675} CA_descriptor;
676
677typedef struct MPEG_PMT_stream {
678        DS_U8   stream_type;
679        DS_U16  elementary_PID;
680        DS_U16  descriptor_length;
681        DS_U8   *descriptors;
682        VideoStreamDescriptor *videoStreamDescriptor;   /* NULL if not present */
683        VideoDecodeControlDescriptor videoDecodeControlDescriptor;      /* Not a pointer. Check valid flag */
684       
685        DS_U8   component_tag;
686        bool b_component_tag_valid;
687} MPEG_PMT_stream;
688
689/*
690 * This contains all interesting fields in a Program Mapping Table
691 */
692#define DYNARRAY_PMTStream      32              /* Debugger thinks there's this many streams - Does not specify actual length of structure */
693typedef struct pmt_t {
694//      DS_U16  PID;
695        DS_U16  program_number;
696        DS_U8   version_number;
697        bool    current_next_indicator;
698        DS_U16  PCR_PID;
699        DS_U16  descriptor_length;
700        DS_U8   *descriptors;           /* program descriptors */
701        int             numStreams;
702        MPEG_PMT_stream streams[DYNARRAY_PMTStream];
703} pmt_t , *pmtPtr_t;
704
705typedef struct pmt_t MPEG_PMT;
706
707#define MPEG_PMTSize(nelem) (sizeof(MPEG_PMT) + \
708                        ((nelem)-DYNARRAY_PMTStream)*sizeof(MPEG_PMT_stream))
709
710
711#if 0
712___Event_Information_Table___()
713#endif
714
715#define MAX_SHORT_EVENTS        12
716#define MAX_EXTENDED_EVENTS     12
717#define MAX_RATINGS             4
718#define MAX_AUDIO_COMPONENT     4
719#define MAX_CAPTION_ES          8
720
721typedef struct tag_dvb_short_event_descriptor_t {
722    DS_U32  ISO_639_language_code;
723    DS_U8   event_name_length;
724    DS_U8  *p_event_name;
725    DS_U8   text_length;
726    DS_U8  *p_text;
727   
728} dvb_short_event_descriptor_t;
729
730typedef struct tag_dvb_ext_event_item_t {
731    DS_U8   item_description_length;
732    DS_U8  *p_item_description;
733   
734    DS_U8   item_length;
735    DS_U8  *p_item_char;
736   
737} dvb_ext_event_item_t;
738
739typedef struct tag_dvb_extended_event_descriptor_t {
740    DS_U8   descriptor_number;
741    DS_U8   last_descriptor_number;
742   
743    DS_U32  ISO_639_language_code;
744   
745    DS_U8   numItems;
746    dvb_ext_event_item_t *items;
747   
748    DS_U8   text_length;
749    DS_U8  *p_text;
750} dvb_extended_event_descriptor_t;
751
752typedef struct tag_dvb_parental_rating_entry_t {
753    DS_U32 country_code;
754    DS_U8  rating_value;
755} dvb_parental_rating_entry_t;
756
757
758typedef struct tag_dvb_parental_rating_descriptor_t {
759    DS_U8   i_num_ratings;
760    dvb_parental_rating_entry_t *p_ratings;              /* country_code for MSB 24bits, rating for LSB 8bits. */
761   
762} dvb_parental_rating_descriptor_t;
763
764typedef struct tag_arib_event_t {
765    DS_U16  service_id;
766    DS_U16  event_id;
767} arib_event_t;
768
769typedef struct tag_arib_other_event_t {
770    DS_U16  original_network_id;
771    DS_U16  transport_stream_id;
772    DS_U16  service_id;
773    DS_U16  event_id;
774} arib_other_event_t;
775
776typedef struct tag_arib_event_group_descriptor_t {
777    DS_U8   group_type;
778
779    DS_U8   numEvents;
780    arib_event_t *p_event;
781   
782    DS_U8   numOtherNetworkEvents;
783    arib_other_event_t *p_other_event;
784} arib_event_group_descriptor_t;
785
786typedef struct tag_arib_audio_component_descriptor_t
787{
788        DS_U8   stream_content;
789        DS_U8   component_type;
790        DS_U8   component_tag;
791        DS_U8   stream_type;
792        DS_U8   simulcast_group_tag;
793        bool    ES_multi_lingual_flag;
794        bool    main_component_flag;
795        DS_U8   quality_indicator;
796        DS_U8   sampling_rate;
797        DS_U32  ISO_639_language_code;
798        DS_U32  ISO_639_language_code_2;
799        DS_U8   *text_char;
800} arib_audio_component_descriptor_t;
801
802typedef struct tag_arib_data_content_descriptor_t
803{
804        DS_U16  data_component_id;
805        DS_U8   entry_component;
806        DS_U8   selector_length;
807        DS_U8   *selector_byte;
808        DS_U8   num_of_component_ref;
809        DS_U8   *component_ref;
810        DS_U32  ISO_639_language_code;
811        DS_U8   text_length;
812        DS_U8   *text_char;
813} arib_data_content_descriptor_t;
814
815typedef struct tag_dvb_eit_event_t {
816    DS_U16  event_id;
817    DS_U16  start_date;     /* 16-bit LSB of start_time in MJD(Modified Julian Date) format. */
818    DS_U32  start_time;     /* 24-bit MSB of start_time in BCD format. */
819    DS_U32  duration;       /* BCD format. */
820   
821    DS_U32  start_time_utc;
822    DS_U32  duration_in_sec;
823   
824    DS_U8   running_status;
825    bool free_CA_mode;
826   
827    int numShortEvents;
828    dvb_short_event_descriptor_t **pp_short_event;
829   
830    int numExtendedEvents;
831    dvb_extended_event_descriptor_t **pp_extended_event;
832   
833    int numParentalRating;
834        dvb_parental_rating_descriptor_t **pp_pr_desc;
835   
836    arib_event_group_descriptor_t *p_event_group;
837   
838    int numAudioComponent;
839    arib_audio_component_descriptor_t **pp_audio_component;
840   
841    /*
842     * Only maintain data_content_descriptor for caption (data_component_id be 0x0008).
843     */
844    int numDataContent;
845    arib_data_content_descriptor_t **pp_data_content;
846   
847    DS_U16  descriptor_length;
848    DS_U8  *descriptors;
849} dvb_eit_event_t;
850
851typedef struct tag_dvb_eit_t {
852    DS_U8   table_id;
853    DS_U16  service_id;
854    DS_U8   version_number;
855    DS_U8   section_number;
856    DS_U8   last_section_number;
857    DS_U8   segment_last_section_number;
858   
859    DS_U16  transport_stream_id;
860    DS_U16  original_network_id;
861    DS_U8   last_table_id;
862   
863    DS_U16  numEvents;
864    dvb_eit_event_t *eit_events;
865   
866} dvb_eit_t, *dvb_eitPtr_t;
867
868typedef dvb_eit_t DVB_EIT;
869typedef dvb_eitPtr_t P_DVB_EIT;
870typedef dvb_eit_event_t DVB_EIT_EVENT;
871
872// TVCT
873typedef enum {
874        mm_analog                       = 0x01,
875        mm_SCTE_mode_1          = 0x02,
876        mm_SCTE_mode_2          = 0x03,
877        mm_ATSC_8VSB            = 0x04,
878        mm_ATSC_16VSB           = 0x05,
879        /* 0x06-0x7F reserved */
880        mm_private_descriptor   = 0x80
881        /* 0x81-0xFF private */
882} modulation_mode_k;
883
884typedef enum {
885        ETM_none                        = 0x00,
886        ETM_in_this_PTC         = 0x01,
887        ETM_in_channel_TSID_PTC = 0x02
888} ETM_location_k;
889
890typedef enum {
891        /* 0x00 reserved */
892        st_analog_television                    = 0x01,
893        st_ATSC_digital_television              = 0x02,
894        st_ATSC_audio_only                      = 0x03,
895        st_ATSC_data_broadcast_service  = 0x04
896        /* 0x05-0x3F reserved */
897} service_type_k;
898
899typedef struct tvctChannel {
900        DS_U16                  short_name[7];
901        DS_U16                  major_channel_number;
902        DS_U16                  minor_channel_number;
903        modulation_mode_k               modulation_mode;
904        DS_U32                  carrier_frequency;
905        DS_U16                  channel_TSID;
906        DS_U16                  program_number;
907        ETM_location_k          ETM_location;
908        bool                    access_controlled;
909        bool                    hidden;
910        bool                    show_guide;
911        service_type_k          service_type;
912        DS_U16                  source_id;
913        DS_U16                  descriptor_length;
914        DS_U8*                  descriptors;            /* un-parsed descriptors */
915} tvctChannel_t, *tvctChannelPtr_t;
916
917typedef struct tvctSection {
918        DS_U16                  transport_stream_id;
919        DS_U8                           version_number;
920        DS_U8                           current_next_indicator;
921        DS_U8                           section_number;
922        DS_U8                           last_section_number;
923        DS_U8                           num_channels_in_section;
924        tvctChannelPtr_t                channel;
925        DS_U16                  additional_descriptor_length;
926        DS_U8*                  additional_descriptors; /* un-parsed descriptors */
927} tvctSection_t, *tvctSectionPtr_t;
928
929typedef struct tvct {
930        DS_U16                  transport_stream_id;
931        DS_U8                           version_number;
932        DS_U8                           numChannels;
933        tvctChannelPtr_t                channel;
934        DS_U16                  additional_descriptor_length;
935        DS_U8*                  additional_descriptors; /* un-parsed descriptors */
936} tvct_t, *tvctPtr_t;
937
938typedef tvct_t TVCT;
939
940/* Cable Virtual Channel Table (CVCT) */
941typedef enum {
942        ps_path1                = 0,
943        ps_path2                = 1
944} path_select_k;
945
946typedef struct cvctChannel {
947        DS_U16                  short_name[7];
948        DS_U16                  major_channel_number;
949        DS_U16                  minor_channel_number;
950        modulation_mode_k               modulation_mode;
951        DS_U32                  carrier_frequency;
952        DS_U16                  channel_TSID;
953        DS_U16                  program_number;
954        ETM_location_k          ETM_location;
955        bool                    access_controlled;
956        bool                    hidden;
957        path_select_k           path_select;
958        bool                    out_of_band;
959        bool                    show_guide;
960        service_type_k          service_type;
961        DS_U16                  source_id;
962        DS_U16                  descriptor_length;
963        DS_U8*                  descriptors;            /* un-parsed descriptors */
964} cvctChannel_t, *cvctChannelPtr_t;
965
966typedef struct cvctSection {
967        DS_U16                  transport_stream_id; /* for oob it is taken as map id */
968        DS_U8                           version_number;
969        DS_U8                           current_next_indicator;
970        DS_U8                           section_number;
971        DS_U8                           last_section_number;
972        DS_U8                           num_channels_in_section;
973        cvctChannelPtr_t                channel;
974        DS_U16                  additional_descriptor_length;
975        DS_U8*                  additional_descriptors; /* un-parsed descriptors */
976} cvctSection_t, *cvctSectionPtr_t;
977
978
979typedef struct cvct {
980        DS_U16                  transport_stream_id;
981        DS_U8                           version_number;
982        DS_U8                           numChannels;
983        cvctChannelPtr_t                channel;
984        DS_U16                  additional_descriptor_length;
985        DS_U8*                  additional_descriptors; /* un-parsed descriptors */
986} cvct_t, *cvctPtr_t;
987
988typedef cvct_t CVCT;
989
990// MGT
991
992typedef enum {
993        tt_terrestrial_VCT_cni_1        = 0x0000,
994        tt_terrestrial_VCT_cni_0        = 0x0001,
995        tt_cable_VCT_cni_1                      = 0x0002, /* same for LVCT in OOB */
996        tt_cable_VCT_cni_0                      = 0x0003, /* same for LVCT in OOB */
997        tt_channel_ETT                          = 0x0004,
998        /* 0x0005-0x00FF Reserved */
999        tt_SVCT_VCM                 = 0x0010,   
1000        tt_SVCT_DCM                         = 0x0011,   
1001        tt_SVCT_ICM                             = 0x0012,   
1002        /* 0x0013 - 0x001F Reserved */
1003        tt_NIT_CDS                                      = 0x0020,
1004        tt_NIT_MMS                                      = 0x0021,
1005        /* 0x0022 - 0x002F reserved */
1006        tt_NTT_SNS                                      = 0x0030,
1007        /* 0x0031 - 0x00FF reserved */
1008        tt_EIT_min                              = 0x0100,
1009        tt_EIT_max                              = 0x017F,
1010        /* 0x0180-0x01FF Reserved */
1011        tt_event_ETT_min                        = 0x0200,
1012        tt_event_ETT_max                        = 0x027F,
1013        /* 0x0280-0x0300 Reserved */
1014        tt_RRT_region_1                 = 0x0301,
1015        tt_RRT_region_255                       = 0x03FF,
1016        /* 0x0400-0x0FFF User Private */
1017        tt_AEIT_min                             = 0x1000,
1018        tt_AEIT_max                                     = 0x10FF,
1019        tt_AETT_min                             = 0x1100,
1020        tt_AETT_max                                     = 0x11FF
1021        /* 0x1200-0xFFFF Reserved */
1022} table_type_k;
1023
1024typedef struct mgtTable {
1025        table_type_k            table_type;
1026        DS_U16                  table_type_PID;
1027        DS_U8                           table_type_version_number;
1028        DS_U32                  number_bytes;
1029        DS_U16                  descriptor_length;
1030        DS_U8*                  descriptors;            /* un-parsed descriptors */
1031} mgtTable_t, *mgtTablePtr_t;
1032
1033typedef struct mgtSection {
1034        DS_U16                  map_id; /* only used in OOB */
1035        DS_U8                           version_number;
1036        DS_U16                  tables_defined;
1037        mgtTablePtr_t           table;                  /* array of size 'tables_defined' */
1038        DS_U16                  descriptor_length;
1039        DS_U8*                  descriptors;            /* un-parsed descriptors */
1040        DS_U32                  CRC32;
1041} mgtSection_t, *mgtSectionPtr_t;
1042
1043typedef mgtSection_t MGT;
1044
1045// EIT
1046typedef struct eitEvent {
1047        DS_U16                  event_id;
1048        DS_U32                  start_time;
1049        ETM_location_k          ETM_location;
1050        DS_U32                  length_in_seconds;
1051        DS_U16                  title_length;
1052        DS_U8                           *title;
1053        DS_U16                  descriptor_length;
1054        DS_U8*                  descriptors;            /* un-parsed descriptors */
1055} eitEvent_t, *eitEventPtr_t;
1056
1057typedef struct eit {
1058        DS_U16                  source_id;
1059        DS_U8                           version_number;
1060        DS_U8                           numEvents;
1061        eitEventPtr_t           event;                  /* array of size 'numEvents' */
1062} eit_t, *eitPtr_t;
1063
1064typedef eit_t   EIT;
1065
1066// ETT
1067
1068typedef struct ett {
1069        DS_U8                           version_number;
1070        DS_U32                  ETM_id;
1071        DS_U16                  extended_text_message_length;
1072        DS_U8                           *extended_text_message;
1073} ettSection_t, *ettSectionPtr_t;
1074
1075typedef ettSection_t    ETT;
1076
1077
1078/* Caption Service Descriptor */
1079typedef enum {
1080        cct_line21              = 0,
1081        cct_advanced    = 1
1082} cc_type_k;
1083
1084typedef enum {
1085        l21f_field1             = 0,
1086        l21f_field2             = 1
1087} line21_field_k;
1088
1089typedef struct captionService {
1090        char                    language[4];
1091        cc_type_k                       cc_type;
1092        union {
1093                line21_field_k  line21_field;
1094                DS_U8                   caption_service_number;
1095        } cc_id;
1096        bool                    easy_reader;
1097        bool                    wide_aspect_ratio;
1098        bool                    korean_code;
1099} captionService_t, *captionServicePtr_t;
1100
1101typedef struct captionServiceDescriptor {
1102        DS_U8                           number_of_services;
1103        captionServicePtr_t     service;                        /* array of size 'number_of_services' */
1104} captionServiceDescriptor_t, *captionServiceDescriptorPtr_t;
1105
1106/* AC-3 Audio Descriptor */
1107typedef enum {
1108        sr_48kHz                                = 0x0,
1109        sr_44kHz                                = 0x1,
1110        sr_32kHz                                = 0x2,
1111        /* 0x3 reserved */
1112        sr_48kHz_or_44kHz                       = 0x4,
1113        sr_48kHz_or_32kHz                       = 0x5,
1114        sr_44kHz_or_32kHz                       = 0x6,
1115        sr_48kHz_or_44kHz_or_32kHz      = 0x7
1116} sample_rate_code_k;
1117
1118typedef enum {
1119        br_32kbps                       = 0x00, br_le_32kbps            = 0x20,
1120        br_40kbps                       = 0x01, br_le_40kbps            = 0x21,
1121        br_48kbps                       = 0x02, br_le_48kbps            = 0x22,
1122        br_56kbps                       = 0x03, br_le_56kbps            = 0x23,
1123        br_64kbps                       = 0x04, br_le_64kbps            = 0x24,
1124        br_80kbps                       = 0x05, br_le_80kbps            = 0x25,
1125        br_96kbps                       = 0x06, br_le_96kbps            = 0x26,
1126        br_112kbps                      = 0x07, br_le_112kbps           = 0x27,
1127        br_128kbps                      = 0x08, br_le_128kbps           = 0x28,
1128        br_160kbps                      = 0x09, br_le_160kbps           = 0x29,
1129        br_192kbps                      = 0x0A, br_le_192kbps           = 0x2A,
1130        br_224kbps                      = 0x0B, br_le_224kbps           = 0x2B,
1131        br_256kbps                      = 0x0C, br_le_256kbps           = 0x2C,
1132        br_320kbps                      = 0x0D, br_le_320kbps           = 0x2D,
1133        br_384kbps                      = 0x0E, br_le_384kbps           = 0x2E,
1134        br_448kbps                      = 0x0F, br_le_448kbps           = 0x2F,
1135        br_512kbps                      = 0x10, br_le_512kbps           = 0x30,
1136        br_576kbps                      = 0x11, br_le_576kbps           = 0x31,
1137        br_640kbps                      = 0x12, br_le_640kbps           = 0x32
1138} bit_rate_code_k;
1139
1140typedef enum {
1141        sm_not_indicated                = 0x0,
1142        sm_not_Dolby_Surround   = 0x1,
1143        sm_Dolby_Surround               = 0x2
1144        /* 0x3 reserved */
1145} surround_mode_k;
1146
1147typedef enum {
1148        bm_main_audio_serv_CM   = 0x0,  /* Complete Main */
1149        bm_main_audio_serv_ME   = 0x1,  /* Music and Effects */
1150        bm_associated_serv_VI   = 0x2,  /* Visually Impaired */
1151        bm_associated_serv_HI   = 0x3,  /* Hearing Impaired */
1152        bm_associated_serv_D    = 0x4,  /* Dialog */
1153        bm_associated_serv_C    = 0x5,  /* Commentary */
1154        bm_associated_serv_E    = 0x6,  /* Emergency */
1155        bm_as_VO_or_ma_K                = 0x7           /* Voice Over (acmod=001) or Karaoke (acmod=010-111) */
1156} bit_stream_mode_k;
1157
1158typedef enum {
1159        nc_acmod_1_1            = 0x0,
1160        nc_acmod_1_0            = 0x1,
1161        nc_acmod_2_0            = 0x2,
1162        nc_acmod_3_0            = 0x3,
1163        nc_acmod_2_1            = 0x4,
1164        nc_acmod_3_1            = 0x5,
1165        nc_acmod_2_2            = 0x6,
1166        nc_acmod_3_2            = 0x7,
1167        nc_encoded_1            = 0x8,
1168        nc_encoded_le_2         = 0x9,
1169        nc_encoded_le_3         = 0xA,
1170        nc_encoded_le_4         = 0xB,
1171        nc_encoded_le_5         = 0xC,
1172        nc_encoded_le_6         = 0xD
1173        /* 0xE-0xF reserved */
1174} num_channels_k;
1175
1176typedef enum {
1177        lc_unknown              = 0x00, lc_Polish               = 0x20, lc_background   = 0x40, lc_Moldavian    = 0x60,
1178        lc_Albanian             = 0x01, lc_Portuguese   = 0x21,                                         lc_Malaysian    = 0x61,
1179        lc_Breton               = 0x02, lc_Romanian             = 0x22,                                         lc_Malagasay    = 0x62,
1180        lc_Catalan              = 0x03, lc_Romansh              = 0x23,                                         lc_Macedonian   = 0x63,
1181        lc_Croatian             = 0x04, lc_Serbian              = 0x24,                                         lc_Laotian              = 0x64,
1182        lc_Welsh                = 0x05, lc_Slovak               = 0x25, lc_Zulu         = 0x45, lc_Korean               = 0x65,
1183        lc_Czech                = 0x06, lc_Slovene              = 0x26, lc_Vietnamese   = 0x46, lc_Khmer                = 0x66,
1184        lc_Danish               = 0x07, lc_Finnish              = 0x27, lc_Uzbek                = 0x47, lc_Kazakh               = 0x67,
1185        lc_German               = 0x08, lc_Swedish              = 0x28, lc_Urdu         = 0x48, lc_Kannada              = 0x68,
1186        lc_English              = 0x09, lc_Turkish              = 0x29, lc_Ukrainian    = 0x49, lc_Japanese             = 0x69,
1187        lc_Spanish              = 0x0A, lc_Flemish              = 0x2A, lc_Thai         = 0x4A, lc_Indonesian   = 0x6A,
1188        lc_Esperanto    = 0x0B, lc_Walloon              = 0x2B, lc_Telugu               = 0x4B, lc_Hindi                = 0x6B,
1189        lc_Estonian             = 0x0C,                                         lc_Tatar                = 0x4C, lc_Hebrew               = 0x6C,
1190        lc_Basque               = 0x0D,                                         lc_Tamil                = 0x4D, lc_Hausa                = 0x6D,
1191        lc_Faroese              = 0x0E,                                         lc_Tadzhik              = 0x4E, lc_Gurani               = 0x6E,
1192        lc_French               = 0x0F,                                         lc_Swahili              = 0x4F, lc_Gujurati             = 0x6F,
1193        lc_Frisian              = 0x10,                                         lc_Sranan_Tongo = 0x50, lc_Greek                = 0x70,
1194        lc_Irish                = 0x11,                                         lc_Somali               = 0x51, lc_Georgian             = 0x71,
1195        lc_Gaelic               = 0x12,                                         lc_Sinhalese    = 0x52, lc_Fulani               = 0x72,
1196        lc_Galician             = 0x13,                                         lc_Shona                = 0x53, lc_Dari         = 0x73,
1197        lc_Icelandic    = 0x14,                                         lc_Serbo_Croat  = 0x54, lc_Churash              = 0x74,
1198        lc_Italian              = 0x15,                                         lc_Ruthenian    = 0x55, lc_Chinese              = 0x75,
1199        lc_Lappish              = 0x16,                                         lc_Russian              = 0x56, lc_Burmese              = 0x76,
1200        lc_Latin                = 0x17,                                         lc_Quechua              = 0x57, lc_Bulgarian    = 0x77,
1201        lc_Latvian              = 0x18,                                         lc_Pustu                = 0x58, lc_Bengali              = 0x78,
1202        lc_Luxembourgian        = 0x19,                                         lc_Punjabi              = 0x59, lc_Belorussian  = 0x79,
1203        lc_Lithuanian   = 0x1A,                                         lc_Persian              = 0x5A, lc_Bambora              = 0x7A,
1204        lc_Hungarian    = 0x1B,                                         lc_Papamiento   = 0x5B, lc_Azerbijani   = 0x7B,
1205        lc_Maltese              = 0x1C,                                         lc_Oriya                = 0x5C, lc_Assamese             = 0x7C,
1206        lc_Dutch                = 0x1D,                                         lc_Nepali               = 0x5D, lc_Armenian             = 0x7D,
1207        lc_Norwegian    = 0x1E,                                         lc_Ndebele              = 0x5E, lc_Arabic               = 0x7E,
1208        lc_Occitan              = 0x1F,                                         lc_Marathi              = 0x5F, lc_Amharic              = 0x7F
1209} language_code_k;
1210
1211typedef enum {
1212        tc_UNICODE_2_Byte               = 0,
1213        tc_ISO8859_1            = 1
1214} text_code_k;
1215
1216typedef struct ac3AudioStreamDescriptor {
1217        sample_rate_code_k      sample_rate_code;
1218        DS_U8                           bsid;
1219        bit_rate_code_k         bit_rate_code;
1220        surround_mode_k         surround_mode;
1221        bit_stream_mode_k               bsmod;
1222        num_channels_k          num_channels;
1223        bool                    full_svc;
1224        bool                    additional_elements1;   /* indicates that more elements are present */
1225        language_code_k         langcod;
1226        language_code_k         langcod2;               /* present if 1+1 mode */
1227        bool                    additional_elements2;   /* indicates that more elements are present */
1228        union {
1229                DS_U8                   mainid;         
1230                DS_U8                   asvcflags;
1231        } bsmod_ext;
1232        DS_U8                           textlen;                /* always zero for ATSC */
1233        text_code_k                     text_code;
1234        DS_U8*                  text;
1235        bool                    langflag;                       /* ISO 639 language code present */
1236        bool                    langflag_2;                     /* 2nd ISO 639 language code for 1+1 */
1237        char                    language[4];                    /* ISO 639 code (0 if not defined) */
1238        char                    language2[4];                   /* "" */
1239} ac3AudioStreamDescriptor_t, *ac3AudioStreamDescriptorPtr_t;
1240               
1241// Functions
1242
1243int DHL_PSI_ParsePAT( DS_U8 **sectionArr, MPEG_PAT **returnPat);
1244int DHL_PSI_ParseDvbSdt(DS_U8 **sectionArr, bool b_actual, dvb_sdt_t **pp_sdt);
1245void DHL_PSI_FreeMpegSection (void *sectionPtr);
1246int DHL_PSI_GetMpegDescriptor (DS_U8 *descriptors, DS_U16 len, DS_U8 tag,
1247                                                        DS_U16 instance, DS_U8 **descriptor);
1248                                                       
1249int DHL_PSI_ParseDvbNit(DS_U8 **sectionArr, bool b_actual, dvb_nit_t **pp_nit);                                                 
1250int DHL_PSI_ParseDvbBit(DS_U8 **sectionArr, dvb_bit_t **pp_bit);                       
1251int DHL_PSI_ParseDvbTot(DS_U8 *sectionArr, dvb_tot_t **pp_tot);
1252int DHL_PSI_ParseDvbEit(DS_U8 **sectionArr, DVB_EIT **pp_eit);
1253int DHL_PSI_ParsePMT( DS_U8 *section, MPEG_PMT **returnPmt);
1254int DHL_PSI_ParseTVCT (DS_U8 **sectionArr, tvctPtr_t *tvctPtr);
1255int DHL_PSI_ParseCaptionServiceDescriptor (DS_U8* p, captionServiceDescriptorPtr_t *descripPtr);
1256void DHL_PSI_FreeMpegDescriptor (void *descriptorPtr);
1257int DHL_PSI_ParseAc3AudioStreamDescriptor (DS_U8* p, ac3AudioStreamDescriptorPtr_t *descripPtr);
1258int DHL_PSI_ParseMGTSection (DS_U8 *section, mgtSectionPtr_t *mgtSectionPtr);
1259int DHL_PSI_ParseEIT (DS_U8 **sectionArr, eitPtr_t *eitPtr);
1260int DHL_PSI_ParseETTSection (DS_U8 *section, ettSectionPtr_t *ettSectionPtr);
1261int DHL_PSI_ParseCVCT (DS_U8 **sectionArr, cvctPtr_t *cvctPtr);
1262
1263#endif// __DST_PARSER_H__
Note: See TracBrowser for help on using the repository browser.