blob: 7f963e6de05d356f7d4d1b564dc60a6a9dc98f02 [file] [log] [blame]
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -08001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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 *
Hamad Kadmany32cb9822012-05-10 08:47:44 +03008 * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
9 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 *
24 */
25
26#ifndef _DVBDMX_H_
27#define _DVBDMX_H_
28
Jaswinder Singh Rajputc86629c2009-01-30 19:55:32 +053029#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#ifdef __KERNEL__
31#include <linux/time.h>
32#else
33#include <time.h>
34#endif
35
36
37#define DMX_FILTER_SIZE 16
38
39typedef enum
40{
41 DMX_OUT_DECODER, /* Streaming directly to decoder. */
42 DMX_OUT_TAP, /* Output going to a memory buffer */
Mauro Carvalho Chehab674434c2005-12-12 00:37:28 -080043 /* (to be retrieved via the read command).*/
Peter Hartleyb01cd932008-04-22 14:45:36 -030044 DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */
Mauro Carvalho Chehab674434c2005-12-12 00:37:28 -080045 /* (to be retrieved by reading from the */
46 /* logical DVR device). */
Peter Hartleyb01cd932008-04-22 14:45:36 -030047 DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */
Linus Torvalds1da177e2005-04-16 15:20:36 -070048} dmx_output_t;
49
50
51typedef enum
52{
53 DMX_IN_FRONTEND, /* Input from a front-end device. */
54 DMX_IN_DVR /* Input from the logical DVR device. */
55} dmx_input_t;
56
57
58typedef enum
59{
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080060 DMX_PES_AUDIO0,
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 DMX_PES_VIDEO0,
62 DMX_PES_TELETEXT0,
63 DMX_PES_SUBTITLE0,
64 DMX_PES_PCR0,
65
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080066 DMX_PES_AUDIO1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 DMX_PES_VIDEO1,
68 DMX_PES_TELETEXT1,
69 DMX_PES_SUBTITLE1,
70 DMX_PES_PCR1,
71
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080072 DMX_PES_AUDIO2,
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 DMX_PES_VIDEO2,
74 DMX_PES_TELETEXT2,
75 DMX_PES_SUBTITLE2,
76 DMX_PES_PCR2,
77
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080078 DMX_PES_AUDIO3,
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 DMX_PES_VIDEO3,
80 DMX_PES_TELETEXT3,
81 DMX_PES_SUBTITLE3,
82 DMX_PES_PCR3,
83
84 DMX_PES_OTHER
85} dmx_pes_type_t;
86
87#define DMX_PES_AUDIO DMX_PES_AUDIO0
88#define DMX_PES_VIDEO DMX_PES_VIDEO0
89#define DMX_PES_TELETEXT DMX_PES_TELETEXT0
90#define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0
91#define DMX_PES_PCR DMX_PES_PCR0
92
93
Linus Torvalds1da177e2005-04-16 15:20:36 -070094typedef struct dmx_filter
95{
96 __u8 filter[DMX_FILTER_SIZE];
97 __u8 mask[DMX_FILTER_SIZE];
98 __u8 mode[DMX_FILTER_SIZE];
99} dmx_filter_t;
100
101
102struct dmx_sct_filter_params
103{
104 __u16 pid;
105 dmx_filter_t filter;
106 __u32 timeout;
107 __u32 flags;
108#define DMX_CHECK_CRC 1
109#define DMX_ONESHOT 2
110#define DMX_IMMEDIATE_START 4
111#define DMX_KERNEL_CLIENT 0x8000
112};
113
114
115struct dmx_pes_filter_params
116{
117 __u16 pid;
118 dmx_input_t input;
119 dmx_output_t output;
120 dmx_pes_type_t pes_type;
121 __u32 flags;
122};
123
Hamad Kadmany32cb9822012-05-10 08:47:44 +0300124struct dmx_buffer_status {
125 /* size of buffer in bytes */
126 unsigned int size;
127
128 /* fullness of buffer in bytes */
129 unsigned int fullness;
130
131 /*
132 * How many bytes are free
133 * It's the same as: size-fullness-1
134 */
135 unsigned int free_bytes;
136
137 /* read pointer offset in bytes */
138 unsigned int read_offset;
139
140 /* write pointer offset in bytes */
141 unsigned int write_offset;
142
143 /* non-zero if data error occured */
144 int error;
145};
146
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147typedef struct dmx_caps {
148 __u32 caps;
149 int num_decoders;
150} dmx_caps_t;
151
152typedef enum {
153 DMX_SOURCE_FRONT0 = 0,
154 DMX_SOURCE_FRONT1,
155 DMX_SOURCE_FRONT2,
156 DMX_SOURCE_FRONT3,
157 DMX_SOURCE_DVR0 = 16,
158 DMX_SOURCE_DVR1,
159 DMX_SOURCE_DVR2,
160 DMX_SOURCE_DVR3
161} dmx_source_t;
162
Hamad Kadmany32cb9822012-05-10 08:47:44 +0300163enum dmx_tsp_format_t {
164 DMX_TSP_FORMAT_188 = 0,
165 DMX_TSP_FORMAT_192_TAIL,
166 DMX_TSP_FORMAT_192_HEAD,
167 DMX_TSP_FORMAT_204,
168};
169
170enum dmx_playback_mode_t {
171 /*
172 * In push mode, if one of output buffers
173 * is full, the buffer would overflow
174 * and demux continue processing incoming stream.
175 * This is the default mode. When playing from frontend,
176 * this is the only mode that is allowed.
177 */
178 DMX_PB_MODE_PUSH = 0,
179
180 /*
181 * In pull mode, if one of output buffers
182 * is full, demux stalls waiting for free space,
183 * this would cause DVR input buffer fullness
184 * to accumulate.
185 * This mode is possible only when playing
186 * from DVR.
187 */
188 DMX_PB_MODE_PULL,
189};
190
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191struct dmx_stc {
192 unsigned int num; /* input : which STC? 0..N */
193 unsigned int base; /* output: divisor for stc to get 90 kHz clock */
194 __u64 stc; /* output: stc in 'base'*90 kHz units */
195};
196
197
198#define DMX_START _IO('o', 41)
199#define DMX_STOP _IO('o', 42)
200#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
201#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
202#define DMX_SET_BUFFER_SIZE _IO('o', 45)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
204#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
205#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
206#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc)
Andreas Oberritter1cb662a2009-07-14 20:28:50 -0300207#define DMX_ADD_PID _IOW('o', 51, __u16)
208#define DMX_REMOVE_PID _IOW('o', 52, __u16)
Hamad Kadmany32cb9822012-05-10 08:47:44 +0300209#define DMX_SET_TS_PACKET_FORMAT _IOW('o', 53, enum dmx_tsp_format_t)
210#define DMX_SET_TS_OUT_FORMAT _IOW('o', 54, enum dmx_tsp_format_t)
211#define DMX_SET_DECODER_BUFFER_SIZE _IO('o', 55)
212#define DMX_GET_BUFFER_STATUS _IOR('o', 56, struct dmx_buffer_status)
213#define DMX_RELEASE_DATA _IO('o', 57)
214#define DMX_FEED_DATA _IO('o', 58)
215#define DMX_SET_PLAYBACK_MODE _IOW('o', 59, enum dmx_playback_mode_t)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216
217#endif /*_DVBDMX_H_*/