libdvbv5 1.24.1 Library to work with Digital TV devices on Linux

dvb-scan.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2014 - Mauro Carvalho Chehab
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation version 2.1 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
17 */
18#ifndef _LIBSCAN_H
19#define _LIBSCAN_H
20
21#include <stdint.h>
22#include <linux/dvb/dmx.h>
23#include <libdvbv5/descriptors.h>
24#include <libdvbv5/dvb-sat.h>
25
37/* According with ISO/IEC 13818-1:2007 */
38
39#define MAX_TABLE_SIZE 1024 * 1024
40
41#ifdef __cplusplus
42 extern "C" {
43#endif
44
45 struct dvb_entry;
46
55 struct dvb_v5_descriptors_program {
56 struct dvb_table_pat_program *pat_pgm;
57 struct dvb_table_pmt *pmt;
58};
59
87 struct dvb_v5_descriptors {
88 uint32_t delivery_system;
89
90 struct dvb_entry *entry;
91 unsigned num_entry;
92
93 struct dvb_table_pat *pat;
94 struct atsc_table_vct *vct;
95 struct dvb_v5_descriptors_program *program;
96 struct dvb_table_nit *nit;
97 struct dvb_table_sdt *sdt;
98
99 unsigned num_program;
100
101 struct dvb_table_nit **other_nits;
102 unsigned num_other_nits;
103
104 struct dvb_table_sdt **other_sdts;
105 unsigned num_other_sdts;
106};
107
122 struct dvb_table_filter {
123 /* Input data */
124 unsigned char tid;
125 uint16_t pid;
126 int ts_id;
127 void **table;
128
129 int allow_section_gaps;
130
131 /*
132 * Private temp data used by dvb_read_sections().
133 * Should not be filled outside dvb-scan.c, as they'll be
134 * overrided
135 */
136 void *priv;
137};
144 void dvb_table_filter_free(struct dvb_table_filter *sect);
145
186 int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd,
187 unsigned char tid, uint16_t pid, void **table,
188 unsigned timeout);
189
208 int dvb_read_section_with_id(struct dvb_v5_fe_parms *parms, int dmx_fd,
209 unsigned char tid, uint16_t pid, int ts_id,
210 void **table, unsigned timeout);
211
225 int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd,
226 struct dvb_table_filter *sect,
227 unsigned timeout);
228
237 struct dvb_v5_descriptors *dvb_scan_alloc_handler_table(uint32_t delivery_system);
238
245 void dvb_scan_free_handler_table(struct dvb_v5_descriptors *dvb_scan_handler);
246
268 struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *parms, int dmx_fd,
269 uint32_t delivery_system,
270 unsigned other_nit,
271 unsigned timeout_multiply);
272
282 void dvb_free_ts_tables(struct dvb_v5_descriptors *dvb_desc);
283
293 typedef int (check_frontend_t)(void *args, struct dvb_v5_fe_parms *parms);
294
340 struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms,
341 struct dvb_entry *entry,
342 int dmx_fd,
343 check_frontend_t *check_frontend,
344 void *args,
345 unsigned other_nit,
346 unsigned timeout_multiply);
347
348
391 void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms,
392 struct dvb_v5_descriptors *dvb_scan_handler,
393 struct dvb_entry *first_entry,
394 struct dvb_entry *entry);
395
396#ifndef _DOXYGEN
397/*
398 * Some ancillary functions used internally inside the library, used to
399 * identify duplicated transport streams and add new found transponder entries
400 */
401 int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
402
403 int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
404 uint32_t freq, enum dvb_sat_polarization pol, int shift);
405
406 struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
407 struct dvb_entry *first_entry,
408 struct dvb_entry *entry,
409 uint32_t freq, uint32_t shift,
410 enum dvb_sat_polarization pol);
411
412 int dvb_new_entry_is_needed(struct dvb_entry *entry,
413 struct dvb_entry *last_entry,
414 uint32_t freq, int shift,
415 enum dvb_sat_polarization pol, uint32_t stream_id);
416
417 struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *parms,
418 struct dvb_entry *first_entry,
419 struct dvb_entry *entry,
420 uint32_t freq, uint32_t shift,
421 enum dvb_sat_polarization pol,
422 uint32_t stream_id);
423
424 void dvb_update_transponders(struct dvb_v5_fe_parms *parms,
425 struct dvb_v5_descriptors *dvb_scan_handler,
426 struct dvb_entry *first_entry,
427 struct dvb_entry *entry);
428#endif
429
430#ifdef __cplusplus
431}
432#endif
433
434#endif
descriptors.h
Provides a way to handle MPEG-TS descriptors found on Digital TV streams.
dvb-sat.h
Provides interfaces to deal with DVB Satellite systems.
dvb_free_ts_tables
void dvb_free_ts_tables(struct dvb_v5_descriptors *dvb_desc)
frees a struct dvb_v5_descriptors
dvb_table_filter_free
void dvb_table_filter_free(struct dvb_table_filter *sect)
deallocates all data associated with a table filter
dvb_scan_transponder
struct dvb_v5_descriptors * dvb_scan_transponder(struct dvb_v5_fe_parms *parms, struct dvb_entry *entry, int dmx_fd, check_frontend_t *check_frontend, void *args, unsigned other_nit, unsigned timeout_multiply)
Scans a DVB dvb_add_scaned_transponder.
dvb_get_ts_tables
struct dvb_v5_descriptors * dvb_get_ts_tables(struct dvb_v5_fe_parms *parms, int dmx_fd, uint32_t delivery_system, unsigned other_nit, unsigned timeout_multiply)
Scans a DVB stream, looking for the tables needed to identify the programs inside a MPEG-TS.
check_frontend_t
int() check_frontend_t(void *args, struct dvb_v5_fe_parms *parms)
Callback for the application to show the frontend status.
Definition: dvb-scan.h:293
dvb_read_section
int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd, unsigned char tid, uint16_t pid, void **table, unsigned timeout)
read MPEG-TS tables that comes from a DTV card
dvb_read_section_with_id
int dvb_read_section_with_id(struct dvb_v5_fe_parms *parms, int dmx_fd, unsigned char tid, uint16_t pid, int ts_id, void **table, unsigned timeout)
read MPEG-TS tables that comes from a DTV card with an specific table section ID
dvb_add_scaned_transponders
void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms, struct dvb_v5_descriptors *dvb_scan_handler, struct dvb_entry *first_entry, struct dvb_entry *entry)
Add new transponders to a dvb_file.
dvb_scan_free_handler_table
void dvb_scan_free_handler_table(struct dvb_v5_descriptors *dvb_scan_handler)
frees a struct dvb_v5_descriptors
dvb_read_sections
int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd, struct dvb_table_filter *sect, unsigned timeout)
read MPEG-TS tables that comes from a DTV card
dvb_scan_alloc_handler_table
struct dvb_v5_descriptors * dvb_scan_alloc_handler_table(uint32_t delivery_system)
allocates a struct dvb_v5_descriptors
dvb_sat_polarization
dvb_sat_polarization
Polarization types for Satellite systems.
Definition: dvb-v5-std.h:138
atsc_table_vct
ATSC VCT table (covers both CVCT and TVCT)
Definition: vct.h:168
dvb_desc
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:117
dvb_entry
Represents one entry on a DTV file.
Definition: dvb-file.h:104
dvb_table_filter
Describes the PES filters used by DVB scan.
Definition: dvb-scan.h:122
dvb_table_filter::ts_id
int ts_id
Definition: dvb-scan.h:126
dvb_table_filter::tid
unsigned char tid
Definition: dvb-scan.h:124
dvb_table_filter::allow_section_gaps
int allow_section_gaps
Definition: dvb-scan.h:129
dvb_table_filter::table
void ** table
Definition: dvb-scan.h:127
dvb_table_filter::priv
void * priv
Definition: dvb-scan.h:136
dvb_table_filter::pid
uint16_t pid
Definition: dvb-scan.h:125
dvb_table_nit
MPEG-TS NIT table.
Definition: nit.h:143
dvb_table_pat_program
MPEG-TS PAT program table.
Definition: pat.h:77
dvb_table_pat
MPEG-TS PAT table.
Definition: pat.h:108
dvb_table_pmt
MPEG-TS PMT table.
Definition: pmt.h:214
dvb_table_sdt
MPEG-TS SDT table.
Definition: sdt.h:123
dvb_v5_descriptors_program
Associates PMT with PAT tables.
Definition: dvb-scan.h:55
dvb_v5_descriptors_program::pat_pgm
struct dvb_table_pat_program * pat_pgm
Definition: dvb-scan.h:56
dvb_v5_descriptors_program::pmt
struct dvb_table_pmt * pmt
Definition: dvb-scan.h:57
dvb_v5_descriptors
Contains the descriptors needed to scan the Service ID and other relevant info at a MPEG-TS Digital T...
Definition: dvb-scan.h:87
dvb_v5_descriptors::other_sdts
struct dvb_table_sdt ** other_sdts
Definition: dvb-scan.h:104
dvb_v5_descriptors::pat
struct dvb_table_pat * pat
Definition: dvb-scan.h:93
dvb_v5_descriptors::num_other_sdts
unsigned num_other_sdts
Definition: dvb-scan.h:105
dvb_v5_descriptors::num_entry
unsigned num_entry
Definition: dvb-scan.h:91
dvb_v5_descriptors::nit
struct dvb_table_nit * nit
Definition: dvb-scan.h:96
dvb_v5_descriptors::entry
struct dvb_entry * entry
Definition: dvb-scan.h:90
dvb_v5_descriptors::program
struct dvb_v5_descriptors_program * program
Definition: dvb-scan.h:95
dvb_v5_descriptors::sdt
struct dvb_table_sdt * sdt
Definition: dvb-scan.h:97
dvb_v5_descriptors::num_program
unsigned num_program
Definition: dvb-scan.h:99
dvb_v5_descriptors::vct
struct atsc_table_vct * vct
Definition: dvb-scan.h:94
dvb_v5_descriptors::num_other_nits
unsigned num_other_nits
Definition: dvb-scan.h:102
dvb_v5_descriptors::other_nits
struct dvb_table_nit ** other_nits
Definition: dvb-scan.h:101
dvb_v5_descriptors::delivery_system
uint32_t delivery_system
Definition: dvb-scan.h:88
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:117