Home | History | Annotate | Download | only in dvb
      1 /*
      2  * dmx.h
      3  *
      4  * Copyright (C) 2000 Marcus Metzler <marcus (at) convergence.de>
      5  *                  & Ralph  Metzler <ralph (at) convergence.de>
      6  *                    for convergence integrated media GmbH
      7  *
      8  * This program is free software; you can redistribute it and/or
      9  * modify it under the terms of the GNU Lesser General Public License
     10  * as published by the Free Software Foundation; either version 2.1
     11  * of the License, or (at your option) any later version.
     12  *
     13  * This program is distributed in the hope that it will be useful,
     14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  * GNU General Public License for more details.
     17  *
     18  * You should have received a copy of the GNU Lesser General Public License
     19  * along with this program; if not, write to the Free Software
     20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     21  *
     22  */
     23 
     24 #ifndef _DVBDMX_H_
     25 #define _DVBDMX_H_
     26 
     27 #include <linux/types.h>
     28 #include <time.h>
     29 
     30 
     31 #define DMX_FILTER_SIZE 16
     32 
     33 typedef enum
     34 {
     35 	DMX_OUT_DECODER, /* Streaming directly to decoder. */
     36 	DMX_OUT_TAP,     /* Output going to a memory buffer */
     37 			 /* (to be retrieved via the read command).*/
     38 	DMX_OUT_TS_TAP,  /* Output multiplexed into a new TS  */
     39 			 /* (to be retrieved by reading from the */
     40 			 /* logical DVR device).                 */
     41 	DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */
     42 } dmx_output_t;
     43 
     44 
     45 typedef enum
     46 {
     47 	DMX_IN_FRONTEND, /* Input from a front-end device.  */
     48 	DMX_IN_DVR       /* Input from the logical DVR device.  */
     49 } dmx_input_t;
     50 
     51 
     52 typedef enum
     53 {
     54 	DMX_PES_AUDIO0,
     55 	DMX_PES_VIDEO0,
     56 	DMX_PES_TELETEXT0,
     57 	DMX_PES_SUBTITLE0,
     58 	DMX_PES_PCR0,
     59 
     60 	DMX_PES_AUDIO1,
     61 	DMX_PES_VIDEO1,
     62 	DMX_PES_TELETEXT1,
     63 	DMX_PES_SUBTITLE1,
     64 	DMX_PES_PCR1,
     65 
     66 	DMX_PES_AUDIO2,
     67 	DMX_PES_VIDEO2,
     68 	DMX_PES_TELETEXT2,
     69 	DMX_PES_SUBTITLE2,
     70 	DMX_PES_PCR2,
     71 
     72 	DMX_PES_AUDIO3,
     73 	DMX_PES_VIDEO3,
     74 	DMX_PES_TELETEXT3,
     75 	DMX_PES_SUBTITLE3,
     76 	DMX_PES_PCR3,
     77 
     78 	DMX_PES_OTHER
     79 } dmx_pes_type_t;
     80 
     81 #define DMX_PES_AUDIO    DMX_PES_AUDIO0
     82 #define DMX_PES_VIDEO    DMX_PES_VIDEO0
     83 #define DMX_PES_TELETEXT DMX_PES_TELETEXT0
     84 #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0
     85 #define DMX_PES_PCR      DMX_PES_PCR0
     86 
     87 
     88 typedef struct dmx_filter
     89 {
     90 	__u8  filter[DMX_FILTER_SIZE];
     91 	__u8  mask[DMX_FILTER_SIZE];
     92 	__u8  mode[DMX_FILTER_SIZE];
     93 } dmx_filter_t;
     94 
     95 
     96 struct dmx_sct_filter_params
     97 {
     98 	__u16          pid;
     99 	dmx_filter_t   filter;
    100 	__u32          timeout;
    101 	__u32          flags;
    102 #define DMX_CHECK_CRC       1
    103 #define DMX_ONESHOT         2
    104 #define DMX_IMMEDIATE_START 4
    105 #define DMX_KERNEL_CLIENT   0x8000
    106 };
    107 
    108 
    109 struct dmx_pes_filter_params
    110 {
    111 	__u16          pid;
    112 	dmx_input_t    input;
    113 	dmx_output_t   output;
    114 	dmx_pes_type_t pes_type;
    115 	__u32          flags;
    116 };
    117 
    118 typedef struct dmx_caps {
    119 	__u32 caps;
    120 	int num_decoders;
    121 } dmx_caps_t;
    122 
    123 typedef enum {
    124 	DMX_SOURCE_FRONT0 = 0,
    125 	DMX_SOURCE_FRONT1,
    126 	DMX_SOURCE_FRONT2,
    127 	DMX_SOURCE_FRONT3,
    128 	DMX_SOURCE_DVR0   = 16,
    129 	DMX_SOURCE_DVR1,
    130 	DMX_SOURCE_DVR2,
    131 	DMX_SOURCE_DVR3
    132 } dmx_source_t;
    133 
    134 struct dmx_stc {
    135 	unsigned int num;	/* input : which STC? 0..N */
    136 	unsigned int base;	/* output: divisor for stc to get 90 kHz clock */
    137 	__u64 stc;		/* output: stc in 'base'*90 kHz units */
    138 };
    139 
    140 
    141 #define DMX_START                _IO('o', 41)
    142 #define DMX_STOP                 _IO('o', 42)
    143 #define DMX_SET_FILTER           _IOW('o', 43, struct dmx_sct_filter_params)
    144 #define DMX_SET_PES_FILTER       _IOW('o', 44, struct dmx_pes_filter_params)
    145 #define DMX_SET_BUFFER_SIZE      _IO('o', 45)
    146 #define DMX_GET_PES_PIDS         _IOR('o', 47, __u16[5])
    147 #define DMX_GET_CAPS             _IOR('o', 48, dmx_caps_t)
    148 #define DMX_SET_SOURCE           _IOW('o', 49, dmx_source_t)
    149 #define DMX_GET_STC              _IOWR('o', 50, struct dmx_stc)
    150 #define DMX_ADD_PID              _IOW('o', 51, __u16)
    151 #define DMX_REMOVE_PID           _IOW('o', 52, __u16)
    152 
    153 #endif /*_DVBDMX_H_*/
    154