dvb-scan.h
Go to the documentation of this file.
/*
* Copyright (c) 2011-2014 - Mauro Carvalho Chehab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation version 2.1 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
#ifndef _LIBSCAN_H
#define _LIBSCAN_H
#include <stdint.h>
#include <linux/dvb/dmx.h>
#include <libdvbv5/descriptors.h>
#include <libdvbv5/dvb-sat.h>
/* According with ISO/IEC 13818-1:2007 */
#define MAX_TABLE_SIZE 1024 * 1024
#ifdef __cplusplus
extern "C" {
#endif
struct dvb_entry;
struct dvb_v5_descriptors_program {
struct dvb_table_pat_program *pat_pgm;
struct dvb_table_pmt *pmt;
};
struct dvb_v5_descriptors {
uint32_t delivery_system;
struct dvb_entry *entry;
unsigned num_entry;
struct dvb_table_pat *pat;
struct atsc_table_vct *vct;
struct dvb_v5_descriptors_program *program;
struct dvb_table_nit *nit;
struct dvb_table_sdt *sdt;
unsigned num_program;
struct dvb_table_nit **other_nits;
unsigned num_other_nits;
struct dvb_table_sdt **other_sdts;
unsigned num_other_sdts;
};
struct dvb_table_filter {
/* Input data */
unsigned char tid;
uint16_t pid;
int ts_id;
void **table;
int allow_section_gaps;
/*
* Private temp data used by dvb_read_sections().
* Should not be filled outside dvb-scan.c, as they'll be
* overrided
*/
void *priv;
};
void dvb_table_filter_free(struct dvb_table_filter *sect);
int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd,
unsigned char tid, uint16_t pid, void **table,
unsigned timeout);
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);
int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd,
struct dvb_table_filter *sect,
unsigned timeout);
struct dvb_v5_descriptors *dvb_scan_alloc_handler_table(uint32_t delivery_system);
void dvb_scan_free_handler_table(struct dvb_v5_descriptors *dvb_scan_handler);
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);
void dvb_free_ts_tables(struct dvb_v5_descriptors *dvb_desc);
typedef int (check_frontend_t)(void *args, struct dvb_v5_fe_parms *parms);
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);
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);
#ifndef _DOXYGEN
/*
* Some ancillary functions used internally inside the library, used to
* identify duplicated transport streams and add new found transponder entries
*/
int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
uint32_t freq, enum dvb_sat_polarization pol, int shift);
struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
struct dvb_entry *first_entry,
struct dvb_entry *entry,
uint32_t freq, uint32_t shift,
enum dvb_sat_polarization pol);
int dvb_new_entry_is_needed(struct dvb_entry *entry,
struct dvb_entry *last_entry,
uint32_t freq, int shift,
enum dvb_sat_polarization pol, uint32_t stream_id);
struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *parms,
struct dvb_entry *first_entry,
struct dvb_entry *entry,
uint32_t freq, uint32_t shift,
enum dvb_sat_polarization pol,
uint32_t stream_id);
void dvb_update_transponders(struct dvb_v5_fe_parms *parms,
struct dvb_v5_descriptors *dvb_scan_handler,
struct dvb_entry *first_entry,
struct dvb_entry *entry);
#endif
#ifdef __cplusplus
}
#endif
#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:208
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