cvs20080628 - trunk
[gitenigma.git] / include / lib / dvb / lowlevel / ps.h
blobf8b8a812cb23fd4690c14a553b45a8448c650e31
2 /*
3 * PROGRAM STREAM
5 * Copyright (C) 1998 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,
23 * Austria
25 *------------------------------------------------------------
29 #ifndef __PS_H__
30 #define __PS_H__
32 #include <sys/types.h>
34 #define PS_SYSTEM_HDR_LEN 12
36 typedef struct {
37 u_char header_length_hi : 8;
38 u_char header_length_lo : 8;
40 #if BYTE_ORDER == BIG_ENDIAN
41 u_char : 1;
42 u_char rate_bound_1 : 7;
43 #else
44 u_char rate_bound_1 : 7;
45 u_char : 1;
46 #endif
48 u_char rate_bound_2 : 8;
50 #if BYTE_ORDER == BIG_ENDIAN
51 u_char rate_bound_3 : 7;
52 u_char : 1;
54 u_char audio_bound : 6;
55 u_char fixed_flag : 1;
56 u_char CSPS_flag : 1;
58 u_char system_audio_lock_flag : 1;
59 u_char system_video_lock_flag : 1;
60 u_char : 1;
61 u_char video_bound : 5;
63 u_char packet_rate_restriction_flag : 1;
64 u_char reserved_byte : 7;
65 #else
66 u_char : 1;
67 u_char rate_bound_3 : 7;
69 u_char CSPS_flag : 1;
70 u_char fixed_flag : 1;
71 u_char audio_bound : 6;
73 u_char video_bound : 5;
74 u_char : 1;
75 u_char system_video_lock_flag : 1;
76 u_char system_audio_lock_flag : 1;
78 u_char reserved_byte : 7;
79 u_char packet_rate_restriction_flag : 1;
80 #endif
81 } ps_system_hdr_t;
83 struct ps_system_hdr_2_struct {
84 u_char stream_id : 8;
86 #if BYTE_ORDER == BIG_ENDIAN
87 u_char : 2; // has to be 11
88 u_char PSTD_buffer_bound_scale : 1;
89 u_char PSDT_buffer_size_bound_hi : 5;
90 #else
91 u_char PSDT_buffer_size_bound_hi : 5;
92 u_char PSTD_buffer_bound_scale : 1;
93 u_char : 2; // has to be 11
94 #endif
96 u_char PSDT_buffer_size_bound_lo : 8;
97 } ps_system_hdr_2_t;
99 #define PS_STREAM_PACK_HDR 0xBA
100 #define PS_STREAM_SYSTEM_HDR 0xBB
101 #define PS_STREAM_VIDEO 0xE0
103 #if BYTE_ORDER == BIG_ENDIAN
104 #define PS_START_CODE_PREFIX_RAW 0x000010
105 #else
106 #define PS_START_CODE_PREFIX_RAW 0x010000
107 #endif
109 #define PS_START_CODE_PREFIX 0x000010
111 #define PS_HDR_LEN 4
113 typedef struct {
114 u_int start_code_prefix : 24;
115 u_char stream_id : 8;
116 } ps_hdr_t;
118 typedef struct {
119 #if BYTE_ORDER == BIG_ENDIAN
120 u_char : 2; // should be '01'
121 u_char system_clock_reference_1 : 3;
122 u_char : 1;
123 u_char system_clock_reference_2 : 2;
124 #else
125 u_char system_clock_reference_2 : 2;
126 u_char : 1;
127 u_char system_clock_reference_1 : 3;
128 u_char : 2; // should be '01'
129 #endif
131 u_char system_clock_reference_3 : 8;
133 #if BYTE_ORDER == BIG_ENDIAN
134 u_char system_clock_reference_4 : 5;
135 u_char : 1;
136 u_char system_clock_reference_5 : 2;
137 #else
138 u_char system_clock_reference_5 : 2;
139 u_char : 1;
140 u_char system_clock_reference_4 : 5;
141 #endif
143 u_char system_clock_reference_6 : 8;
145 #if BYTE_ORDER == BIG_ENDIAN
146 u_char system_clock_reference_7 : 5;
147 u_char : 1;
148 u_char system_clock_reference_ext_1 : 2;
150 u_char system_clock_reference_ext_2 : 7;
151 u_char : 1;
152 #else
153 u_char system_clock_reference_ext_1 : 2;
154 u_char : 1;
155 u_char system_clock_reference_7 : 5;
157 u_char : 1;
158 u_char system_clock_reference_ext_2 : 7;
159 #endif
161 u_char program_mux_rate_1 : 8;
162 u_char program_mux_rate_2 : 8;
164 #if BYTE_ORDER == BIG_ENDIAN
165 u_char program_mux_rate_3 : 6;
166 u_char : 2;
168 u_char : 5; //reserved
169 u_char pack_stuffing_length : 3;
170 #else
171 u_char : 2;
172 u_char program_mux_rate_3 : 6;
174 u_char pack_stuffing_length : 3;
175 u_char : 5; //reserved
176 #endif
177 } ps_pack_t;
179 #define PS_PACK_LEN 10
180 #endif