vdr  2.2.0
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 3.1 2013/10/30 10:16:18 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;
31  u_char section_length_hi :4;
32 #else
33  u_char section_length_hi :4;
34  u_char :3;
35  u_char section_syntax_indicator :1;
36 #endif
37  u_char section_length_lo :8;
38 };
39 
41  u_char table_id :8;
42 #if BYTE_ORDER == BIG_ENDIAN
44  u_char :3;
45  u_char section_length_hi :4;
46 #else
47  u_char section_length_hi :4;
48  u_char :3;
49  u_char section_syntax_indicator :1;
50 #endif
51  u_char section_length_lo :8;
52  u_char table_id_extension_hi :8;
53  u_char table_id_extension_lo :8;
54 #if BYTE_ORDER == BIG_ENDIAN
55  u_char :2;
56  u_char version_number :5;
57  u_char current_next_indicator :1;
58 #else
59  u_char current_next_indicator :1;
60  u_char version_number :5;
61  u_char :2;
62 #endif
63  u_char section_number :8;
64  u_char last_section_number :8;
65 };
66 
68  u_char descriptor_tag :8;
69  u_char descriptor_length :8;
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;
97  u_char section_length_hi :4;
98 #else
99  u_char section_length_hi :4;
100  u_char :2;
101  u_char dummy :1; // has to be 0
102  u_char section_syntax_indicator :1;
103 #endif
104  u_char section_length_lo :8;
105  u_char transport_stream_id_hi :8;
106  u_char transport_stream_id_lo :8;
107 #if BYTE_ORDER == BIG_ENDIAN
108  u_char :2;
109  u_char version_number :5;
110  u_char current_next_indicator :1;
111 #else
112  u_char current_next_indicator :1;
113  u_char version_number :5;
114  u_char :2;
115 #endif
116  u_char section_number :8;
117  u_char last_section_number :8;
118 };
119 
120 #define PAT_PROG_LEN 4
121 
122 struct pat_prog {
123  u_char program_number_hi :8;
124  u_char program_number_lo :8;
125 #if BYTE_ORDER == BIG_ENDIAN
126  u_char :3;
127  u_char network_pid_hi :5;
128 #else
129  u_char network_pid_hi :5;
130  u_char :3;
131 #endif
132  u_char network_pid_lo :8;
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;
154  u_char section_length_hi :4;
155 #else
156  u_char section_length_hi :4;
157  u_char :2;
158  u_char dummy :1; // has to be 0
159  u_char section_syntax_indicator :1;
160 #endif
161  u_char section_length_lo :8;
162  u_char reserved_1 :8;
163  u_char reserved_2 :8;
164 #if BYTE_ORDER == BIG_ENDIAN
165  u_char :2;
166  u_char version_number :5;
167  u_char current_next_indicator :1;
168 #else
169  u_char current_next_indicator :1;
170  u_char version_number :5;
171  u_char :2;
172 #endif
173  u_char section_number :8;
174  u_char last_section_number :8;
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;
195  u_char section_length_hi :4;
196 #else
197  u_char section_length_hi :4;
198  u_char :2;
199  u_char dummy :1; // has to be 0
200  u_char section_syntax_indicator :1;
201 #endif
202  u_char section_length_lo :8;
203  u_char program_number_hi :8;
204  u_char program_number_lo :8;
205 #if BYTE_ORDER == BIG_ENDIAN
206  u_char :2;
207  u_char version_number :5;
208  u_char current_next_indicator :1;
209 #else
210  u_char current_next_indicator :1;
211  u_char version_number :5;
212  u_char :2;
213 #endif
214  u_char section_number :8;
215  u_char last_section_number :8;
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;
226  u_char program_info_length_hi :4;
227 #else
228  u_char program_info_length_hi :4;
229  u_char :4;
230 #endif
231  u_char program_info_length_lo :8;
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;
241  u_char elementary_PID_hi :5;
242 #else
243  u_char elementary_PID_hi :5;
244  u_char :3;
245 #endif
246  u_char elementary_PID_lo :8;
247 #if BYTE_ORDER == BIG_ENDIAN
248  u_char :4;
249  u_char ES_info_length_hi :4;
250 #else
251  u_char ES_info_length_hi :4;
252  u_char :4;
253 #endif
254  u_char ES_info_length_lo :8;
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;
276  u_char section_length_hi :4;
277 #else
278  u_char section_length_hi :4;
279  u_char :2;
280  u_char dummy :1; // has to be 0
281  u_char section_syntax_indicator :1;
282 #endif
283  u_char section_length_lo :8;
284  u_char :8;
285  u_char :8;
286 #if BYTE_ORDER == BIG_ENDIAN
287  u_char :2;
288  u_char version_number :5;
289  u_char current_next_indicator :1;
290 #else
291  u_char current_next_indicator :1;
292  u_char version_number :5;
293  u_char :2;
294 #endif
295  u_char section_number :8;
296  u_char last_section_number :8;
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;
316  u_char section_length_hi :4;
317 #else
318  u_char section_length_hi :4;
319  u_char :3;
320  u_char section_syntax_indicator :1;
321 #endif
322  u_char section_length_lo :8;
323  u_char network_id_hi :8;
324  u_char network_id_lo :8;
325 #if BYTE_ORDER == BIG_ENDIAN
326  u_char :2;
327  u_char version_number :5;
328  u_char current_next_indicator :1;
329 #else
330  u_char current_next_indicator :1;
331  u_char version_number :5;
332  u_char :2;
333 #endif
334  u_char section_number :8;
335  u_char last_section_number :8;
336 #if BYTE_ORDER == BIG_ENDIAN
337  u_char :4;
338  u_char network_descriptor_length_hi :4;
339 #else
340  u_char network_descriptor_length_hi :4;
341  u_char :4;
342 #endif
343  u_char network_descriptor_length_lo :8;
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;
352  u_char transport_stream_loop_length_hi :4;
353 #else
354  u_char transport_stream_loop_length_hi :4;
355  u_char :4;
356 #endif
357  u_char transport_stream_loop_length_lo :8;
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 {
369  u_char transport_stream_id_hi :8;
370  u_char transport_stream_id_lo :8;
371  u_char original_network_id_hi :8;
372  u_char original_network_id_lo :8;
373 #if BYTE_ORDER == BIG_ENDIAN
374  u_char :4;
375  u_char transport_descriptors_length_hi :4;
376 #else
377  u_char transport_descriptors_length_hi :4;
378  u_char :4;
379 #endif
380  u_char transport_descriptors_length_lo :8;
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;
418  u_char section_length_hi :4;
419 #else
420  u_char section_length_hi :4;
421  u_char :3;
422  u_char section_syntax_indicator :1;
423 #endif
424  u_char section_length_lo :8;
425  u_char transport_stream_id_hi :8;
426  u_char transport_stream_id_lo :8;
427 #if BYTE_ORDER == BIG_ENDIAN
428  u_char :2;
429  u_char version_number :5;
430  u_char current_next_indicator :1;
431 #else
432  u_char current_next_indicator :1;
433  u_char version_number :5;
434  u_char :2;
435 #endif
436  u_char section_number :8;
437  u_char last_section_number :8;
438  u_char original_network_id_hi :8;
439  u_char original_network_id_lo :8;
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 {
449  u_char service_id_hi :8;
450  u_char service_id_lo :8;
451 #if BYTE_ORDER == BIG_ENDIAN
452  u_char :6;
453  u_char eit_schedule_flag :1;
454  u_char eit_present_following_flag :1;
455  u_char running_status :3;
456  u_char free_ca_mode :1;
457  u_char descriptors_loop_length_hi :4;
458 #else
459  u_char eit_present_following_flag :1;
460  u_char eit_schedule_flag :1;
461  u_char :6;
462  u_char descriptors_loop_length_hi :4;
463  u_char free_ca_mode :1;
464  u_char running_status :3;
465 #endif
466  u_char descriptors_loop_length_lo :8;
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;
487  u_char section_length_hi :4;
488 #else
489  u_char section_length_hi :4;
490  u_char :3;
491  u_char section_syntax_indicator :1;
492 #endif
493  u_char section_length_lo :8;
494  u_char service_id_hi :8;
495  u_char service_id_lo :8;
496 #if BYTE_ORDER == BIG_ENDIAN
497  u_char :2;
498  u_char version_number :5;
499  u_char current_next_indicator :1;
500 #else
501  u_char current_next_indicator :1;
502  u_char version_number :5;
503  u_char :2;
504 #endif
505  u_char section_number :8;
506  u_char last_section_number :8;
507  u_char transport_stream_id_hi :8;
508  u_char transport_stream_id_lo :8;
509  u_char original_network_id_hi :8;
510  u_char original_network_id_lo :8;
511  u_char segment_last_section_number :8;
512  u_char last_table_id :8;
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
529  u_char running_status :3;
530  u_char free_ca_mode :1;
531  u_char descriptors_loop_length_hi :4;
532 #else
533  u_char descriptors_loop_length_hi :4;
534  u_char free_ca_mode :1;
535  u_char running_status :3;
536 #endif
537  u_char descriptors_loop_length_lo :8;
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;
555  u_char section_length_hi :4;
556 #else
557  u_char section_length_hi :4;
558  u_char :3;
559  u_char section_syntax_indicator :1;
560 #endif
561  u_char section_length_lo :8;
562 };
563 
564 struct rst_info {
565  u_char transport_stream_id_hi :8;
566  u_char transport_stream_id_lo :8;
567  u_char original_network_id_hi :8;
568  u_char original_network_id_lo :8;
569  u_char service_id_hi :8;
570  u_char service_id_lo :8;
571  u_char event_id_hi :8;
572  u_char event_id_lo :8;
573 #if BYTE_ORDER == BIG_ENDIAN
574  u_char :5;
575  u_char running_status :3;
576 #else
577  u_char running_status :3;
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;
599  u_char section_length_hi :4;
600 #else
601  u_char section_length_hi :4;
602  u_char :3;
603  u_char section_syntax_indicator :1;
604 #endif
605  u_char section_length_lo :8;
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;
629  u_char section_length_hi :4;
630 #else
631  u_char section_length_hi :4;
632  u_char :3;
633  u_char section_syntax_indicator :1;
634 #endif
635  u_char section_length_lo :8;
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;
643  u_char descriptors_loop_length_hi :4;
644 #else
645  u_char descriptors_loop_length_hi :4;
646  u_char :4;
647 #endif
648  u_char descriptors_loop_length_lo :8;
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;
698  u_char section_length_hi :4;
699 #else
700  u_char section_length_hi :4;
701  u_char :3;
702  u_char section_syntax_indicator :1;
703 #endif
704  u_char section_length_lo :8;
705  u_char application_type_hi :8;
706  u_char application_type_lo :8;
707 #if BYTE_ORDER == BIG_ENDIAN
708  u_char :2;
709  u_char version_number :5;
710  u_char current_next_indicator :1;
711 #else
712  u_char current_next_indicator :1;
713  u_char version_number :5;
714  u_char :2;
715 #endif
716  u_char section_number :8;
717  u_char last_section_number :8;
718 #if BYTE_ORDER == BIG_ENDIAN
719  u_char :4;
720  u_char common_descriptors_length_hi :4;
721 #else
722  u_char common_descriptors_length_hi :4;
723  u_char :4;
724 #endif
725  u_char common_descriptors_length_lo :8;
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;
733  u_char application_loop_length_hi :4;
734 #else
735  u_char application_loop_length_hi :4;
736  u_char :4;
737 #endif
738  u_char application_loop_length_lo :8;
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 
752  u_char organisation_id_hi_hi :8;
753  u_char organisation_id_hi_lo :8;
754  u_char organisation_id_lo_hi :8;
755  u_char organisation_id_lo_lo :8;
756 
757  //long organisation_id :32;
758  u_char application_id_hi :8;
759  u_char application_id_lo :8;
760  u_char application_control_code :8;
761 #if BYTE_ORDER == BIG_ENDIAN
762  u_char :4;
763  u_char application_descriptors_length_hi :4;
764 #else
765  u_char application_descriptors_length_hi :4;
766  u_char :4;
767 #endif
768  u_char application_descriptors_length_lo :8;
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;
782  u_char section_length_hi :4;
783 #else
784  u_char section_length_hi :4;
785  u_char :2;
786  u_char dummy :1; // has to be 0
787  u_char section_syntax_indicator :1;
788 #endif
789  u_char section_length_lo :8;
790  u_char :8;
791  u_char :8;
792 #if BYTE_ORDER == BIG_ENDIAN
793  u_char :2;
794  u_char version_number :5;
795  u_char current_next_indicator :1;
796 #else
797  u_char current_next_indicator :1;
798  u_char version_number :5;
799  u_char :2;
800 #endif
801  u_char section_number :8;
802  u_char last_section_number :8;
803 
804  u_char contentId_hi_hi :8;
805  u_char contentId_hi_lo :8;
806  u_char contentId_lo_hi :8;
807  u_char contentId_lo_lo :8;
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;
815  u_char descriptors_loop_length_hi :4;
816 #else
817  u_char descriptors_loop_length_hi :4;
818  u_char :4;
819 #endif
820  u_char descriptors_loop_length_lo :8;
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 {
844  u_char descriptor_tag :8;
845  u_char descriptor_length :8;
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 {
855  u_char descriptor_tag :8;
856  u_char descriptor_length :8;
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
873  u_char descriptor_tag :8;
874  u_char descriptor_length :8;
875 };
876 
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
888  u_char descriptor_tag :8;
889  u_char descriptor_length :8;
890  u_char carousel_id_hi_hi :8;
891  u_char carousel_id_hi_lo :8;
892  u_char carousel_id_lo_hi :8;
893  u_char carousel_id_lo_lo :8;
894  u_char FormatId :8;
895  /* FormatSpecifier follows */
896 };
897 
898 /* 0x40 network_name_descriptor */
899 
900 #define DESCR_NETWORK_NAME_LEN 2
902  u_char descriptor_tag :8;
903  u_char descriptor_length :8;
904 };
905 
906 /* 0x41 service_list_descriptor */
907 
908 #define DESCR_SERVICE_LIST_LEN 2
910  u_char descriptor_tag :8;
911  u_char descriptor_length :8;
912 };
913 
914 #define DESCR_SERVICE_LIST_LOOP_LEN 3
916  u_char service_id_hi :8;
917  u_char service_id_lo :8;
918  u_char service_type :8;
919 };
920 
921 /* 0x42 stuffing_descriptor */
922 
923 #define DESCR_STUFFING_LEN XX
925  u_char descriptor_tag :8;
926  u_char descriptor_length :8;
927  /* TBD */
928 };
929 
930 /* 0x43 satellite_delivery_system_descriptor */
931 
932 #define DESCR_SATELLITE_DELIVERY_SYSTEM_LEN 13
934  u_char descriptor_tag :8;
935  u_char descriptor_length :8;
936  u_char frequency_hi_hi :8;
937  u_char frequency_hi_lo :8;
938  u_char frequency_lo_hi :8;
939  u_char frequency_lo_lo :8;
940  u_char orbital_position_hi :8;
941  u_char orbital_position_lo :8;
942 #if BYTE_ORDER == BIG_ENDIAN
943  u_char west_east_flag :1;
944  u_char polarization :2;
945  u_char roll_off :2;
946  u_char modulation_system :1;
947  u_char modulation_type :2;
948 #else
949  u_char modulation_type :2;
950  u_char modulation_system :1;
951  u_char roll_off :2;
952  u_char polarization :2;
953  u_char west_east_flag :1;
954 #endif
955  u_char symbol_rate_hi_hi :8;
956  u_char symbol_rate_hi_lo :8;
957  u_char symbol_rate_lo_1 :8;
958 #if BYTE_ORDER == BIG_ENDIAN
959  u_char symbol_rate_lo_2 :4;
960  u_char fec_inner :4;
961 #else
962  u_char fec_inner :4;
963  u_char symbol_rate_lo_2 :4;
964 #endif
965 };
966 
967 /* 0x44 cable_delivery_system_descriptor */
968 
969 #define DESCR_CABLE_DELIVERY_SYSTEM_LEN 13
971  u_char descriptor_tag :8;
972  u_char descriptor_length :8;
973  u_char frequency_hi_hi :8;
974  u_char frequency_hi_lo :8;
975  u_char frequency_lo_hi :8;
976  u_char frequency_lo_lo :8;
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;
986  u_char symbol_rate_hi_hi :8;
987  u_char symbol_rate_hi_lo :8;
988  u_char symbol_rate_lo_1 :8;
989 #if BYTE_ORDER == BIG_ENDIAN
990  u_char symbol_rate_lo_2 :4;
991  u_char fec_inner :4;
992 #else
993  u_char fec_inner :4;
994  u_char symbol_rate_lo_2 :4;
995 #endif
996 };
997 
998 /* 0x45 vbi_data_descriptor */
999 
1000 #define DESCR_VBI_DATA_LEN XX
1002  u_char descriptor_tag :8;
1003  u_char descriptor_length :8;
1004  /* TBD */
1005 };
1006 
1007 /* 0x46 vbi_teletext_descriptor */
1008 
1009 #define DESCR_VBI_TELETEXT_LEN XX
1011  u_char descriptor_tag :8;
1012  u_char descriptor_length :8;
1013  /* TBD */
1014 };
1015 
1016 /* 0x47 bouquet_name_descriptor */
1017 
1018 #define DESCR_BOUQUET_NAME_LEN 2
1020  u_char descriptor_tag :8;
1021  u_char descriptor_length :8;
1022 };
1023 
1024 /* 0x48 service_descriptor */
1025 
1026 #define DESCR_SERVICE_LEN 4
1028  u_char descriptor_tag :8;
1029  u_char descriptor_length :8;
1030  u_char service_type :8;
1031  u_char provider_name_length :8;
1032 };
1033 
1035  u_char service_name_length :8;
1036 };
1037 
1038 /* 0x49 country_availability_descriptor */
1039 
1040 #define DESCR_COUNTRY_AVAILABILITY_LEN 3
1042  u_char descriptor_tag :8;
1043  u_char descriptor_length :8;
1044 #if BYTE_ORDER == BIG_ENDIAN
1045  u_char country_availability_flag :1;
1046  u_char reserved :7;
1047 #else
1048  u_char reserved :7;
1049  u_char country_availability_flag :1;
1050 #endif
1051 };
1052 
1053 /* 0x4A linkage_descriptor */
1054 
1055 #define DESCR_LINKAGE_LEN 9
1057  u_char descriptor_tag :8;
1058  u_char descriptor_length :8;
1059  u_char transport_stream_id_hi :8;
1060  u_char transport_stream_id_lo :8;
1061  u_char original_network_id_hi :8;
1062  u_char original_network_id_lo :8;
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
1070 #if BYTE_ORDER == BIG_ENDIAN
1071  u_char hand_over_type :4;
1072  u_char reserved :3;
1073  u_char origin_type :1;
1074 #else
1075  u_char origin_type :1;
1076  u_char reserved :3;
1077  u_char hand_over_type :4;
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
1087  u_char descriptor_tag :8;
1088  u_char descriptor_length :8;
1089 };
1090 
1091 #define ITEM_NVOD_REFERENCE_LEN 6
1093  u_char transport_stream_id_hi :8;
1094  u_char transport_stream_id_lo :8;
1095  u_char original_network_id_hi :8;
1096  u_char original_network_id_lo :8;
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
1105  u_char descriptor_tag :8;
1106  u_char descriptor_length :8;
1107  u_char reference_service_id_hi :8;
1108  u_char reference_service_id_lo :8;
1109 };
1110 
1111 /* 0x4D short_event_descriptor */
1112 
1113 #define DESCR_SHORT_EVENT_LEN 6
1115  u_char descriptor_tag :8;
1116  u_char descriptor_length :8;
1117  u_char lang_code1 :8;
1118  u_char lang_code2 :8;
1119  u_char lang_code3 :8;
1120  u_char event_name_length :8;
1121 };
1122 
1124  u_char text_length :8;
1125 };
1126 
1127 /* 0x4E extended_event_descriptor */
1128 
1129 #define DESCR_EXTENDED_EVENT_LEN 7
1131  u_char descriptor_tag :8;
1132  u_char descriptor_length :8;
1133  /* TBD */
1134 #if BYTE_ORDER == BIG_ENDIAN
1135  u_char descriptor_number :4;
1136  u_char last_descriptor_number :4;
1137 #else
1138  u_char last_descriptor_number :4;
1139  u_char descriptor_number :4;
1140 #endif
1141  u_char lang_code1 :8;
1142  u_char lang_code2 :8;
1143  u_char lang_code3 :8;
1144  u_char length_of_items :8;
1145 };
1146 
1148  u_char text_length :8;
1149 };
1150 
1151 #define ITEM_EXTENDED_EVENT_LEN 1
1153  u_char item_description_length :8;
1154 };
1155 
1157  u_char item_length :8;
1158 };
1159 
1160 /* 0x4F time_shifted_event_descriptor */
1161 
1162 #define DESCR_TIME_SHIFTED_EVENT_LEN 6
1164  u_char descriptor_tag :8;
1165  u_char descriptor_length :8;
1166  u_char reference_service_id_hi :8;
1167  u_char reference_service_id_lo :8;
1168  u_char reference_event_id_hi :8;
1169  u_char reference_event_id_lo :8;
1170 };
1171 
1172 /* 0x50 component_descriptor */
1173 
1174 #define DESCR_COMPONENT_LEN 8
1176  u_char descriptor_tag :8;
1177  u_char descriptor_length :8;
1178 #if BYTE_ORDER == BIG_ENDIAN
1179  u_char reserved :4;
1180  u_char stream_content :4;
1181 #else
1182  u_char stream_content :4;
1183  u_char reserved :4;
1184 #endif
1185  u_char component_type :8;
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
1196  u_char descriptor_tag :8;
1197  u_char descriptor_length :8;
1198  /* TBD */
1199 };
1200 
1201 /* 0x52 stream_identifier_descriptor */
1202 
1203 #define DESCR_STREAM_IDENTIFIER_LEN 3
1205  u_char descriptor_tag :8;
1206  u_char descriptor_length :8;
1207  u_char component_tag :8;
1208 };
1209 
1210 /* 0x53 ca_identifier_descriptor */
1211 
1212 #define DESCR_CA_IDENTIFIER_LEN 2
1214  u_char descriptor_tag :8;
1215  u_char descriptor_length :8;
1216 };
1217 
1218 /* 0x54 content_descriptor */
1219 
1220 #define DESCR_CONTENT_LEN 2
1222  u_char descriptor_tag :8;
1223  u_char descriptor_length :8;
1224 };
1225 
1227 #if BYTE_ORDER == BIG_ENDIAN
1228  u_char content_nibble_level_1 :4;
1229  u_char content_nibble_level_2 :4;
1230 #else
1231  u_char content_nibble_level_2 :4;
1232  u_char content_nibble_level_1 :4;
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
1247  u_char descriptor_tag :8;
1248  u_char descriptor_length :8;
1249 };
1250 
1251 #define PARENTAL_RATING_LEN 4
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
1263  u_char descriptor_tag :8;
1264  u_char descriptor_length :8;
1265 };
1266 
1267 #define ITEM_TELETEXT_LEN 5
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;
1274  u_char magazine_number :3;
1275 #else
1276  u_char magazine_number :3;
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
1286  u_char descriptor_tag :8;
1287  u_char descriptor_length :8;
1288  /* TBD */
1289 };
1290 
1291 /* 0x58 local_time_offset_descriptor */
1292 
1293 #define DESCR_LOCAL_TIME_OFFSET_LEN 2
1295  u_char descriptor_tag :8;
1296  u_char descriptor_length :8;
1297 };
1298 
1299 #define LOCAL_TIME_OFFSET_ENTRY_LEN 15
1301  u_char country_code1 :8;
1302  u_char country_code2 :8;
1303  u_char country_code3 :8;
1304 #if BYTE_ORDER == BIG_ENDIAN
1305  u_char country_region_id :6;
1306  u_char :1;
1307  u_char local_time_offset_polarity :1;
1308 #else
1309  u_char local_time_offset_polarity :1;
1310  u_char :1;
1311  u_char country_region_id :6;
1312 #endif
1313  u_char local_time_offset_h :8;
1314  u_char local_time_offset_m :8;
1315  u_char time_of_change_mjd_hi :8;
1316  u_char time_of_change_mjd_lo :8;
1317  u_char time_of_change_time_h :8;
1318  u_char time_of_change_time_m :8;
1319  u_char time_of_change_time_s :8;
1320  u_char next_time_offset_h :8;
1321  u_char next_time_offset_m :8;
1322 };
1323 
1324 /* 0x59 subtitling_descriptor */
1325 
1326 #define DESCR_SUBTITLING_LEN 2
1328  u_char descriptor_tag :8;
1329  u_char descriptor_length :8;
1330 };
1331 
1332 #define ITEM_SUBTITLING_LEN 8
1334  u_char lang_code1 :8;
1335  u_char lang_code2 :8;
1336  u_char lang_code3 :8;
1337  u_char subtitling_type :8;
1338  u_char composition_page_id_hi :8;
1339  u_char composition_page_id_lo :8;
1340  u_char ancillary_page_id_hi :8;
1341  u_char ancillary_page_id_lo :8;
1342 };
1343 
1344 /* 0x5A terrestrial_delivery_system_descriptor */
1345 
1346 #define DESCR_TERRESTRIAL_DELIVERY_SYSTEM_LEN XX
1348  u_char descriptor_tag :8;
1349  u_char descriptor_length :8;
1350  u_char frequency_hi_hi :8;
1351  u_char frequency_hi_lo :8;
1352  u_char frequency_lo_hi :8;
1353  u_char frequency_lo_lo :8;
1354 #if BYTE_ORDER == BIG_ENDIAN
1355  u_char bandwidth :3;
1356  u_char priority :1;
1357  u_char time_slicing_indicator :1;
1358  u_char mpe_fec_indicator :1;
1359  u_char reserved1 :2;
1360 #else
1361  u_char reserved1 :2;
1362  u_char mpe_fec_indicator :1;
1363  u_char time_slicing_indicator :1;
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;
1378  u_char guard_interval :2;
1379  u_char transmission_mode :2;
1380  u_char other_frequency_flag :1;
1381 #else
1382  u_char other_frequency_flag :1;
1383  u_char transmission_mode :2;
1384  u_char guard_interval :2;
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
1397  u_char descriptor_tag :8;
1398  u_char descriptor_length :8;
1399 };
1400 
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
1412  u_char descriptor_tag :8;
1413  u_char descriptor_length :8;
1414 };
1415 
1416 /* 0x5D multilingual_service_name_descriptor */
1417 
1418 #define DESCR_MULTILINGUAL_SERVICE_NAME_LEN XX
1420  u_char descriptor_tag :8;
1421  u_char descriptor_length :8;
1422 };
1423 
1425  u_char service_name_length :8;
1426 };
1427 
1428 /* 0x5E multilingual_component_descriptor */
1429 
1430 #define DESCR_MULTILINGUAL_COMPONENT_LEN XX
1432  u_char descriptor_tag :8;
1433  u_char descriptor_length :8;
1434  u_char component_tag :8;
1435 };
1436 
1437 /* 0x5F private_data_specifier_descriptor */
1438 
1439 #define DESCR_PRIVATE_DATA_SPECIFIER_LEN XX
1441  u_char descriptor_tag :8;
1442  u_char descriptor_length :8;
1443  u_char private_data_specifier_hi_hi :8;
1444  u_char private_data_specifier_hi_lo :8;
1445  u_char private_data_specifier_lo_hi :8;
1446  u_char private_data_specifier_lo_lo :8;
1447 };
1448 
1449 /* 0x60 service_move_descriptor */
1450 
1451 #define DESCR_SERVICE_MOVE_LEN XX
1453  u_char descriptor_tag :8;
1454  u_char descriptor_length :8;
1455  u_char new_original_network_id_hi :8;
1456  u_char new_original_network_id_lo :8;
1457  u_char new_transport_stream_id_hi :8;
1458  u_char new_transport_stream_id_lo :8;
1459  u_char new_service_id_hi :8;
1460  u_char new_service_id_lo :8;
1461 };
1462 
1463 /* 0x61 short_smoothing_buffer_descriptor */
1464 
1465 #define DESCR_SHORT_SMOOTHING_BUFFER_LEN XX
1467  u_char descriptor_tag :8;
1468  u_char descriptor_length :8;
1469  /* TBD */
1470 };
1471 
1472 /* 0x62 frequency_list_descriptor */
1473 
1474 #define DESCR_FREQUENCY_LIST_LEN XX
1476  u_char descriptor_tag :8;
1477  u_char descriptor_length :8;
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
1491  u_char descriptor_tag :8;
1492  u_char descriptor_length :8;
1493  /* TBD */
1494 };
1495 
1496 /* 0x64 data_broadcast_descriptor */
1497 
1498 #define DESCR_DATA_BROADCAST_LEN XX
1500  u_char descriptor_tag :8;
1501  u_char descriptor_length :8;
1502  /* TBD */
1503 };
1504 
1505 /* 0x65 scrambling_descriptor */
1506 
1507 #define DESCR_SCRAMBLING_LEN XX
1509  u_char descriptor_tag :8;
1510  u_char descriptor_length :8;
1511  /* TBD */
1512 };
1513 
1514 /* 0x66 data_broadcast_id_descriptor */
1515 
1516 #define DESCR_DATA_BROADCAST_ID_LEN XX
1518  u_char descriptor_tag :8;
1519  u_char descriptor_length :8;
1520  /* TBD */
1521 };
1522 
1523 /* 0x67 transport_stream_descriptor */
1524 
1525 #define DESCR_TRANSPORT_STREAM_LEN XX
1527  u_char descriptor_tag :8;
1528  u_char descriptor_length :8;
1529  /* TBD */
1530 };
1531 
1532 /* 0x68 dsng_descriptor */
1533 
1534 #define DESCR_DSNG_LEN XX
1535 struct descr_dsng {
1536  u_char descriptor_tag :8;
1537  u_char descriptor_length :8;
1538  /* TBD */
1539 };
1540 
1541 /* 0x69 pdc_descriptor */
1542 
1543 #define DESCR_PDC_LEN 5
1544 struct descr_pdc {
1545  u_char descriptor_tag :8;
1546  u_char descriptor_length :8;
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 {
1556  u_char descriptor_tag :8;
1557  u_char descriptor_length :8;
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
1581  u_char descriptor_tag :8;
1582  u_char descriptor_length :8;
1583  u_char ancillary_data_identifier :8;
1584 };
1585 
1586 /* 0x6C cell_list_descriptor */
1587 
1588 #define DESCR_CELL_LIST_LEN XX
1590  u_char descriptor_tag :8;
1591  u_char descriptor_length :8;
1592  /* TBD */
1593 };
1594 
1595 /* 0x6D cell_frequency_link_descriptor */
1596 
1597 #define DESCR_CELL_FREQUENCY_LINK_LEN XX
1599  u_char descriptor_tag :8;
1600  u_char descriptor_length :8;
1601  /* TBD */
1602 };
1603 
1604 /* 0x6E announcement_support_descriptor */
1605 
1606 #define DESCR_ANNOUNCEMENT_SUPPORT_LEN XX
1608  u_char descriptor_tag :8;
1609  u_char descriptor_length :8;
1610  /* TBD */
1611 };
1612 
1613 /* 0x6F application_signalling_descriptor */
1614 
1615 #define DESCR_APPLICATION_SIGNALLING_LEN 2
1617  u_char descriptor_tag :8;
1618  u_char descriptor_length :8;
1619 };
1620 
1621 #define APPLICATION_SIGNALLING_ENTRY_LEN 3
1623  u_char application_type_hi :8;
1624  u_char application_type_lo :8;
1625 #if BYTE_ORDER == BIG_ENDIAN
1626  u_char :3;
1627  u_char AIT_version_number :5;
1628 #else
1629  u_char AIT_version_number :5;
1630  u_char :3;
1631 #endif
1632 };
1633 
1634 /* 0x71 service_identifier_descriptor (ETSI TS 102 812, MHP) */
1635 
1637  u_char descriptor_tag :8;
1638  u_char descriptor_length :8;
1639 };
1640 
1641 /* 0x72 service_availbility_descriptor */
1642 
1644  u_char descriptor_tag :8;
1645  u_char descriptor_length :8;
1646 #if BYTE_ORDER == BIG_ENDIAN
1647  u_char availability_flag :1;
1648  u_char reserved :7;
1649 #else
1650  u_char reserved :7;
1651  u_char availability_flag :1;
1652 #endif
1653 };
1654 
1655 /* 0x73 default_authority_descriptor (ETSI TS 102 323) */
1656 
1658  u_char descriptor_tag :8;
1659  u_char descriptor_length :8;
1660 };
1661 
1662 /* 0x74 related_content_descriptor (ETSI TS 102 323) */
1663 
1665  u_char descriptor_tag :8;
1666  u_char descriptor_length :8;
1667 };
1668 
1669 /* 0x75 tva_id_descriptor (ETSI TS 102 323) */
1670 
1672  u_char descriptor_tag :8;
1673  u_char descriptor_length :8;
1674 };
1675 
1676 /* 0x76 content_identifier_descriptor (ETSI TS 102 323) */
1677 
1679  u_char descriptor_tag :8;
1680  u_char descriptor_length :8;
1681 };
1682 
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 
1704  u_char descriptor_tag :8;
1705  u_char descriptor_length :8;
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
1717  u_char max_burst_duration :8;
1718 #if BYTE_ORDER == BIG_ENDIAN
1719  u_char max_average_rate :4;
1720  u_char time_slice_fec_id :4;
1721 #else
1722  u_char time_slice_fec_id :4;
1723  u_char max_average_rate :4;
1724 #endif
1725 };
1726 
1727 /* 0x78 ecm_repetition_rate_descriptor (ETSI EN 301 192) */
1728 
1730  u_char descriptor_tag :8;
1731  u_char descriptor_length :8;
1732  u_char ca_system_id_hi :8;
1733  u_char ca_system_id_lo :8;
1734  u_char ecm_repetition_rate_hi :8;
1735  u_char ecm_repetition_rate_lo :8;
1736 };
1737 
1738 /* 0x79 s2_satellite_delivery_system_descriptor */
1739 
1741  u_char descriptor_tag :8;
1742  u_char descriptor_length :8;
1743 #if BYTE_ORDER == BIG_ENDIAN
1744  u_char scrambling_sequence_selector :1;
1745  u_char multiple_input_stream_flag :1;
1746  u_char backwards_compatibility_indicator :1;
1747  u_char reserved :5;
1748 #else
1749  u_char reserved :5;
1750  u_char backwards_compatibility_indicator :1;
1751  u_char multiple_input_stream_flag :1;
1752  u_char scrambling_sequence_selector :1;
1753 #endif
1754 };
1755 
1757 #if BYTE_ORDER == BIG_ENDIAN
1758  u_char reserved :6;
1759  u_char scrambling_sequence_index_hi_lo :2;
1760 #else
1761  u_char scrambling_sequence_index_hi_lo :2;
1762  u_char reserved :6;
1763 #endif
1764  u_char scrambling_sequence_index_lo_hi :8;
1765  u_char scrambling_sequence_index_lo_lo :8;
1766 };
1767 
1768 /* 0x7A enhanced_ac3_descriptor */
1769 
1771  u_char descriptor_tag :8;
1772  u_char descriptor_length :8;
1773 #if BYTE_ORDER == BIG_ENDIAN
1774  u_char component_type_flag :1;
1775  u_char bsid_flag :1;
1776  u_char mainid_flag :1;
1777  u_char asvc_flag :1;
1778  u_char mixinfoexists :1;
1779  u_char substream1_flag :1;
1780  u_char substream2_flag :1;
1781  u_char substream3_flag :1;
1782 #else
1783  u_char substream3_flag :1;
1784  u_char substream2_flag :1;
1785  u_char substream1_flag :1;
1786  u_char mixinfoexists :1;
1787  u_char asvc_flag :1;
1788  u_char mainid_flag :1;
1789  u_char bsid_flag :1;
1790  u_char component_type_flag :1;
1791 #endif
1792 };
1793 
1794 /* 0x7B dts_descriptor */
1795 
1796 struct descr_dts {
1797  u_char descriptor_tag :8;
1798  u_char descriptor_length :8;
1799 #if BYTE_ORDER == BIG_ENDIAN
1800  u_char sample_rate_code :4;
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;
1807  u_char extended_surround_flag :2;
1808 #else
1809  u_char extended_surround_flag :2;
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;
1816  u_char sample_rate_code :4;
1817 #endif
1818 };
1819 
1820 /* 0x7C aac_descriptor */
1821 
1822 struct descr_aac {
1823  u_char descriptor_tag :8;
1824  u_char descriptor_length :8;
1825  u_char profile_and_level :8;
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 
1837  u_char descriptor_tag :8;
1838  u_char descriptor_length :8;
1839  u_char descriptor_tag_extension :8;
1840 };
1841 
1842 /* extension 0x04 t2_delivery_system_descriptor */
1843 
1845  u_char descriptor_tag :8;
1846  u_char descriptor_length :8;
1847  u_char descriptor_tag_extension :8;
1848  u_char plp_id :8;
1849  u_char t2_system_id_hi :8;
1850  u_char t2_system_id_lo :8;
1851 #if BYTE_ORDER == BIG_ENDIAN
1852  u_char siso_miso :2;
1853  u_char bandwidth :4;
1854  u_char reserved :2;
1855  u_char guard_interval :3;
1856  u_char transmission_mode :3;
1857  u_char other_frequency_flag :1;
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;
1864  u_char other_frequency_flag :1;
1865  u_char transmission_mode :3;
1866  u_char guard_interval :3;
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 /* 0x83 logical_channel_descriptor */
1874 
1875 #define DESCR_LOGICAL_CHANNEL_LEN 2
1877  u_char descriptor_tag :8;
1878  u_char descriptor_length :8;
1879 };
1880 
1881 #define ITEM_LOGICAL_CHANNEL_LEN 4
1883  u_char service_id_hi :8;
1884  u_char service_id_lo :8;
1885 #if BYTE_ORDER == BIG_ENDIAN
1886  u_char visible_service_flag :1;
1887  u_char reserved :5;
1888  u_char logical_channel_number_hi :2;
1889 #else
1890  u_char logical_channel_number_hi :2;
1891  u_char reserved :5;
1892  u_char visible_service_flag :1;
1893 #endif
1894  u_char logical_channel_number_lo :8;
1895 };
1896 
1897 /* 0x88 hd_simulcast_logical_channel_descriptor */
1898 
1899 #define DESCR_HD_SIMULCAST_LOGICAL_CHANNEL_LEN 2
1901  u_char descriptor_tag :8;
1902  u_char descriptor_length :8;
1903 };
1904 
1905 #define ITEM_HD_SIMULCAST_LOGICAL_CHANNEL_LEN 4
1907  u_char service_id_hi :8;
1908  u_char service_id_lo :8;
1909 #if BYTE_ORDER == BIG_ENDIAN
1910  u_char visible_service_flag :1;
1911  u_char reserved :5;
1912  u_char logical_channel_number_hi :2;
1913 #else
1914  u_char logical_channel_number_hi :2;
1915  u_char reserved :5;
1916  u_char visible_service_flag :1;
1917 #endif
1918  u_char logical_channel_number_lo :8;
1919 };
1920 
1921 /* MHP 0x00 application_descriptor */
1922 
1923 #define DESCR_APPLICATION_LEN 3
1924 
1926  u_char descriptor_tag :8;
1927  u_char descriptor_length :8;
1928  u_char application_profiles_length :8;
1929 };
1930 
1931 #define DESCR_APPLICATION_END_LEN 2
1932 
1934 #if BYTE_ORDER == BIG_ENDIAN
1935  u_char service_bound_flag :1;
1936  u_char visibility :2;
1937  u_char :5;
1938 #else
1939  u_char :5;
1940  u_char visibility :2;
1941  u_char service_bound_flag :1;
1942 #endif
1943  u_char application_priority :8;
1944 /*now follow 8bit transport_protocol_label fields to the end */
1945 };
1946 
1947 #define APPLICATION_PROFILE_ENTRY_LEN 5
1948 
1950  u_char application_profile_hi :8;
1951  u_char application_profile_lo :8;
1952  u_char version_major :8;
1953  u_char version_minor :8;
1954  u_char version_micro :8;
1955 };
1956 
1957 /* MHP 0x01 application_name_desriptor */
1958 
1959 #define DESCR_APPLICATION_NAME_LEN 2
1960 
1962  u_char descriptor_tag :8;
1963  u_char descriptor_length :8;
1964 };
1965 
1966 #define APPLICATION_NAME_ENTRY_LEN 4
1967 
1969  u_char lang_code1 :8;
1970  u_char lang_code2 :8;
1971  u_char lang_code3 :8;
1972  u_char application_name_length :8;
1973  /* application name string */
1974 };
1975 
1976 /* MHP 0x02 transport_protocol_descriptor */
1977 
1978 #define DESCR_TRANSPORT_PROTOCOL_LEN 5
1979 
1981  u_char descriptor_tag :8;
1982  u_char descriptor_length :8;
1983  u_char protocol_id_hi :8;
1984  u_char protocol_id_lo :8;
1985  u_char transport_protocol_label :8;
1986  /* protocol_id-specific selector bytes follow */
1987 };
1988 
1990  u_char url_extension_length :8;
1991  /* URL extension string */
1992 };
1993 
1994 #define TRANSPORT_VIA_OC_LEN 1
1995 
1997 #if BYTE_ORDER == BIG_ENDIAN
1998  u_char remote :1;
1999  u_char :7;
2000 #else
2001  u_char :7;
2002  u_char remote :1;
2003 #endif
2004 };
2005 
2006 //if remote is true, transport_via_oc_remote_end_t follows,
2007 // else transport_via_oc_end_t.
2008 
2009 #define TRANSPORT_VIA_OC_REMOTE_END_LEN 7
2010 
2012  u_char original_network_id_hi :8;
2013  u_char original_network_id_lo :8;
2014  u_char transport_stream_id_hi :8;
2015  u_char transport_stream_id_lo :8;
2016  u_char service_id_hi :8;
2017  u_char service_id_lo :8;
2018  u_char component_tag :8;
2019 };
2020 
2021 #define TRANSPORT_VIA_OC_END_LEN 1
2022 
2024  u_char component_tag :8;
2025 };
2026 
2027 #define TRANSPORT_VIA_HTTP_LEN 1
2028 
2030  u_char url_base_length :8;
2031 };
2032 
2033 /* 0x03 dvb_j_application_descriptor() */
2034 
2035 #define DESCR_DVBJ_APPLICATION_LEN 2
2036 
2038  u_char descriptor_tag :8;
2039  u_char descriptor_length :8;
2040 };
2041 
2042 #define DESCR_DVBJ_APPLICATION_ENTRY_LEN 1
2043 
2045  u_char parameter_length :8;
2046  /* parameter string */
2047 };
2048 
2049 /* 0x04 dvb_j_application_location_descriptor */
2050 
2051 #define DESCR_DVBJ_APPLICATION_LOCATION_LEN 3
2052 
2054  u_char descriptor_tag :8;
2055  u_char descriptor_length :8;
2056  u_char base_directory_length :8;
2057  /* base directory string */
2058 };
2059 
2060 #define DESCR_DVBJ_APPLICATION_LOCATION_MID_LEN 1
2061 
2063  u_char classpath_extension_length :8;
2064 };
2065 
2066 /* 0x0B application_icons_descriptor */
2067 
2068 #define DESCR_APPLICATION_ICONS_LEN 3
2069 
2071  u_char descriptor_tag :8;
2072  u_char descriptor_length :8;
2073  u_char icon_locator_length :8;
2074  /* icon locator */
2075 };
2076 
2077 #define DESCR_APPLICATION_ICONS_END_LEN 2
2078 
2080  u_char icon_flags_hi :8;
2081  u_char icon_flags_lo :8;
2082 };
2083 
2084 /* 0x15 simple application location descrptor */
2085 
2086 #define DESCR_SIMPLE_APPLICATION_LOCATION_LEN 3
2087 
2089  u_char descriptor_tag :8;
2090  u_char descriptor_length :8;
2091  /* initial_path_bytes */
2092 };
2093 
2094 // Private DVB Descriptor Premiere.de
2095 // 0xF2 Content Transmission Descriptor
2096 // http://dvbsnoop.sourceforge.net/examples/example-private-section.html
2097 
2098 #define DESCR_PREMIERE_CONTENT_TRANSMISSION_LEN 8
2099 
2101  u_char descriptor_tag :8;
2102  u_char descriptor_length :8;
2103  u_char transport_stream_id_hi :8;
2104  u_char transport_stream_id_lo :8;
2105  u_char original_network_id_hi :8;
2106  u_char original_network_id_lo :8;
2107  u_char service_id_hi :8;
2108  u_char service_id_lo :8;
2109 };
2110 
2111 #define ITEM_PREMIERE_CONTENT_TRANSMISSION_DAY_LEN 3
2112 
2114  u_char mjd_hi :8;
2115  u_char mjd_lo :8;
2116  u_char start_time_loop :8;
2117 };
2118 
2119 #define ITEM_PREMIERE_CONTENT_TRANSMISSION_TIME_LEN 3
2120 
2122  u_char start_time_h :8;
2123  u_char start_time_m :8;
2124  u_char start_time_s :8;
2125 };
2126 
2127 /* 0x05 registration_descriptor */
2128 
2129 #define DESCR_REGISTRATION_LEN 6
2131  u_char descriptor_tag :8;
2132  u_char descriptor_length :8;
2133  u_char format_identifier_hi_hi :8;
2134  u_char format_identifier_hi_lo :8;
2135  u_char format_identifier_lo_hi :8;
2136  u_char format_identifier_lo_lo :8;
2137 };
2138 
2139 /* 0x28 avc_descriptor */
2140 
2141 #define DESCR_AVC_LEN 6
2142 struct descr_avc {
2143  u_char descriptor_tag :8;
2144  u_char descriptor_length :8;
2145  u_char profile_idc :8;
2146  u_char constraint_set0_flag :1;
2147  u_char constraint_set1_flag :1;
2148  u_char constraint_set2_flag :1;
2149  u_char constraint_set3_flag :1;
2150  u_char constraint_set4_flag :1;
2151  u_char constraint_set5_flag :1;
2152  u_char avc_compatible_flags :2;
2153  u_char level_idc :8;
2154  u_char avc_still_present :1;
2155  u_char avc_24_hour_picture_flag :1;
2156  u_char frame_packing_sei_not_present_flag :1;
2157  u_char reserved :5;
2158 };
2159 
2160 } //end of namespace
2161 
2162 #endif //LIBSI_HEADERS_H
u_char section_syntax_indicator
Definition: headers.h:29
u_char table_id
Definition: headers.h:27
Definition: headers.h:1968
Definition: headers.h:1989
u_char section_length_hi
Definition: headers.h:31
Definition: descriptor.c:16
Definition: headers.h:1622
long CRC
Definition: headers.h:744
Definition: headers.h:2044
Definition: headers.h:1300
Definition: headers.h:1683
Definition: headers.h:1949
unsigned char u_char
Definition: headers.h:24
long CRC
Definition: headers.h:363
u_char section_length_lo
Definition: headers.h:37