Commit 9a3eaeff authored by Georgi Chorbadzhiyski's avatar Georgi Chorbadzhiyski

dvb/si: Add support for descriptor 0x61 (Short smoothing buffer).

parent 39dc510c
......@@ -130,6 +130,7 @@ Supported DVB descriptors
* Descriptor 0x5e: Multilingual component descriptor
* Descriptor 0x5f: Private data specifier descriptor
* Descriptor 0x60: Service move descriptor
* Descriptor 0x61: Short smoothing buffer 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 0x61: short_smoothing_buffer_descriptor
- Descriptor 0x62: frequency_list_descriptor
- Descriptor 0x63: partial_transport_stream_descriptor
- Descriptor 0x64: data_broadcast_descriptor
......
/*****************************************************************************
* desc_61.h: ETSI EN 300 468 Descriptor 0x61: Short smoothing buffer
*****************************************************************************
* 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_61_H__
#define __BITSTREAM_DVB_DESC_61_H__
#include <bitstream/common.h>
#include <bitstream/mpeg/psi/descriptors.h>
#ifdef __cplusplus
extern "C"
{
#endif
/*****************************************************************************
* Descriptor 0x61: Short smoothing buffer descriptor
*****************************************************************************/
#define DESC61_HEADER_SIZE (DESC_HEADER_SIZE + 1)
static inline void desc61_init(uint8_t *p_desc)
{
desc_set_tag(p_desc, 0x61);
desc_set_length(p_desc, DESC61_HEADER_SIZE - DESC_HEADER_SIZE);
}
static inline uint8_t desc61_get_sb_size(const uint8_t *p_desc)
{
return p_desc[2] >> 6;
}
static inline void desc61_set_sb_size(uint8_t *p_desc, uint8_t i_sb_size)
{
p_desc[2] = (p_desc[2] & 0x3f) | (i_sb_size << 6);
}
static inline uint8_t desc61_get_sb_leak_rate(const uint8_t *p_desc)
{
return p_desc[2] & 0x3f;
}
static inline void desc61_set_sb_leak_rate(uint8_t *p_desc, uint8_t i_sb_leak_rate)
{
p_desc[2] = (p_desc[2] & 0xc0) | (i_sb_leak_rate & 0x3f);
}
static inline bool desc61_validate(const uint8_t *p_desc)
{
return desc_get_length(p_desc) >= DESC61_HEADER_SIZE - DESC_HEADER_SIZE;
}
static inline void desc61_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, "<SHORT_SMOOTHING_BUFFER_DESC sb_size=\"%u\" sb_leak_rate=\"%u\"/>",
desc61_get_sb_size(p_desc),
desc61_get_sb_leak_rate(p_desc)
);
break;
default:
pf_print(opaque, " - desc 61 short_smoothing_buffer sb_size=%u sb_leak_rate=%u",
desc61_get_sb_size(p_desc),
desc61_get_sb_leak_rate(p_desc)
);
}
}
#ifdef __cplusplus
}
#endif
#endif
......@@ -67,6 +67,7 @@
#include <bitstream/dvb/si/desc_5e.h>
#include <bitstream/dvb/si/desc_5f.h>
#include <bitstream/dvb/si/desc_60.h>
#include <bitstream/dvb/si/desc_61.h>
#include <bitstream/dvb/si/desc_6a.h>
#include <bitstream/dvb/si/desc_83p28.h>
#include <bitstream/dvb/si/desc_88p28.h>
......
......@@ -1008,7 +1008,13 @@ static void build_desc60(uint8_t *desc) {
desc60_set_new_service_id(desc, 20000);
}
/* --- Descriptor 0x61: short_smoothing_buffer_descriptor */
/* DVB Descriptor 0x61: Short smoothing buffer descriptor */
static void build_desc61(uint8_t *desc) {
desc61_init(desc);
desc61_set_sb_size(desc, 1); // 1536 bytes buffer size
desc61_set_sb_leak_rate(desc, 10); // 0.5 Mbit/s
}
/* --- Descriptor 0x62: frequency_list_descriptor */
/* --- Descriptor 0x63: partial_transport_stream_descriptor */
/* --- Descriptor 0x64: data_broadcast_descriptor */
......@@ -1701,6 +1707,9 @@ static void generate_eit(void) {
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc4d(desc);
desc = descs_get_desc(desc_loop, desc_counter++);
build_desc61(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);
......
......@@ -120,6 +120,7 @@ new EIT tableid=0x4e type=actual_pf version=1 tsid=10000 onid=40000 seg_last_sec
- extended_event_item description="Year" text="2011"
- extended_event_item description="Rating" text="***++"
- 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 54 content content_l1=2 content_l2=4 user=78
- desc 54 content content_l1=6 content_l2=8 user=177
......
......@@ -206,6 +206,9 @@
<DESC id="0x4d" length="44" value="656e670e4d616a6f72205456206576656e7419546865206576656e74206f66207468652063656e7475727921">
<SHORT_EVENT_DESC lang="eng" event_name="Major TV event" text="The event of the century!"/>
</DESC>
<DESC id="0x61" length="1" value="4a">
<SHORT_SMOOTHING_BUFFER_DESC sb_size="1" sb_leak_rate="10"/>
</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="0x54" length="4" value="244e68b1">
......
......@@ -161,6 +161,7 @@ static inline void descl_print(uint8_t *p_descl, uint16_t i_length,
CASE_DESC_ICONV(5d)
CASE_DESC_ICONV(5e)
CASE_DESC(60)
CASE_DESC(61)
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