4 * Copyright (C) 2003 Convergence GmbH
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.
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.
17 #ifndef _DVB_FILTER_H_
18 #define _DVB_FILTER_H_
20 #include <linux/slab.h>
22 #include <media/demux.h>
24 typedef int (dvb_filter_pes2ts_cb_t) (void *, unsigned char *);
26 struct dvb_filter_pes2ts {
27 unsigned char buf[188];
29 dvb_filter_pes2ts_cb_t *cb;
33 void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid,
34 dvb_filter_pes2ts_cb_t *cb, void *priv);
36 int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes,
37 int len, int payload_start);
40 #define PROG_STREAM_MAP 0xBC
41 #define PRIVATE_STREAM1 0xBD
42 #define PADDING_STREAM 0xBE
43 #define PRIVATE_STREAM2 0xBF
44 #define AUDIO_STREAM_S 0xC0
45 #define AUDIO_STREAM_E 0xDF
46 #define VIDEO_STREAM_S 0xE0
47 #define VIDEO_STREAM_E 0xEF
48 #define ECM_STREAM 0xF0
49 #define EMM_STREAM 0xF1
50 #define DSM_CC_STREAM 0xF2
51 #define ISO13522_STREAM 0xF3
52 #define PROG_STREAM_DIR 0xFF
54 #define DVB_PICTURE_START 0x00
55 #define DVB_USER_START 0xb2
56 #define DVB_SEQUENCE_HEADER 0xb3
57 #define DVB_SEQUENCE_ERROR 0xb4
58 #define DVB_EXTENSION_START 0xb5
59 #define DVB_SEQUENCE_END 0xb7
60 #define DVB_GOP_START 0xb8
61 #define DVB_EXCEPT_SLICE 0xb0
63 #define SEQUENCE_EXTENSION 0x01
64 #define SEQUENCE_DISPLAY_EXTENSION 0x02
65 #define PICTURE_CODING_EXTENSION 0x08
66 #define QUANT_MATRIX_EXTENSION 0x03
67 #define PICTURE_DISPLAY_EXTENSION 0x07
73 /* Initialize sequence_data */
74 #define INIT_HORIZONTAL_SIZE 720
75 #define INIT_VERTICAL_SIZE 576
76 #define INIT_ASPECT_RATIO 0x02
77 #define INIT_FRAME_RATE 0x03
78 #define INIT_DISP_HORIZONTAL_SIZE 540
79 #define INIT_DISP_VERTICAL_SIZE 576
83 #define PTS_DTS_FLAGS 0xC0
84 #define ESCR_FLAG 0x20
85 #define ES_RATE_FLAG 0x10
86 #define DSM_TRICK_FLAG 0x08
87 #define ADD_CPY_FLAG 0x04
88 #define PES_CRC_FLAG 0x02
89 #define PES_EXT_FLAG 0x01
96 #define TRANS_ERROR 0x80
97 #define PAY_START 0x40
98 #define TRANS_PRIO 0x20
99 #define PID_MASK_HI 0x1F
101 #define TRANS_SCRMBL1 0x80
102 #define TRANS_SCRMBL2 0x40
103 #define ADAPT_FIELD 0x20
105 #define COUNT_MASK 0x0F
108 #define DISCON_IND 0x80
109 #define RAND_ACC_IND 0x40
110 #define ES_PRI_IND 0x20
111 #define PCR_FLAG 0x10
112 #define OPCR_FLAG 0x08
113 #define SPLICE_FLAG 0x04
114 #define TRANS_PRIV 0x02
115 #define ADAP_EXT_FLAG 0x01
117 // adaptation extension flags
118 #define LTW_FLAG 0x80
119 #define PIECE_RATE 0x40
120 #define SEAM_SPLICE 0x20
123 #define MAX_PLENGTH 0xFFFF
124 #define MMAX_PLENGTH (256*MAX_PLENGTH)
147 void (*func)(u8 *buf, int size, void *priv);
152 struct dvb_video_info {
167 #define FIRST_FIELD 0
168 #define SECOND_FIELD 1
169 #define VIDEO_FRAME_PICTURE 0x03
173 struct dvb_video_info vinfo;
174 u32 *sequence_gop_header;
180 int sequence_header_flag;
182 int sequence_end_flag;
184 u8 profile_and_level;
185 s32 picture_coding_parameter;
187 s8 matrix_change_flag;
189 u8 picture_header_parameter;
190 /* bit 0 - 2: bwd f code
192 bit 4 - 6: fwd f code
193 bit 7 : fpf vector */
196 int progressive_sequence;
197 int sequence_display_extension_flag;
198 u32 sequence_header_data;
199 s16 last_frame_centre_horizontal_offset;
200 s16 last_frame_centre_vertical_offset;
202 u32 pts[2]; /* [0] 1st field, [1] 2nd field */
204 int repeat_first_field;
205 int progressive_frame;
210 s16 frame_centre_horizontal_offset[OFF_SIZE];
211 /* [0-2] 1st field, [3] 2nd field */
212 s16 frame_centre_vertical_offset[OFF_SIZE];
213 /* [0-2] 1st field, [3] 2nd field */
214 s16 temporal_reference[2];
215 /* [0] 1st field, [1] 2nd field */
217 s8 picture_coding_type[2];
218 /* [0] 1st field, [1] 2nd field */
219 s8 picture_structure[2];
220 /* [0] 1st field, [1] 2nd field */
221 s8 picture_display_extension_flag[2];
222 /* [0] 1st field, [1] 2nd field */
223 /* picture_display_extenion() 0:no 1:exit*/
225 /* [0] 1st field, [1] 2nd field */
228 struct dvb_audio_info {
239 int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr);