vdr-1.4.7/libsi/headers.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   (C) 2001-03 Rolf Hakenes <hakenes@hippomi.de>, under the              *
00004  *               GNU GPL with contribution of Oleg Assovski,               *
00005  *               www.satmania.com                                          *
00006  *               Adapted and extended by Marcel Wiesweg                    *
00007  *                                                                         *
00008  *   This program is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   $Id: headers.h 1.8 2006/09/02 20:25:16 kls Exp $
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00017 #ifndef LIBSI_HEADERS_H
00018 #define LIBSI_HEADERS_H
00019 
00020 #include <endian.h>
00021 
00022 namespace SI {
00023 
00024 typedef unsigned char u_char;
00025 
00026 struct SectionHeader {
00027    u_char table_id                               :8;
00028 #if BYTE_ORDER == BIG_ENDIAN
00029    u_char section_syntax_indicator               :1;
00030    u_char                                        :3;
00031    u_char section_length_hi                      :4;
00032 #else
00033    u_char section_length_hi                      :4;
00034    u_char                                        :3;
00035    u_char section_syntax_indicator               :1;
00036 #endif
00037    u_char section_length_lo                      :8;
00038 };
00039 
00040 struct ExtendedSectionHeader {
00041    u_char table_id                               :8;
00042 #if BYTE_ORDER == BIG_ENDIAN
00043    u_char section_syntax_indicator               :1;
00044    u_char                                        :3;
00045    u_char section_length_hi                      :4;
00046 #else
00047    u_char section_length_hi                      :4;
00048    u_char                                        :3;
00049    u_char section_syntax_indicator               :1;
00050 #endif
00051    u_char section_length_lo                      :8;
00052    u_char table_id_extension_hi                  :8;
00053    u_char table_id_extension_lo                  :8;
00054 #if BYTE_ORDER == BIG_ENDIAN
00055    u_char                                        :2;
00056    u_char version_number                         :5;
00057    u_char current_next_indicator                 :1;
00058 #else
00059    u_char current_next_indicator                 :1;
00060    u_char version_number                         :5;
00061    u_char                                        :2;
00062 #endif
00063    u_char section_number                         :8;
00064    u_char last_section_number                    :8;
00065 };
00066 
00067 struct DescriptorHeader {
00068    u_char descriptor_tag                         :8;
00069    u_char descriptor_length                      :8;
00070 };
00071 
00072 /*
00073  *
00074  *    ETSI ISO/IEC 13818-1 specifies SI which is referred to as PSI. The PSI
00075  *    data provides information to enable automatic configuration of the
00076  *    receiver to demultiplex and decode the various streams of programs
00077  *    within the multiplex. The PSI data is structured as four types of table.
00078  *    The tables are transmitted in sections.
00079  *
00080  *    1) Program Association Table (PAT):
00081  *
00082  *       - for each service in the multiplex, the PAT indicates the location
00083  *         (the Packet Identifier (PID) values of the Transport Stream (TS)
00084  *         packets) of the corresponding Program Map Table (PMT).
00085  *         It also gives the location of the Network Information Table (NIT).
00086  *
00087  */
00088 
00089 #define PAT_LEN 8
00090 
00091 struct pat {
00092    u_char table_id                               :8;
00093 #if BYTE_ORDER == BIG_ENDIAN
00094    u_char section_syntax_indicator               :1;
00095    u_char dummy                                  :1;        // has to be 0
00096    u_char                                        :2;
00097    u_char section_length_hi                      :4;
00098 #else
00099    u_char section_length_hi                      :4;
00100    u_char                                        :2;
00101    u_char dummy                                  :1;        // has to be 0
00102    u_char section_syntax_indicator               :1;
00103 #endif
00104    u_char section_length_lo                      :8;
00105    u_char transport_stream_id_hi                 :8;
00106    u_char transport_stream_id_lo                 :8;
00107 #if BYTE_ORDER == BIG_ENDIAN
00108    u_char                                        :2;
00109    u_char version_number                         :5;
00110    u_char current_next_indicator                 :1;
00111 #else
00112    u_char current_next_indicator                 :1;
00113    u_char version_number                         :5;
00114    u_char                                        :2;
00115 #endif
00116    u_char section_number                         :8;
00117    u_char last_section_number                    :8;
00118 };
00119 
00120 #define PAT_PROG_LEN 4
00121 
00122 struct pat_prog {
00123    u_char program_number_hi                      :8;
00124    u_char program_number_lo                      :8;
00125 #if BYTE_ORDER == BIG_ENDIAN
00126    u_char                                        :3;
00127    u_char network_pid_hi                         :5;
00128 #else
00129    u_char network_pid_hi                         :5;
00130    u_char                                        :3;
00131 #endif
00132    u_char network_pid_lo                         :8;
00133    /* or program_map_pid (if prog_num=0)*/
00134 };
00135 
00136 /*
00137  *
00138  *    2) Conditional Access Table (CAT):
00139  *
00140  *       - the CAT provides information on the CA systems used in the
00141  *         multiplex; the information is private and dependent on the CA
00142  *         system, but includes the location of the EMM stream, when
00143  *         applicable.
00144  *
00145  */
00146 #define CAT_LEN 8
00147 
00148 struct cat {
00149    u_char table_id                               :8;
00150 #if BYTE_ORDER == BIG_ENDIAN
00151    u_char section_syntax_indicator               :1;
00152    u_char dummy                                  :1;        // has to be 0
00153    u_char                                        :2;
00154    u_char section_length_hi                      :4;
00155 #else
00156    u_char section_length_hi                      :4;
00157    u_char                                        :2;
00158    u_char dummy                                  :1;        // has to be 0
00159    u_char section_syntax_indicator               :1;
00160 #endif
00161    u_char section_length_lo                      :8;
00162    u_char reserved_1                             :8;
00163    u_char reserved_2                             :8;
00164 #if BYTE_ORDER == BIG_ENDIAN
00165    u_char                                        :2;
00166    u_char version_number                         :5;
00167    u_char current_next_indicator                 :1;
00168 #else
00169    u_char current_next_indicator                 :1;
00170    u_char version_number                         :5;
00171    u_char                                        :2;
00172 #endif
00173    u_char section_number                         :8;
00174    u_char last_section_number                    :8;
00175 };
00176 
00177 /*
00178  *
00179  *    3) Program Map Table (PMT):
00180  *
00181  *       - the PMT identifies and indicates the locations of the streams that
00182  *         make up each service, and the location of the Program Clock
00183  *         Reference fields for a service.
00184  *
00185  */
00186 
00187 #define PMT_LEN 12
00188 
00189 struct pmt {
00190    u_char table_id                               :8;
00191 #if BYTE_ORDER == BIG_ENDIAN
00192    u_char section_syntax_indicator               :1;
00193    u_char dummy                                  :1; // has to be 0
00194    u_char                                        :2;
00195    u_char section_length_hi                      :4;
00196 #else
00197    u_char section_length_hi                      :4;
00198    u_char                                        :2;
00199    u_char dummy                                  :1; // has to be 0
00200    u_char section_syntax_indicator               :1;
00201 #endif
00202    u_char section_length_lo                      :8;
00203    u_char program_number_hi                      :8;
00204    u_char program_number_lo                      :8;
00205 #if BYTE_ORDER == BIG_ENDIAN
00206    u_char                                        :2;
00207    u_char version_number                         :5;
00208    u_char current_next_indicator                 :1;
00209 #else
00210    u_char current_next_indicator                 :1;
00211    u_char version_number                         :5;
00212    u_char                                        :2;
00213 #endif
00214    u_char section_number                         :8;
00215    u_char last_section_number                    :8;
00216 #if BYTE_ORDER == BIG_ENDIAN
00217    u_char                                        :3;
00218    u_char PCR_PID_hi                             :5;
00219 #else
00220    u_char PCR_PID_hi                             :5;
00221    u_char                                        :3;
00222 #endif
00223    u_char PCR_PID_lo                             :8;
00224 #if BYTE_ORDER == BIG_ENDIAN
00225    u_char                                        :4;
00226    u_char program_info_length_hi                 :4;
00227 #else
00228    u_char program_info_length_hi                 :4;
00229    u_char                                        :4;
00230 #endif
00231    u_char program_info_length_lo                 :8;
00232    //descriptors
00233 };
00234 
00235 #define PMT_INFO_LEN 5
00236 
00237 struct pmt_info {
00238    u_char stream_type                            :8;
00239 #if BYTE_ORDER == BIG_ENDIAN
00240    u_char                                        :3;
00241    u_char elementary_PID_hi                      :5;
00242 #else
00243    u_char elementary_PID_hi                      :5;
00244    u_char                                        :3;
00245 #endif
00246    u_char elementary_PID_lo                      :8;
00247 #if BYTE_ORDER == BIG_ENDIAN
00248    u_char                                        :4;
00249    u_char ES_info_length_hi                      :4;
00250 #else
00251    u_char ES_info_length_hi                      :4;
00252    u_char                                        :4;
00253 #endif
00254    u_char ES_info_length_lo                      :8;
00255    // descriptors
00256 };
00257 
00258 /*
00259  *
00260  *    4) Transport Stream Description Table (TSDT):
00261  *
00262  *       - The TSDT carries a loop of descriptors that apply to
00263  *         the whole transport stream. The syntax and semantics
00264  *         of the TSDT are defined in newer versions of ISO/IEC 13818-1.
00265  *
00266  */
00267 
00268 #define TSDT_LEN 8
00269 
00270 struct tsdt {
00271    u_char table_id                               :8;
00272 #if BYTE_ORDER == BIG_ENDIAN
00273    u_char section_syntax_indicator               :1;
00274    u_char dummy                                  :1; // has to be 0
00275    u_char                                        :2;
00276    u_char section_length_hi                      :4;
00277 #else
00278    u_char section_length_hi                      :4;
00279    u_char                                        :2;
00280    u_char dummy                                  :1; // has to be 0
00281    u_char section_syntax_indicator               :1;
00282 #endif
00283    u_char section_length_lo                      :8;
00284    u_char                                        :8;
00285    u_char                                        :8;
00286 #if BYTE_ORDER == BIG_ENDIAN
00287    u_char                                        :2;
00288    u_char version_number                         :5;
00289    u_char current_next_indicator                 :1;
00290 #else
00291    u_char current_next_indicator                 :1;
00292    u_char version_number                         :5;
00293    u_char                                        :2;
00294 #endif
00295    u_char section_number                         :8;
00296    u_char last_section_number                    :8;
00297 };
00298 
00299 /*
00300  *
00301  *    5) Network Information Table (NIT):
00302  *
00303  *       - the NIT is intended to provide information about the physical
00304  *         network. The syntax and semantics of the NIT are defined in
00305  *         ETSI EN 300 468.
00306  *
00307  */
00308 
00309 #define NIT_LEN 10
00310 
00311 struct nit {
00312    u_char table_id                               :8;
00313 #if BYTE_ORDER == BIG_ENDIAN
00314    u_char section_syntax_indicator               :1;
00315    u_char                                        :3;
00316    u_char section_length_hi                      :4;
00317 #else
00318    u_char section_length_hi                      :4;
00319    u_char                                        :3;
00320    u_char section_syntax_indicator               :1;
00321 #endif
00322    u_char section_length_lo                      :8;
00323    u_char network_id_hi                          :8;
00324    u_char network_id_lo                          :8;
00325 #if BYTE_ORDER == BIG_ENDIAN
00326    u_char                                        :2;
00327    u_char version_number                         :5;
00328    u_char current_next_indicator                 :1;
00329 #else
00330    u_char current_next_indicator                 :1;
00331    u_char version_number                         :5;
00332    u_char                                        :2;
00333 #endif
00334    u_char section_number                         :8;
00335    u_char last_section_number                    :8;
00336 #if BYTE_ORDER == BIG_ENDIAN
00337    u_char                                        :4;
00338    u_char network_descriptor_length_hi           :4;
00339 #else
00340    u_char network_descriptor_length_hi           :4;
00341    u_char                                        :4;
00342 #endif
00343    u_char network_descriptor_length_lo           :8;
00344   /* descriptors */
00345 };
00346 
00347 #define SIZE_NIT_MID 2
00348 
00349 struct nit_mid {                                 // after descriptors
00350 #if BYTE_ORDER == BIG_ENDIAN
00351    u_char                                        :4;
00352    u_char transport_stream_loop_length_hi        :4;
00353 #else
00354    u_char transport_stream_loop_length_hi        :4;
00355    u_char                                        :4;
00356 #endif
00357    u_char transport_stream_loop_length_lo        :8;
00358 };
00359 
00360 #define SIZE_NIT_END 4
00361 
00362 struct nit_end {
00363    long CRC;
00364 };
00365 
00366 #define NIT_TS_LEN 6
00367 
00368 struct ni_ts {
00369    u_char transport_stream_id_hi                 :8;
00370    u_char transport_stream_id_lo                 :8;
00371    u_char original_network_id_hi                 :8;
00372    u_char original_network_id_lo                 :8;
00373 #if BYTE_ORDER == BIG_ENDIAN
00374    u_char                                        :4;
00375    u_char transport_descriptors_length_hi        :4;
00376 #else
00377    u_char transport_descriptors_length_hi        :4;
00378    u_char                                        :4;
00379 #endif
00380    u_char transport_descriptors_length_lo        :8;
00381    /* descriptors  */
00382 };
00383 
00384 /*
00385  *
00386  *    In addition to the PSI, data is needed to provide identification of
00387  *    services and events for the user. In contrast with the PAT, CAT, and
00388  *    PMT of the PSI, which give information only for the multiplex in which
00389  *    they are contained (the actual multiplex), the additional information
00390  *    defined within the present document can also provide information on
00391  *    services and events carried by different multiplexes, and even on other
00392  *    networks. This data is structured as nine tables:
00393  *
00394  *    1) Bouquet Association Table (BAT):
00395  *
00396  *       - the BAT provides information regarding bouquets. As well as giving
00397  *         the name of the bouquet, it provides a list of services for each
00398  *         bouquet.
00399  *
00400  */
00401 /* SEE NIT (It has the same structure but has different allowed descriptors) */
00402 /*
00403  *
00404  *    2) Service Description Table (SDT):
00405  *
00406  *       - the SDT contains data describing the services in the system e.g.
00407  *         names of services, the service provider, etc.
00408  *
00409  */
00410 
00411 #define SDT_LEN 11
00412 
00413 struct sdt {
00414    u_char table_id                               :8;
00415 #if BYTE_ORDER == BIG_ENDIAN
00416    u_char section_syntax_indicator               :1;
00417    u_char                                        :3;
00418    u_char section_length_hi                      :4;
00419 #else
00420    u_char section_length_hi                      :4;
00421    u_char                                        :3;
00422    u_char section_syntax_indicator               :1;
00423 #endif
00424    u_char section_length_lo                      :8;
00425    u_char transport_stream_id_hi                 :8;
00426    u_char transport_stream_id_lo                 :8;
00427 #if BYTE_ORDER == BIG_ENDIAN
00428    u_char                                        :2;
00429    u_char version_number                         :5;
00430    u_char current_next_indicator                 :1;
00431 #else
00432    u_char current_next_indicator                 :1;
00433    u_char version_number                         :5;
00434    u_char                                        :2;
00435 #endif
00436    u_char section_number                         :8;
00437    u_char last_section_number                    :8;
00438    u_char original_network_id_hi                 :8;
00439    u_char original_network_id_lo                 :8;
00440    u_char                                        :8;
00441 };
00442 
00443 #define GetSDTTransportStreamId(x) (HILO(((sdt_t *) x)->transport_stream_id))
00444 #define GetSDTOriginalNetworkId(x) (HILO(((sdt_t *) x)->original_network_id))
00445 
00446 #define SDT_DESCR_LEN 5
00447 
00448 struct sdt_descr {
00449    u_char service_id_hi                          :8;
00450    u_char service_id_lo                          :8;
00451 #if BYTE_ORDER == BIG_ENDIAN
00452    u_char                                        :6;
00453    u_char eit_schedule_flag                      :1;
00454    u_char eit_present_following_flag             :1;
00455    u_char running_status                         :3;
00456    u_char free_ca_mode                           :1;
00457    u_char descriptors_loop_length_hi             :4;
00458 #else
00459    u_char eit_present_following_flag             :1;
00460    u_char eit_schedule_flag                      :1;
00461    u_char                                        :6;
00462    u_char descriptors_loop_length_hi             :4;
00463    u_char free_ca_mode                           :1;
00464    u_char running_status                         :3;
00465 #endif
00466    u_char descriptors_loop_length_lo             :8;
00467 };
00468 
00469 /*
00470  *
00471  *    3) Event Information Table (EIT):
00472  *
00473  *       - the EIT contains data concerning events or programmes such as event
00474  *         name, start time, duration, etc.; - the use of different descriptors
00475  *         allows the transmission of different kinds of event information e.g.
00476  *         for different service types.
00477  *
00478  */
00479 
00480 #define EIT_LEN 14
00481 
00482 struct eit {
00483    u_char table_id                               :8;
00484 #if BYTE_ORDER == BIG_ENDIAN
00485    u_char section_syntax_indicator               :1;
00486    u_char                                        :3;
00487    u_char section_length_hi                      :4;
00488 #else
00489    u_char section_length_hi                      :4;
00490    u_char                                        :3;
00491    u_char section_syntax_indicator               :1;
00492 #endif
00493    u_char section_length_lo                      :8;
00494    u_char service_id_hi                          :8;
00495    u_char service_id_lo                          :8;
00496 #if BYTE_ORDER == BIG_ENDIAN
00497    u_char                                        :2;
00498    u_char version_number                         :5;
00499    u_char current_next_indicator                 :1;
00500 #else
00501    u_char current_next_indicator                 :1;
00502    u_char version_number                         :5;
00503    u_char                                        :2;
00504 #endif
00505    u_char section_number                         :8;
00506    u_char last_section_number                    :8;
00507    u_char transport_stream_id_hi                 :8;
00508    u_char transport_stream_id_lo                 :8;
00509    u_char original_network_id_hi                 :8;
00510    u_char original_network_id_lo                 :8;
00511    u_char segment_last_section_number            :8;
00512    u_char last_table_id                          :8;
00513 };
00514 
00515 #define EIT_EVENT_LEN 12
00516 
00517 struct eit_event {
00518    u_char event_id_hi                            :8;
00519    u_char event_id_lo                            :8;
00520    u_char mjd_hi                                 :8;
00521    u_char mjd_lo                                 :8;
00522    u_char start_time_h                           :8;
00523    u_char start_time_m                           :8;
00524    u_char start_time_s                           :8;
00525    u_char duration_h                             :8;
00526    u_char duration_m                             :8;
00527    u_char duration_s                             :8;
00528 #if BYTE_ORDER == BIG_ENDIAN
00529    u_char running_status                         :3;
00530    u_char free_ca_mode                           :1;
00531    u_char descriptors_loop_length_hi             :4;
00532 #else
00533    u_char descriptors_loop_length_hi             :4;
00534    u_char free_ca_mode                           :1;
00535    u_char running_status                         :3;
00536 #endif
00537    u_char descriptors_loop_length_lo             :8;
00538 };
00539 
00540 /*
00541  *
00542  *    4) Running Status Table (RST):
00543  *
00544  *       - the RST gives the status of an event (running/not running). The RST
00545  *         updates this information and allows timely automatic switching to
00546  *         events.
00547  *
00548  */
00549 
00550 struct rst {
00551    u_char table_id                               :8;
00552 #if BYTE_ORDER == BIG_ENDIAN
00553    u_char section_syntax_indicator               :1;
00554    u_char                                        :3;
00555    u_char section_length_hi                      :4;
00556 #else
00557    u_char section_length_hi                      :4;
00558    u_char                                        :3;
00559    u_char section_syntax_indicator               :1;
00560 #endif
00561    u_char section_length_lo                      :8;
00562 };
00563 
00564 struct rst_info {
00565    u_char transport_stream_id_hi                 :8;
00566    u_char transport_stream_id_lo                 :8;
00567    u_char original_network_id_hi                 :8;
00568    u_char original_network_id_lo                 :8;
00569    u_char service_id_hi                          :8;
00570    u_char service_id_lo                          :8;
00571    u_char event_id_hi                            :8;
00572    u_char event_id_lo                            :8;
00573 #if BYTE_ORDER == BIG_ENDIAN
00574    u_char                                        :5;
00575    u_char running_status                         :3;
00576 #else
00577    u_char running_status                         :3;
00578    u_char                                        :5;
00579 #endif
00580 };
00581 
00582 /*
00583  *
00584  *    5) Time and Date Table (TDT):
00585  *
00586  *       - the TDT gives information relating to the present time and date.
00587  *         This information is given in a separate table due to the frequent
00588  *         updating of this information.
00589  *
00590  */
00591 
00592 #define TDT_LEN 8
00593 
00594 struct tdt {
00595    u_char table_id                               :8;
00596 #if BYTE_ORDER == BIG_ENDIAN
00597    u_char section_syntax_indicator               :1;
00598    u_char                                        :3;
00599    u_char section_length_hi                      :4;
00600 #else
00601    u_char section_length_hi                      :4;
00602    u_char                                        :3;
00603    u_char section_syntax_indicator               :1;
00604 #endif
00605    u_char section_length_lo                      :8;
00606    u_char utc_mjd_hi                             :8;
00607    u_char utc_mjd_lo                             :8;
00608    u_char utc_time_h                             :8;
00609    u_char utc_time_m                             :8;
00610    u_char utc_time_s                             :8;
00611 };
00612 
00613 /*
00614  *
00615  *    6) Time Offset Table (TOT):
00616  *
00617  *       - the TOT gives information relating to the present time and date and
00618  *         local time offset. This information is given in a separate table due
00619  *         to the frequent updating of the time information.
00620  *
00621  */
00622 #define TOT_LEN 10
00623 
00624 struct tot {
00625    u_char table_id                               :8;
00626 #if BYTE_ORDER == BIG_ENDIAN
00627    u_char section_syntax_indicator               :1;
00628    u_char                                        :3;
00629    u_char section_length_hi                      :4;
00630 #else
00631    u_char section_length_hi                      :4;
00632    u_char                                        :3;
00633    u_char section_syntax_indicator               :1;
00634 #endif
00635    u_char section_length_lo                      :8;
00636    u_char utc_mjd_hi                             :8;
00637    u_char utc_mjd_lo                             :8;
00638    u_char utc_time_h                             :8;
00639    u_char utc_time_m                             :8;
00640    u_char utc_time_s                             :8;
00641 #if BYTE_ORDER == BIG_ENDIAN
00642    u_char                                        :4;
00643    u_char descriptors_loop_length_hi             :4;
00644 #else
00645    u_char descriptors_loop_length_hi             :4;
00646    u_char                                        :4;
00647 #endif
00648    u_char descriptors_loop_length_lo             :8;
00649 };
00650 
00651 /*
00652  *
00653  *    7) Stuffing Table (ST):
00654  *
00655  *       - the ST is used to invalidate existing sections, for example at
00656  *         delivery system boundaries.
00657  *
00658  */
00659     /* TO BE DONE */
00660 /*
00661  *
00662  *    8) Selection Information Table (SIT):
00663  *
00664  *       - the SIT is used only in "partial" (i.e. recorded) bitstreams. It
00665  *         carries a summary of the SI information required to describe the
00666  *         streams in the partial bitstream.
00667  *
00668  */
00669     /* TO BE DONE */
00670 /*
00671  *
00672  *    9) Discontinuity Information Table (DIT):
00673  *
00674  *       - the DIT is used only in "partial" (i.e. recorded) bitstreams.
00675  *         It is inserted where the SI information in the partial bitstream may
00676  *         be discontinuous. Where applicable the use of descriptors allows a
00677  *         flexible approach to the organization of the tables and allows for
00678  *         future compatible extensions.
00679  *
00680  */
00681     /* TO BE DONE */
00682 
00683 /*
00684  *
00685  *    3) Application Information Table (AIT):
00686  *
00687  *       - the AIT contains data concerning MHP application broadcast by a service.
00688  *
00689  */
00690 
00691 #define AIT_LEN 10
00692 
00693 struct ait {
00694    u_char table_id                               :8;
00695 #if BYTE_ORDER == BIG_ENDIAN
00696    u_char section_syntax_indicator               :1;
00697    u_char                                        :3;
00698    u_char section_length_hi                      :4;
00699 #else
00700    u_char section_length_hi                      :4;
00701    u_char                                        :3;
00702    u_char section_syntax_indicator               :1;
00703 #endif
00704    u_char section_length_lo                      :8;
00705    u_char application_type_hi                    :8;
00706    u_char application_type_lo                    :8;
00707 #if BYTE_ORDER == BIG_ENDIAN
00708    u_char                                        :2;
00709    u_char version_number                         :5;
00710    u_char current_next_indicator                 :1;
00711 #else
00712    u_char current_next_indicator                 :1;
00713    u_char version_number                         :5;
00714    u_char                                        :2;
00715 #endif
00716    u_char section_number                         :8;
00717    u_char last_section_number                    :8;
00718 #if BYTE_ORDER == BIG_ENDIAN
00719    u_char                                        :4;
00720    u_char common_descriptors_length_hi           :4;
00721 #else
00722    u_char common_descriptors_length_hi           :4;
00723    u_char                                        :4;
00724 #endif
00725    u_char common_descriptors_length_lo           :8;
00726 };
00727 
00728 #define SIZE_AIT_MID 2
00729 
00730 struct ait_mid {                                 // after descriptors
00731 #if BYTE_ORDER == BIG_ENDIAN
00732    u_char                                        :4;
00733    u_char application_loop_length_hi             :4;
00734 #else
00735    u_char application_loop_length_hi             :4;
00736    u_char                                        :4;
00737 #endif
00738    u_char application_loop_length_lo             :8;
00739 };
00740 
00741 #define SIZE_AIT_END 4
00742 
00743 struct ait_end {
00744    long CRC;
00745 };
00746 
00747 #define AIT_APP_LEN 9
00748 
00749 struct ait_app {
00750    //how to deal with 32 bit fields?
00751 
00752    u_char organisation_id_hi_hi                  :8;
00753    u_char organisation_id_hi_lo                  :8;
00754    u_char organisation_id_lo_hi                  :8;
00755    u_char organisation_id_lo_lo                  :8;
00756 
00757    //long organisation_id                          :32;
00758    u_char application_id_hi                      :8;
00759    u_char application_id_lo                      :8;
00760    u_char application_control_code               :8;
00761 #if BYTE_ORDER == BIG_ENDIAN
00762    u_char                                        :4;
00763    u_char application_descriptors_length_hi      :4;
00764 #else
00765    u_char application_descriptors_length_hi      :4;
00766    u_char                                        :4;
00767 #endif
00768    u_char application_descriptors_length_lo      :8;
00769    /* descriptors  */
00770 };
00771 
00772 /* Premiere Content Information Table */
00773 
00774 #define PCIT_LEN 17
00775 
00776 struct pcit {
00777    u_char table_id                               :8;
00778 #if BYTE_ORDER == BIG_ENDIAN
00779    u_char section_syntax_indicator               :1;
00780    u_char dummy                                  :1; // has to be 0
00781    u_char                                        :2;
00782    u_char section_length_hi                      :4;
00783 #else
00784    u_char section_length_hi                      :4;
00785    u_char                                        :2;
00786    u_char dummy                                  :1; // has to be 0
00787    u_char section_syntax_indicator               :1;
00788 #endif
00789    u_char section_length_lo                      :8;
00790    u_char                                        :8;
00791    u_char                                        :8;
00792 #if BYTE_ORDER == BIG_ENDIAN
00793    u_char                                        :2;
00794    u_char version_number                         :5;
00795    u_char current_next_indicator                 :1;
00796 #else
00797    u_char current_next_indicator                 :1;
00798    u_char version_number                         :5;
00799    u_char                                        :2;
00800 #endif
00801    u_char section_number                         :8;
00802    u_char last_section_number                    :8;
00803 
00804    u_char contentId_hi_hi                        :8;
00805    u_char contentId_hi_lo                        :8;
00806    u_char contentId_lo_hi                        :8;
00807    u_char contentId_lo_lo                        :8;
00808 
00809    u_char duration_h                             :8;
00810    u_char duration_m                             :8;
00811    u_char duration_s                             :8;
00812 
00813 #if BYTE_ORDER == BIG_ENDIAN
00814    u_char                                        :4;
00815    u_char descriptors_loop_length_hi             :4;
00816 #else
00817    u_char descriptors_loop_length_hi             :4;
00818    u_char                                        :4;
00819 #endif
00820    u_char descriptors_loop_length_lo             :8;
00821 };
00822 
00823 /*
00824  *
00825  *    The following describes the different descriptors that can be used within
00826  *    the SI.
00827  *
00828  *    The following semantics apply to all the descriptors defined in this
00829  *    subclause:
00830  *
00831  *    descriptor_tag: The descriptor tag is an 8-bit field which identifies
00832  *                    each descriptor. Those values with MPEG-2 normative
00833  *                    meaning are described in ISO/IEC 13818-1. The values of
00834  *                    descriptor_tag are defined in 'libsi.h'
00835  *    descriptor_length: The descriptor length is an 8-bit field specifying the
00836  *                       total number of bytes of the data portion of the
00837  *                       descriptor following the byte defining the value of
00838  *                       this field.
00839  *
00840  */
00841 
00842 #define DESCR_GEN_LEN 2
00843 struct descr_gen {
00844    u_char descriptor_tag                         :8;
00845    u_char descriptor_length                      :8;
00846 };
00847 
00848 #define GetDescriptorTag(x) (((descr_gen_t *) x)->descriptor_tag)
00849 #define GetDescriptorLength(x) (((descr_gen_t *) x)->descriptor_length+DESCR_GEN_LEN)
00850 
00851 /* 0x09 ca_descriptor */
00852 
00853 #define DESCR_CA_LEN 6
00854 struct descr_ca {
00855    u_char descriptor_tag                         :8;
00856    u_char descriptor_length                      :8;
00857    u_char CA_type_hi                             :8;
00858    u_char CA_type_lo                             :8;
00859 #if BYTE_ORDER == BIG_ENDIAN
00860    u_char reserved                               :3;
00861    u_char CA_PID_hi                              :5;
00862 #else
00863    u_char CA_PID_hi                              :5;
00864    u_char reserved                               :3;
00865 #endif
00866    u_char CA_PID_lo                              :8;
00867 };
00868 
00869 /* 0x0A iso_639_language_descriptor */
00870 
00871 #define DESCR_ISO_639_LANGUAGE_LEN 5
00872 struct descr_iso_639_language {
00873    u_char descriptor_tag                         :8;
00874    u_char descriptor_length                      :8;
00875 };
00876 
00877 struct descr_iso_639_language_loop {
00878    u_char lang_code1                             :8;
00879    u_char lang_code2                             :8;
00880    u_char lang_code3                             :8;
00881    u_char audio_type                             :8;
00882 };
00883 
00884 /* 0x13 carousel_identifier_descriptor */
00885 
00886 #define DESCR_CAROUSEL_IDENTIFIER_LEN 7
00887 struct descr_carousel_identifier {
00888    u_char descriptor_tag                         :8;
00889    u_char descriptor_length                      :8;
00890    u_char carousel_id_hi_hi                      :8;
00891    u_char carousel_id_hi_lo                      :8;
00892    u_char carousel_id_lo_hi                      :8;
00893    u_char carousel_id_lo_lo                      :8;
00894    u_char FormatId                               :8;
00895    /* FormatSpecifier follows */
00896 };
00897 
00898 /* 0x40 network_name_descriptor */
00899 
00900 #define DESCR_NETWORK_NAME_LEN 2
00901 struct descr_network_name {
00902    u_char descriptor_tag                         :8;
00903    u_char descriptor_length                      :8;
00904 };
00905 
00906 /* 0x41 service_list_descriptor */
00907 
00908 #define DESCR_SERVICE_LIST_LEN 2
00909 struct descr_service_list {
00910    u_char descriptor_tag                         :8;
00911    u_char descriptor_length                      :8;
00912 };
00913 
00914 #define DESCR_SERVICE_LIST_LOOP_LEN 3
00915 struct descr_service_list_loop {
00916    u_char service_id_hi                          :8;
00917    u_char service_id_lo                          :8;
00918    u_char service_type                           :8;
00919 };
00920 
00921 /* 0x42 stuffing_descriptor */
00922 
00923 #define DESCR_STUFFING_LEN XX
00924 struct descr_stuffing {
00925    u_char descriptor_tag                         :8;
00926    u_char descriptor_length                      :8;
00927    /* TBD */
00928 };
00929 
00930 /* 0x43 satellite_delivery_system_descriptor */
00931 
00932 #define DESCR_SATELLITE_DELIVERY_SYSTEM_LEN 13
00933 struct descr_satellite_delivery_system {
00934    u_char descriptor_tag                         :8;
00935    u_char descriptor_length                      :8;
00936    u_char frequency_hi_hi                        :8;
00937    u_char frequency_hi_lo                        :8;
00938    u_char frequency_lo_hi                        :8;
00939    u_char frequency_lo_lo                        :8;
00940    u_char orbital_position_hi                    :8;
00941    u_char orbital_position_lo                    :8;
00942 #if BYTE_ORDER == BIG_ENDIAN
00943    u_char west_east_flag                         :1;
00944    u_char polarization                           :2;
00945    u_char modulation                             :5;
00946 #else
00947    u_char modulation                             :5;
00948    u_char polarization                           :2;
00949    u_char west_east_flag                         :1;
00950 #endif
00951    u_char symbol_rate_hi_hi                      :8;
00952    u_char symbol_rate_hi_lo                      :8;
00953    u_char symbol_rate_lo_1                       :8;
00954 #if BYTE_ORDER == BIG_ENDIAN
00955    u_char symbol_rate_lo_2                       :4;
00956    u_char fec_inner                              :4;
00957 #else
00958    u_char fec_inner                              :4;
00959    u_char symbol_rate_lo_2                       :4;
00960 #endif
00961 };
00962 
00963 /* 0x44 cable_delivery_system_descriptor */
00964 
00965 #define DESCR_CABLE_DELIVERY_SYSTEM_LEN 13
00966 struct descr_cable_delivery_system {
00967    u_char descriptor_tag                         :8;
00968    u_char descriptor_length                      :8;
00969    u_char frequency_hi_hi                        :8;
00970    u_char frequency_hi_lo                        :8;
00971    u_char frequency_lo_hi                        :8;
00972    u_char frequency_lo_lo                        :8;
00973    u_char reserved1                              :8;
00974 #if BYTE_ORDER == BIG_ENDIAN
00975    u_char reserved2                              :4;
00976    u_char fec_outer                              :4;
00977 #else
00978    u_char fec_outer                              :4;
00979    u_char reserved2                              :4;
00980 #endif
00981    u_char modulation                             :8;
00982    u_char symbol_rate_hi_hi                      :8;
00983    u_char symbol_rate_hi_lo                      :8;
00984    u_char symbol_rate_lo_1                       :8;
00985 #if BYTE_ORDER == BIG_ENDIAN
00986    u_char symbol_rate_lo_2                       :4;
00987    u_char fec_inner                              :4;
00988 #else
00989    u_char fec_inner                              :4;
00990    u_char symbol_rate_lo_2                       :4;
00991 #endif
00992 };
00993 
00994 /* 0x45 vbi_data_descriptor */
00995 
00996 #define DESCR_VBI_DATA_LEN XX
00997 struct descr_vbi_data {
00998    u_char descriptor_tag                         :8;
00999    u_char descriptor_length                      :8;
01000    /* TBD */
01001 };
01002 
01003 /* 0x46 vbi_teletext_descriptor */
01004 
01005 #define DESCR_VBI_TELETEXT_LEN XX
01006 struct descr_vbi_teletext {
01007    u_char descriptor_tag                         :8;
01008    u_char descriptor_length                      :8;
01009    /* TBD */
01010 };
01011 
01012 /* 0x47 bouquet_name_descriptor */
01013 
01014 #define DESCR_BOUQUET_NAME_LEN 2
01015 struct descr_bouquet_name {
01016    u_char descriptor_tag                         :8;
01017    u_char descriptor_length                      :8;
01018 };
01019 
01020 /* 0x48 service_descriptor */
01021 
01022 #define DESCR_SERVICE_LEN  4
01023 struct descr_service {
01024    u_char descriptor_tag                         :8;
01025    u_char descriptor_length                      :8;
01026    u_char service_type                           :8;
01027    u_char provider_name_length                   :8;
01028 };
01029 
01030 struct descr_service_mid {
01031    u_char service_name_length                   :8;
01032 };
01033 
01034 /* 0x49 country_availability_descriptor */
01035 
01036 #define DESCR_COUNTRY_AVAILABILITY_LEN 3
01037 struct descr_country_availability {
01038    u_char descriptor_tag                         :8;
01039    u_char descriptor_length                      :8;
01040 #if BYTE_ORDER == BIG_ENDIAN
01041    u_char country_availability_flag              :1;
01042    u_char reserved                               :7;
01043 #else
01044    u_char reserved                               :7;
01045    u_char country_availability_flag              :1;
01046 #endif
01047 };
01048 
01049 /* 0x4A linkage_descriptor */
01050 
01051 #define DESCR_LINKAGE_LEN 9
01052 struct descr_linkage {
01053    u_char descriptor_tag                         :8;
01054    u_char descriptor_length                      :8;
01055    u_char transport_stream_id_hi                 :8;
01056    u_char transport_stream_id_lo                 :8;
01057    u_char original_network_id_hi                 :8;
01058    u_char original_network_id_lo                 :8;
01059    u_char service_id_hi                          :8;
01060    u_char service_id_lo                          :8;
01061    u_char linkage_type                           :8;
01062 };
01063 
01064 #define DESCR_LINKAGE_8_LEN 3
01065 struct descr_linkage_8 {
01066 #if BYTE_ORDER == BIG_ENDIAN
01067    u_char hand_over_type                         :4;
01068    u_char reserved                               :3;
01069    u_char origin_type                            :1;
01070 #else
01071    u_char origin_type                            :1;
01072    u_char reserved                               :3;
01073    u_char hand_over_type                         :4;
01074 #endif
01075    u_char id_hi                                  :8;
01076    u_char id_lo                                  :8;
01077 };
01078 
01079 /* 0x4B nvod_reference_descriptor */
01080 
01081 #define DESCR_NVOD_REFERENCE_LEN 2
01082 struct descr_nvod_reference {
01083    u_char descriptor_tag                         :8;
01084    u_char descriptor_length                      :8;
01085 };
01086 
01087 #define ITEM_NVOD_REFERENCE_LEN 6
01088 struct item_nvod_reference {
01089    u_char transport_stream_id_hi                 :8;
01090    u_char transport_stream_id_lo                 :8;
01091    u_char original_network_id_hi                 :8;
01092    u_char original_network_id_lo                 :8;
01093    u_char service_id_hi                          :8;
01094    u_char service_id_lo                          :8;
01095 };
01096 
01097 /* 0x4C time_shifted_service_descriptor */
01098 
01099 #define DESCR_TIME_SHIFTED_SERVICE_LEN 4
01100 struct descr_time_shifted_service {
01101    u_char descriptor_tag                         :8;
01102    u_char descriptor_length                      :8;
01103    u_char reference_service_id_hi                :8;
01104    u_char reference_service_id_lo                :8;
01105 };
01106 
01107 /* 0x4D short_event_descriptor */
01108 
01109 #define DESCR_SHORT_EVENT_LEN 6
01110 struct descr_short_event {
01111    u_char descriptor_tag                         :8;
01112    u_char descriptor_length                      :8;
01113    u_char lang_code1                             :8;
01114    u_char lang_code2                             :8;
01115    u_char lang_code3                             :8;
01116    u_char event_name_length                      :8;
01117 };
01118 
01119 struct descr_short_event_mid {
01120    u_char text_length                      :8;
01121 };
01122 
01123 /* 0x4E extended_event_descriptor */
01124 
01125 #define DESCR_EXTENDED_EVENT_LEN 7
01126 struct descr_extended_event {
01127    u_char descriptor_tag                         :8;
01128    u_char descriptor_length                      :8;
01129    /* TBD */
01130 #if BYTE_ORDER == BIG_ENDIAN
01131    u_char descriptor_number                      :4;
01132    u_char last_descriptor_number                 :4;
01133 #else
01134    u_char last_descriptor_number                 :4;
01135    u_char descriptor_number                      :4;
01136 #endif
01137    u_char lang_code1                             :8;
01138    u_char lang_code2                             :8;
01139    u_char lang_code3                             :8;
01140    u_char length_of_items                        :8;
01141 };
01142 
01143 struct descr_extended_event_mid {
01144    u_char text_length                            :8;
01145 };
01146 
01147 #define ITEM_EXTENDED_EVENT_LEN 1
01148 struct item_extended_event {
01149    u_char item_description_length                :8;
01150 };
01151 
01152 struct item_extended_event_mid {
01153    u_char item_length                            :8;
01154 };
01155 
01156 /* 0x4F time_shifted_event_descriptor */
01157 
01158 #define DESCR_TIME_SHIFTED_EVENT_LEN 6
01159 struct descr_time_shifted_event {
01160    u_char descriptor_tag                         :8;
01161    u_char descriptor_length                      :8;
01162    u_char reference_service_id_hi                :8;
01163    u_char reference_service_id_lo                :8;
01164    u_char reference_event_id_hi                  :8;
01165    u_char reference_event_id_lo                  :8;
01166 };
01167 
01168 /* 0x50 component_descriptor */
01169 
01170 #define DESCR_COMPONENT_LEN  8
01171 struct descr_component {
01172    u_char descriptor_tag                         :8;
01173    u_char descriptor_length                      :8;
01174 #if BYTE_ORDER == BIG_ENDIAN
01175    u_char reserved                               :4;
01176    u_char stream_content                         :4;
01177 #else
01178    u_char stream_content                         :4;
01179    u_char reserved                               :4;
01180 #endif
01181    u_char component_type                         :8;
01182    u_char component_tag                          :8;
01183    u_char lang_code1                             :8;
01184    u_char lang_code2                             :8;
01185    u_char lang_code3                             :8;
01186 };
01187 
01188 /* 0x51 mosaic_descriptor */
01189 
01190 #define DESCR_MOSAIC_LEN XX
01191 struct descr_mosaic {
01192    u_char descriptor_tag                         :8;
01193    u_char descriptor_length                      :8;
01194    /* TBD */
01195 };
01196 
01197 /* 0x52 stream_identifier_descriptor */
01198 
01199 #define DESCR_STREAM_IDENTIFIER_LEN 3
01200 struct descr_stream_identifier {
01201    u_char descriptor_tag                         :8;
01202    u_char descriptor_length                      :8;
01203    u_char component_tag                          :8;
01204 };
01205 
01206 /* 0x53 ca_identifier_descriptor */
01207 
01208 #define DESCR_CA_IDENTIFIER_LEN 2
01209 struct descr_ca_identifier {
01210    u_char descriptor_tag                         :8;
01211    u_char descriptor_length                      :8;
01212 };
01213 
01214 /* 0x54 content_descriptor */
01215 
01216 #define DESCR_CONTENT_LEN 2
01217 struct descr_content {
01218    u_char descriptor_tag                         :8;
01219    u_char descriptor_length                      :8;
01220 };
01221 
01222 struct nibble_content {
01223 #if BYTE_ORDER == BIG_ENDIAN
01224    u_char content_nibble_level_1                 :4;
01225    u_char content_nibble_level_2                 :4;
01226 #else
01227    u_char content_nibble_level_2                 :4;
01228    u_char content_nibble_level_1                 :4;
01229 #endif
01230 #if BYTE_ORDER == BIG_ENDIAN
01231    u_char user_nibble_1                          :4;
01232    u_char user_nibble_2                          :4;
01233 #else
01234    u_char user_nibble_2                          :4;
01235    u_char user_nibble_1                          :4;
01236 #endif
01237 };
01238 
01239 /* 0x55 parental_rating_descriptor */
01240 
01241 #define DESCR_PARENTAL_RATING_LEN 2
01242 struct descr_parental_rating {
01243    u_char descriptor_tag                         :8;
01244    u_char descriptor_length                      :8;
01245 };
01246 
01247 #define PARENTAL_RATING_LEN 4
01248 struct parental_rating {
01249    u_char lang_code1                             :8;
01250    u_char lang_code2                             :8;
01251    u_char lang_code3                             :8;
01252    u_char rating                                 :8;
01253 };
01254 
01255 /* 0x56 teletext_descriptor */
01256 
01257 #define DESCR_TELETEXT_LEN 2
01258 struct descr_teletext {
01259    u_char descriptor_tag                         :8;
01260    u_char descriptor_length                      :8;
01261 };
01262 
01263 #define ITEM_TELETEXT_LEN 5
01264 struct item_teletext {
01265    u_char lang_code1                             :8;
01266    u_char lang_code2                             :8;
01267    u_char lang_code3                             :8;
01268 #if BYTE_ORDER == BIG_ENDIAN
01269    u_char type                                   :5;
01270    u_char magazine_number                        :3;
01271 #else
01272    u_char magazine_number                        :3;
01273    u_char type                                   :5;
01274 #endif
01275    u_char page_number                            :8;
01276 };
01277 
01278 /* 0x57 telephone_descriptor */
01279 
01280 #define DESCR_TELEPHONE_LEN XX
01281 struct descr_telephone {
01282    u_char descriptor_tag                         :8;
01283    u_char descriptor_length                      :8;
01284    /* TBD */
01285 };
01286 
01287 /* 0x58 local_time_offset_descriptor */
01288 
01289 #define DESCR_LOCAL_TIME_OFFSET_LEN 2
01290 struct descr_local_time_offset {
01291    u_char descriptor_tag                         :8;
01292    u_char descriptor_length                      :8;
01293 };
01294 
01295 #define LOCAL_TIME_OFFSET_ENTRY_LEN 15
01296 struct local_time_offset_entry {
01297    u_char country_code1                          :8;
01298    u_char country_code2                          :8;
01299    u_char country_code3                          :8;
01300 #if BYTE_ORDER == BIG_ENDIAN
01301    u_char country_region_id                      :6;
01302    u_char                                        :1;
01303    u_char local_time_offset_polarity             :1;
01304 #else
01305    u_char local_time_offset_polarity             :1;
01306    u_char                                        :1;
01307    u_char country_region_id                      :6;
01308 #endif
01309    u_char local_time_offset_h                    :8;
01310    u_char local_time_offset_m                    :8;
01311    u_char time_of_change_mjd_hi                  :8;
01312    u_char time_of_change_mjd_lo                  :8;
01313    u_char time_of_change_time_h                  :8;
01314    u_char time_of_change_time_m                  :8;
01315    u_char time_of_change_time_s                  :8;
01316    u_char next_time_offset_h                     :8;
01317    u_char next_time_offset_m                     :8;
01318 };
01319 
01320 /* 0x59 subtitling_descriptor */
01321 
01322 #define DESCR_SUBTITLING_LEN 2
01323 struct descr_subtitling {
01324    u_char descriptor_tag                         :8;
01325    u_char descriptor_length                      :8;
01326 };
01327 
01328 #define ITEM_SUBTITLING_LEN 8
01329 struct item_subtitling {
01330    u_char lang_code1                             :8;
01331    u_char lang_code2                             :8;
01332    u_char lang_code3                             :8;
01333    u_char subtitling_type                        :8;
01334    u_char composition_page_id_hi                 :8;
01335    u_char composition_page_id_lo                 :8;
01336    u_char ancillary_page_id_hi                   :8;
01337    u_char ancillary_page_id_lo                   :8;
01338 };
01339 
01340 /* 0x5A terrestrial_delivery_system_descriptor */
01341 
01342 #define DESCR_TERRESTRIAL_DELIVERY_SYSTEM_LEN XX
01343 struct descr_terrestrial_delivery {
01344    u_char descriptor_tag                         :8;
01345    u_char descriptor_length                      :8;
01346    u_char frequency_hi_hi                        :8;
01347    u_char frequency_hi_lo                        :8;
01348    u_char frequency_lo_hi                        :8;
01349    u_char frequency_lo_lo                        :8;
01350 #if BYTE_ORDER == BIG_ENDIAN
01351    u_char bandwidth                              :3;
01352    u_char reserved1                              :5;
01353 #else
01354    u_char reserved1                              :5;
01355    u_char bandwidth                              :3;
01356 #endif
01357 #if BYTE_ORDER == BIG_ENDIAN
01358    u_char constellation                          :2;
01359    u_char hierarchy                              :3;
01360    u_char code_rate_HP                           :3;
01361 #else
01362    u_char code_rate_HP                           :3;
01363    u_char hierarchy                              :3;
01364    u_char constellation                          :2;
01365 #endif
01366 #if BYTE_ORDER == BIG_ENDIAN
01367    u_char code_rate_LP                           :3;
01368    u_char guard_interval                         :2;
01369    u_char transmission_mode                      :2;
01370    u_char other_frequency_flag                   :1;
01371 #else
01372    u_char other_frequency_flag                   :1;
01373    u_char transmission_mode                      :2;
01374    u_char guard_interval                         :2;
01375    u_char code_rate_LP                           :3;
01376 #endif
01377    u_char reserver2                              :8;
01378    u_char reserver3                              :8;
01379    u_char reserver4                              :8;
01380    u_char reserver5                              :8;
01381 };
01382 
01383 /* 0x5B multilingual_network_name_descriptor */
01384 
01385 #define DESCR_MULTILINGUAL_NETWORK_NAME_LEN XX
01386 struct descr_multilingual_network_name {
01387    u_char descriptor_tag                         :8;
01388    u_char descriptor_length                      :8;
01389 };
01390 
01391 struct entry_multilingual_name {
01392    u_char lang_code1                             :8;
01393    u_char lang_code2                             :8;
01394    u_char lang_code3                             :8;
01395    u_char text_length                            :8;
01396 };
01397 
01398 /* 0x5C multilingual_bouquet_name_descriptor */
01399 
01400 #define DESCR_MULTILINGUAL_BOUQUET_NAME_LEN XX
01401 struct descr_multilingual_bouquet_name {
01402    u_char descriptor_tag                         :8;
01403    u_char descriptor_length                      :8;
01404 };
01405 
01406 /* 0x5D multilingual_service_name_descriptor */
01407 
01408 #define DESCR_MULTILINGUAL_SERVICE_NAME_LEN XX
01409 struct descr_multilingual_service_name {
01410    u_char descriptor_tag                         :8;
01411    u_char descriptor_length                      :8;
01412 };
01413 
01414 struct entry_multilingual_service_name_mid {
01415    u_char service_name_length                    :8;
01416 };
01417 
01418 /* 0x5E multilingual_component_descriptor */
01419 
01420 #define DESCR_MULTILINGUAL_COMPONENT_LEN XX
01421 struct descr_multilingual_component {
01422    u_char descriptor_tag                         :8;
01423    u_char descriptor_length                      :8;
01424    u_char component_tag                          :8;
01425 };
01426 
01427 /* 0x5F private_data_specifier_descriptor */
01428 
01429 #define DESCR_PRIVATE_DATA_SPECIFIER_LEN XX
01430 struct descr_private_data_specifier {
01431    u_char descriptor_tag                         :8;
01432    u_char descriptor_length                      :8;
01433    u_char private_data_specifier_hi_hi           :8;
01434    u_char private_data_specifier_hi_lo           :8;
01435    u_char private_data_specifier_lo_hi           :8;
01436    u_char private_data_specifier_lo_lo           :8;
01437 };
01438 
01439 /* 0x60 service_move_descriptor */
01440 
01441 #define DESCR_SERVICE_MOVE_LEN XX
01442 struct descr_service_move {
01443    u_char descriptor_tag                         :8;
01444    u_char descriptor_length                      :8;
01445    u_char new_original_network_id_hi             :8;
01446    u_char new_original_network_id_lo             :8;
01447    u_char new_transport_stream_id_hi             :8;
01448    u_char new_transport_stream_id_lo             :8;
01449    u_char new_service_id_hi                      :8;
01450    u_char new_service_id_lo                      :8;
01451 };
01452 
01453 /* 0x61 short_smoothing_buffer_descriptor */
01454 
01455 #define DESCR_SHORT_SMOOTHING_BUFFER_LEN XX
01456 struct descr_short_smoothing_buffer {
01457    u_char descriptor_tag                         :8;
01458    u_char descriptor_length                      :8;
01459    /* TBD */
01460 };
01461 
01462 /* 0x62 frequency_list_descriptor */
01463 
01464 #define DESCR_FREQUENCY_LIST_LEN XX
01465 struct descr_frequency_list {
01466    u_char descriptor_tag                         :8;
01467    u_char descriptor_length                      :8;
01468 #if BYTE_ORDER == BIG_ENDIAN
01469    u_char                                        :6;
01470    u_char coding_type                            :2;
01471 #else
01472    u_char coding_type                            :2;
01473    u_char                                        :6;
01474 #endif
01475 };
01476 
01477 /* 0x63 partial_transport_stream_descriptor */
01478 
01479 #define DESCR_PARTIAL_TRANSPORT_STREAM_LEN XX
01480 struct descr_partial_transport_stream {
01481    u_char descriptor_tag                         :8;
01482    u_char descriptor_length                      :8;
01483    /* TBD */
01484 };
01485 
01486 /* 0x64 data_broadcast_descriptor */
01487 
01488 #define DESCR_DATA_BROADCAST_LEN XX
01489 struct descr_data_broadcast {
01490    u_char descriptor_tag                         :8;
01491    u_char descriptor_length                      :8;
01492    /* TBD */
01493 };
01494 
01495 /* 0x65 ca_system_descriptor */
01496 
01497 #define DESCR_CA_SYSTEM_LEN XX
01498 struct descr_ca_system {
01499    u_char descriptor_tag                         :8;
01500    u_char descriptor_length                      :8;
01501    /* TBD */
01502 };
01503 
01504 /* 0x66 data_broadcast_id_descriptor */
01505 
01506 #define DESCR_DATA_BROADCAST_ID_LEN XX
01507 struct descr_data_broadcast_id {
01508    u_char descriptor_tag                         :8;
01509    u_char descriptor_length                      :8;
01510    /* TBD */
01511 };
01512 
01513 /* 0x67 transport_stream_descriptor */
01514 
01515 #define DESCR_TRANSPORT_STREAM_LEN XX
01516 struct descr_transport_stream {
01517    u_char descriptor_tag                         :8;
01518    u_char descriptor_length                      :8;
01519    /* TBD */
01520 };
01521 
01522 /* 0x68 dsng_descriptor */
01523 
01524 #define DESCR_DSNG_LEN XX
01525 struct descr_dsng {
01526    u_char descriptor_tag                         :8;
01527    u_char descriptor_length                      :8;
01528    /* TBD */
01529 };
01530 
01531 /* 0x69 pdc_descriptor */
01532 
01533 #define DESCR_PDC_LEN 5
01534 struct descr_pdc {
01535    u_char descriptor_tag                         :8;
01536    u_char descriptor_length                      :8;
01537    u_char pil0                                   :8;
01538    u_char pil1                                   :8;
01539    u_char pil2                                   :8;
01540 };
01541 
01542 /* 0x6A ac3_descriptor */
01543 
01544 #define DESCR_AC3_LEN 3
01545 struct descr_ac3 {
01546    u_char descriptor_tag                         :8;
01547    u_char descriptor_length                      :8;
01548 #if BYTE_ORDER == BIG_ENDIAN
01549    u_char ac3_type_flag                          :1;
01550    u_char bsid_flag                              :1;
01551    u_char mainid_flag                            :1;
01552    u_char asvc_flag                              :1;
01553    u_char reserved                               :4;
01554 #else
01555    u_char reserved                               :4;
01556    u_char asvc_flag                              :1;
01557    u_char mainid_flag                            :1;
01558    u_char bsid_flag                              :1;
01559    u_char ac3_type_flag                          :1;
01560 #endif
01561    u_char ac3_type                               :8;
01562    u_char bsid                                   :8;
01563    u_char mainid                                 :8;
01564    u_char asvc                                   :8;
01565 };
01566 
01567 /* 0x6B ancillary_data_descriptor */
01568 
01569 #define DESCR_ANCILLARY_DATA_LEN 3
01570 struct descr_ancillary_data {
01571    u_char descriptor_tag                         :8;
01572    u_char descriptor_length                      :8;
01573    u_char ancillary_data_identifier              :8;
01574 };
01575 
01576 /* 0x6C cell_list_descriptor */
01577 
01578 #define DESCR_CELL_LIST_LEN XX
01579 struct descr_cell_list {
01580    u_char descriptor_tag                         :8;
01581    u_char descriptor_length                      :8;
01582    /* TBD */
01583 };
01584 
01585 /* 0x6D cell_frequency_link_descriptor */
01586 
01587 #define DESCR_CELL_FREQUENCY_LINK_LEN XX
01588 struct descr_cell_frequency_link {
01589    u_char descriptor_tag                         :8;
01590    u_char descriptor_length                      :8;
01591    /* TBD */
01592 };
01593 
01594 /* 0x6E announcement_support_descriptor */
01595 
01596 #define DESCR_ANNOUNCEMENT_SUPPORT_LEN XX
01597 struct descr_announcement_support {
01598    u_char descriptor_tag                         :8;
01599    u_char descriptor_length                      :8;
01600    /* TBD */
01601 };
01602 
01603 /* 0x6F application_signalling_descriptor */
01604 
01605 #define DESCR_APPLICATION_SIGNALLING_LEN 2
01606 struct descr_application_signalling {
01607    u_char descriptor_tag                         :8;
01608    u_char descriptor_length                      :8;
01609 };
01610 
01611 #define APPLICATION_SIGNALLING_ENTRY_LEN 3
01612 struct application_signalling_entry {
01613    u_char application_type_hi                    :8;
01614    u_char application_type_lo                    :8;
01615 #if BYTE_ORDER == BIG_ENDIAN
01616    u_char                                        :3;
01617    u_char AIT_version_number                     :5;
01618 #else
01619    u_char AIT_version_number                     :5;
01620    u_char                                        :3;
01621 #endif
01622 };
01623 
01624 /* 0x71 service_identifier_descriptor (ETSI TS 102 812, MHP) */
01625 
01626 struct descr_service_identifier {
01627    u_char descriptor_tag                         :8;
01628    u_char descriptor_length                      :8;
01629 };
01630 
01631 /* MHP 0x00 application_descriptor */
01632 
01633 #define DESCR_APPLICATION_LEN 3
01634 
01635 struct descr_application {
01636    u_char descriptor_tag                         :8;
01637    u_char descriptor_length                      :8;
01638    u_char application_profiles_length            :8;
01639 };
01640 
01641 #define DESCR_APPLICATION_END_LEN 2
01642 
01643 struct descr_application_end {
01644 #if BYTE_ORDER == BIG_ENDIAN
01645    u_char service_bound_flag                     :1;
01646    u_char visibility                             :2;
01647    u_char                                        :5;
01648 #else
01649    u_char                                        :5;
01650    u_char visibility                             :2;
01651    u_char service_bound_flag                     :1;
01652 #endif
01653    u_char application_priority                   :8;
01654 /*now follow 8bit transport_protocol_label fields to the end */
01655 };
01656 
01657 #define APPLICATION_PROFILE_ENTRY_LEN 5
01658 
01659 struct application_profile_entry {
01660    u_char application_profile_hi                 :8;
01661    u_char application_profile_lo                 :8;
01662    u_char version_major                          :8;
01663    u_char version_minor                          :8;
01664    u_char version_micro                          :8;
01665 };
01666 
01667 /* MHP 0x01 application_name_desriptor */
01668 
01669 #define DESCR_APPLICATION_NAME_LEN 2
01670 
01671 struct descr_application_name {
01672    u_char descriptor_tag                         :8;
01673    u_char descriptor_length                      :8;
01674 };
01675 
01676 #define APPLICATION_NAME_ENTRY_LEN 4
01677 
01678 struct descr_application_name_entry {
01679    u_char lang_code1                             :8;
01680    u_char lang_code2                             :8;
01681    u_char lang_code3                             :8;
01682    u_char application_name_length                :8;
01683    /* application name string */
01684 };
01685 
01686 /* MHP 0x02 transport_protocol_descriptor */
01687 
01688 #define DESCR_TRANSPORT_PROTOCOL_LEN 5
01689 
01690 struct descr_transport_protocol {
01691    u_char descriptor_tag                         :8;
01692    u_char descriptor_length                      :8;
01693    u_char protocol_id_hi                         :8;
01694    u_char protocol_id_lo                         :8;
01695    u_char transport_protocol_label               :8;
01696    /* protocol_id-specific selector bytes follow */
01697 };
01698 
01699 #define TRANSPORT_VIA_OC_LEN 1
01700 
01701 struct transport_via_oc {
01702 #if BYTE_ORDER == BIG_ENDIAN
01703    u_char remote                                 :1;
01704    u_char                                        :7;
01705 #else
01706    u_char                                        :7;
01707    u_char remote                                 :1;
01708 #endif
01709 };
01710 
01711 //if remote is true, transport_via_oc_remote_end_t follows,
01712 // else transport_via_oc_end_t.
01713 
01714 #define TRANSPORT_VIA_OC_REMOTE_END_LEN 7
01715 
01716 struct transport_via_oc_remote_end {
01717    u_char original_network_id_hi                 :8;
01718    u_char original_network_id_lo                 :8;
01719    u_char transport_stream_id_hi                 :8;
01720    u_char transport_stream_id_lo                 :8;
01721    u_char service_id_hi                          :8;
01722    u_char service_id_lo                          :8;
01723    u_char component_tag                          :8;
01724 };
01725 
01726 #define TRANSPORT_VIA_OC_END_LEN 1
01727 
01728 struct transport_via_oc_end {
01729    u_char component_tag                          :8;
01730 };
01731 
01732 /* 0x03 dvb_j_application_descriptor() */
01733 
01734 #define DESCR_DVBJ_APPLICATION_LEN 2
01735 
01736 struct descr_dvbj_application {
01737    u_char descriptor_tag                         :8;
01738    u_char descriptor_length                      :8;
01739 };
01740 
01741 #define DESCR_DVBJ_APPLICATION_ENTRY_LEN 1
01742 
01743 struct descr_dvbj_application_entry {
01744    u_char parameter_length                       :8;
01745    /* parameter string */
01746 };
01747 
01748 /* 0x04 dvb_j_application_location_descriptor */
01749 
01750 #define DESCR_DVBJ_APPLICATION_LOCATION_LEN 3
01751 
01752 struct descr_dvbj_application_location {
01753    u_char descriptor_tag                         :8;
01754    u_char descriptor_length                      :8;
01755    u_char base_directory_length                  :8;
01756    /* base directory string */
01757 };
01758 
01759 #define DESCR_DVBJ_APPLICATION_LOCATION_MID_LEN 1
01760 
01761 struct descr_dvbj_application_location_mid {
01762    u_char classpath_extension_length                  :8;
01763 };
01764 
01765 /* 0x0B application_icons_descriptor */
01766 
01767 #define DESCR_APPLICATION_ICONS_LEN 3
01768 
01769 struct descr_application_icons_descriptor {
01770    u_char descriptor_tag                         :8;
01771    u_char descriptor_length                      :8;
01772    u_char icon_locator_length                    :8;
01773    /* icon locator */
01774 };
01775 
01776 #define DESCR_APPLICATION_ICONS_END_LEN 2
01777 
01778 struct descr_application_icons_descriptor_end {
01779    u_char icon_flags_hi                          :8;
01780    u_char icon_flags_lo                          :8;
01781 };
01782 
01783 // Private DVB Descriptor  Premiere.de
01784 // 0xF2  Content Transmission Descriptor
01785 // http://dvbsnoop.sourceforge.net/examples/example-private-section.html
01786 
01787 #define DESCR_PREMIERE_CONTENT_TRANSMISSION_LEN 8
01788 
01789 struct descr_premiere_content_transmission {
01790    u_char descriptor_tag                         :8;
01791    u_char descriptor_length                      :8;
01792    u_char transport_stream_id_hi                 :8;
01793    u_char transport_stream_id_lo                 :8;
01794    u_char original_network_id_hi                 :8;
01795    u_char original_network_id_lo                 :8;
01796    u_char service_id_hi                          :8;
01797    u_char service_id_lo                          :8;
01798 };
01799 
01800 #define ITEM_PREMIERE_CONTENT_TRANSMISSION_DAY_LEN 3
01801 
01802 struct item_premiere_content_transmission_day {
01803    u_char mjd_hi                                 :8;
01804    u_char mjd_lo                                 :8;
01805    u_char start_time_loop                        :8;
01806 };
01807 
01808 #define ITEM_PREMIERE_CONTENT_TRANSMISSION_TIME_LEN 3
01809 
01810 struct item_premiere_content_transmission_time {
01811    u_char start_time_h                           :8;
01812    u_char start_time_m                           :8;
01813    u_char start_time_s                           :8;
01814 };
01815 
01816 } //end of namespace
01817 
01818 #endif //LIBSI_HEADERS_H

Generated on Tue Nov 6 19:57:54 2007 for VDR by  doxygen 1.5.3-20071008