diff --git a/README b/README index 4ac9b51..2de8963 100644 --- a/README +++ b/README @@ -137,6 +137,7 @@ Supported DVB descriptors * Descriptor 0x65: Scrambling descriptor * Descriptor 0x66: Data broadcast id descriptor * Descriptor 0x67: Transport stream descriptor + * Descriptor 0x68: DSNG descriptor * Descriptor 0x6a: AC-3 descriptor [p] Legend: diff --git a/TODO b/TODO index b5c23b8..6f6a4ae 100644 --- a/TODO +++ b/TODO @@ -14,7 +14,6 @@ so if you like something just do it and send a patch. - Descriptor 0x6a: AC-3 descriptor - Add support (parser, generator, example) for these DVB descriptors: - - Descriptor 0x68: DSNG_descriptor - Descriptor 0x69: PDC_descriptor - Descriptor 0x6b: ancillary_data_descriptor - Descriptor 0x6c: cell_list_descriptor diff --git a/dvb/si/desc_67.h b/dvb/si/desc_67.h index b1affff..319faf3 100644 --- a/dvb/si/desc_67.h +++ b/dvb/si/desc_67.h @@ -78,6 +78,7 @@ static inline void desc67_print(const uint8_t *p_desc, f_print pf_print, void *opaque, print_type_t i_print_type) { uint8_t i_bytes_length, i; + bool b_dsng_desc = desc_get_tag(p_desc) == 0x68; const uint8_t *p_bytes = desc67_get_bytes(p_desc, &i_bytes_length); char psz_bytes[2 * 255 + 1]; char psz_bytes_txt[255 + 1]; @@ -95,14 +96,18 @@ static inline void desc67_print(const uint8_t *p_desc, f_print pf_print, switch (i_print_type) { case PRINT_XML: pf_print(opaque, - "", + !b_dsng_desc + ? "" + : "", psz_bytes, psz_bytes_txt ); break; default: pf_print(opaque, - " - desc 67 transport_stream bytes=\"%s\" bytes_txt=\"%s\"", + !b_dsng_desc + ? " - desc 67 transport_stream bytes=\"%s\" bytes_txt=\"%s\"" + : " - desc 68 dsng bytes=\"%s\" bytes_txt=\"%s\"", psz_bytes, psz_bytes_txt ); diff --git a/dvb/si/desc_68.h b/dvb/si/desc_68.h new file mode 100644 index 0000000..d63bdc2 --- /dev/null +++ b/dvb/si/desc_68.h @@ -0,0 +1,66 @@ +/***************************************************************************** + * desc_68.h: ETSI EN 300 468 Descriptor 0x68: DSNG descriptor + ***************************************************************************** + * Copyright (C) 2011 Unix Solutions Ltd. + * + * Authors: Georgi Chorbadzhiyski + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *****************************************************************************/ + +/* + * Normative references: + * - ETSI EN 300 468 V1.11.1 (2010-04) (SI in DVB systems) + */ + +#ifndef __BITSTREAM_DVB_DESC_68_H__ +#define __BITSTREAM_DVB_DESC_68_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +/***************************************************************************** + * Descriptor 0x68: DSNG descriptor + *****************************************************************************/ +#define DESC68_HEADER_SIZE DESC_HEADER_SIZE + +static inline void desc68_init(uint8_t *p_desc) +{ + desc_set_tag(p_desc, 0x68); + desc_set_length(p_desc, 0); +} + +#define desc68_get_bytes_length desc67_get_bytes_length +#define desc68_get_bytes desc67_get_bytes +#define desc68_set_bytes desc67_set_bytes +#define desc68_validate desc67_validate +#define desc68_print desc67_print + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/dvb/si/descs_list.h b/dvb/si/descs_list.h index aaf7f41..0a398c8 100644 --- a/dvb/si/descs_list.h +++ b/dvb/si/descs_list.h @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/dvb_gen_si.c b/examples/dvb_gen_si.c index ebf6980..96571e8 100644 --- a/examples/dvb_gen_si.c +++ b/examples/dvb_gen_si.c @@ -1084,7 +1084,13 @@ static void build_desc67(uint8_t *desc, char *bytes) { desc67_set_bytes(desc, (uint8_t *)bytes, strlen(bytes)); } -/* --- Descriptor 0x68: DSNG_descriptor */ +/* DVB Descriptor 0x68: DSNG_descriptor */ +static void build_desc68(uint8_t *desc) { + char *dsng_bytes = "1234,SNG_Headquarter,SNG_Provider"; + desc68_init(desc); + desc68_set_bytes(desc, (uint8_t *)dsng_bytes, strlen(dsng_bytes)); +} + /* --- Descriptor 0x69: PDC_descriptor */ /* DVB Descriptor 0x6a: AC-3 descriptor */ /* --- Descriptor 0x6b: ancillary_data_descriptor */ @@ -1280,6 +1286,9 @@ static void generate_tsdt(void) { desc = descs_get_desc(desc_loop, desc_counter++); build_desc67(desc, "CONT"); + desc = descs_get_desc(desc_loop, desc_counter++); + build_desc68(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); diff --git a/examples/dvb_print_si.output.txt b/examples/dvb_print_si.output.txt index c7c9f8e..77cc04b 100644 --- a/examples/dvb_print_si.output.txt +++ b/examples/dvb_print_si.output.txt @@ -23,6 +23,7 @@ end TSDT new TSDT version=1 - desc 67 transport_stream bytes="445642" bytes_txt="DVB" - desc 67 transport_stream bytes="434f4e54" bytes_txt="CONT" + - desc 68 dsng bytes="313233342c534e475f48656164717561727465722c534e475f50726f7669646572" bytes_txt="1234,SNG_Headquarter,SNG_Provider" end TSDT new NIT actual networkid=40000 version=0 end NIT diff --git a/examples/dvb_print_si.output.xml b/examples/dvb_print_si.output.xml index 73280fd..fa60cdf 100644 --- a/examples/dvb_print_si.output.xml +++ b/examples/dvb_print_si.output.xml @@ -35,6 +35,9 @@ + + + diff --git a/mpeg/psi/descs_print.h b/mpeg/psi/descs_print.h index 1bbafbc..c501a1e 100644 --- a/mpeg/psi/descs_print.h +++ b/mpeg/psi/descs_print.h @@ -168,6 +168,7 @@ static inline void descl_print(uint8_t *p_descl, uint16_t i_length, CASE_DESC(65) CASE_DESC(66) CASE_DESC(67) + CASE_DESC(68) CASE_DESC(6a) #undef CASE_DESC