File: cat.h

package info (click to toggle)
v4l-utils 1.32.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,276 kB
  • sloc: ansic: 85,528; cpp: 69,473; perl: 11,915; sh: 1,333; python: 883; php: 119; makefile: 39
file content (106 lines) | stat: -rw-r--r-- 3,049 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 * Copyright (c) 2013 - 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
 *
 */

/**
 * @file cat.h
 * @ingroup dvb_table
 * @brief Provides the table parser for the CAT (Conditional Access Table)
 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1)
 * @author Andre Roth
 *
 * @par Bug Report
 * Please submit bug reports and patches to linux-media@vger.kernel.org
 */

#ifndef _CAT_H
#define _CAT_H

#include <stdint.h>
#include <unistd.h> /* ssize_t */

#include <libdvbv5/header.h>

/**
 * @def DVB_TABLE_CAT
 *	@brief ATSC CAT table ID
 * 	@ingroup dvb_table
 * @def DVB_TABLE_CAT_PID
 *	@brief ATSC PID table ID
 * 	@ingroup dvb_table
 */
#define DVB_TABLE_CAT      0x01
#define DVB_TABLE_CAT_PID  0x0001

/**
 * @struct dvb_table_cat
 * @brief ATSC CAT table
 *
 * @param header	struct dvb_table_header content
 * @param descriptor	pointer to struct dvb_desc
 */
struct dvb_table_cat {
	struct dvb_table_header header;
	struct dvb_desc *descriptor;
} __attribute__((packed));

struct dvb_v5_fe_parms;

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Initializes and parses CAT table
 *
 * @param parms	struct dvb_v5_fe_parms pointer to the opened device
 * @param buf buffer containing the CAT raw data
 * @param buflen length of the buffer
 * @param table pointer to struct dvb_table_cat to be allocated and filled
 *
 * This function allocates an CAT table and fills the fields inside
 * the struct. It also makes sure that all fields will follow the CPU
 * endianness. Due to that, the content of the buffer may change.
 *
 * @return On success, it returns the size of the allocated struct.
 *	   A negative value indicates an error.
 */
ssize_t dvb_table_cat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
			   ssize_t buflen, struct dvb_table_cat **table);

/**
 * @brief Frees all data allocated by the CAT table parser
 *
 * @param table pointer to struct dvb_table_cat to be freed
 */
void dvb_table_cat_free(struct dvb_table_cat *table);

/**
 * @brief Prints the content of the CAT table
 *
 * @param parms	struct dvb_v5_fe_parms pointer to the opened device
 * @param table pointer to struct dvb_table_cat
 */
void dvb_table_cat_print(struct dvb_v5_fe_parms *parms,
			 struct dvb_table_cat *table);

#ifdef __cplusplus
}
#endif

#endif