linux/drivers/media/dvb-core/dvb_filter.h
<<
>>
Prefs
   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
  28typedef int (dvb_filter_pes2ts_cb_t) (void *, unsigned char *);
  29
  30struct dvb_filter_pes2ts {
  31        unsigned char buf[188];
  32        unsigned char cc;
  33        dvb_filter_pes2ts_cb_t *cb;
  34        void *priv;
  35};
  36
  37void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid,
  38                            dvb_filter_pes2ts_cb_t *cb, void *priv);
  39
  40int 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
 134struct ipack {
 135        int size;
 136        int found;
 137        u8 *buf;
 138        u8 cid;
 139        u32 plength;
 140        u8 plen[2];
 141        u8 flag1;
 142        u8 flag2;
 143        u8 hlength;
 144        u8 pts[5];
 145        u16 *pid;
 146        int mpeg;
 147        u8 check;
 148        int which;
 149        int done;
 150        void *data;
 151        void (*func)(u8 *buf,  int size, void *priv);
 152        int count;
 153        int repack_subids;
 154};
 155
 156struct dvb_video_info {
 157        u32 horizontal_size;
 158        u32 vertical_size;
 159        u32 aspect_ratio;
 160        u32 framerate;
 161        u32 video_format;
 162        u32 bit_rate;
 163        u32 comp_bit_rate;
 164        u32 vbv_buffer_size;
 165        s16 vbv_delay;
 166        u32 CSPF;
 167        u32 off;
 168};
 169
 170#define OFF_SIZE 4
 171#define FIRST_FIELD 0
 172#define SECOND_FIELD 1
 173#define VIDEO_FRAME_PICTURE 0x03
 174
 175struct mpg_picture {
 176        int       channel;
 177        struct dvb_video_info vinfo;
 178        u32      *sequence_gop_header;
 179        u32      *picture_header;
 180        s32       time_code;
 181        int       low_delay;
 182        int       closed_gop;
 183        int       broken_link;
 184        int       sequence_header_flag;
 185        int       gop_flag;
 186        int       sequence_end_flag;
 187
 188        u8        profile_and_level;
 189        s32       picture_coding_parameter;
 190        u32       matrix[32];
 191        s8        matrix_change_flag;
 192
 193        u8        picture_header_parameter;
 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
 199        int       mpeg1_flag;
 200        int       progressive_sequence;
 201        int       sequence_display_extension_flag;
 202        u32       sequence_header_data;
 203        s16       last_frame_centre_horizontal_offset;
 204        s16       last_frame_centre_vertical_offset;
 205
 206        u32       pts[2]; /* [0] 1st field, [1] 2nd field */
 207        int       top_field_first;
 208        int       repeat_first_field;
 209        int       progressive_frame;
 210        int       bank;
 211        int       forward_bank;
 212        int       backward_bank;
 213        int       compress;
 214        s16       frame_centre_horizontal_offset[OFF_SIZE];
 215                  /* [0-2] 1st field, [3] 2nd field */
 216        s16       frame_centre_vertical_offset[OFF_SIZE];
 217                  /* [0-2] 1st field, [3] 2nd field */
 218        s16       temporal_reference[2];
 219                  /* [0] 1st field, [1] 2nd field */
 220
 221        s8        picture_coding_type[2];
 222                  /* [0] 1st field, [1] 2nd field */
 223        s8        picture_structure[2];
 224                  /* [0] 1st field, [1] 2nd field */
 225        s8        picture_display_extension_flag[2];
 226                  /* [0] 1st field, [1] 2nd field */
 227                  /* picture_display_extenion() 0:no 1:exit*/
 228        s8        pts_flag[2];
 229                  /* [0] 1st field, [1] 2nd field */
 230};
 231
 232struct dvb_audio_info {
 233        int layer;
 234        u32 bit_rate;
 235        u32 frequency;
 236        u32 mode;
 237        u32 mode_extension ;
 238        u32 emphasis;
 239        u32 framesize;
 240        u32 off;
 241};
 242
 243int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr);
 244
 245
 246#endif
 247