Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dvb_filter.h
Go to the documentation of this file.
1 /*
2  * dvb_filter.h
3  *
4  * Copyright (C) 2003 Convergence GmbH
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either version 2.1
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef _DVB_FILTER_H_
22 #define _DVB_FILTER_H_
23 
24 #include <linux/slab.h>
25 
26 #include "demux.h"
27 
28 typedef int (dvb_filter_pes2ts_cb_t) (void *, unsigned char *);
29 
31  unsigned char buf[188];
32  unsigned char cc;
34  void *priv;
35 };
36 
37 void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid,
39 
40 int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes,
41  int len, int payload_start);
42 
43 
44 #define PROG_STREAM_MAP 0xBC
45 #define PRIVATE_STREAM1 0xBD
46 #define PADDING_STREAM 0xBE
47 #define PRIVATE_STREAM2 0xBF
48 #define AUDIO_STREAM_S 0xC0
49 #define AUDIO_STREAM_E 0xDF
50 #define VIDEO_STREAM_S 0xE0
51 #define VIDEO_STREAM_E 0xEF
52 #define ECM_STREAM 0xF0
53 #define EMM_STREAM 0xF1
54 #define DSM_CC_STREAM 0xF2
55 #define ISO13522_STREAM 0xF3
56 #define PROG_STREAM_DIR 0xFF
57 
58 #define DVB_PICTURE_START 0x00
59 #define DVB_USER_START 0xb2
60 #define DVB_SEQUENCE_HEADER 0xb3
61 #define DVB_SEQUENCE_ERROR 0xb4
62 #define DVB_EXTENSION_START 0xb5
63 #define DVB_SEQUENCE_END 0xb7
64 #define DVB_GOP_START 0xb8
65 #define DVB_EXCEPT_SLICE 0xb0
66 
67 #define SEQUENCE_EXTENSION 0x01
68 #define SEQUENCE_DISPLAY_EXTENSION 0x02
69 #define PICTURE_CODING_EXTENSION 0x08
70 #define QUANT_MATRIX_EXTENSION 0x03
71 #define PICTURE_DISPLAY_EXTENSION 0x07
72 
73 #define I_FRAME 0x01
74 #define B_FRAME 0x02
75 #define P_FRAME 0x03
76 
77 /* Initialize sequence_data */
78 #define INIT_HORIZONTAL_SIZE 720
79 #define INIT_VERTICAL_SIZE 576
80 #define INIT_ASPECT_RATIO 0x02
81 #define INIT_FRAME_RATE 0x03
82 #define INIT_DISP_HORIZONTAL_SIZE 540
83 #define INIT_DISP_VERTICAL_SIZE 576
84 
85 
86 //flags2
87 #define PTS_DTS_FLAGS 0xC0
88 #define ESCR_FLAG 0x20
89 #define ES_RATE_FLAG 0x10
90 #define DSM_TRICK_FLAG 0x08
91 #define ADD_CPY_FLAG 0x04
92 #define PES_CRC_FLAG 0x02
93 #define PES_EXT_FLAG 0x01
94 
95 //pts_dts flags
96 #define PTS_ONLY 0x80
97 #define PTS_DTS 0xC0
98 
99 #define TS_SIZE 188
100 #define TRANS_ERROR 0x80
101 #define PAY_START 0x40
102 #define TRANS_PRIO 0x20
103 #define PID_MASK_HI 0x1F
104 //flags
105 #define TRANS_SCRMBL1 0x80
106 #define TRANS_SCRMBL2 0x40
107 #define ADAPT_FIELD 0x20
108 #define PAYLOAD 0x10
109 #define COUNT_MASK 0x0F
110 
111 // adaptation flags
112 #define DISCON_IND 0x80
113 #define RAND_ACC_IND 0x40
114 #define ES_PRI_IND 0x20
115 #define PCR_FLAG 0x10
116 #define OPCR_FLAG 0x08
117 #define SPLICE_FLAG 0x04
118 #define TRANS_PRIV 0x02
119 #define ADAP_EXT_FLAG 0x01
120 
121 // adaptation extension flags
122 #define LTW_FLAG 0x80
123 #define PIECE_RATE 0x40
124 #define SEAM_SPLICE 0x20
125 
126 
127 #define MAX_PLENGTH 0xFFFF
128 #define MMAX_PLENGTH (256*MAX_PLENGTH)
129 
130 #ifndef IPACKS
131 #define IPACKS 2048
132 #endif
133 
134 struct ipack {
135  int size;
136  int found;
137  u8 *buf;
140  u8 plen[2];
144  u8 pts[5];
146  int mpeg;
148  int which;
149  int done;
150  void *data;
151  void (*func)(u8 *buf, int size, void *priv);
152  int count;
154 };
155 
168 };
169 
170 #define OFF_SIZE 4
171 #define FIRST_FIELD 0
172 #define SECOND_FIELD 1
173 #define VIDEO_FRAME_PICTURE 0x03
174 
175 struct mpg_picture {
176  int channel;
185  int gop_flag;
187 
190  u32 matrix[32];
192 
194  /* bit 0 - 2: bwd f code
195  bit 3 : fpb vector
196  bit 4 - 6: fwd f code
197  bit 7 : fpf vector */
198 
205 
206  u32 pts[2]; /* [0] 1st field, [1] 2nd field */
210  int bank;
213  int compress;
215  /* [0-2] 1st field, [3] 2nd field */
217  /* [0-2] 1st field, [3] 2nd field */
219  /* [0] 1st field, [1] 2nd field */
220 
222  /* [0] 1st field, [1] 2nd field */
224  /* [0] 1st field, [1] 2nd field */
226  /* [0] 1st field, [1] 2nd field */
227  /* picture_display_extenion() 0:no 1:exit*/
229  /* [0] 1st field, [1] 2nd field */
230 };
231 
233  int layer;
241 };
242 
243 int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr);
244 
245 
246 #endif