1 /* $NetBSD: dtvio_demux.h,v 1.2 2011/07/10 15:50:48 jmcneill Exp $ */ 2 3 /*- 4 * Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by Jared D. McNeill. 18 * 4. Neither the name of The NetBSD Foundation nor the names of its 19 * contributors may be used to endorse or promote products derived 20 * from this software without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 23 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 * POSSIBILITY OF SUCH DAMAGE. 33 */ 34 35 #ifndef _DEV_DTV_DTVIO_DEMUX_H 36 #define _DEV_DTV_DTVIO_DEMUX_H 37 38 #include <sys/ioccom.h> 39 40 /* 41 * DVB Demux API 42 */ 43 44 typedef enum { 45 DMX_OUT_DECODER, 46 DMX_OUT_TAP, 47 DMX_OUT_TS_TAP, 48 DMX_OUT_TSDEMUX_TAP, 49 } dmx_output_t; 50 51 typedef enum { 52 DMX_IN_FRONTEND, 53 DMX_IN_DVR, 54 } dmx_input_t; 55 56 typedef enum { 57 DMX_PES_AUDIO0, 58 DMX_PES_VIDEO0, 59 DMX_PES_TELETEXT0, 60 DMX_PES_SUBTITLE0, 61 DMX_PES_PCR0, 62 63 DMX_PES_AUDIO1, 64 DMX_PES_VIDEO1, 65 DMX_PES_TELETEXT1, 66 DMX_PES_SUBTITLE1, 67 DMX_PES_PCR1, 68 69 DMX_PES_AUDIO2, 70 DMX_PES_VIDEO2, 71 DMX_PES_TELETEXT2, 72 DMX_PES_SUBTITLE2, 73 DMX_PES_PCR2, 74 75 DMX_PES_AUDIO3, 76 DMX_PES_VIDEO3, 77 DMX_PES_TELETEXT3, 78 DMX_PES_SUBTITLE3, 79 DMX_PES_PCR3, 80 81 DMX_PES_OTHER, 82 } dmx_pes_type_t; 83 84 #define DMX_PES_AUDIO DMX_PES_AUDIO0 85 #define DMX_PES_VIDEO DMX_PES_VIDEO0 86 #define DMX_PES_TELETEXT DMX_PES_TELETEXT0 87 #define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0 88 #define DMX_PES_PCR DMX_PES_PCR0 89 90 #define DMX_FILTER_SIZE 16 91 92 typedef struct dmx_filter { 93 uint8_t filter[DMX_FILTER_SIZE]; 94 uint8_t mask[DMX_FILTER_SIZE]; 95 uint8_t mode[DMX_FILTER_SIZE]; 96 } dmx_filter_t; 97 98 struct dmx_sct_filter_params { 99 uint16_t pid; 100 dmx_filter_t filter; 101 uint32_t timeout; 102 uint32_t flags; 103 #define DMX_CHECK_CRC 0x0001 104 #define DMX_ONESHOT 0x0002 105 #define DMX_IMMEDIATE_START 0x0004 106 #define DMX_KERNEL_CLIENT 0x8000 107 }; 108 109 struct dmx_pes_filter_params { 110 uint16_t pid; 111 dmx_input_t input; 112 dmx_output_t output; 113 dmx_pes_type_t pes_type; 114 uint32_t flags; 115 }; 116 117 struct dmx_stc { 118 unsigned int num; 119 unsigned int base; 120 uint64_t stc; 121 }; 122 123 typedef struct dmx_caps { 124 uint32_t caps; 125 int num_decoders; 126 } dmx_caps_t; 127 128 typedef enum { 129 DMX_SOURCE_FRONT0 = 0, 130 DMX_SOURCE_FRONT1, 131 DMX_SOURCE_FRONT2, 132 DMX_SOURCE_FRONT3, 133 DMX_SOURCE_DVR0 = 16, 134 DMX_SOURCE_DVR1, 135 DMX_SOURCE_DVR2, 136 DMX_SOURCE_DVR3, 137 } dmx_source_t; 138 139 #define DMX_START _IO('D', 100) 140 #define DMX_STOP _IO('D', 101) 141 #define DMX_SET_FILTER _IOW('D', 102, struct dmx_sct_filter_params) 142 #define DMX_SET_PES_FILTER _IOW('D', 103, struct dmx_pes_filter_params) 143 #define DMX_SET_BUFFER_SIZE _IO('D', 104) 144 #define DMX_GET_STC _IOWR('D', 105, struct dmx_stc) 145 #define DMX_ADD_PID _IOW('D', 106, uint16_t) 146 #define DMX_REMOVE_PID _IOW('D', 107, uint16_t) 147 #define DMX_GET_CAPS _IOR('D', 108, dmx_caps_t) 148 #define DMX_SET_SOURCE _IOW('D', 109, dmx_source_t) 149 150 #endif /* !_DEV_DTV_DTVIO_DEMUX_H */ 151