Commit ef59fee1 authored by Georgi Chorbadzhiyski's avatar Georgi Chorbadzhiyski

dvb/si: Complete support for descriptor 0x4a (Linkage descriptor).

parent 75b1ac28
......@@ -98,8 +98,8 @@ Supported DVB descriptors
=========================
* Descriptor 0x40: Network name descriptor
* Descriptor 0x42: Stuffing descriptor
* Descriptor 0x41: Service list descriptor
* Descriptor 0x42: Stuffing descriptor
* Descriptor 0x43: Satellite delivery system descriptor
* Descriptor 0x44: Cable delivery system descriptor
* Descriptor 0x45: VBI data descriptor
......@@ -107,7 +107,7 @@ Supported DVB descriptors
* Descriptor 0x47: Bouquet name descriptor
* Descriptor 0x48: Service descriptor
* Descriptor 0x49: Country availability descriptor
* Descriptor 0x4a: Linkage descriptor (partially implemented)
* Descriptor 0x4a: Linkage descriptor
* Descriptor 0x4b: NVOD reference descriptor
* Descriptor 0x4c: Time shifted service descriptor
* Descriptor 0x4d: Short event descriptor
......
......@@ -9,9 +9,6 @@ so if you like something just do it and send a patch.
- Descriptor 0x26 metadata_descriptor
- Descriptor 0x29 IPMP_descriptor (defined in ISO/IEC 13818-11, MPEG-2 IPMP)
- Add generators and example usage for these DVB descriptors:
- Descriptor 0x4a: Linkage descriptor
- Add support (parser, generator, example) for these DVB descriptors:
- Descriptor 0x6b: ancillary_data_descriptor
- Descriptor 0x6c: cell_list_descriptor
......
/*****************************************************************************
* desc_4a.h: ETSI EN 300 468 Descriptor 0x4a: Linkage descriptor (partially implemented)
* desc_4a.h: ETSI EN 300 468 Descriptor 0x4a: Linkage descriptor
*****************************************************************************
* Copyright (C) 2009-2010 VideoLAN
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Georgi Chorbadzhiyski <georgi@unixsol.org>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
......@@ -42,50 +43,546 @@ extern "C"
#endif
/*****************************************************************************
* Descriptor 0x4a: Linkage descriptor (partially implemented)
* Descriptor 0x4a: Linkage descriptor
*****************************************************************************/
#define DESC4A_HEADER_SIZE (DESC_HEADER_SIZE + 7)
#define DESC4A_LINKAGE_MOBILE 0x08
#define DESC4A_LINKAGE_EVENT 0x0d
#define DESC4A_LINKAGE_EXT_EVENT 0x0e
static inline void desc4a_init(uint8_t *p_desc)
{
desc_set_tag(p_desc, 0x4a);
desc_set_length(p_desc, DESC4A_HEADER_SIZE - DESC_HEADER_SIZE);
}
static inline uint16_t desc4a_get_tsid(const uint8_t *p_desc)
{
return (p_desc[2] << 8) | p_desc[3];
}
static inline void desc4a_set_tsid(uint8_t *p_desc, uint16_t i_tsid)
{
p_desc[2] = (i_tsid >> 8) & 0xff;
p_desc[3] = i_tsid & 0xff;
}
static inline uint16_t desc4a_get_onid(const uint8_t *p_desc)
{
return (p_desc[4] << 8) | p_desc[5];
}
static inline void desc4a_set_onid(uint8_t *p_desc, uint16_t i_onid)
{
p_desc[4] = (i_onid >> 8) & 0xff;
p_desc[5] = i_onid & 0xff;
}
static inline uint16_t desc4a_get_sid(const uint8_t *p_desc)
{
return (p_desc[6] << 8) | p_desc[7];
}
static inline void desc4a_set_sid(uint8_t *p_desc, uint16_t i_sid)
{
p_desc[6] = (i_sid >> 8) & 0xff;
p_desc[7] = i_sid & 0xff;
}
static inline uint8_t desc4a_get_linkage(const uint8_t *p_desc)
{
return p_desc[8];
}
static inline void desc4a_set_linkage(uint8_t *p_desc, uint8_t i_linkage)
{
p_desc[8] = i_linkage;
}
static inline const char *desc4a_get_linkage_txt(uint8_t i_linkage)
{
return i_linkage == 0x00 ? "reserved" :
i_linkage == 0x01 ? "information service" :
i_linkage == 0x02 ? "EPG service" :
i_linkage == 0x03 ? "CA replacement service" :
i_linkage == 0x04 ? "TS containing complete Network/Bouquet SI" :
i_linkage == 0x05 ? "service replacement service" :
i_linkage == 0x06 ? "data broadcast service" :
i_linkage == 0x07 ? "RCS Map" :
i_linkage == 0x08 ? "mobile hand-over" :
i_linkage == 0x09 ? "System Software Update Service (TS 102 006 [11])" :
i_linkage == 0x0a ? "TS containing SSU BAT or NIT (TS 102 006 [11])" :
i_linkage == 0x0b ? "IP/MAC Notification Service (EN 301 192 [4])" :
i_linkage == 0x0c ? "TS containing INT BAT or NIT (EN 301 192 [4])" :
i_linkage == 0x0d ? "event linkage" :
i_linkage == 0x0e ? "extended event linkage" :
i_linkage >= 0x0f && i_linkage <= 0x7f ? "reserved" :
i_linkage >= 0x80 && i_linkage <= 0xfe ? "user defined" : "reserved";
}
/* MOBILE HANDOVER linkage == 0x08 (DESC4A_LINKAGE_MOBILE) */
static inline uint8_t desc4a_get_mobile_handover_type(const uint8_t *p_desc)
{
return (p_desc[9] & 0xf0) >> 4;
}
static inline void desc4a_set_mobile_handover_type(uint8_t *p_desc, uint8_t i_handover_type)
{
p_desc[9] = ((i_handover_type & 0x0f) << 4) | 0x0e | (p_desc[9] & 0x01);
}
static inline bool desc4a_get_mobile_origin_type(const uint8_t *p_desc)
{
return (p_desc[9] & 0x01) == 0x01;
}
static inline void desc4a_set_mobile_origin_type(uint8_t *p_desc, bool b_origin_type)
{
p_desc[9] = b_origin_type ? (p_desc[9] | 0x01) : (p_desc[9] &~ 0x01);
}
static inline bool desc4a_have_mobile_nid(const uint8_t *p_desc)
{
uint8_t i_handover_type = desc4a_get_mobile_handover_type(p_desc);
return (i_handover_type >= 0x01 && i_handover_type <= 0x03);
}
static inline uint16_t desc4a_get_mobile_nid(const uint8_t *p_desc)
{
if (desc4a_have_mobile_nid(p_desc))
return (p_desc[10] << 8) | p_desc[11];
else
return 0;
}
static inline void desc4a_set_mobile_nid(uint8_t *p_desc, uint16_t i_nid)
{
if (desc4a_have_mobile_nid(p_desc)) {
p_desc[10] = (i_nid >> 8) & 0xff;
p_desc[11] = i_nid & 0xff;
}
}
static inline uint16_t desc4a_get_mobile_initial_sid(const uint8_t *p_desc)
{
if (!desc4a_get_mobile_origin_type(p_desc)) {
uint8_t ofs = 10;
if (desc4a_have_mobile_nid(p_desc))
ofs += 2;
return (p_desc[ofs + 0] << 8) | p_desc[ofs + 1];
}
return 0;
}
static inline void desc4a_set_mobile_initial_sid(uint8_t *p_desc, uint16_t i_initial_sid)
{
if (!desc4a_get_mobile_origin_type(p_desc)) {
uint8_t ofs = 10;
if (desc4a_have_mobile_nid(p_desc))
ofs += 2;
p_desc[ofs + 0] = (i_initial_sid >> 8) & 0xff;
p_desc[ofs + 1] = i_initial_sid & 0xff;
}
}
static inline uint8_t desc4a_get_mobile_handover_length(const uint8_t *p_desc)
{
uint8_t i_length = 0;
if (desc4a_get_linkage(p_desc) == DESC4A_LINKAGE_MOBILE)
{
i_length += 1;
if (desc4a_have_mobile_nid(p_desc))
i_length += 2;
if (!desc4a_get_mobile_origin_type(p_desc))
i_length += 2;
}
return i_length;
}
/* EVENT LINKAGE == 0x0d (DESC4A_LINKAGE_EVENT) */
static inline uint16_t desc4a_get_event_target_event_id(const uint8_t *p_desc)
{
return (p_desc[9] << 8) | p_desc[10];
}
static inline void desc4a_set_event_target_event_id(uint8_t *p_desc, uint16_t i_target_event_id)
{
p_desc[ 9] = (i_target_event_id >> 8) & 0xff;
p_desc[10] = i_target_event_id & 0xff;
}
static inline bool desc4a_get_event_target_listed(const uint8_t *p_desc)
{
return (p_desc[11] & 0x80) == 0x80;
}
static inline void desc4a_set_event_target_listed(uint8_t *p_desc, bool b_target_listed)
{
p_desc[11] |= 0x3f;
p_desc[11] = b_target_listed ? (p_desc[11] | 0x80) : (p_desc[11] &~ 0x80);
}
static inline bool desc4a_get_event_simulcast(const uint8_t *p_desc)
{
return (p_desc[11] & 0x40) == 0x40;
}
static inline void desc4a_set_event_simulcast(uint8_t *p_desc, bool b_event_simulcast)
{
p_desc[11] |= 0x3f;
p_desc[11] = b_event_simulcast ? (p_desc[11] | 0x40) : (p_desc[11] &~ 0x40);
}
static inline uint8_t desc4a_get_event_length(const uint8_t *p_desc)
{
if (desc4a_get_linkage(p_desc) == DESC4A_LINKAGE_EVENT)
return 3;
return 0;
}
/* EXTENDED EVENT LINKAGE == 0x0e (DESC4A_LINKAGE_EXT_EVENT) */
static inline uint16_t desc4an_get_ext_event_target_event_id(const uint8_t *p_desc_n)
{
return (p_desc_n[0] << 8) | p_desc_n[1];
}
static inline void desc4an_set_ext_event_target_event_id(uint8_t *p_desc_n, uint16_t i_target_event_id)
{
p_desc_n[0] = (i_target_event_id >> 8) & 0xff;
p_desc_n[1] = i_target_event_id & 0xff;
}
static inline bool desc4an_get_ext_event_target_listed(const uint8_t *p_desc_n)
{
return (p_desc_n[2] & 0x80) == 0x80;
}
static inline void desc4an_set_ext_event_target_listed(uint8_t *p_desc_n, bool b_target_listed)
{
p_desc_n[2] = b_target_listed ? (p_desc_n[2] | 0x80) : (p_desc_n[2] &~ 0x80);
}
static inline bool desc4an_get_ext_event_simulcast(const uint8_t *p_desc_n)
{
return (p_desc_n[2] & 0x40) == 0x40;
}
static inline void desc4an_set_ext_event_simulcast(uint8_t *p_desc_n, bool b_event_simulcast)
{
p_desc_n[2] = b_event_simulcast ? (p_desc_n[2] | 0x40) : (p_desc_n[2] &~ 0x40);
}
static inline uint8_t desc4an_get_ext_event_link_type(const uint8_t *p_desc_n)
{
return (p_desc_n[2] & 0x30) >> 4;
}
static inline void desc4an_set_ext_event_link_type(uint8_t *p_desc_n, uint8_t i_link_type)
{
p_desc_n[2] = (p_desc_n[2] & 0xcf) | ((i_link_type & 0x03) << 4);
}
static inline const char *desc4a_get_ext_event_link_type_txt(uint8_t i_link_type)
{
return i_link_type == 0 ? "SD" :
i_link_type == 1 ? "HD" :
i_link_type == 2 ? "3D" : "reserved";
}
static inline uint8_t desc4an_get_ext_event_target_id_type(const uint8_t *p_desc_n)
{
return (p_desc_n[2] & 0x0c) >> 2;
}
static inline void desc4an_set_ext_event_target_id_type(uint8_t *p_desc_n, uint8_t i_target_id_type)
{
p_desc_n[2] = (p_desc_n[2] & 0xf3) | ((i_target_id_type & 0x03) << 2);
}
static inline const char *desc4a_get_ext_event_target_id_type_txt(uint8_t i_target_id_type)
{
return i_target_id_type == 0 ? "use tsid" :
i_target_id_type == 1 ? "use target_tsid" :
i_target_id_type == 2 ? "match any tsid" : "use user_defined_id";
}
static inline bool desc4an_get_ext_event_onid_id_flag(const uint8_t *p_desc_n)
{
return (p_desc_n[2] & 0x02) == 0x02;
}
static inline void desc4an_set_ext_event_onid_id_flag(uint8_t *p_desc_n, bool b_event_onid_id_flag)
{
p_desc_n[2] = b_event_onid_id_flag ? (p_desc_n[2] | 0x02) : (p_desc_n[2] &~ 0x02);
}
static inline bool desc4an_get_ext_event_service_id_flag(const uint8_t *p_desc_n)
{
return (p_desc_n[2] & 0x01) == 0x01;
}
static inline void desc4an_set_ext_event_service_id_flag(uint8_t *p_desc_n, bool b_event_service_id_flag)
{
p_desc_n[2] = b_event_service_id_flag ? (p_desc_n[2] | 0x01) : (p_desc_n[2] &~ 0x01);
}
static inline bool desc4an_ext_event_have_user_defined_id(const uint8_t *p_desc_n)
{
return desc4an_get_ext_event_target_id_type(p_desc_n) == 3;
}
static inline bool desc4an_ext_event_have_target_tsid(const uint8_t *p_desc_n)
{
return desc4an_get_ext_event_target_id_type(p_desc_n) == 1;
}
static inline uint16_t desc4an_get_ext_event_user_defined_id(const uint8_t *p_desc_n)
{
if (desc4an_ext_event_have_user_defined_id(p_desc_n))
return (p_desc_n[3] << 8) | p_desc_n[4];
else
return 0;
}
static inline void desc4an_set_ext_event_user_defined_id(uint8_t *p_desc_n, uint16_t i_user_defined_id)
{
if (desc4an_ext_event_have_user_defined_id(p_desc_n)) {
p_desc_n[3] = (i_user_defined_id >> 8) & 0xff;
p_desc_n[4] = i_user_defined_id & 0xff;
}
}
static inline uint16_t desc4an_get_ext_event_target_tsid(const uint8_t *p_desc_n)
{
if (desc4an_ext_event_have_target_tsid(p_desc_n))
return (p_desc_n[3] << 8) | p_desc_n[4];
else
return 0;
}
static inline void desc4an_set_ext_event_target_tsid(uint8_t *p_desc_n, uint16_t i_target_tsid)
{
if (desc4an_ext_event_have_target_tsid(p_desc_n)) {
p_desc_n[3] = (i_target_tsid >> 8) & 0xff;
p_desc_n[4] = i_target_tsid & 0xff;
}
}
static inline uint16_t desc4an_get_ext_event_target_onid(const uint8_t *p_desc_n)
{
if (desc4an_ext_event_have_user_defined_id(p_desc_n))
return 0;
uint8_t ofs = desc4an_ext_event_have_target_tsid(p_desc_n) ? 5 : 3;
if (desc4an_get_ext_event_onid_id_flag(p_desc_n))
return (p_desc_n[ofs + 0] << 8) | p_desc_n[ofs + 1];
else
return 0;
}
static inline void desc4an_set_ext_event_target_onid(uint8_t *p_desc_n, uint16_t i_target_onid)
{
if (desc4an_ext_event_have_user_defined_id(p_desc_n))
return;
uint8_t ofs = desc4an_ext_event_have_target_tsid(p_desc_n) ? 5 : 3;
if (desc4an_get_ext_event_onid_id_flag(p_desc_n)) {
p_desc_n[ofs + 0] = (i_target_onid >> 8) & 0xff;
p_desc_n[ofs + 1] = i_target_onid & 0xff;
}
}
static inline uint16_t desc4an_get_ext_event_service_id(const uint8_t *p_desc_n)
{
if (desc4an_ext_event_have_user_defined_id(p_desc_n))
return 0;
uint8_t ofs = desc4an_ext_event_have_target_tsid(p_desc_n) ? 5 : 3;
if (desc4an_get_ext_event_onid_id_flag(p_desc_n))
ofs += 2;
if (desc4an_get_ext_event_service_id_flag(p_desc_n))
return (p_desc_n[ofs + 0] << 8) | p_desc_n[ofs + 1];
else
return 0;
}
static inline void desc4an_set_ext_event_service_id(uint8_t *p_desc_n, uint16_t i_service_id)
{
if (desc4an_ext_event_have_user_defined_id(p_desc_n))
return;
uint8_t ofs = desc4an_ext_event_have_target_tsid(p_desc_n) ? 5 : 3;
if (desc4an_get_ext_event_onid_id_flag(p_desc_n))
ofs += 2;
if (desc4an_get_ext_event_service_id_flag(p_desc_n)) {
p_desc_n[ofs + 0] = (i_service_id >> 8) & 0xff;
p_desc_n[ofs + 1] = i_service_id & 0xff;
}
}
static inline uint8_t desc4an_get_ext_event_length(const uint8_t *p_desc_n)
{
uint8_t i_len = 3;
if (desc4an_ext_event_have_user_defined_id(p_desc_n))
return i_len + 2;
if (desc4an_ext_event_have_target_tsid(p_desc_n))
i_len += 2;
if (desc4an_get_ext_event_onid_id_flag(p_desc_n))
i_len += 2;
if (desc4an_get_ext_event_service_id_flag(p_desc_n))
i_len += 2;
return i_len;
}
static inline uint8_t *desc4a_get_ext_event(const uint8_t *p_desc, uint8_t n)
{
uint8_t *p = (uint8_t *)p_desc + DESC4A_HEADER_SIZE;
uint8_t *p_end = (uint8_t *)p_desc + DESC_HEADER_SIZE + desc_get_length(p_desc);
if (p == p_end)
return NULL;
if (n == 0)
return p;
while (p < p_end && n) {
p += desc4an_get_ext_event_length(p);
if (--n == 0 && p < p_end )
return p;
}
return NULL;
}
/* Generic desc4a continued... */
static inline void desc4a_set_length(uint8_t *p_desc)
{
uint8_t i_length = DESC4A_HEADER_SIZE - DESC_HEADER_SIZE;
i_length += desc4a_get_mobile_handover_length(p_desc);
i_length += desc4a_get_event_length(p_desc);
desc_set_length(p_desc, i_length);
}
static inline bool desc4a_validate(const uint8_t *p_desc)
{
return desc_get_length(p_desc) >= DESC4A_HEADER_SIZE - DESC_HEADER_SIZE;
uint8_t i_length = DESC4A_HEADER_SIZE - DESC_HEADER_SIZE;
i_length += desc4a_get_mobile_handover_length(p_desc);
i_length += desc4a_get_event_length(p_desc);
return desc_get_length(p_desc) >= i_length;
}
static inline void desc4a_print(const uint8_t *p_desc, f_print pf_print,
void *opaque, print_type_t i_print_type)
{
uint8_t j;
uint8_t *p_desc_n;
uint8_t i_linkage = desc4a_get_linkage(p_desc);
switch (i_print_type) {
case PRINT_XML:
pf_print(opaque,
"<LINKAGE_DESC tsid=\"%hu\" onid=\"%hu\" sid=\"%hu\" linkage=\"%hhu\" />",
"<LINKAGE_DESC tsid=\"%hu\" onid=\"%hu\" sid=\"%hu\" linkage=\"0x%02x\" linkage_txt=\"%s\">",
desc4a_get_tsid(p_desc), desc4a_get_onid(p_desc),
desc4a_get_sid(p_desc), desc4a_get_linkage(p_desc));
desc4a_get_sid(p_desc), i_linkage,
desc4a_get_linkage_txt(i_linkage)
);
if (i_linkage == DESC4A_LINKAGE_MOBILE) {
pf_print(opaque,
"<MOBILE_HANDOVER_INFO handover_type=\"%u\" origin_type=\"%u\" nid=\"%u\" initial_sid=\"%u\"/>",
desc4a_get_mobile_handover_type(p_desc),
desc4a_get_mobile_origin_type(p_desc),
desc4a_get_mobile_nid(p_desc),
desc4a_get_mobile_initial_sid(p_desc)
);
}
if (i_linkage == DESC4A_LINKAGE_EVENT) { // event linkage
pf_print(opaque,
"<EVENT_LINKAGE target_event_id=\"%u\" target_listed=\"%u\" event_simulcast=\"%u\"/>",
desc4a_get_event_target_event_id(p_desc),
desc4a_get_event_target_listed(p_desc),
desc4a_get_event_simulcast(p_desc)
);
}
if (i_linkage == DESC4A_LINKAGE_EXT_EVENT) {
j = 0;
while ((p_desc_n = desc4a_get_ext_event(p_desc, j++)) != NULL) {
pf_print(opaque,
"<EXTENDED_EVENT_LINKAGE target_event_id=\"%u\" target_listed=\"%u\" event_simulcast=\"%u\""
" link_type=\"%u\" link_type_txt=\"%s\""
" target_id_type=\"%u\" target_id_type_txt=\"%s\""
" onid_id_flag=\"%u\" service_id_flag=\"%u\""
" user_defined_id=\"%u\" target_tsid=\"%u\" target_onid=\"%u\" target_service_id=\"%u\"/>",
desc4an_get_ext_event_target_event_id(p_desc_n),
desc4an_get_ext_event_target_listed(p_desc_n),
desc4an_get_ext_event_simulcast(p_desc_n),
desc4an_get_ext_event_link_type(p_desc_n),
desc4a_get_ext_event_link_type_txt(desc4an_get_ext_event_link_type(p_desc_n)),
desc4an_get_ext_event_target_id_type(p_desc_n),
desc4a_get_ext_event_target_id_type_txt(desc4an_get_ext_event_target_id_type(p_desc_n)),
desc4an_get_ext_event_onid_id_flag(p_desc_n),
desc4an_get_ext_event_service_id_flag(p_desc_n),
desc4an_get_ext_event_user_defined_id(p_desc_n),
desc4an_get_ext_event_target_tsid(p_desc_n),
desc4an_get_ext_event_target_onid(p_desc_n),
desc4an_get_ext_event_service_id(p_desc_n)
);
}
}
pf_print(opaque,
"</LINKAGE_DESC>");
break;
default:
pf_print(opaque,
" - desc 4a linkage tsid=%hu onid=%hu sid=%hu linkage=%hhu",
" - desc 4a linkage tsid=%hu onid=%hu sid=%hu linkage=0x%02x linkage_txt=\"%s\"",
desc4a_get_tsid(p_desc), desc4a_get_onid(p_desc),
desc4a_get_sid(p_desc), desc4a_get_linkage(p_desc));
desc4a_get_sid(p_desc), i_linkage,
desc4a_get_linkage_txt(i_linkage)
);
if (i_linkage == DESC4A_LINKAGE_MOBILE) {
pf_print(opaque,
" - mobile_handover handover_type=%u origin_type=%u nid=%u initial_sid=%u",
desc4a_get_mobile_handover_type(p_desc),
desc4a_get_mobile_origin_type(p_desc),
desc4a_get_mobile_nid(p_desc),
desc4a_get_mobile_initial_sid(p_desc)
);
}
if (i_linkage == DESC4A_LINKAGE_EVENT) {
pf_print(opaque,
" - event_linkage target_event_id=%u target_listed=%u event_simulcast=%u",
desc4a_get_event_target_event_id(p_desc),
desc4a_get_event_target_listed(p_desc),
desc4a_get_event_simulcast(p_desc)
);
}
if (i_linkage == DESC4A_LINKAGE_EXT_EVENT) {
j = 0;
while ((p_desc_n = desc4a_get_ext_event(p_desc, j++)) != NULL) {
pf_print(opaque,
" - extended_event_linkage target_event_id=%u target_listed=%u event_simulcast=%u"
" link_type=%u link_type_txt=\"%s\""
" target_id_type=%u target_id_type_txt=\"%s\""
" onid_id_flag=%u service_id_flag=%u"
" user_defined_id=%u target_tsid=%u target_onid=%u target_service_id=%u",
desc4an_get_ext_event_target_event_id(p_desc_n),
desc4an_get_ext_event_target_listed(p_desc_n),
desc4an_get_ext_event_simulcast(p_desc_n),
desc4an_get_ext_event_link_type(p_desc_n),
desc4a_get_ext_event_link_type_txt(desc4an_get_ext_event_link_type(p_desc_n)),
desc4an_get_ext_event_target_id_type(p_desc_n),
desc4a_get_ext_event_target_id_type_txt(desc4an_get_ext_event_target_id_type(p_desc_n)),
desc4an_get_ext_event_onid_id_flag(p_desc_n),
desc4an_get_ext_event_service_id_flag(p_desc_n),
desc4an_get_ext_event_user_defined_id(p_desc_n),
desc4an_get_ext_event_target_tsid(p_desc_n),
desc4an_get_ext_event_target_onid(p_desc_n),
desc4an_get_ext_event_service_id(p_desc_n)
);
}
}
}
}
......
......@@ -379,7 +379,6 @@ static void build_desc41(uint8_t *desc) {
desc_set_length(desc, service_n - desc - DESC_HEADER_SIZE);
}
/* --- Descriptor 0x42: Stuffing descriptor */
/* DVB Descriptor 0x43: Satellite delivery system descriptor */
static void build_desc43(uint8_t *desc) {
desc43_init(desc);
......@@ -536,7 +535,111 @@ static void build_desc49(uint8_t *desc, bool b_available) {
desc_set_length(desc, code_n - desc - DESC_HEADER_SIZE);
}
/* DVB Descriptor 0x4a: Linkage descriptor (partially implemented) */
/* DVB Descriptor 0x4a: Linkage descriptor */
static void build_desc4a_std(uint8_t *desc) {
desc4a_init(desc);
desc4a_set_tsid(desc, tsid + 500);
desc4a_set_onid(desc, onid + 500);
desc4a_set_sid (desc, 0x0000);
desc4a_set_linkage(desc, 0x04); // new ts
}
static void build_desc4a_mobile(uint8_t *desc) {
desc4a_init(desc);
desc4a_set_tsid(desc, tsid + 600);
desc4a_set_onid(desc, onid + 600);
desc4a_set_sid (desc, sid + 600);
// mobile handover
desc4a_set_linkage(desc, DESC4A_LINKAGE_MOBILE);
desc4a_set_mobile_handover_type(desc, 1);
desc4a_set_mobile_origin_type(desc, false);
desc4a_set_mobile_nid(desc, onid + 1000);
desc4a_set_mobile_initial_sid(desc, sid + 1000);
desc4a_set_length(desc);
}
static void build_desc4a_event(uint8_t *desc) {
desc4a_init(desc);
desc4a_set_tsid(desc, tsid + 700);
desc4a_set_onid(desc, onid + 700);
desc4a_set_sid (desc, sid + 700);
// event linkage
desc4a_set_linkage(desc, DESC4A_LINKAGE_EVENT);
desc4a_set_event_target_event_id(desc, event_id + 1000);
desc4a_set_event_target_listed(desc, true);
desc4a_set_event_simulcast(desc, true);
desc4a_set_length(desc);
}
static void build_desc4a_extended_event(uint8_t *desc) {
uint8_t k = 0;
uint8_t *ext_n;
desc4a_init(desc);
desc4a_set_tsid(desc, tsid + 800);
desc4a_set_onid(desc, onid + 800);
desc4a_set_sid (desc, sid + 800);
// extended event linkage
desc4a_set_linkage(desc, DESC4A_LINKAGE_EXT_EVENT);
desc_set_length(desc, 255);
ext_n = desc4a_get_ext_event(desc, k++);
desc4an_set_ext_event_target_event_id(ext_n, event_id + 1000);
desc4an_set_ext_event_target_listed (ext_n, false);
desc4an_set_ext_event_simulcast (ext_n, true);
desc4an_set_ext_event_link_type (ext_n, 1); // HD
desc4an_set_ext_event_target_id_type (ext_n, 3); // user defined id
desc4an_set_ext_event_onid_id_flag (ext_n, true);
desc4an_set_ext_event_service_id_flag(ext_n, true);
desc4an_set_ext_event_user_defined_id(ext_n, 7878);
desc4an_set_ext_event_target_tsid (ext_n, tsid + 1000); // !!!
desc4an_set_ext_event_target_onid (ext_n, onid + 1000); // !!!
desc4an_set_ext_event_service_id (ext_n, sid + 1000); // !!!
ext_n = desc4a_get_ext_event(desc, k++);
desc4an_set_ext_event_target_event_id(ext_n, event_id + 2000);
desc4an_set_ext_event_target_listed (ext_n, true);
desc4an_set_ext_event_simulcast (ext_n, true);
desc4an_set_ext_event_link_type (ext_n, 0); // SD
desc4an_set_ext_event_target_id_type (ext_n, 0); // onid_id_flag, target_service_id_flag
desc4an_set_ext_event_onid_id_flag (ext_n, true);
desc4an_set_ext_event_service_id_flag(ext_n, true);
desc4an_set_ext_event_user_defined_id(ext_n, 8787); // !!!
desc4an_set_ext_event_target_tsid (ext_n, tsid + 2000); // !!!
desc4an_set_ext_event_target_onid (ext_n, onid + 2000);
desc4an_set_ext_event_service_id (ext_n, sid + 2000);
ext_n = desc4a_get_ext_event(desc, k++);
desc4an_set_ext_event_target_event_id(ext_n, event_id + 3000);
desc4an_set_ext_event_target_listed (ext_n, true);
desc4an_set_ext_event_simulcast (ext_n, true);
desc4an_set_ext_event_link_type (ext_n, 2); // 3D
desc4an_set_ext_event_target_id_type (ext_n, 1); // target_tsid, onid_id_flag, target_service_id_flag
desc4an_set_ext_event_onid_id_flag (ext_n, true);
desc4an_set_ext_event_service_id_flag(ext_n, true);
desc4an_set_ext_event_user_defined_id(ext_n, 8787); // !!!
desc4an_set_ext_event_target_tsid (ext_n, tsid + 3000);
desc4an_set_ext_event_target_onid (ext_n, onid + 3000);
desc4an_set_ext_event_service_id (ext_n, sid + 3000);
ext_n = desc4a_get_ext_event(desc, k++);
desc4an_set_ext_event_target_event_id(ext_n, event_id + 4000);
desc4an_set_ext_event_target_listed (ext_n, false);
desc4an_set_ext_event_simulcast (ext_n, false);
desc4an_set_ext_event_link_type (ext_n, 0); // SD
desc4an_set_ext_event_target_id_type (ext_n, 0); // onid_id_flag, target_service_id_flag
desc4an_set_ext_event_onid_id_flag (ext_n, false);
desc4an_set_ext_event_service_id_flag(ext_n, false);
desc4an_set_ext_event_user_defined_id(ext_n, 8787); // !!!
desc4an_set_ext_event_target_tsid (ext_n, tsid + 4000); // !!!
desc4an_set_ext_event_target_onid (ext_n, onid + 4000); // !!!
desc4an_set_ext_event_service_id (ext_n, sid + 4000); // !!!
ext_n = desc4a_get_ext_event(desc, k);
desc_set_length(desc, ext_n - desc - DESC_HEADER_SIZE);
}
/* DVB Descriptor 0x4b: NVOD_reference_descriptor */
static void build_desc4b(uint8_t *desc, bool b_available) {
uint8_t k = 0;
......@@ -1462,6 +1565,9 @@ static void generate_nit(void) {
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc41(desc);
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc4a_std(desc);
// Finish descriptor generation
desc = descs_get_desc(desc_loop, desc_counter); // Get next descriptor pos
descs_set_length(desc_loop, desc - desc_loop - DESCS_HEADER_SIZE);
......@@ -1488,6 +1594,9 @@ static void generate_nit(void) {
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc41(desc);
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc4a_mobile(desc);
// Finish descriptor generation
desc = descs_get_desc(desc_loop, desc_counter); // Get next descriptor pos
descs_set_length(desc_loop, desc - desc_loop - DESCS_HEADER_SIZE);
......@@ -1860,6 +1969,9 @@ static void generate_eit(void) {
desc_loop = eitn_get_descs(eit_n);
descs_set_length(desc_loop, DESCS_MAX_SIZE); // This is needed so descs_get_desc(x, n) works
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc4a_event(desc);
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc4e(desc);
......@@ -1887,6 +1999,9 @@ static void generate_eit(void) {
desc_loop = eitn_get_descs(eit_n);
descs_set_length(desc_loop, DESCS_MAX_SIZE); // This is needed so descs_get_desc(x, n) works
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc4a_extended_event(desc);
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc54(desc);
......
......@@ -45,12 +45,15 @@ new NIT actual networkid=40000 version=1
- desc 41 service_list sid=20100 type=0x02
- desc 41 service_list sid=20200 type=0x01
- desc 41 service_list sid=20300 type=0x02
- desc 4a linkage tsid=10500 onid=40500 sid=0 linkage=0x04 linkage_txt="TS containing complete Network/Bouquet SI"
* ts tsid=10100 onid=40100
* ts tsid=10200 onid=40200
- desc 41 service_list sid=20000 type=0x01
- desc 41 service_list sid=20100 type=0x02
- desc 41 service_list sid=20200 type=0x01
- desc 41 service_list sid=20300 type=0x02
- desc 4a linkage tsid=10600 onid=40600 sid=20600 linkage=0x08 linkage_txt="mobile hand-over"
- mobile_handover handover_type=1 origin_type=0 nid=41000 initial_sid=21000
* ts tsid=10300 onid=40300
end NIT
new BAT networkid=40000 version=0
......@@ -124,6 +127,8 @@ new EIT tableid=0x4e type=actual_pf version=1 tsid=10000 onid=40000 seg_last_sec
* EVENT id=30000 start_time=1234567890 start_time_dec="2009-02-13 23:31:30 UTC" duration=86399 duration_dec=23:59:59 running_status=2 free_CA_mode=0
- desc 4d short_event lang=eng event_name="Major TV event" text="The event of the century!"
* EVENT id=30100 start_time=1 start_time_dec="1970-01-01 00:00:01 UTC" duration=3600 duration_dec=01:00:00 running_status=1 free_CA_mode=0
- desc 4a linkage tsid=10700 onid=40700 sid=20700 linkage=0x0d linkage_txt="event linkage"
- event_linkage target_event_id=31000 target_listed=1 event_simulcast=1
- desc 4e extended_event desc_number=0 last_desc_number=0 lang=eng text="Wow, what an event!"
- extended_event_item description="Director" text="Famous director"
- extended_event_item description="Year" text="2011"
......@@ -131,6 +136,11 @@ new EIT tableid=0x4e type=actual_pf version=1 tsid=10000 onid=40000 seg_last_sec
- desc 4d short_event lang=eng event_name="Major TV event" text="The event of the century!"
- desc 61 short_smoothing_buffer sb_size=1 sb_leak_rate=10
* EVENT id=30200 start_time=999999999 start_time_dec="2001-09-09 01:46:39 UTC" duration=7200 duration_dec=02:00:00 running_status=0 free_CA_mode=0
- desc 4a linkage tsid=10800 onid=40800 sid=20800 linkage=0x0e linkage_txt="extended event linkage"
- extended_event_linkage target_event_id=31000 target_listed=0 event_simulcast=1 link_type=1 link_type_txt="HD" target_id_type=3 target_id_type_txt="use user_defined_id" onid_id_flag=1 service_id_flag=1 user_defined_id=7878 target_tsid=0 target_onid=0 target_service_id=0
- extended_event_linkage target_event_id=32000 target_listed=1 event_simulcast=1 link_type=0 link_type_txt="SD" target_id_type=0 target_id_type_txt="use tsid" onid_id_flag=1 service_id_flag=1 user_defined_id=0 target_tsid=0 target_onid=42000 target_service_id=22000
- extended_event_linkage target_event_id=33000 target_listed=1 event_simulcast=1 link_type=2 link_type_txt="3D" target_id_type=1 target_id_type_txt="use target_tsid" onid_id_flag=1 service_id_flag=1 user_defined_id=0 target_tsid=13000 target_onid=43000 target_service_id=23000
- extended_event_linkage target_event_id=34000 target_listed=0 event_simulcast=0 link_type=0 link_type_txt="SD" target_id_type=0 target_id_type_txt="use tsid" onid_id_flag=0 service_id_flag=0 user_defined_id=0 target_tsid=0 target_onid=0 target_service_id=0
- desc 54 content content_l1=2 content_l2=4 user=78
- desc 54 content content_l1=6 content_l2=8 user=177
- desc 53 ca_identifier ca_sysid=0xaabb
......
......@@ -73,6 +73,10 @@
<SERVICE_LIST_DESC sid="20200" type="0x01" />
<SERVICE_LIST_DESC sid="20300" type="0x02" />
</DESC>
<DESC id="0x4a" length="7" value="29049e34000004">
<LINKAGE_DESC tsid="10500" onid="40500" sid="0" linkage="0x04" linkage_txt="TS containing complete Network/Bouquet SI">
</LINKAGE_DESC>
</DESC>
</TS>
<TS tsid="10100" onid="40100">
</TS>
......@@ -83,6 +87,11 @@
<SERVICE_LIST_DESC sid="20200" type="0x01" />
<SERVICE_LIST_DESC sid="20300" type="0x02" />
</DESC>
<DESC id="0x4a" length="12" value="29689e985078081ea0285208">
<LINKAGE_DESC tsid="10600" onid="40600" sid="20600" linkage="0x08" linkage_txt="mobile hand-over">
<MOBILE_HANDOVER_INFO handover_type="1" origin_type="0" nid="41000" initial_sid="21000"/>
</LINKAGE_DESC>
</DESC>
</TS>
<TS tsid="10300" onid="40300">
</TS>
......@@ -215,6 +224,11 @@
</DESC>
</EVENT>
<EVENT id="30100" start_time="1" start_time_dec="1970-01-01 00:00:01 UTC" duration="3600" duration_dec="01:00:00" running_status="1" free_CA_mode="0">
<DESC id="0x4a" length="10" value="29cc9efc50dc0d7918ff">
<LINKAGE_DESC tsid="10700" onid="40700" sid="20700" linkage="0x0d" linkage_txt="event linkage">
<EVENT_LINKAGE target_event_id="31000" target_listed="1" event_simulcast="1"/>
</LINKAGE_DESC>
</DESC>
<DESC id="0x4e" length="73" value="00656e6730084469726563746f720f46616d6f7573206469726563746f720459656172043230313106526174696e67052a2a2a2b2b13576f772c207768617420616e206576656e7421">
<EXTENDED_EVENT_DESC desc_number="0" last_desc_number="0" lang="eng" text="Wow, what an event!">
<EXTENDED_EVENT_ITEM description="Director" text="Famous director"/>
......@@ -230,6 +244,14 @@
</DESC>
</EVENT>
<EVENT id="30200" start_time="999999999" start_time_dec="2001-09-09 01:46:39 UTC" duration="7200" duration_dec="02:00:00" running_status="0" free_CA_mode="0">
<DESC id="0x4a" length="31" value="2a309f6051400e79185f1ec67d00c3a41055f080e8e732c8a7f859d884d000">
<LINKAGE_DESC tsid="10800" onid="40800" sid="20800" linkage="0x0e" linkage_txt="extended event linkage">
<EXTENDED_EVENT_LINKAGE target_event_id="31000" target_listed="0" event_simulcast="1" link_type="1" link_type_txt="HD" target_id_type="3" target_id_type_txt="use user_defined_id" onid_id_flag="1" service_id_flag="1" user_defined_id="7878" target_tsid="0" target_onid="0" target_service_id="0"/>
<EXTENDED_EVENT_LINKAGE target_event_id="32000" target_listed="1" event_simulcast="1" link_type="0" link_type_txt="SD" target_id_type="0" target_id_type_txt="use tsid" onid_id_flag="1" service_id_flag="1" user_defined_id="0" target_tsid="0" target_onid="42000" target_service_id="22000"/>
<EXTENDED_EVENT_LINKAGE target_event_id="33000" target_listed="1" event_simulcast="1" link_type="2" link_type_txt="3D" target_id_type="1" target_id_type_txt="use target_tsid" onid_id_flag="1" service_id_flag="1" user_defined_id="0" target_tsid="13000" target_onid="43000" target_service_id="23000"/>
<EXTENDED_EVENT_LINKAGE target_event_id="34000" target_listed="0" event_simulcast="0" link_type="0" link_type_txt="SD" target_id_type="0" target_id_type_txt="use tsid" onid_id_flag="0" service_id_flag="0" user_defined_id="0" target_tsid="0" target_onid="0" target_service_id="0"/>
</LINKAGE_DESC>
</DESC>
<DESC id="0x54" length="4" value="244e68b1">
<CONTENT_DESC content_l1="2" content_l2="4" user="78"/>
<CONTENT_DESC content_l1="6" content_l2="8" user="177"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment