5 * Copyright (C) 1998, 1999 Thomas Mirlacher
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * The author may be reached as dent@cosy.sbg.ac.at, or
22 * Thomas Mirlacher, Jakob-Haringerstr. 2, A-5020 Salzburg,
25 *------------------------------------------------------------
32 #include <sys/types.h>
34 #define TS_SYNC_BYTE 0x47
38 #define TS_DATA_LEN (TS_LEN - TS_HDR_LEN)
41 u_char sync_byte
: 8; /* should be 0x47 */
43 #if BYTE_ORDER == BIG_ENDIAN
44 u_char transport_error_indicator
: 1;
45 u_char payload_unit_start_indicator
: 1;
46 u_char transport_priority
: 1;
50 u_char transport_priority
: 1;
51 u_char payload_unit_start_indicator
: 1;
52 u_char transport_error_indicator
: 1;
56 #if BYTE_ORDER == BIG_ENDIAN
57 u_char transport_scrambling_control
: 2;
58 u_char adaptation_field_control
: 2;
59 u_char continuity_counter
: 4;
61 u_char continuity_counter
: 4;
62 u_char adaptation_field_control
: 2;
63 u_char transport_scrambling_control
: 2;
67 #define TS_ADAPTATION_FIELD_LEN 1
70 #if BYTE_ORDER == BIG_ENDIAN
71 u_char discontinuity_indicator
: 1;
72 u_char random_access_indicator
: 1;
73 u_char elementary_stream_priority_indicator
: 1;
76 u_char splicing_point_flag
: 1;
77 u_char transport_private_data_flag
: 1;
78 u_char adaptation_field_extension_flag
: 1;
80 u_char adaptation_field_extension_flag
: 1;
81 u_char transport_private_data_flag
: 1;
82 u_char splicing_point_flag
: 1;
85 u_char elementary_stream_priority_indicator
: 1;
86 u_char random_access_indicator
: 1;
87 u_char discontinuity_indicator
: 1;
94 u_char program_clock_reference_base_1
: 8;
96 u_char program_clock_reference_base_2
: 8;
98 u_char program_clock_reference_base_3
: 8;
100 u_char program_clock_reference_base_4
: 8;
102 #if BYTE_ORDER == BIG_ENDIAN
103 u_char program_clock_reference_base_5
: 1;
105 u_char program_clock_reference_extension_hi
: 1;
107 u_char program_clock_reference_extension_hi
: 1;
109 u_char program_clock_reference_base_5
: 1;
112 u_char program_clock_reference_extension_lo
: 8;
115 struct ts_opcr_struct
{
116 unsigned long long original_program_clock_reference_base
: 33;
118 u_short original_program_clock_reference_extension
: 9;
121 struct ts_splicing_point_struct
{
122 u_char splice_countdown
: 8;
125 struct ts_transport_private_data_struct
{
126 u_char transport_private_data_length
: 8;
129 struct ts_adaptation_field_extension_struct
{
130 #if BYTE_ORDER == BIG_ENDIAN
132 u_char seamless_splice_flag
: 1;
133 u_char piecewise_rate_flag
: 1;
135 u_char adaptation_field_extension_length
: 8;
137 u_char adaptation_field_extension_length
: 8;
139 u_char piecewise_rate_flag
: 1;
140 u_char seamless_splice_flag
: 1;
145 // TODO: CHECK DOWN HERE
147 struct ts_ltw_struct
{
148 u_char ltw_calid_flag
: 1;
149 u_short ltw_offset
: 15;
152 struct ts_piecewise_rate_struct
{
154 u_int piecewise_rate
: 22;
157 struct ts_seamless_splice_struct
{
158 u_char splice_type
: 4;
159 u_char DTS_next_AU_32_30
: 3;
160 u_char marker_bit0
: 1;
161 u_short DTS_next_AU_29_15
: 15;
162 u_char marker_bit1
: 1;
163 u_short DTS_next_AU_14_0
: 15;
164 u_char marker_bit2
: 1;
167 #define TS_PAYLEN 184
168 #define TS_NOSYNC -1 /* no valid sync byte */
169 #define TS_NODATA -2 /* no payload */
170 #define TS_SCRAMBLED -3 /* scrambled - and we can't descramble it */
171 #define TS_INPKT -4 /* doing our reassembling task */
172 #define TS_UNKNOWN -5 /* an unknown error appeared */