~ubuntu-branches/ubuntu/precise/me-tv/precise-proposed

« back to all changes in this revision

Viewing changes to src/libdvbapi/dvbdemux.h

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Kern
  • Date: 2008-07-23 14:03:56 UTC
  • mfrom: (1.1.3 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080723140356-m6ze7fbkydes42c7
Tags: 0.5.33-3
Fix xine-lib ffmpeg dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * libdvbdemux - a DVB demux library
3
 
 *
4
 
 * Copyright (C) 2005 Andrew de Quincey (adq_dvb@lidskialf.net)
5
 
 *
6
 
 * This library is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the GNU Lesser General Public
8
 
 * License as published by the Free Software Foundation; either
9
 
 * version 2.1 of the License, or (at your option) any later version.
10
 
 *
11
 
 * This library is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
 * Lesser General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU Lesser General Public
17
 
 * License along with this library; if not, write to the Free Software
18
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
19
 
 */
20
 
 
21
 
#ifndef LIBDVBDEMUX_H
22
 
#define LIBDVBDEMUX_H 1
23
 
 
24
 
#ifdef __cplusplus
25
 
extern "C"
26
 
{
27
 
#endif
28
 
 
29
 
#include <stdint.h>
30
 
 
31
 
/**
32
 
 * Source of the data to be demuxed.
33
 
 *
34
 
 * FRONTEND. The data will be read from the frontend on the adapter.
35
 
 *
36
 
 * DVR. The data will be read from the DVR device of the adapter (of course,
37
 
 * you need to write data TO the DVR device as well).
38
 
 */
39
 
#define DVBDEMUX_INPUT_FRONTEND 0
40
 
#define DVBDEMUX_INPUT_DVR 1
41
 
 
42
 
/**
43
 
 * Destination of the demuxed data.
44
 
 *
45
 
 * DECODER. Sends the data directly to a hardware decoder (if present).
46
 
 *
47
 
 * DEMUX. Sends the PID stream to the current demux file descriptor. HOWEVER, the
48
 
 * data will be the payload *only* - transport stream headers will be stripped.
49
 
 *
50
 
 * DVR sends the data to the DVR device. The data will be the complete transport
51
 
 * stream packets with headers intact. Note: if multiple filters specify
52
 
 * DVBDEMUX_OUTPUT_DVR, the individual PID streams will be re-multiplexed
53
 
 * together.
54
 
 */
55
 
#define DVBDEMUX_OUTPUT_DECODER 0
56
 
#define DVBDEMUX_OUTPUT_DEMUX 1
57
 
#define DVBDEMUX_OUTPUT_DVR 2
58
 
 
59
 
/**
60
 
 * PES types.
61
 
 */
62
 
#define DVBDEMUX_PESTYPE_AUDIO 0
63
 
#define DVBDEMUX_PESTYPE_VIDEO 1
64
 
#define DVBDEMUX_PESTYPE_TELETEXT 2
65
 
#define DVBDEMUX_PESTYPE_SUBTITLE 3
66
 
#define DVBDEMUX_PESTYPE_PCR 4
67
 
 
68
 
/**
69
 
 * Open a demux device. Can be called multiple times. These let you setup a
70
 
 * single filter per FD. It can can also be read() from if you use a section
71
 
 * filter, or create a pes_filter or raw_filter with output DVBDEMUX_OUTPUT_DEMUX.
72
 
 *
73
 
 * @param adapter Index of the DVB adapter.
74
 
 * @param demuxdevice Index of the demux device on that adapter (usually 0).
75
 
 * @param nonblocking If 1, frontend will be opened in nonblocking mode.
76
 
 * @return A unix file descriptor on success, or -1 on failure.
77
 
 */
78
 
extern int dvbdemux_open_demux(int adapter, int demuxdevice, int nonblocking);
79
 
 
80
 
/**
81
 
 * Open a DVR device. May be opened for writing once, or multiple times in readonly
82
 
 * mode. It is used to either write() transport stream data to be demuxed
83
 
 * (if input == DVBDEMUX_INPUT_DVR), or to read() a stream of demuxed data
84
 
 * (if output == DVBDEMUX_OUTPUT_DVR).
85
 
 *
86
 
 * Note, all demux filters with output set to DVBDEMUX_OUTPUT_DVR will be
87
 
 * multiplexed together and output their data on this device.
88
 
 *
89
 
 * @param adapter Index of the DVB adapter.
90
 
 * @param dvrdevice Index of the dvr device on that adapter (usually 0)
91
 
 * @param readonly If 1, frontend will be opened in readonly mode only.
92
 
 * @param nonblocking If 1, frontend will be opened in nonblocking mode.
93
 
 * @return A unix file descriptor on success, or -1 on failure.
94
 
 */
95
 
extern int dvbdemux_open_dvr(int adapter, int dvrdevice, int readonly, int nonblocking);
96
 
 
97
 
/**
98
 
 * Set filter for the first 18 bytes of decoded SI table sections. Note that
99
 
 * bytes 1 and 2 are _not_ filtered since they contain the length field.
100
 
 *
101
 
 * Conceptually, the driver computes the following for each filtered bit.
102
 
 *
103
 
 * (filter[X].bit[Y] & mask[X].bit[Y]) == (header[X].bit[Y] & mask[X].bit[Y])
104
 
 *
105
 
 * Any sections which do not match this criteria for every bit will be discarded.
106
 
 *
107
 
 * The SI data is always read from the frontend, and is always returned by
108
 
 * read()ing the demux fd. FIXME: check this statement!
109
 
 *
110
 
 * @param fd FD as opened with dvbdemux_open_demux() above.
111
 
 * @param pid PID of the stream.
112
 
 * @param filter The filter values of the first 18 bytes of the desired sections.
113
 
 * @param mask Bitmask indicating which bits in the filter array should be tested
114
 
 * (if a bit is 1, it will be tested).
115
 
 * @param start If 1, the filter will be started immediately. Otherwise you must
116
 
 * call dvbdemux_start() manually.
117
 
 * @param checkcrc If 1, the driver will check the CRC on the table sections.
118
 
 * Any bad sections will be dropped.
119
 
 * @return 0 on success, nonzero on failure.
120
 
 */
121
 
extern int dvbdemux_set_section_filter(int fd, int pid,
122
 
                                       uint8_t filter[18], uint8_t mask[18],
123
 
                                       int start, int checkcrc);
124
 
 
125
 
/**
126
 
 * Set filter for a stream of PES data. This call can only used for cards
127
 
 * equipped with a hardware decoder.
128
 
 *
129
 
 * @param fd FD as opened with dvbdemux_open_demux() above.
130
 
 * @param pid PID of the stream.
131
 
 * @param input One of DVBDEMUX_INPUT_*.
132
 
 * @param output One of DVBDEMUX_OUTPUT_*.
133
 
 * @param pestype One of DVBDEMUX_PESTYPE_* - this tells the decoder the type
134
 
 * of data in this stream.
135
 
 * @param start If 1, the filter will be started immediately. Otherwise you must
136
 
 * call dvbdemux_start() manually.
137
 
 * @return 0 on success, nonzero on failure.
138
 
 */
139
 
extern int dvbdemux_set_pes_filter(int fd, int pid,
140
 
                                   int input, int output,
141
 
                                   int pestype,
142
 
                                   int start);
143
 
 
144
 
/**
145
 
 * Create a pid filter - this will extract transport stream packets for a
146
 
 * specified PID.
147
 
 *
148
 
 * Note: The wildcard PID can only be used on "budget" cards.
149
 
 *
150
 
 * @param fd FD as opened with dvbdemux_open_demux() above.
151
 
 * @param pid PID to retrieve, or use -1 as a wildcard for ALL PIDs.
152
 
 * @param input One of DVBDEMUX_INPUT_*.
153
 
 * @param output One of DVBDEMUX_OUTPUT_*.
154
 
 * @param start If 1, the filter will be started immediately. Otherwise you must
155
 
 * call dvbdemux_start() manually.
156
 
 * @return 0 on success, nonzero on failure.
157
 
 */
158
 
extern int dvbdemux_set_pid_filter(int fd, int pid,
159
 
                                   int input, int output,
160
 
                                   int start);
161
 
 
162
 
/**
163
 
 * Start a demux going.
164
 
 *
165
 
 * @param fd FD as opened with dvbdemux_open_demux() above.
166
 
 * @return 0 on success, nonzero on failure.
167
 
 */
168
 
extern int dvbdemux_start(int fd);
169
 
 
170
 
/**
171
 
 * Stop a demux.
172
 
 *
173
 
 * @param fd FD as opened with dvbdemux_open_demux() above.
174
 
 * @return 0 on success, nonzero on failure.
175
 
 */
176
 
extern int dvbdemux_stop(int fd);
177
 
 
178
 
/**
179
 
 * Retrieve the current STC from the demux. This call can only used for cards
180
 
 * equipped with a hardware decoder.
181
 
 *
182
 
 * @param fd FD as opened with dvbdemux_open_demux() above.
183
 
 * @param stc Where to put the retrieved STC value (in 90kHz clock).
184
 
 * @return 0 on success, nonzero on failure.
185
 
 */
186
 
extern int dvbdemux_get_stc(int fd, uint64_t *stc);
187
 
 
188
 
/**
189
 
 * Change the internal buffer size used by the demuxer. The default buffer size
190
 
 * is 8192 bytes. Can only be used if the demux in question is stopped.
191
 
 *
192
 
 * @param fd FD as opened with dvbdemux_open_demux() above.
193
 
 * @param bufsize New buffer size to use.
194
 
 * @return 0 on success, nonzero on failure.
195
 
 */
196
 
extern int dvbdemux_set_buffer(int fd, int bufsize);
197
 
 
198
 
#ifdef __cplusplus
199
 
}
200
 
#endif
201
 
 
202
 
#endif // LIBDVBDEMUX_H