Commit cafd3176 authored by Georgi Chorbadzhiyski's avatar Georgi Chorbadzhiyski

dvb/si: Add support for descriptor 0x68 (DSNG descriptor).

parent cb5e4762
......@@ -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:
......
......@@ -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
......
......@@ -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,
"<TRANSPORT_STREAM_DESC bytes=\"%s\" bytes_txt=\"%s\"/>",
!b_dsng_desc
? "<TRANSPORT_STREAM_DESC bytes=\"%s\" bytes_txt=\"%s\"/>"
: "<DSNG_DESC bytes=\"%s\" bytes_txt=\"%s\"/>",
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
);
......
/*****************************************************************************
* desc_68.h: ETSI EN 300 468 Descriptor 0x68: DSNG descriptor
*****************************************************************************
* Copyright (C) 2011 Unix Solutions Ltd.
*
* Authors: 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
* "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 <bitstream/common.h>
#include <bitstream/mpeg/psi/descriptors.h>
#include <bitstream/dvb/si/desc_67.h>
#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
......@@ -74,6 +74,7 @@
#include <bitstream/dvb/si/desc_65.h>
#include <bitstream/dvb/si/desc_66.h>
#include <bitstream/dvb/si/desc_67.h>
#include <bitstream/dvb/si/desc_68.h>
#include <bitstream/dvb/si/desc_6a.h>
#include <bitstream/dvb/si/desc_83p28.h>
#include <bitstream/dvb/si/desc_88p28.h>
......
......@@ -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);
......
......@@ -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
......
......@@ -35,6 +35,9 @@
<DESC id="0x67" length="4" value="434f4e54">
<TRANSPORT_STREAM_DESC bytes="434f4e54" bytes_txt="CONT"/>
</DESC>
<DESC id="0x68" length="33" value="313233342c534e475f48656164717561727465722c534e475f50726f7669646572">
<DSNG_DESC bytes="313233342c534e475f48656164717561727465722c534e475f50726f7669646572" bytes_txt="1234,SNG_Headquarter,SNG_Provider"/>
</DESC>
</TSDT>
<NIT tid="64" networkid="40000" version="0" current_next="1">
</NIT>
......
......@@ -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
......
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