vdr  1.7.31
libsi/headers.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * (C) 2001-03 Rolf Hakenes <hakenes@hippomi.de>, under the *
4  * GNU GPL with contribution of Oleg Assovski, *
5  * www.satmania.com *
6  * Adapted and extended by Marcel Wiesweg *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * $Id: headers.h 2.5 2012/06/09 14:37:24 kls Exp $
14  * *
15  ***************************************************************************/
16 
17 #ifndef LIBSI_HEADERS_H
18 #define LIBSI_HEADERS_H
19 
20 #include <endian.h>
21 
22 namespace SI {
23 
24 typedef unsigned char u_char;
25 
26 struct SectionHeader {
27  u_char table_id :8;
28 #if BYTE_ORDER == BIG_ENDIAN
30  u_char :3;
32 #else
34  u_char :3;
36 #endif
38 };
39 
40 struct ExtendedSectionHeader {
41  u_char table_id :8;
42 #if BYTE_ORDER == BIG_ENDIAN
44  u_char :3;
46 #else
48  u_char :3;
50 #endif
54 #if BYTE_ORDER == BIG_ENDIAN
55  u_char :2;
58 #else
61  u_char :2;
62 #endif
65 };
66 
67 struct DescriptorHeader {
70 };
71 
72 /*
73  *
74  * ETSI ISO/IEC 13818-1 specifies SI which is referred to as PSI. The PSI
75  * data provides information to enable automatic configuration of the
76  * receiver to demultiplex and decode the various streams of programs
77  * within the multiplex. The PSI data is structured as four types of table.
78  * The tables are transmitted in sections.
79  *
80  * 1) Program Association Table (PAT):
81  *
82  * - for each service in the multiplex, the PAT indicates the location
83  * (the Packet Identifier (PID) values of the Transport Stream (TS)
84  * packets) of the corresponding Program Map Table (PMT).
85  * It also gives the location of the Network Information Table (NIT).
86  *
87  */
88 
89 #define PAT_LEN 8
90 
91 struct pat {
92  u_char table_id :8;
93 #if BYTE_ORDER == BIG_ENDIAN
95  u_char dummy :1; // has to be 0
96  u_char :2;
98 #else
100  u_char :2;
101  u_char dummy :1; // has to be 0
103 #endif
107 #if BYTE_ORDER == BIG_ENDIAN
108  u_char :2;
111 #else
114  u_char :2;
115 #endif
118 };
119 
120 #define PAT_PROG_LEN 4
121 
122 struct pat_prog {
125 #if BYTE_ORDER == BIG_ENDIAN
126  u_char :3;
128 #else
130  u_char :3;
131 #endif
133  /* or program_map_pid (if prog_num=0)*/
134 };
135 
136 /*
137  *
138  * 2) Conditional Access Table (CAT):
139  *
140  * - the CAT provides information on the CA systems used in the
141  * multiplex; the information is private and dependent on the CA
142  * system, but includes the location of the EMM stream, when
143  * applicable.
144  *
145  */
146 #define CAT_LEN 8
147 
148 struct cat {
149  u_char table_id :8;
150 #if BYTE_ORDER == BIG_ENDIAN
152  u_char dummy :1; // has to be 0
153  u_char :2;
155 #else
157  u_char :2;
158  u_char dummy :1; // has to be 0
160 #endif
162  u_char reserved_1 :8;
163  u_char reserved_2 :8;
164 #if BYTE_ORDER == BIG_ENDIAN
165  u_char :2;
168 #else
171  u_char :2;
172 #endif
175 };
176 
177 /*
178  *
179  * 3) Program Map Table (PMT):
180  *
181  * - the PMT identifies and indicates the locations of the streams that
182  * make up each service, and the location of the Program Clock
183  * Reference fields for a service.
184  *
185  */
186 
187 #define PMT_LEN 12
188 
189 struct pmt {
190  u_char table_id :8;
191 #if BYTE_ORDER == BIG_ENDIAN
193  u_char dummy :1; // has to be 0
194  u_char :2;
196 #else
198  u_char :2;
199  u_char dummy :1; // has to be 0
201 #endif
205 #if BYTE_ORDER == BIG_ENDIAN
206  u_char :2;
209 #else
212  u_char :2;
213 #endif
216 #if BYTE_ORDER == BIG_ENDIAN
217  u_char :3;
218  u_char PCR_PID_hi :5;
219 #else
220  u_char PCR_PID_hi :5;
221  u_char :3;
222 #endif
223  u_char PCR_PID_lo :8;
224 #if BYTE_ORDER == BIG_ENDIAN
225  u_char :4;
227 #else
229  u_char :4;
230 #endif
232  //descriptors
233 };
234 
235 #define PMT_INFO_LEN 5
236 
237 struct pmt_info {
238  u_char stream_type :8;
239 #if BYTE_ORDER == BIG_ENDIAN
240  u_char :3;
242 #else
244  u_char :3;
245 #endif
247 #if BYTE_ORDER == BIG_ENDIAN
248  u_char :4;
250 #else
252  u_char :4;
253 #endif
255  // descriptors
256 };
257 
258 /*
259  *
260  * 4) Transport Stream Description Table (TSDT):
261  *
262  * - The TSDT carries a loop of descriptors that apply to
263  * the whole transport stream. The syntax and semantics
264  * of the TSDT are defined in newer versions of ISO/IEC 13818-1.
265  *
266  */
267 
268 #define TSDT_LEN 8
269 
270 struct tsdt {
271  u_char table_id :8;
272 #if BYTE_ORDER == BIG_ENDIAN
274  u_char dummy :1; // has to be 0
275  u_char :2;
277 #else
279  u_char :2;
280  u_char dummy :1; // has to be 0
282 #endif
284  u_char :8;
285  u_char :8;
286 #if BYTE_ORDER == BIG_ENDIAN
287  u_char :2;
290 #else
293  u_char :2;
294 #endif
297 };
298 
299 /*
300  *
301  * 5) Network Information Table (NIT):
302  *
303  * - the NIT is intended to provide information about the physical
304  * network. The syntax and semantics of the NIT are defined in
305  * ETSI EN 300 468.
306  *
307  */
308 
309 #define NIT_LEN 10
310 
311 struct nit {
312  u_char table_id :8;
313 #if BYTE_ORDER == BIG_ENDIAN
315  u_char :3;
317 #else
319  u_char :3;
321 #endif
325 #if BYTE_ORDER == BIG_ENDIAN
326  u_char :2;
329 #else
332  u_char :2;
333 #endif
336 #if BYTE_ORDER == BIG_ENDIAN
337  u_char :4;
339 #else
341  u_char :4;
342 #endif
344  /* descriptors */
345 };
346 
347 #define SIZE_NIT_MID 2
348 
349 struct nit_mid { // after descriptors
350 #if BYTE_ORDER == BIG_ENDIAN
351  u_char :4;
353 #else
355  u_char :4;
356 #endif
358 };
359 
360 #define SIZE_NIT_END 4
361 
362 struct nit_end {
363  long CRC;
364 };
365 
366 #define NIT_TS_LEN 6
367 
368 struct ni_ts {
373 #if BYTE_ORDER == BIG_ENDIAN
374  u_char :4;
376 #else
378  u_char :4;
379 #endif
381  /* descriptors */
382 };
383 
384 /*
385  *
386  * In addition to the PSI, data is needed to provide identification of
387  * services and events for the user. In contrast with the PAT, CAT, and
388  * PMT of the PSI, which give information only for the multiplex in which
389  * they are contained (the actual multiplex), the additional information
390  * defined within the present document can also provide information on
391  * services and events carried by different multiplexes, and even on other
392  * networks. This data is structured as nine tables:
393  *
394  * 1) Bouquet Association Table (BAT):
395  *
396  * - the BAT provides information regarding bouquets. As well as giving
397  * the name of the bouquet, it provides a list of services for each
398  * bouquet.
399  *
400  */
401 /* SEE NIT (It has the same structure but has different allowed descriptors) */
402 /*
403  *
404  * 2) Service Description Table (SDT):
405  *
406  * - the SDT contains data describing the services in the system e.g.
407  * names of services, the service provider, etc.
408  *
409  */
410 
411 #define SDT_LEN 11
412 
413 struct sdt {
414  u_char table_id :8;
415 #if BYTE_ORDER == BIG_ENDIAN
417  u_char :3;
419 #else
421  u_char :3;
423 #endif
427 #if BYTE_ORDER == BIG_ENDIAN
428  u_char :2;
431 #else
434  u_char :2;
435 #endif
440  u_char :8;
441 };
442 
443 #define GetSDTTransportStreamId(x) (HILO(((sdt_t *) x)->transport_stream_id))
444 #define GetSDTOriginalNetworkId(x) (HILO(((sdt_t *) x)->original_network_id))
445 
446 #define SDT_DESCR_LEN 5
447 
448 struct sdt_descr {
451 #if BYTE_ORDER == BIG_ENDIAN
452  u_char :6;
456  u_char free_ca_mode :1;
458 #else
461  u_char :6;
463  u_char free_ca_mode :1;
465 #endif
467 };
468 
469 /*
470  *
471  * 3) Event Information Table (EIT):
472  *
473  * - the EIT contains data concerning events or programmes such as event
474  * name, start time, duration, etc.; - the use of different descriptors
475  * allows the transmission of different kinds of event information e.g.
476  * for different service types.
477  *
478  */
479 
480 #define EIT_LEN 14
481 
482 struct eit {
483  u_char table_id :8;
484 #if BYTE_ORDER == BIG_ENDIAN
486  u_char :3;
488 #else
490  u_char :3;
492 #endif
496 #if BYTE_ORDER == BIG_ENDIAN
497  u_char :2;
500 #else
503  u_char :2;
504 #endif
513 };
514 
515 #define EIT_EVENT_LEN 12
516 
517 struct eit_event {
518  u_char event_id_hi :8;
519  u_char event_id_lo :8;
520  u_char mjd_hi :8;
521  u_char mjd_lo :8;
522  u_char start_time_h :8;
523  u_char start_time_m :8;
524  u_char start_time_s :8;
525  u_char duration_h :8;
526  u_char duration_m :8;
527  u_char duration_s :8;
528 #if BYTE_ORDER == BIG_ENDIAN
530  u_char free_ca_mode :1;
532 #else
534  u_char free_ca_mode :1;
536 #endif
538 };
539 
540 /*
541  *
542  * 4) Running Status Table (RST):
543  *
544  * - the RST gives the status of an event (running/not running). The RST
545  * updates this information and allows timely automatic switching to
546  * events.
547  *
548  */
549 
550 struct rst {
551  u_char table_id :8;
552 #if BYTE_ORDER == BIG_ENDIAN
554  u_char :3;
556 #else
558  u_char :3;
560 #endif
562 };
563 
564 struct rst_info {
571  u_char event_id_hi :8;
572  u_char event_id_lo :8;
573 #if BYTE_ORDER == BIG_ENDIAN
574  u_char :5;
576 #else
578  u_char :5;
579 #endif
580 };
581 
582 /*
583  *
584  * 5) Time and Date Table (TDT):
585  *
586  * - the TDT gives information relating to the present time and date.
587  * This information is given in a separate table due to the frequent
588  * updating of this information.
589  *
590  */
591 
592 #define TDT_LEN 8
593 
594 struct tdt {
595  u_char table_id :8;
596 #if BYTE_ORDER == BIG_ENDIAN
598  u_char :3;
600 #else
602  u_char :3;
604 #endif
606  u_char utc_mjd_hi :8;
607  u_char utc_mjd_lo :8;
608  u_char utc_time_h :8;
609  u_char utc_time_m :8;
610  u_char utc_time_s :8;
611 };
612 
613 /*
614  *
615  * 6) Time Offset Table (TOT):
616  *
617  * - the TOT gives information relating to the present time and date and
618  * local time offset. This information is given in a separate table due
619  * to the frequent updating of the time information.
620  *
621  */
622 #define TOT_LEN 10
623 
624 struct tot {
625  u_char table_id :8;
626 #if BYTE_ORDER == BIG_ENDIAN
628  u_char :3;
630 #else
632  u_char :3;
634 #endif
636  u_char utc_mjd_hi :8;
637  u_char utc_mjd_lo :8;
638  u_char utc_time_h :8;
639  u_char utc_time_m :8;
640  u_char utc_time_s :8;
641 #if BYTE_ORDER == BIG_ENDIAN
642  u_char :4;
644 #else
646  u_char :4;
647 #endif
649 };
650 
651 /*
652  *
653  * 7) Stuffing Table (ST):
654  *
655  * - the ST is used to invalidate existing sections, for example at
656  * delivery system boundaries.
657  *
658  */
659  /* TO BE DONE */
660 /*
661  *
662  * 8) Selection Information Table (SIT):
663  *
664  * - the SIT is used only in "partial" (i.e. recorded) bitstreams. It
665  * carries a summary of the SI information required to describe the
666  * streams in the partial bitstream.
667  *
668  */
669  /* TO BE DONE */
670 /*
671  *
672  * 9) Discontinuity Information Table (DIT):
673  *
674  * - the DIT is used only in "partial" (i.e. recorded) bitstreams.
675  * It is inserted where the SI information in the partial bitstream may
676  * be discontinuous. Where applicable the use of descriptors allows a
677  * flexible approach to the organization of the tables and allows for
678  * future compatible extensions.
679  *
680  */
681  /* TO BE DONE */
682 
683 /*
684  *
685  * 3) Application Information Table (AIT):
686  *
687  * - the AIT contains data concerning MHP application broadcast by a service.
688  *
689  */
690 
691 #define AIT_LEN 10
692 
693 struct ait {
694  u_char table_id :8;
695 #if BYTE_ORDER == BIG_ENDIAN
697  u_char :3;
699 #else
701  u_char :3;
703 #endif
707 #if BYTE_ORDER == BIG_ENDIAN
708  u_char :2;
711 #else
714  u_char :2;
715 #endif
718 #if BYTE_ORDER == BIG_ENDIAN
719  u_char :4;
721 #else
723  u_char :4;
724 #endif
726 };
727 
728 #define SIZE_AIT_MID 2
729 
730 struct ait_mid { // after descriptors
731 #if BYTE_ORDER == BIG_ENDIAN
732  u_char :4;
734 #else
736  u_char :4;
737 #endif
739 };
740 
741 #define SIZE_AIT_END 4
742 
743 struct ait_end {
744  long CRC;
745 };
746 
747 #define AIT_APP_LEN 9
748 
749 struct ait_app {
750  //how to deal with 32 bit fields?
751 
756 
757  //long organisation_id :32;
761 #if BYTE_ORDER == BIG_ENDIAN
762  u_char :4;
764 #else
766  u_char :4;
767 #endif
769  /* descriptors */
770 };
771 
772 /* Premiere Content Information Table */
773 
774 #define PCIT_LEN 17
775 
776 struct pcit {
777  u_char table_id :8;
778 #if BYTE_ORDER == BIG_ENDIAN
780  u_char dummy :1; // has to be 0
781  u_char :2;
783 #else
785  u_char :2;
786  u_char dummy :1; // has to be 0
788 #endif
790  u_char :8;
791  u_char :8;
792 #if BYTE_ORDER == BIG_ENDIAN
793  u_char :2;
796 #else
799  u_char :2;
800 #endif
803 
808 
809  u_char duration_h :8;
810  u_char duration_m :8;
811  u_char duration_s :8;
812 
813 #if BYTE_ORDER == BIG_ENDIAN
814  u_char :4;
816 #else
818  u_char :4;
819 #endif
821 };
822 
823 /*
824  *
825  * The following describes the different descriptors that can be used within
826  * the SI.
827  *
828  * The following semantics apply to all the descriptors defined in this
829  * subclause:
830  *
831  * descriptor_tag: The descriptor tag is an 8-bit field which identifies
832  * each descriptor. Those values with MPEG-2 normative
833  * meaning are described in ISO/IEC 13818-1. The values of
834  * descriptor_tag are defined in 'libsi.h'
835  * descriptor_length: The descriptor length is an 8-bit field specifying the
836  * total number of bytes of the data portion of the
837  * descriptor following the byte defining the value of
838  * this field.
839  *
840  */
841 
842 #define DESCR_GEN_LEN 2
843 struct descr_gen {
846 };
847 
848 #define GetDescriptorTag(x) (((descr_gen_t *) x)->descriptor_tag)
849 #define GetDescriptorLength(x) (((descr_gen_t *) x)->descriptor_length+DESCR_GEN_LEN)
850 
851 /* 0x09 ca_descriptor */
852 
853 #define DESCR_CA_LEN 6
854 struct descr_ca {
857  u_char CA_type_hi :8;
858  u_char CA_type_lo :8;
859 #if BYTE_ORDER == BIG_ENDIAN
860  u_char reserved :3;
861  u_char CA_PID_hi :5;
862 #else
863  u_char CA_PID_hi :5;
864  u_char reserved :3;
865 #endif
866  u_char CA_PID_lo :8;
867 };
868 
869 /* 0x0A iso_639_language_descriptor */
870 
871 #define DESCR_ISO_639_LANGUAGE_LEN 5
872 struct descr_iso_639_language {
875 };
876 
877 struct descr_iso_639_language_loop {
878  u_char lang_code1 :8;
879  u_char lang_code2 :8;
880  u_char lang_code3 :8;
881  u_char audio_type :8;
882 };
883 
884 /* 0x13 carousel_identifier_descriptor */
885 
886 #define DESCR_CAROUSEL_IDENTIFIER_LEN 7
887 struct descr_carousel_identifier {
894  u_char FormatId :8;
895  /* FormatSpecifier follows */
896 };
897 
898 /* 0x40 network_name_descriptor */
899 
900 #define DESCR_NETWORK_NAME_LEN 2
901 struct descr_network_name {
904 };
905 
906 /* 0x41 service_list_descriptor */
907 
908 #define DESCR_SERVICE_LIST_LEN 2
909 struct descr_service_list {
912 };
913 
914 #define DESCR_SERVICE_LIST_LOOP_LEN 3
915 struct descr_service_list_loop {
918  u_char service_type :8;
919 };
920 
921 /* 0x42 stuffing_descriptor */
922 
923 #define DESCR_STUFFING_LEN XX
924 struct descr_stuffing {
927  /* TBD */
928 };
929 
930 /* 0x43 satellite_delivery_system_descriptor */
931 
932 #define DESCR_SATELLITE_DELIVERY_SYSTEM_LEN 13
933 struct descr_satellite_delivery_system {
942 #if BYTE_ORDER == BIG_ENDIAN
944  u_char polarization :2;
945  u_char roll_off :2;
948 #else
951  u_char roll_off :2;
952  u_char polarization :2;
954 #endif
958 #if BYTE_ORDER == BIG_ENDIAN
960  u_char fec_inner :4;
961 #else
962  u_char fec_inner :4;
964 #endif
965 };
966 
967 /* 0x44 cable_delivery_system_descriptor */
968 
969 #define DESCR_CABLE_DELIVERY_SYSTEM_LEN 13
970 struct descr_cable_delivery_system {
977  u_char reserved1 :8;
978 #if BYTE_ORDER == BIG_ENDIAN
979  u_char reserved2 :4;
980  u_char fec_outer :4;
981 #else
982  u_char fec_outer :4;
983  u_char reserved2 :4;
984 #endif
985  u_char modulation :8;
989 #if BYTE_ORDER == BIG_ENDIAN
991  u_char fec_inner :4;
992 #else
993  u_char fec_inner :4;
995 #endif
996 };
997 
998 /* 0x45 vbi_data_descriptor */
999 
1000 #define DESCR_VBI_DATA_LEN XX
1001 struct descr_vbi_data {
1004  /* TBD */
1005 };
1006 
1007 /* 0x46 vbi_teletext_descriptor */
1008 
1009 #define DESCR_VBI_TELETEXT_LEN XX
1010 struct descr_vbi_teletext {
1013  /* TBD */
1014 };
1015 
1016 /* 0x47 bouquet_name_descriptor */
1017 
1018 #define DESCR_BOUQUET_NAME_LEN 2
1019 struct descr_bouquet_name {
1022 };
1023 
1024 /* 0x48 service_descriptor */
1025 
1026 #define DESCR_SERVICE_LEN 4
1027 struct descr_service {
1030  u_char service_type :8;
1032 };
1033 
1034 struct descr_service_mid {
1036 };
1037 
1038 /* 0x49 country_availability_descriptor */
1039 
1040 #define DESCR_COUNTRY_AVAILABILITY_LEN 3
1041 struct descr_country_availability {
1044 #if BYTE_ORDER == BIG_ENDIAN
1046  u_char reserved :7;
1047 #else
1048  u_char reserved :7;
1050 #endif
1051 };
1052 
1053 /* 0x4A linkage_descriptor */
1054 
1055 #define DESCR_LINKAGE_LEN 9
1056 struct descr_linkage {
1063  u_char service_id_hi :8;
1064  u_char service_id_lo :8;
1065  u_char linkage_type :8;
1066 };
1067 
1068 #define DESCR_LINKAGE_8_LEN 3
1069 struct descr_linkage_8 {
1070 #if BYTE_ORDER == BIG_ENDIAN
1072  u_char reserved :3;
1073  u_char origin_type :1;
1074 #else
1075  u_char origin_type :1;
1076  u_char reserved :3;
1078 #endif
1079  u_char id_hi :8;
1080  u_char id_lo :8;
1081 };
1082 
1083 /* 0x4B nvod_reference_descriptor */
1084 
1085 #define DESCR_NVOD_REFERENCE_LEN 2
1086 struct descr_nvod_reference {
1089 };
1090 
1091 #define ITEM_NVOD_REFERENCE_LEN 6
1092 struct item_nvod_reference {
1097  u_char service_id_hi :8;
1098  u_char service_id_lo :8;
1099 };
1100 
1101 /* 0x4C time_shifted_service_descriptor */
1102 
1103 #define DESCR_TIME_SHIFTED_SERVICE_LEN 4
1104 struct descr_time_shifted_service {
1109 };
1110 
1111 /* 0x4D short_event_descriptor */
1112 
1113 #define DESCR_SHORT_EVENT_LEN 6
1114 struct descr_short_event {
1117  u_char lang_code1 :8;
1118  u_char lang_code2 :8;
1119  u_char lang_code3 :8;
1121 };
1122 
1123 struct descr_short_event_mid {
1124  u_char text_length :8;
1125 };
1126 
1127 /* 0x4E extended_event_descriptor */
1128 
1129 #define DESCR_EXTENDED_EVENT_LEN 7
1130 struct descr_extended_event {
1133  /* TBD */
1134 #if BYTE_ORDER == BIG_ENDIAN
1137 #else
1140 #endif
1141  u_char lang_code1 :8;
1142  u_char lang_code2 :8;
1143  u_char lang_code3 :8;
1145 };
1146 
1147 struct descr_extended_event_mid {
1148  u_char text_length :8;
1149 };
1150 
1151 #define ITEM_EXTENDED_EVENT_LEN 1
1152 struct item_extended_event {
1154 };
1155 
1156 struct item_extended_event_mid {
1157  u_char item_length :8;
1158 };
1159 
1160 /* 0x4F time_shifted_event_descriptor */
1161 
1162 #define DESCR_TIME_SHIFTED_EVENT_LEN 6
1163 struct descr_time_shifted_event {
1170 };
1171 
1172 /* 0x50 component_descriptor */
1173 
1174 #define DESCR_COMPONENT_LEN 8
1175 struct descr_component {
1178 #if BYTE_ORDER == BIG_ENDIAN
1179  u_char reserved :4;
1181 #else
1183  u_char reserved :4;
1184 #endif
1186  u_char component_tag :8;
1187  u_char lang_code1 :8;
1188  u_char lang_code2 :8;
1189  u_char lang_code3 :8;
1190 };
1191 
1192 /* 0x51 mosaic_descriptor */
1193 
1194 #define DESCR_MOSAIC_LEN XX
1195 struct descr_mosaic {
1198  /* TBD */
1199 };
1200 
1201 /* 0x52 stream_identifier_descriptor */
1202 
1203 #define DESCR_STREAM_IDENTIFIER_LEN 3
1204 struct descr_stream_identifier {
1207  u_char component_tag :8;
1208 };
1209 
1210 /* 0x53 ca_identifier_descriptor */
1211 
1212 #define DESCR_CA_IDENTIFIER_LEN 2
1213 struct descr_ca_identifier {
1216 };
1217 
1218 /* 0x54 content_descriptor */
1219 
1220 #define DESCR_CONTENT_LEN 2
1221 struct descr_content {
1224 };
1225 
1226 struct nibble_content {
1227 #if BYTE_ORDER == BIG_ENDIAN
1230 #else
1233 #endif
1234 #if BYTE_ORDER == BIG_ENDIAN
1235  u_char user_nibble_1 :4;
1236  u_char user_nibble_2 :4;
1237 #else
1238  u_char user_nibble_2 :4;
1239  u_char user_nibble_1 :4;
1240 #endif
1241 };
1242 
1243 /* 0x55 parental_rating_descriptor */
1244 
1245 #define DESCR_PARENTAL_RATING_LEN 2
1246 struct descr_parental_rating {
1249 };
1250 
1251 #define PARENTAL_RATING_LEN 4
1252 struct parental_rating {
1253  u_char lang_code1 :8;
1254  u_char lang_code2 :8;
1255  u_char lang_code3 :8;
1256  u_char rating :8;
1257 };
1258 
1259 /* 0x56 teletext_descriptor */
1260 
1261 #define DESCR_TELETEXT_LEN 2
1262 struct descr_teletext {
1265 };
1266 
1267 #define ITEM_TELETEXT_LEN 5
1268 struct item_teletext {
1269  u_char lang_code1 :8;
1270  u_char lang_code2 :8;
1271  u_char lang_code3 :8;
1272 #if BYTE_ORDER == BIG_ENDIAN
1273  u_char type :5;
1275 #else
1277  u_char type :5;
1278 #endif
1279  u_char page_number :8;
1280 };
1281 
1282 /* 0x57 telephone_descriptor */
1283 
1284 #define DESCR_TELEPHONE_LEN XX
1285 struct descr_telephone {
1288  /* TBD */
1289 };
1290 
1291 /* 0x58 local_time_offset_descriptor */
1292 
1293 #define DESCR_LOCAL_TIME_OFFSET_LEN 2
1294 struct descr_local_time_offset {
1297 };
1298 
1299 #define LOCAL_TIME_OFFSET_ENTRY_LEN 15
1300 struct local_time_offset_entry {
1301  u_char country_code1 :8;
1302  u_char country_code2 :8;
1303  u_char country_code3 :8;
1304 #if BYTE_ORDER == BIG_ENDIAN
1306  u_char :1;
1308 #else
1310  u_char :1;
1312 #endif
1322 };
1323 
1324 /* 0x59 subtitling_descriptor */
1325 
1326 #define DESCR_SUBTITLING_LEN 2
1327 struct descr_subtitling {
1330 };
1331 
1332 #define ITEM_SUBTITLING_LEN 8
1333 struct item_subtitling {
1334  u_char lang_code1 :8;
1335  u_char lang_code2 :8;
1336  u_char lang_code3 :8;
1342 };
1343 
1344 /* 0x5A terrestrial_delivery_system_descriptor */
1345 
1346 #define DESCR_TERRESTRIAL_DELIVERY_SYSTEM_LEN XX
1347 struct descr_terrestrial_delivery {
1354 #if BYTE_ORDER == BIG_ENDIAN
1355  u_char bandwidth :3;
1356  u_char priority :1;
1359  u_char reserved1 :2;
1360 #else
1361  u_char reserved1 :2;
1364  u_char priority :1;
1365  u_char bandwidth :3;
1366 #endif
1367 #if BYTE_ORDER == BIG_ENDIAN
1368  u_char constellation :2;
1369  u_char hierarchy :3;
1370  u_char code_rate_HP :3;
1371 #else
1372  u_char code_rate_HP :3;
1373  u_char hierarchy :3;
1374  u_char constellation :2;
1375 #endif
1376 #if BYTE_ORDER == BIG_ENDIAN
1377  u_char code_rate_LP :3;
1381 #else
1385  u_char code_rate_LP :3;
1386 #endif
1387  u_char reserver2 :8;
1388  u_char reserver3 :8;
1389  u_char reserver4 :8;
1390  u_char reserver5 :8;
1391 };
1392 
1393 /* 0x5B multilingual_network_name_descriptor */
1394 
1395 #define DESCR_MULTILINGUAL_NETWORK_NAME_LEN XX
1396 struct descr_multilingual_network_name {
1399 };
1400 
1401 struct entry_multilingual_name {
1402  u_char lang_code1 :8;
1403  u_char lang_code2 :8;
1404  u_char lang_code3 :8;
1405  u_char text_length :8;
1406 };
1407 
1408 /* 0x5C multilingual_bouquet_name_descriptor */
1409 
1410 #define DESCR_MULTILINGUAL_BOUQUET_NAME_LEN XX
1411 struct descr_multilingual_bouquet_name {
1414 };
1415 
1416 /* 0x5D multilingual_service_name_descriptor */
1417 
1418 #define DESCR_MULTILINGUAL_SERVICE_NAME_LEN XX
1419 struct descr_multilingual_service_name {
1422 };
1423 
1424 struct entry_multilingual_service_name_mid {
1426 };
1427 
1428 /* 0x5E multilingual_component_descriptor */
1429 
1430 #define DESCR_MULTILINGUAL_COMPONENT_LEN XX
1431 struct descr_multilingual_component {
1434  u_char component_tag :8;
1435 };
1436 
1437 /* 0x5F private_data_specifier_descriptor */
1438 
1439 #define DESCR_PRIVATE_DATA_SPECIFIER_LEN XX
1440 struct descr_private_data_specifier {
1447 };
1448 
1449 /* 0x60 service_move_descriptor */
1450 
1451 #define DESCR_SERVICE_MOVE_LEN XX
1452 struct descr_service_move {
1461 };
1462 
1463 /* 0x61 short_smoothing_buffer_descriptor */
1464 
1465 #define DESCR_SHORT_SMOOTHING_BUFFER_LEN XX
1466 struct descr_short_smoothing_buffer {
1469  /* TBD */
1470 };
1471 
1472 /* 0x62 frequency_list_descriptor */
1473 
1474 #define DESCR_FREQUENCY_LIST_LEN XX
1475 struct descr_frequency_list {
1478 #if BYTE_ORDER == BIG_ENDIAN
1479  u_char :6;
1480  u_char coding_type :2;
1481 #else
1482  u_char coding_type :2;
1483  u_char :6;
1484 #endif
1485 };
1486 
1487 /* 0x63 partial_transport_stream_descriptor */
1488 
1489 #define DESCR_PARTIAL_TRANSPORT_STREAM_LEN XX
1490 struct descr_partial_transport_stream {
1493  /* TBD */
1494 };
1495 
1496 /* 0x64 data_broadcast_descriptor */
1497 
1498 #define DESCR_DATA_BROADCAST_LEN XX
1499 struct descr_data_broadcast {
1502  /* TBD */
1503 };
1504 
1505 /* 0x65 scrambling_descriptor */
1506 
1507 #define DESCR_SCRAMBLING_LEN XX
1508 struct descr_scrambling {
1511  /* TBD */
1512 };
1513 
1514 /* 0x66 data_broadcast_id_descriptor */
1515 
1516 #define DESCR_DATA_BROADCAST_ID_LEN XX
1517 struct descr_data_broadcast_id {
1520  /* TBD */
1521 };
1522 
1523 /* 0x67 transport_stream_descriptor */
1524 
1525 #define DESCR_TRANSPORT_STREAM_LEN XX
1526 struct descr_transport_stream {
1529  /* TBD */
1530 };
1531 
1532 /* 0x68 dsng_descriptor */
1533 
1534 #define DESCR_DSNG_LEN XX
1535 struct descr_dsng {
1538  /* TBD */
1539 };
1540 
1541 /* 0x69 pdc_descriptor */
1542 
1543 #define DESCR_PDC_LEN 5
1544 struct descr_pdc {
1547  u_char pil0 :8;
1548  u_char pil1 :8;
1549  u_char pil2 :8;
1550 };
1551 
1552 /* 0x6A ac3_descriptor */
1553 
1554 #define DESCR_AC3_LEN 3
1555 struct descr_ac3 {
1558 #if BYTE_ORDER == BIG_ENDIAN
1559  u_char ac3_type_flag :1;
1560  u_char bsid_flag :1;
1561  u_char mainid_flag :1;
1562  u_char asvc_flag :1;
1563  u_char reserved :4;
1564 #else
1565  u_char reserved :4;
1566  u_char asvc_flag :1;
1567  u_char mainid_flag :1;
1568  u_char bsid_flag :1;
1569  u_char ac3_type_flag :1;
1570 #endif
1571  u_char ac3_type :8;
1572  u_char bsid :8;
1573  u_char mainid :8;
1574  u_char asvc :8;
1575 };
1576 
1577 /* 0x6B ancillary_data_descriptor */
1578 
1579 #define DESCR_ANCILLARY_DATA_LEN 3
1580 struct descr_ancillary_data {
1584 };
1585 
1586 /* 0x6C cell_list_descriptor */
1587 
1588 #define DESCR_CELL_LIST_LEN XX
1589 struct descr_cell_list {
1592  /* TBD */
1593 };
1594 
1595 /* 0x6D cell_frequency_link_descriptor */
1596 
1597 #define DESCR_CELL_FREQUENCY_LINK_LEN XX
1598 struct descr_cell_frequency_link {
1601  /* TBD */
1602 };
1603 
1604 /* 0x6E announcement_support_descriptor */
1605 
1606 #define DESCR_ANNOUNCEMENT_SUPPORT_LEN XX
1607 struct descr_announcement_support {
1610  /* TBD */
1611 };
1612 
1613 /* 0x6F application_signalling_descriptor */
1614 
1615 #define DESCR_APPLICATION_SIGNALLING_LEN 2
1616 struct descr_application_signalling {
1619 };
1620 
1621 #define APPLICATION_SIGNALLING_ENTRY_LEN 3
1622 struct application_signalling_entry {
1625 #if BYTE_ORDER == BIG_ENDIAN
1626  u_char :3;
1628 #else
1630  u_char :3;
1631 #endif
1632 };
1633 
1634 /* 0x71 service_identifier_descriptor (ETSI TS 102 812, MHP) */
1635 
1636 struct descr_service_identifier {
1639 };
1640 
1641 /* 0x72 service_availbility_descriptor */
1642 
1643 struct descr_service_availbility {
1646 #if BYTE_ORDER == BIG_ENDIAN
1648  u_char reserved :7;
1649 #else
1650  u_char reserved :7;
1652 #endif
1653 };
1654 
1655 /* 0x73 default_authority_descriptor (ETSI TS 102 323) */
1656 
1657 struct descr_default_authority {
1660 };
1661 
1662 /* 0x74 related_content_descriptor (ETSI TS 102 323) */
1663 
1664 struct descr_related_content {
1667 };
1668 
1669 /* 0x75 tva_id_descriptor (ETSI TS 102 323) */
1670 
1671 struct descr_tva_id {
1674 };
1675 
1676 /* 0x76 content_identifier_descriptor (ETSI TS 102 323) */
1677 
1678 struct descr_content_identifier {
1681 };
1682 
1683 struct content_identifier_entry {
1684 #if BYTE_ORDER == BIG_ENDIAN
1685  u_char crid_type :6;
1686  u_char crid_location :2;
1687 #else
1688  u_char crid_location :2;
1689  u_char crid_type :6;
1690 #endif
1691  union {
1692  u_char crid_length :8;
1693  u_char crid_ref_hi :8;
1694  };
1695  union {
1696  u_char crid_byte :8;
1697  u_char crid_ref_lo :8;
1698  };
1699 };
1700 
1701 /* 0x77 time_slice_fec_identifier_descriptor (ETSI EN 301 192) */
1702 
1703 struct descr_time_slice_fec_identifier {
1706 #if BYTE_ORDER == BIG_ENDIAN
1707  u_char time_slicing :1;
1708  u_char mpe_fec :2;
1709  u_char reserved :2;
1710  u_char frame_size :3;
1711 #else
1712  u_char frame_size :3;
1713  u_char reserved :2;
1714  u_char mpe_fec :2;
1715  u_char time_slicing :1;
1716 #endif
1718 #if BYTE_ORDER == BIG_ENDIAN
1721 #else
1724 #endif
1725 };
1726 
1727 /* 0x78 ecm_repetition_rate_descriptor (ETSI EN 301 192) */
1728 
1729 struct descr_ecm_repetition_rate {
1736 };
1737 
1738 /* 0x79 s2_satellite_delivery_system_descriptor */
1739 
1740 struct descr_s2_satellite_delivery_system {
1743 #if BYTE_ORDER == BIG_ENDIAN
1747  u_char reserved :5;
1748 #else
1749  u_char reserved :5;
1753 #endif
1754 };
1755 
1756 struct descr_scrambling_sequence_selector {
1757 #if BYTE_ORDER == BIG_ENDIAN
1758  u_char reserved :6;
1760 #else
1762  u_char reserved :6;
1763 #endif
1766 };
1767 
1768 /* 0x7A enhanced_ac3_descriptor */
1769 
1770 struct descr_enhanced_ac3 {
1773 #if BYTE_ORDER == BIG_ENDIAN
1775  u_char bsid_flag :1;
1776  u_char mainid_flag :1;
1777  u_char asvc_flag :1;
1778  u_char mixinfoexists :1;
1782 #else
1786  u_char mixinfoexists :1;
1787  u_char asvc_flag :1;
1788  u_char mainid_flag :1;
1789  u_char bsid_flag :1;
1791 #endif
1792 };
1793 
1794 /* 0x7B dts_descriptor */
1795 
1796 struct descr_dts {
1799 #if BYTE_ORDER == BIG_ENDIAN
1801  u_char bit_rate_code :6;
1802  u_char nblks :7;
1803  u_char fsize_hi :6;
1804  u_char fsize_lo :8;
1805  u_char surround_mode :6;
1806  u_char lfe_flag :1;
1808 #else
1810  u_char lfe_flag :1;
1811  u_char surround_mode :6;
1812  u_char fsize_lo :8;
1813  u_char fsize_hi :6;
1814  u_char nblks :7;
1815  u_char bit_rate_code :6;
1817 #endif
1818 };
1819 
1820 /* 0x7C aac_descriptor */
1821 
1822 struct descr_aac {
1826 #if BYTE_ORDER == BIG_ENDIAN
1827  u_char aac_type_flag :1;
1828  u_char reserved :7;
1829 #else
1830  u_char reserved :7;
1831  u_char aac_type_flag :1;
1832 #endif
1833 };
1834 /* 0x7F extension_descriptor */
1835 
1836 struct descr_extension {
1840 };
1841 
1842 /* extension 0x04 t2_delivery_system_descriptor */
1843 
1844 struct descr_t2_delivery_system {
1848  u_char plp_id :8;
1851 #if BYTE_ORDER == BIG_ENDIAN
1852  u_char siso_miso :2;
1853  u_char bandwidth :4;
1854  u_char reserved :2;
1858  u_char tfs_flag :1;
1859 #else
1860  u_char reserved :2;
1861  u_char bandwidth :4;
1862  u_char siso_miso :2;
1863  u_char tfs_flag :1;
1867 #endif
1868 /* now follow cell_id, frequency_loop_length, centre_frequency,
1869  subcell_info_loop_length, cell_id_extension, transposer_frequency
1870  fields looping to the end */
1871 };
1872 
1873 /* MHP 0x00 application_descriptor */
1874 
1875 #define DESCR_APPLICATION_LEN 3
1876 
1877 struct descr_application {
1881 };
1882 
1883 #define DESCR_APPLICATION_END_LEN 2
1884 
1885 struct descr_application_end {
1886 #if BYTE_ORDER == BIG_ENDIAN
1888  u_char visibility :2;
1889  u_char :5;
1890 #else
1891  u_char :5;
1892  u_char visibility :2;
1894 #endif
1896 /*now follow 8bit transport_protocol_label fields to the end */
1897 };
1898 
1899 #define APPLICATION_PROFILE_ENTRY_LEN 5
1900 
1901 struct application_profile_entry {
1904  u_char version_major :8;
1905  u_char version_minor :8;
1906  u_char version_micro :8;
1907 };
1908 
1909 /* MHP 0x01 application_name_desriptor */
1910 
1911 #define DESCR_APPLICATION_NAME_LEN 2
1912 
1913 struct descr_application_name {
1916 };
1917 
1918 #define APPLICATION_NAME_ENTRY_LEN 4
1919 
1920 struct descr_application_name_entry {
1921  u_char lang_code1 :8;
1922  u_char lang_code2 :8;
1923  u_char lang_code3 :8;
1925  /* application name string */
1926 };
1927 
1928 /* MHP 0x02 transport_protocol_descriptor */
1929 
1930 #define DESCR_TRANSPORT_PROTOCOL_LEN 5
1931 
1932 struct descr_transport_protocol {
1938  /* protocol_id-specific selector bytes follow */
1939 };
1940 
1941 struct descr_url_extension_entry {
1943  /* URL extension string */
1944 };
1945 
1946 #define TRANSPORT_VIA_OC_LEN 1
1947 
1948 struct transport_via_oc {
1949 #if BYTE_ORDER == BIG_ENDIAN
1950  u_char remote :1;
1951  u_char :7;
1952 #else
1953  u_char :7;
1954  u_char remote :1;
1955 #endif
1956 };
1957 
1958 //if remote is true, transport_via_oc_remote_end_t follows,
1959 // else transport_via_oc_end_t.
1960 
1961 #define TRANSPORT_VIA_OC_REMOTE_END_LEN 7
1962 
1963 struct transport_via_oc_remote_end {
1968  u_char service_id_hi :8;
1969  u_char service_id_lo :8;
1970  u_char component_tag :8;
1971 };
1972 
1973 #define TRANSPORT_VIA_OC_END_LEN 1
1974 
1975 struct transport_via_oc_end {
1976  u_char component_tag :8;
1977 };
1978 
1979 #define TRANSPORT_VIA_HTTP_LEN 1
1980 
1981 struct transport_via_http {
1983 };
1984 
1985 /* 0x03 dvb_j_application_descriptor() */
1986 
1987 #define DESCR_DVBJ_APPLICATION_LEN 2
1988 
1989 struct descr_dvbj_application {
1992 };
1993 
1994 #define DESCR_DVBJ_APPLICATION_ENTRY_LEN 1
1995 
1996 struct descr_dvbj_application_entry {
1998  /* parameter string */
1999 };
2000 
2001 /* 0x04 dvb_j_application_location_descriptor */
2002 
2003 #define DESCR_DVBJ_APPLICATION_LOCATION_LEN 3
2004 
2005 struct descr_dvbj_application_location {
2009  /* base directory string */
2010 };
2011 
2012 #define DESCR_DVBJ_APPLICATION_LOCATION_MID_LEN 1
2013 
2014 struct descr_dvbj_application_location_mid {
2016 };
2017 
2018 /* 0x0B application_icons_descriptor */
2019 
2020 #define DESCR_APPLICATION_ICONS_LEN 3
2021 
2022 struct descr_application_icons_descriptor {
2026  /* icon locator */
2027 };
2028 
2029 #define DESCR_APPLICATION_ICONS_END_LEN 2
2030 
2031 struct descr_application_icons_descriptor_end {
2032  u_char icon_flags_hi :8;
2033  u_char icon_flags_lo :8;
2034 };
2035 
2036 /* 0x15 simple application location descrptor */
2037 
2038 #define DESCR_SIMPLE_APPLICATION_LOCATION_LEN 3
2039 
2040 struct descr_simple_application_location_descriptor {
2043  /* initial_path_bytes */
2044 };
2045 
2046 // Private DVB Descriptor Premiere.de
2047 // 0xF2 Content Transmission Descriptor
2048 // http://dvbsnoop.sourceforge.net/examples/example-private-section.html
2049 
2050 #define DESCR_PREMIERE_CONTENT_TRANSMISSION_LEN 8
2051 
2052 struct descr_premiere_content_transmission {
2059  u_char service_id_hi :8;
2060  u_char service_id_lo :8;
2061 };
2062 
2063 #define ITEM_PREMIERE_CONTENT_TRANSMISSION_DAY_LEN 3
2064 
2065 struct item_premiere_content_transmission_day {
2066  u_char mjd_hi :8;
2067  u_char mjd_lo :8;
2069 };
2070 
2071 #define ITEM_PREMIERE_CONTENT_TRANSMISSION_TIME_LEN 3
2072 
2073 struct item_premiere_content_transmission_time {
2074  u_char start_time_h :8;
2075  u_char start_time_m :8;
2076  u_char start_time_s :8;
2077 };
2078 
2079 /* 0x05 registration_descriptor */
2080 
2081 #define DESCR_REGISTRATION_LEN 6
2082 struct descr_registration {
2089 };
2090 
2091 } //end of namespace
2092 
2093 #endif //LIBSI_HEADERS_H