libdvbv5  1.11.0
Library to work with Digital TV devices on Linux
descriptors.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2012 - Mauro Carvalho Chehab
3  * Copyright (c) 2012-2014 - Andre Roth <neolynx@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation version 2.1 of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18  */
19 
44 #ifndef _DESCRIPTORS_H
45 #define _DESCRIPTORS_H
46 
47 #include <unistd.h>
48 #include <stdint.h>
49 #include <arpa/inet.h>
50 
55 #define DVB_MAX_PAYLOAD_PACKET_SIZE 4096
56 
61 #define DVB_CRC_SIZE 4
62 
63 
64 #ifndef _DOXYGEN
65 struct dvb_v5_fe_parms;
66 #endif
67 
79 typedef void (*dvb_table_init_func)(struct dvb_v5_fe_parms *parms,
80  const uint8_t *buf, ssize_t buflen,
81  void **table);
82 
88 
89 #ifndef _DOXYGEN
90 #define bswap16(b) do {\
91  b = ntohs(b); \
92 } while (0)
93 
94 #define bswap32(b) do {\
95  b = ntohl(b); \
96 } while (0)
97 
98 /* Deprecated */
99 #define DVB_DESC_HEADER() \
100  uint8_t type; \
101  uint8_t length; \
102  struct dvb_desc *next
103 
104 #endif /* _DOXYGEN */
105 
117 struct dvb_desc {
118  uint8_t type;
119  uint8_t length;
120  struct dvb_desc *next;
121 
122  uint8_t data[];
123 } __attribute__((packed));
124 
125 #ifndef _DOXYGEN
126 
127 #define dvb_desc_foreach( _desc, _tbl ) \
128  for( struct dvb_desc *_desc = _tbl->descriptor; _desc; _desc = _desc->next ) \
129 
130 #define dvb_desc_find(_struct, _desc, _tbl, _type) \
131  for( _struct *_desc = (_struct *) _tbl->descriptor; _desc; _desc = (_struct *) _desc->next ) \
132  if(_desc->type == _type) \
133 
134 #endif /* _DOXYGEN */
135 
136 #ifdef __cplusplus
137 extern "C" {
138 #endif
139 
146 uint32_t dvb_bcd(uint32_t bcd);
147 
157 void dvb_hexdump(struct dvb_v5_fe_parms *parms, const char *prefix,
158  const unsigned char *buf, int len);
159 
181 int dvb_desc_parse(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
182  uint16_t buflen, struct dvb_desc **head_desc);
183 
190 void dvb_desc_free (struct dvb_desc **list);
191 
199 void dvb_desc_print(struct dvb_v5_fe_parms *parms, struct dvb_desc *desc);
200 
201 #ifdef __cplusplus
202 }
203 #endif
204 
213 typedef int (*dvb_desc_init_func) (struct dvb_v5_fe_parms *parms,
214  const uint8_t *buf, struct dvb_desc *desc);
215 
223 typedef void (*dvb_desc_print_func)(struct dvb_v5_fe_parms *parms,
224  const struct dvb_desc *desc);
225 
232 typedef void (*dvb_desc_free_func) (struct dvb_desc *desc);
233 
248  const char *name;
252  ssize_t size;
253 };
254 
259 extern const struct dvb_descriptor dvb_descriptors[];
260 
591  /* ISO/IEC 13818-1 */
609 
628 
629  /* ETSI EN 300 468 V1.11.1 (2010-04) */
630 
695 
696  /* SCTE 35 2004 */
698 
701  /* From http://www.etherguidesystems.com/Help/SDOs/ATSC/Semantics/Descriptors/Default.aspx */
703 
704  /* From http://www.coolstf.com/tsreader/descriptors.html */
706 
707  /* ISDB Descriptors, as defined on ABNT NBR 15603-1 2007 */
708 
712 
752 
753  /* ATSC descriptors - ATSC A/65:2009 spec */
767 };
768 
769 /* Please see desc_extension.h for extension_descriptor types */
770 
771 #endif
multilingual_bouquet_name descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:659
maximum_bitrate descriptor - ISO/IEC 13818-1
Definition: descriptors.h:604
CA_contract_information descriptor - ABNT NBR 15603-1 2007.
Definition: descriptors.h:724
ancillary_data descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:674
metadata_std descriptor - ISO/IEC 13818-1
Definition: descriptors.h:622
const dvb_table_init_func dvb_table_initializers[256]
Table with all possible descriptors.
emergency_information descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:749
series descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:734
iod descriptor - ISO/IEC 13818-1
Definition: descriptors.h:612
bouquet_name descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:638
partial_transport_stream descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:666
external_es_id descriptor - ISO/IEC 13818-1
Definition: descriptors.h:615
extended_channel_name descriptor - SCTE 35 2004
Definition: descriptors.h:699
atsc_service_location descriptor - ATSC A/65:2009
Definition: descriptors.h:759
frequency_list descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:665
ISDBT terrestrial_delivery_system descriptor - ABNT NBR 15603-1 2007.
Definition: descriptors.h:747
mpeg4_audio descriptor - ISO/IEC 13818-1
Definition: descriptors.h:611
hierarchy descriptor - ISO/IEC 13818-1
Definition: descriptors.h:594
std descriptor - ISO/IEC 13818-1
Definition: descriptors.h:607
DTS descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:690
broadcaster_Name descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:737
ibp descriptor - ISO/IEC 13818-1
Definition: descriptors.h:608
content_availability descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:743
void(* dvb_table_init_func)(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, void **table)
Function prototype for a function that initializes the descriptors parsing on a table.
Definition: descriptors.h:79
stuffing descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:633
subtitling descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:656
hierarchical_transmission descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:713
dvb_desc_free_func free
Definition: descriptors.h:251
local_time_offset descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:655
service_availability descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:681
flexmux_timing descriptor - ISO/IEC 13818-1
Definition: descriptors.h:627
partial_transport_stream_time descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:716
basic_local_event descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:729
void dvb_desc_free(struct dvb_desc **list)
frees a dvb_desc linked list
struct dvb_desc * next
Definition: descriptors.h:120
CUE_identifier descriptor - SCTE 35 2004.
Definition: descriptors.h:697
short_smoothing_buffer descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:664
extended_event descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:645
TVA_id descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:684
atsc_genre descriptor - ATSC A/65:2009
Definition: descriptors.h:766
short_node_information descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:732
carousel_id descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:709
logical_channel_number descriptor - SCTE 35 2004
Definition: descriptors.h:705
dvb_desc_init_func init
Definition: descriptors.h:249
const char * name
Definition: descriptors.h:248
multiplexbuffer descriptor - ISO/IEC 13818-1
Definition: descriptors.h:618
void dvb_hexdump(struct dvb_v5_fe_parms *parms, const char *prefix, const unsigned char *buf, int len)
dumps data into the logs in hexadecimal format
connected_transmission descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:742
metadata descriptor - ISO/IEC 13818-1
Definition: descriptors.h:621
CA_EMM_TS descriptor - ABNT NBR 15603-1 2007.
Definition: descriptors.h:723
atsc_component_name descriptor - ATSC A/65:2009
Definition: descriptors.h:761
video_stream descriptor - ISO/IEC 13818-1
Definition: descriptors.h:592
private_data_specifier descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:662
service_location descriptor - SCTE 35 2004
Definition: descriptors.h:700
uint32_t dvb_bcd(uint32_t bcd)
Converts from BCD to CPU integer internal representation.
target_background_grid descriptor - ISO/IEC 13818-1
Definition: descriptors.h:597
metadata_pointer descriptor - ISO/IEC 13818-1
Definition: descriptors.h:620
uint8_t length
Definition: descriptors.h:119
dvb_desc_print_func print
Definition: descriptors.h:250
private_data_indicator descriptor - ISO/IEC 13818-1
Definition: descriptors.h:605
component descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:647
video_decode_control descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:721
transport_stream_information descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:726
satellite_delivery_system descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:634
reference descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:730
country_availability descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:640
multilingual_service_name descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:660
related_content descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:683
stream_identifier descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:649
multiplex_buffer_utilization descriptor - ISO/IEC 13818-1
Definition: descriptors.h:602
carousel_compatible_composite descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:745
iso639_language descriptor - ISO/IEC 13818-1
Definition: descriptors.h:600
short_event descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:644
data_component descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:750
ipmp descriptor - ISO/IEC 13818-1
Definition: descriptors.h:624
STC_reference descriptor - ABNT NBR 15603-1 2007.
Definition: descriptors.h:733
partial_reception descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:748
AVC_video descriptor - ISO/IEC 13818-1.
Definition: descriptors.h:623
announcement_support descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:677
uint8_t data[]
Definition: descriptors.h:122
hyperlink descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:718
component_name descriptor - SCTE 35 2004
Definition: descriptors.h:702
AVC_timing_and_HRD descriptor - ISO/IEC 13818-1.
Definition: descriptors.h:625
digital_copy_control descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:714
default_authority descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:682
void(* dvb_desc_free_func)(struct dvb_desc *desc)
Function prototype for the descriptors memory free code.
Definition: descriptors.h:232
descriptors
List containing all descriptors used by Digital TV MPEG-TS.
Definition: descriptors.h:590
system_clock descriptor - ISO/IEC 13818-1
Definition: descriptors.h:601
fmc descriptor - ISO/IEC 13818-1
Definition: descriptors.h:614
AAC descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:691
transport_stream descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:670
cell_list descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:675
copyright descriptor - ISO/IEC 13818-1
Definition: descriptors.h:603
multilingual_component descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:661
SI_parameter descriptor - ABNT NBR 15603-1 2007.
Definition: descriptors.h:736
time_shifted_event descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:646
parental_rating descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:652
application_signalling descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:678
audio_component descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:717
time_slice_fec_identifier descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:686
atsc_time_shifted_service descriptor - ATSC A/65:2009
Definition: descriptors.h:760
network_identifier descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:715
DSNG descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:671
cell_frequency_link descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:676
fmxbuffersize descriptor - ISO/IEC 13818-1
Definition: descriptors.h:617
content_labeling descriptor - ISO/IEC 13818-1
Definition: descriptors.h:619
extension descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:694
FTA_content_management descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:693
component_group descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:738
video_window descriptor - ISO/IEC 13818-1
Definition: descriptors.h:598
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:117
multilingual_network_name descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:658
data_contents descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:720
void(* dvb_desc_print_func)(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc)
Function prototype for the descriptors parsing print code.
Definition: descriptors.h:223
event_group descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:735
mpeg4_video descriptor - ISO/IEC 13818-1
Definition: descriptors.h:610
teletext descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:653
download_content descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:722
ds_alignment descriptor - ISO/IEC 13818-1
Definition: descriptors.h:596
conditional_access descriptor - ISO/IEC 13818-1
Definition: descriptors.h:599
service_list descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:632
PDC descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:672
atsc_DCC_departing_request descriptor - ATSC A/65:2009
Definition: descriptors.h:762
data_broadcast descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:667
node_relation descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:731
scrambling descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:668
target_area descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:719
smoothing_buffer descriptor - ISO/IEC 13818-1
Definition: descriptors.h:606
atsc_DCC_arriving_request descriptor - ATSC A/65:2009
Definition: descriptors.h:763
atsc_redistribution_control descriptor - ATSC A/65:2009
Definition: descriptors.h:764
Contains the parser information for the MPEG-TS parser code.
Definition: descriptors.h:247
atsc_caption_service descriptor - ATSC A/65:2009
Definition: descriptors.h:756
content_identifier descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:685
terrestrial_delivery_system descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:657
service_move descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:663
const struct dvb_descriptor dvb_descriptors[]
Contains the parsers for the several descriptors.
CA_identifier descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:650
network_name descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:631
logo_transmission descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:728
linkage descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:641
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:117
mpeg2_aac_audio descriptor - ISO/IEC 13818-1
Definition: descriptors.h:626
atsc_content_advisory descriptor - ATSC A/65:2009
Definition: descriptors.h:757
atsc_ac3_audio descriptor - ATSC A/65:2009
Definition: descriptors.h:755
system_management descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:751
CA_service descriptor - ABNT NBR 15603-1 2007.
Definition: descriptors.h:725
void dvb_desc_print(struct dvb_v5_fe_parms *parms, struct dvb_desc *desc)
prints the contents of a struct dvb_desc linked list
extended_broadcaster descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:727
adaptation_field_data descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:679
cable_delivery_system descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:635
mosaic descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:648
content descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:651
muxcode descriptor - ISO/IEC 13818-1
Definition: descriptors.h:616
int(* dvb_desc_init_func)(struct dvb_v5_fe_parms *parms, const uint8_t *buf, struct dvb_desc *desc)
Function prototype for the descriptors parsing init code.
Definition: descriptors.h:213
service descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:639
deferred_association_tags descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:711
audio_stream descriptor - ISO/IEC 13818-1
Definition: descriptors.h:593
service_group descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:744
conditional_playback descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:746
LDT_linkage descriptor - ABNT NBR 15603-1 2007.
Definition: descriptors.h:741
S2_satellite_delivery_system descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:688
atsc_ATSC_private_information descriptor - ATSC A/65:2009
Definition: descriptors.h:765
board_information descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:740
atsc_extended_channel descriptor - ATSC A/65:2009
Definition: descriptors.h:758
enhanced_AC_3 descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:689
sl descriptor - ISO/IEC 13818-1
Definition: descriptors.h:613
NVOD_reference descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:642
int dvb_desc_parse(struct dvb_v5_fe_parms *parms, const uint8_t *buf, uint16_t buflen, struct dvb_desc **head_desc)
parse MPEG-TS descriptors
service_identifier descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:680
association_tag descriptor - ABNT NBR 15603-1 2007
Definition: descriptors.h:710
VBI_data descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:636
AC_3 descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:673
atsc_stuffing descriptor - ATSC A/65:2009
Definition: descriptors.h:754
XAIT_location descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:692
registration descriptor - ISO/IEC 13818-1
Definition: descriptors.h:595
time_shifted_service descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:643
data_broadcast_id descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:669
uint8_t type
Definition: descriptors.h:118
ECM_repetition_rate descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:687
VBI_teletext descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:637
telephone descriptor - ETSI EN 300 468 V1.11.1 (2010-04)
Definition: descriptors.h:654
SI_prime_transport_stream descriptor - ABNT NBR 15603-1 2007.
Definition: descriptors.h:739