nit.h
Go to the documentation of this file.
/*
* Copyright (c) 2011-2012 - Mauro Carvalho Chehab
* Copyright (c) 2012 - Andre Roth <neolynx@gmail.com>
*
* 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 _NIT_H
#define _NIT_H
#include <stdint.h>
#include <unistd.h> /* ssize_t */
#include <libdvbv5/header.h>
#include <libdvbv5/descriptors.h>
#define DVB_TABLE_NIT 0x40
#define DVB_TABLE_NIT2 0x41
#define DVB_TABLE_NIT_PID 0x10
union dvb_table_nit_transport_header {
uint16_t bitfield;
struct {
uint16_t transport_length:12;
uint16_t reserved:4;
} __attribute__((packed));
} __attribute__((packed));
struct dvb_table_nit_transport {
uint16_t transport_id;
uint16_t network_id;
union {
uint16_t bitfield;
struct {
uint16_t desc_length:12;
uint16_t reserved:4;
} __attribute__((packed));
} __attribute__((packed));
struct dvb_desc *descriptor;
struct dvb_table_nit_transport *next;
} __attribute__((packed));
struct dvb_table_nit {
struct dvb_table_header header;
union {
uint16_t bitfield;
struct {
uint16_t desc_length:12;
uint16_t reserved:4;
} __attribute__((packed));
} __attribute__((packed));
struct dvb_desc *descriptor;
struct dvb_table_nit_transport *transport;
} __attribute__((packed));
typedef void nit_handler_callback_t(struct dvb_table_nit *nit,
struct dvb_desc *desc,
void *priv);
typedef void nit_tran_handler_callback_t(struct dvb_table_nit *nit,
struct dvb_table_nit_transport *tran,
struct dvb_desc *desc,
void *priv);
#define dvb_nit_transport_foreach( _tran, _nit ) \
if (_nit && _nit->transport) \
for (struct dvb_table_nit_transport *_tran = _nit->transport; _tran; _tran = _tran->next) \
struct dvb_v5_fe_parms;
#ifdef __cplusplus
extern "C" {
#endif
ssize_t dvb_table_nit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
ssize_t buflen, struct dvb_table_nit **table);
void dvb_table_nit_free(struct dvb_table_nit *table);
void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table);
void dvb_table_nit_descriptor_handler(
struct dvb_v5_fe_parms *parms,
struct dvb_table_nit *table,
enum descriptors descriptor,
nit_handler_callback_t *call_nit,
nit_tran_handler_callback_t *call_tran,
void *priv);
#ifdef __cplusplus
}
#endif
#endif
descriptors.h
Provides a way to handle MPEG-TS descriptors found on Digital TV streams.
descriptors
descriptors
List containing all descriptors used by Digital TV MPEG-TS.
Definition descriptors.h:592
nit_handler_callback_t
void nit_handler_callback_t(struct dvb_table_nit *nit, struct dvb_desc *desc, void *priv)
typedef for a callback used when a NIT table entry is found
Definition nit.h:164
dvb_table_nit_print
void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table)
Prints the content of the NIT table.
dvb_table_nit_descriptor_handler
void dvb_table_nit_descriptor_handler(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table, enum descriptors descriptor, nit_handler_callback_t *call_nit, nit_tran_handler_callback_t *call_tran, void *priv)
For each entry at NIT and NIT transport tables, call a callback.
dvb_table_nit_init
ssize_t dvb_table_nit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, struct dvb_table_nit **table)
Initializes and parses NIT table.
dvb_table_nit_free
void dvb_table_nit_free(struct dvb_table_nit *table)
Frees all data allocated by the NIT table parser.
nit_tran_handler_callback_t
void nit_tran_handler_callback_t(struct dvb_table_nit *nit, struct dvb_table_nit_transport *tran, struct dvb_desc *desc, void *priv)
typedef for a callback used when a NIT transport table entry is found
Definition nit.h:177
header.h
Provides the MPEG TS table headers.
dvb_desc
Linked list containing the several descriptors found on a MPEG-TS table.
Definition descriptors.h:117
dvb_table_header
Header of a MPEG-TS table.
Definition header.h:103
dvb_table_nit_transport
MPEG-TS NIT transport table.
Definition nit.h:109
dvb_table_nit_transport::network_id
uint16_t network_id
Definition nit.h:111
dvb_table_nit_transport::reserved
uint16_t reserved
Definition nit.h:116
dvb_table_nit_transport::descriptor
struct dvb_desc * descriptor
Definition nit.h:119
dvb_table_nit_transport::desc_length
uint16_t desc_length
Definition nit.h:115
dvb_table_nit_transport::transport_id
uint16_t transport_id
Definition nit.h:110
dvb_table_nit_transport::bitfield
uint16_t bitfield
Definition nit.h:113
dvb_table_nit_transport::next
struct dvb_table_nit_transport * next
Definition nit.h:120
dvb_table_nit
MPEG-TS NIT table.
Definition nit.h:143
dvb_table_nit::descriptor
struct dvb_desc * descriptor
Definition nit.h:152
dvb_table_nit::desc_length
uint16_t desc_length
Definition nit.h:148
dvb_table_nit::transport
struct dvb_table_nit_transport * transport
Definition nit.h:153
dvb_table_nit::bitfield
uint16_t bitfield
Definition nit.h:146
dvb_table_nit::reserved
uint16_t reserved
Definition nit.h:149
dvb_table_nit::header
struct dvb_table_header header
Definition nit.h:144
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition dvb-fe.h:117
dvb_table_nit_transport_header
MPEG-TS NIT transport header.
Definition nit.h:79
dvb_table_nit_transport_header::transport_length
uint16_t transport_length
Definition nit.h:82
dvb_table_nit_transport_header::bitfield
uint16_t bitfield
Definition nit.h:80
dvb_table_nit_transport_header::reserved
uint16_t reserved
Definition nit.h:83