Commit aa01270b authored by Georgi Chorbadzhiyski's avatar Georgi Chorbadzhiyski
Browse files

dvb/si: Add support for descriptor 0x6b (Ancillary data descriptor).

parent 8c8a685b
......@@ -144,6 +144,7 @@ Supported DVB descriptors
* Descriptor 0x68: DSNG descriptor
* Descriptor 0x69: PDC descriptor
* Descriptor 0x6a: AC-3 descriptor
* Descriptor 0x6b: Ancillary data descriptor
* Descriptor 0x7a: Enhanced AC-3 descriptor
* Descriptor 0x7b: DTS descriptor
* Descriptor 0x7c: AAC descriptor
......
......@@ -5,7 +5,6 @@ so if you like something just do it and send a patch.
- Descriptor 0x29 IPMP_descriptor (defined in ISO/IEC 13818-11, MPEG-2 IPMP)
- Add support (parser, generator, example) for these DVB descriptors:
- Descriptor 0x6b: ancillary_data_descriptor
- Descriptor 0x6c: cell_list_descriptor
- Descriptor 0x6d: cell_frequency_link_descriptor
- Descriptor 0x6e: announcement_support_descriptor
......
/*****************************************************************************
* desc_6b.h: ETSI EN 300 468 Descriptor 0x6b: Ancillary data 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_6B_H__
#define __BITSTREAM_DVB_DESC_6B_H__
#include <bitstream/common.h>
#include <bitstream/mpeg/psi/descriptors.h>
#ifdef __cplusplus
extern "C"
{
#endif
/*****************************************************************************
* Descriptor 0x6b: Ancillary data descriptor
*****************************************************************************/
#define DESC6B_HEADER_SIZE (DESC_HEADER_SIZE + 1)
static inline void desc6b_init(uint8_t *p_desc)
{
desc_set_tag(p_desc, 0x6b);
desc_set_length(p_desc, (DESC6B_HEADER_SIZE - DESC_HEADER_SIZE));
p_desc[2] = 0x01;
}
static inline uint8_t desc6b_get_ancillary_data_indentifier(const uint8_t *p_desc)
{
return p_desc[2];
}
static inline void desc6b_set_ancillary_data_indentifier(uint8_t *p_desc, uint8_t i_data)
{
p_desc[2] = i_data | 0x01;
}
#define __DEFINE_FLAG(FLAGNAME, bit) \
static inline bool desc6b_get_##FLAGNAME##_flag(const uint8_t *p_desc) \
{ \
return (p_desc[2] & bit) == bit; \
} \
\
static inline void desc6b_set_##FLAGNAME##_flag(uint8_t *p_desc, bool b_##FLAGNAME) \
{ \
p_desc[2] = b_##FLAGNAME ? (p_desc[2] | bit) : (p_desc[2] &~ bit); \
}
__DEFINE_FLAG (dvd_video_ancillary_data , 0x80)
__DEFINE_FLAG (extended_ancillary_data , 0x40)
__DEFINE_FLAG (announcement_switching_data , 0x20)
__DEFINE_FLAG (dab_ancillary_data , 0x10)
__DEFINE_FLAG (scale_factor_error_check , 0x08)
__DEFINE_FLAG (mpeg4_ancillary_data , 0x04)
__DEFINE_FLAG (rds_via_uecp , 0x02)
#undef __DEFINE_FLAG
static inline bool desc6b_validate(const uint8_t *p_desc)
{
return desc_get_length(p_desc) >= DESC6B_HEADER_SIZE - DESC_HEADER_SIZE;
}
static inline void desc6b_print(const uint8_t *p_desc, f_print pf_print,
void *opaque, print_type_t i_print_type)
{
switch (i_print_type) {
case PRINT_XML:
pf_print(opaque,
"<ANCILLARY_DATA_DESC "
" ancillary_data_indentifier=\"0x%02x\""
" dvd_video_ancillary_data_flag=\"%u\""
" extended_ancillary_data_flag=\"%u\""
" announcement_switching_data_flag=\"%u\""
" dab_ancillary_data_flag=\"%u\""
" scale_factor_error_check_flag=\"%u\""
" mpeg4_ancillary_data_flag=\"%u\""
" rds_via_uecp_flag=\"%u\"/>",
desc6b_get_ancillary_data_indentifier(p_desc),
desc6b_get_dvd_video_ancillary_data_flag(p_desc),
desc6b_get_extended_ancillary_data_flag(p_desc),
desc6b_get_announcement_switching_data_flag(p_desc),
desc6b_get_dab_ancillary_data_flag(p_desc),
desc6b_get_scale_factor_error_check_flag(p_desc),
desc6b_get_mpeg4_ancillary_data_flag(p_desc),
desc6b_get_rds_via_uecp_flag(p_desc)
);
break;
default:
pf_print(opaque,
" - desc 6b ancillary_data"
" ancillary_data_indentifier=0x%02x"
" dvd_video_ancillary_data_flag=%u"
" extended_ancillary_data_flag=%u"
" announcement_switching_data_flag=%u"
" dab_ancillary_data_flag=%u"
" scale_factor_error_check_flag=%u"
" mpeg4_ancillary_data_flag=%u"
" rds_via_uecp_flag=%u",
desc6b_get_ancillary_data_indentifier(p_desc),
desc6b_get_dvd_video_ancillary_data_flag(p_desc),
desc6b_get_extended_ancillary_data_flag(p_desc),
desc6b_get_announcement_switching_data_flag(p_desc),
desc6b_get_dab_ancillary_data_flag(p_desc),
desc6b_get_scale_factor_error_check_flag(p_desc),
desc6b_get_mpeg4_ancillary_data_flag(p_desc),
desc6b_get_rds_via_uecp_flag(p_desc)
);
}
}
#ifdef __cplusplus
}
#endif
#endif
......@@ -77,6 +77,7 @@
#include <bitstream/dvb/si/desc_68.h>
#include <bitstream/dvb/si/desc_69.h>
#include <bitstream/dvb/si/desc_6a.h>
#include <bitstream/dvb/si/desc_6b.h>
#include <bitstream/dvb/si/desc_7a.h>
#include <bitstream/dvb/si/desc_7b.h>
#include <bitstream/dvb/si/desc_7c.h>
......
......@@ -1452,7 +1452,18 @@ static void build_desc6a(uint8_t *desc) {
desc6a_set_length(desc);
}
/* --- Descriptor 0x6b: ancillary_data_descriptor */
/* DVB Descriptor 0x6b: Ancillary data descriptor */
static void build_desc6b(uint8_t *desc) {
desc6b_init(desc);
desc6b_set_dvd_video_ancillary_data_flag (desc, true);
desc6b_set_extended_ancillary_data_flag (desc, false);
desc6b_set_announcement_switching_data_flag (desc, true);
desc6b_set_dab_ancillary_data_flag (desc, false);
desc6b_set_scale_factor_error_check_flag (desc, true);
desc6b_set_mpeg4_ancillary_data_flag (desc, false);
desc6b_set_rds_via_uecp_flag (desc, true);
}
/* --- Descriptor 0x6c: cell_list_descriptor */
/* --- Descriptor 0x6d: cell_frequency_link_descriptor */
/* --- Descriptor 0x6e: announcement_support_descriptor */
......@@ -2711,6 +2722,9 @@ static void generate_pmt(void) {
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc2a(desc);
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc6b(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);
......
......@@ -307,6 +307,7 @@ new PMT program=20000 version=1 pcrpid=110
- desc 26 metadata metadata_application_format=0xffff metadata_application_format_identifier=0x00112233 metadata_format=0xff metadata_format_identifier=0xdeadbeaf metadata_service_id=0x88 dsm_cc_flag=1 service_identification_record_length=3 service_identification_record="616263" decoder_config_flags=3 dec_config_identification_record_length=3 dec_config_identification_record_data="414243" decoder_config_metadata_service_id=0
- desc 28 avc_video profile_idc=0x12 constraint_set0_flag=1 constraint_set1_flag=1 constraint_set2_flag=0 AVC_compatible_flags=0x0a level_idc=0x34 AVC_still_present=0 AVC_24_hour_picture_flag=0
- desc 2a avc_timing_and_hrd hrd_management_valid_flag=0 picture_and_timing_info_present=1 flag_90khz=0 N=12345678 K=34567890 num_units_in_tick=456789 fixed_frame_rate_flag=1 temporal_poc_flag=0 picture_to_display_conversion_flag=1
- desc 6b ancillary_data ancillary_data_indentifier=0xab dvd_video_ancillary_data_flag=1 extended_ancillary_data_flag=0 announcement_switching_data_flag=1 dab_ancillary_data_flag=0 scale_factor_error_check_flag=1 mpeg4_ancillary_data_flag=0 rds_via_uecp_flag=1
* ES pid=127 streamtype=0x0f streamtype_txt="13818-7 Audio with ADTS transport syntax"
- desc 42 stuffing length=4
- desc 2b mpeg2_aac_audio profile=0x12 channel_config=0x05 additional_info=0x00
......
......@@ -559,6 +559,9 @@
<DESC id="0x2a" length="15" value="7f7f00bc614e020f76d20006f855bf">
<AVC_TIMING_AND_HRD_DESC hrd_management_valid_flag="0" picture_and_timing_info_present="1" flag_90khz="0" N="12345678" K="34567890" num_units_in_tick="456789" fixed_frame_rate_flag="1" temporal_poc_flag="0" picture_to_display_conversion_flag="1"/>
</DESC>
<DESC id="0x6b" length="1" value="ab">
<ANCILLARY_DATA_DESC ancillary_data_indentifier="0xab" dvd_video_ancillary_data_flag="1" extended_ancillary_data_flag="0" announcement_switching_data_flag="1" dab_ancillary_data_flag="0" scale_factor_error_check_flag="1" mpeg4_ancillary_data_flag="0" rds_via_uecp_flag="1"/>
</DESC>
</ES>
<ES pid="127" streamtype="0x0f" streamtype_txt="13818-7 Audio with ADTS transport syntax">
<DESC id="0x42" length="4" value="aabbccdd">
......
......@@ -176,6 +176,7 @@ static inline void descl_print(uint8_t *p_descl, uint16_t i_length,
CASE_DESC(68)
CASE_DESC(69)
CASE_DESC(6a)
CASE_DESC(6b)
CASE_DESC(7a)
CASE_DESC(7b)
CASE_DESC(7c)
......
Supports Markdown
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