dtvio_demux.h revision 1.1 1 /* $NetBSD: dtvio_demux.h,v 1.1 2011/07/09 14:46:56 jmcneill Exp $ */
2
3 /*-
4 * Copyright (c) 2011 Jared D. McNeill <jmcneill (at) 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_FILTER_SIZE 16
85
86 typedef struct dmx_filter {
87 uint8_t filter[DMX_FILTER_SIZE];
88 uint8_t mask[DMX_FILTER_SIZE];
89 uint8_t mode[DMX_FILTER_SIZE];
90 } dmx_filter_t;
91
92 struct dmx_sct_filter_params {
93 uint16_t pid;
94 dmx_filter_t filter;
95 uint32_t timeout;
96 uint32_t flags;
97 #define DMX_CHECK_CRC 0x0001
98 #define DMX_ONESHOT 0x0002
99 #define DMX_IMMEDIATE_START 0x0004
100 #define DMX_KERNEL_CLIENT 0x8000
101 };
102
103 struct dmx_pes_filter_params {
104 uint16_t pid;
105 dmx_input_t input;
106 dmx_output_t output;
107 dmx_pes_type_t pes_type;
108 uint32_t flags;
109 };
110
111 struct dmx_stc {
112 unsigned int num;
113 unsigned int base;
114 uint64_t stc;
115 };
116
117 typedef struct dmx_caps {
118 uint32_t caps;
119 int num_decoders;
120 } dmx_caps_t;
121
122 typedef enum {
123 DMX_SOURCE_FRONT0 = 0,
124 DMX_SOURCE_FRONT1,
125 DMX_SOURCE_FRONT2,
126 DMX_SOURCE_FRONT3,
127 DMX_SOURCE_DVR0 = 16,
128 DMX_SOURCE_DVR1,
129 DMX_SOURCE_DVR2,
130 DMX_SOURCE_DVR3,
131 } dmx_source_t;
132
133 #define DMX_START _IO('D', 100)
134 #define DMX_STOP _IO('D', 101)
135 #define DMX_SET_FILTER _IOW('D', 102, struct dmx_sct_filter_params)
136 #define DMX_SET_PES_FILTER _IOW('D', 103, struct dmx_pes_filter_params)
137 #define DMX_SET_BUFFER_SIZE _IO('D', 104)
138 #define DMX_GET_STC _IOWR('D', 105, struct dmx_stc)
139 #define DMX_ADD_PID _IOW('D', 106, uint16_t)
140 #define DMX_REMOVE_PID _IOW('D', 107, uint16_t)
141 #define DMX_GET_CAPS _IOR('D', 108, dmx_caps_t)
142 #define DMX_SET_SOURCE _IOW('D', 109, dmx_source_t)
143
144 #endif /* !_DEV_DTV_DTVIO_DEMUX_H */
145