1 /* 2 * dmx.h 3 * 4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> 5 * & Ralph Metzler <ralph@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 #ifdef __FreeBSD__ 28 #define __u8 uint8_t 29 #define __u16 uint16_t 30 #define __u32 uint32_t 31 #define __u64 uint64_t 32 #define __s16 int16_t 33 #define __s32 int32_t 34 #endif 35 36 #ifdef __KERNEL__ 37 #include <linux/time.h> 38 #else 39 #include <time.h> 40 #endif 41 42 43 #define DMX_FILTER_SIZE 16 44 45 typedef enum 46 { 47 DMX_OUT_DECODER, /* Streaming directly to decoder. */ 48 DMX_OUT_TAP, /* Output going to a memory buffer */ 49 /* (to be retrieved via the read command).*/ 50 DMX_OUT_TS_TAP /* Output multiplexed into a new TS */ 51 /* (to be retrieved by reading from the */ 52 /* logical DVR device). */ 53 } dmx_output_t; 54 55 56 typedef enum 57 { 58 DMX_IN_FRONTEND, /* Input from a front-end device. */ 59 DMX_IN_DVR /* Input from the logical DVR device. */ 60 } dmx_input_t; 61 62 63 typedef enum 64 { 65 DMX_PES_AUDIO0, 66 DMX_PES_VIDEO0, 67 DMX_PES_TELETEXT0, 68 DMX_PES_SUBTITLE0, 69 DMX_PES_PCR0, 70 71 DMX_PES_AUDIO1, 72 DMX_PES_VIDEO1, 73 DMX_PES_TELETEXT1, 74 DMX_PES_SUBTITLE1, 75 DMX_PES_PCR1, 76 77 DMX_PES_AUDIO2, 78 DMX_PES_VIDEO2, 79 DMX_PES_TELETEXT2, 80 DMX_PES_SUBTITLE2, 81 DMX_PES_PCR2, 82 83 DMX_PES_AUDIO3, 84 DMX_PES_VIDEO3, 85 DMX_PES_TELETEXT3, 86 DMX_PES_SUBTITLE3, 87 DMX_PES_PCR3, 88 89 DMX_PES_OTHER 90 } dmx_pes_type_t; 91 92 #define DMX_PES_AUDIO DMX_PES_AUDIO0 93 #define DMX_PES_VIDEO DMX_PES_VIDEO0 94 #define DMX_PES_TELETEXT DMX_PES_TELETEXT0 95 #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 96 #define DMX_PES_PCR DMX_PES_PCR0 97 98 99 typedef struct dmx_filter 100 { 101 __u8 filter[DMX_FILTER_SIZE]; 102 __u8 mask[DMX_FILTER_SIZE]; 103 __u8 mode[DMX_FILTER_SIZE]; 104 } dmx_filter_t; 105 106 107 struct dmx_sct_filter_params 108 { 109 __u16 pid; 110 dmx_filter_t filter; 111 __u32 timeout; 112 __u32 flags; 113 #define DMX_CHECK_CRC 1 114 #define DMX_ONESHOT 2 115 #define DMX_IMMEDIATE_START 4 116 #define DMX_KERNEL_CLIENT 0x8000 117 }; 118 119 120 struct dmx_pes_filter_params 121 { 122 __u16 pid; 123 dmx_input_t input; 124 dmx_output_t output; 125 dmx_pes_type_t pes_type; 126 __u32 flags; 127 }; 128 129 typedef struct dmx_caps { 130 __u32 caps; 131 int num_decoders; 132 } dmx_caps_t; 133 134 typedef enum { 135 DMX_SOURCE_FRONT0 = 0, 136 DMX_SOURCE_FRONT1, 137 DMX_SOURCE_FRONT2, 138 DMX_SOURCE_FRONT3, 139 DMX_SOURCE_DVR0 = 16, 140 DMX_SOURCE_DVR1, 141 DMX_SOURCE_DVR2, 142 DMX_SOURCE_DVR3 143 } dmx_source_t; 144 145 struct dmx_stc { 146 unsigned int num; /* input : which STC? 0..N */ 147 unsigned int base; /* output: divisor for stc to get 90 kHz clock */ 148 __u64 stc; /* output: stc in 'base'*90 kHz units */ 149 }; 150 151 152 #define DMX_START _IO('o', 41) 153 #define DMX_STOP _IO('o', 42) 154 #define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params) 155 #define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params) 156 #define DMX_SET_BUFFER_SIZE _IO('o', 45) 157 #define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5]) 158 #define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t) 159 #define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t) 160 #define DMX_GET_STC _IOWR('o', 50, struct dmx_stc) 161 162 #endif /*_DVBDMX_H_*/ 163