Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
bitstream
Commits
bb44c0ab
Commit
bb44c0ab
authored
Oct 11, 2011
by
Georgi Chorbadzhiyski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dvb/si: Add support for descriptor 0x5d (Multilingual service name).
parent
0699c3b1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
214 additions
and
2 deletions
+214
-2
README
README
+1
-0
TODO
TODO
+0
-1
dvb/si/desc_5d.h
dvb/si/desc_5d.h
+170
-0
dvb/si/descs_list.h
dvb/si/descs_list.h
+1
-0
examples/dvb_gen_si.c
examples/dvb_gen_si.c
+33
-1
examples/dvb_print_si.output.txt
examples/dvb_print_si.output.txt
+3
-0
examples/dvb_print_si.output.xml
examples/dvb_print_si.output.xml
+5
-0
mpeg/psi/descs_print.h
mpeg/psi/descs_print.h
+1
-0
No files found.
README
View file @
bb44c0ab
...
...
@@ -126,6 +126,7 @@ Supported DVB descriptors
* Descriptor 0x5a: Terrestrial delivery system descriptor
* Descriptor 0x5b: Multilingual network name descriptor
* Descriptor 0x5c: Multilingual bouquet name descriptor
* Descriptor 0x5d: Multilingual service name descriptor
* Descriptor 0x5f: Private data specifier descriptor
* Descriptor 0x6a: AC-3 descriptor [p]
...
...
TODO
View file @
bb44c0ab
...
...
@@ -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 0x5d: multilingual_service_name_descriptor
- Descriptor 0x5e: multilingual_component_descriptor
- Descriptor 0x60: service_move_descriptor
- Descriptor 0x61: short_smoothing_buffer_descriptor
...
...
dvb/si/desc_5d.h
0 → 100644
View file @
bb44c0ab
/*****************************************************************************
* desc_5d.h: ETSI EN 300 468 Descriptor 0x5d: Multilingual service name
*****************************************************************************
* 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
* "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_5D_H__
#define __BITSTREAM_DVB_DESC_5D_H__
#include <bitstream/common.h>
#include <bitstream/mpeg/psi/descriptors.h>
#include <bitstream/mpeg/psi/desc_0a.h>
#include <bitstream/dvb/si/strings.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/*****************************************************************************
* Descriptor 0x5d: Multilingual service name
*****************************************************************************/
#define DESC5D_HEADER_SIZE DESC_HEADER_SIZE
#define DESC5D_DATA_SIZE 5
static
inline
void
desc5d_init
(
uint8_t
*
p_desc
)
{
desc_set_tag
(
p_desc
,
0x5d
);
}
#define desc5dn_set_code desc0an_set_code
#define desc5dn_get_code desc0an_get_code
static
inline
uint8_t
desc5dn_get_provider_name_length
(
const
uint8_t
*
p_desc_n
)
{
return
p_desc_n
[
3
];
}
static
inline
const
uint8_t
*
desc5dn_get_provider_name
(
const
uint8_t
*
p_desc_n
,
uint8_t
*
pi_length
)
{
*
pi_length
=
desc5dn_get_provider_name_length
(
p_desc_n
);
return
p_desc_n
+
4
;
}
static
inline
void
desc5dn_set_provider_name
(
uint8_t
*
p_desc_n
,
const
uint8_t
*
p_network_name
,
uint8_t
i_length
)
{
p_desc_n
[
3
]
=
i_length
;
memcpy
(
p_desc_n
+
4
,
p_network_name
,
i_length
);
}
static
inline
uint8_t
desc5dn_get_service_name_length
(
const
uint8_t
*
p_desc_n
)
{
return
p_desc_n
[
4
+
desc5dn_get_provider_name_length
(
p_desc_n
)];
}
static
inline
const
uint8_t
*
desc5dn_get_service_name
(
const
uint8_t
*
p_desc_n
,
uint8_t
*
pi_length
)
{
*
pi_length
=
desc5dn_get_service_name_length
(
p_desc_n
);
return
p_desc_n
+
5
+
desc5dn_get_provider_name_length
(
p_desc_n
);
}
static
inline
void
desc5dn_set_service_name
(
uint8_t
*
p_desc_n
,
const
uint8_t
*
p_network_name
,
uint8_t
i_length
)
{
p_desc_n
[
4
+
desc5dn_get_provider_name_length
(
p_desc_n
)]
=
i_length
;
memcpy
(
p_desc_n
+
5
+
desc5dn_get_provider_name_length
(
p_desc_n
),
p_network_name
,
i_length
);
}
static
inline
uint8_t
*
desc5d_get_data
(
const
uint8_t
*
p_desc
,
uint8_t
n
)
{
const
uint8_t
*
p_desc_n
=
p_desc
+
DESC5D_HEADER_SIZE
;
uint8_t
i_desc_size
=
desc_get_length
(
p_desc
);
while
(
n
)
{
if
(
p_desc_n
+
DESC5D_DATA_SIZE
-
p_desc
>
i_desc_size
)
return
NULL
;
p_desc_n
+=
DESC5D_DATA_SIZE
+
desc5dn_get_provider_name_length
(
p_desc_n
)
+
desc5dn_get_service_name_length
(
p_desc_n
);
n
--
;
}
if
(
p_desc_n
-
p_desc
>
i_desc_size
)
return
NULL
;
return
(
uint8_t
*
)
p_desc_n
;
}
static
inline
bool
desc5d_validate
(
const
uint8_t
*
p_desc
)
{
const
uint8_t
*
p_desc_n
=
p_desc
+
DESC5D_HEADER_SIZE
;
int
i_desc_size
=
desc_get_length
(
p_desc
);
while
(
i_desc_size
>
0
)
{
uint8_t
i_data_sz
=
DESC5D_DATA_SIZE
+
desc5dn_get_provider_name_length
(
p_desc_n
)
+
desc5dn_get_service_name_length
(
p_desc_n
);
i_desc_size
-=
i_data_sz
;
p_desc_n
+=
i_data_sz
;
}
return
i_desc_size
==
0
;
}
static
inline
void
desc5d_print
(
const
uint8_t
*
p_desc
,
f_print
pf_print
,
void
*
print_opaque
,
f_iconv
pf_iconv
,
void
*
iconv_opaque
,
print_type_t
i_print_type
)
{
const
uint8_t
*
p_desc_n
;
uint8_t
j
=
0
;
while
((
p_desc_n
=
desc5d_get_data
(
p_desc
,
j
++
))
!=
NULL
)
{
uint8_t
i_provider_name_length
,
i_service_name_length
;
const
uint8_t
*
p_provider_name
=
desc5dn_get_provider_name
(
p_desc_n
,
&
i_provider_name_length
);
const
uint8_t
*
p_service_name
=
desc5dn_get_service_name
(
p_desc_n
,
&
i_service_name_length
);
char
*
psz_provider_name
=
dvb_string_get
(
p_provider_name
,
i_provider_name_length
,
pf_iconv
,
iconv_opaque
);
char
*
psz_service_name
=
dvb_string_get
(
p_service_name
,
i_service_name_length
,
pf_iconv
,
iconv_opaque
);
switch
(
i_print_type
)
{
case
PRINT_XML
:
psz_provider_name
=
dvb_string_xml_escape
(
psz_provider_name
);
pf_print
(
print_opaque
,
"<MULTILINGUAL_SERVICE_NAME_DESC code=
\"
%3.3s
\"
provider=
\"
%s
\"
service=
\"
%s
\"
/>"
,
desc5dn_get_code
(
p_desc_n
),
psz_provider_name
,
psz_service_name
);
break
;
default:
pf_print
(
print_opaque
,
" - desc 5d multilingual_service_name code=
\"
%3.3s
\"
provider=
\"
%s
\"
service=
\"
%s
\"
"
,
desc5dn_get_code
(
p_desc_n
),
psz_provider_name
,
psz_service_name
);
}
free
(
psz_provider_name
);
free
(
psz_service_name
);
}
}
#ifdef __cplusplus
}
#endif
#endif
dvb/si/descs_list.h
View file @
bb44c0ab
...
...
@@ -63,6 +63,7 @@
#include <bitstream/dvb/si/desc_5a.h>
#include <bitstream/dvb/si/desc_5b.h>
#include <bitstream/dvb/si/desc_5c.h>
#include <bitstream/dvb/si/desc_5d.h>
#include <bitstream/dvb/si/desc_5f.h>
#include <bitstream/dvb/si/desc_6a.h>
#include <bitstream/dvb/si/desc_83p28.h>
...
...
examples/dvb_gen_si.c
View file @
bb44c0ab
...
...
@@ -937,7 +937,36 @@ static void build_desc5c(uint8_t *desc) {
desc_set_length
(
desc
,
data_n
-
desc
-
DESC_HEADER_SIZE
);
}
/* --- Descriptor 0x5d: multilingual_service_name_descriptor */
/* DVB Descriptor 0x5d: Multilingual service name descriptor */
static
void
build_desc5d
(
uint8_t
*
desc
)
{
char
*
provider_name
=
"M Provider"
;
char
*
service_name
=
"M Service"
;
uint8_t
k
=
0
;
uint8_t
*
data_n
;
desc5d_init
(
desc
);
desc_set_length
(
desc
,
255
);
data_n
=
desc5d_get_data
(
desc
,
k
++
);
desc5dn_set_code
(
data_n
,
(
uint8_t
*
)
"eng"
);
desc5dn_set_provider_name
(
data_n
,
(
uint8_t
*
)
provider_name
,
strlen
(
provider_name
));
desc5dn_set_service_name
(
data_n
,
(
uint8_t
*
)
service_name
,
strlen
(
service_name
));
data_n
=
desc5d_get_data
(
desc
,
k
++
);
desc5dn_set_code
(
data_n
,
(
uint8_t
*
)
"fre"
);
desc5dn_set_provider_name
(
data_n
,
(
uint8_t
*
)
provider_name
,
strlen
(
provider_name
));
desc5dn_set_service_name
(
data_n
,
(
uint8_t
*
)
service_name
,
strlen
(
service_name
));
data_n
=
desc5d_get_data
(
desc
,
k
++
);
desc5dn_set_code
(
data_n
,
(
uint8_t
*
)
"bul"
);
desc5dn_set_provider_name
(
data_n
,
(
uint8_t
*
)
provider_name
,
strlen
(
provider_name
));
desc5dn_set_service_name
(
data_n
,
(
uint8_t
*
)
service_name
,
strlen
(
service_name
));
data_n
=
desc5d_get_data
(
desc
,
k
);
desc_set_length
(
desc
,
data_n
-
desc
-
DESC_HEADER_SIZE
);
}
/* --- Descriptor 0x5e: multilingual_component_descriptor */
/* DVB Descriptor 0x5f: Private data specifier descriptor */
static
void
build_desc5f
(
uint8_t
*
desc
)
{
...
...
@@ -1465,6 +1494,9 @@ static void generate_sdt(void) {
desc
=
descs_get_desc
(
desc_loop
,
desc_counter
++
);
build_desc57
(
desc
);
desc
=
descs_get_desc
(
desc_loop
,
desc_counter
++
);
build_desc5d
(
desc
);
desc
=
descs_get_desc
(
desc_loop
,
desc_counter
++
);
build_desc5f
(
desc
);
...
...
examples/dvb_print_si.output.txt
View file @
bb44c0ab
...
...
@@ -88,6 +88,9 @@ new SDT actual tsid=10000 version=1 onid=40000
- elementary_cell cell_id=7
- elementary_cell cell_id=8
- desc 57 telephone foreign_availability=1 connection_type=3 country_prefix=+ international_area_code=359 operator_code=2 national_area_code= core_number=9868620 phone=+35929868620
- desc 5d multilingual_service_name code="eng" provider="M Provider" service="M Service"
- desc 5d multilingual_service_name code="fre" provider="M Provider" service="M Service"
- desc 5d multilingual_service_name code="bul" provider="M Provider" service="M Service"
- desc 5f private_data specifier=0xaabbccdd
* service sid=20100 eit_schedule running=1
- desc 48 service type=0x1 provider="Test Provider Name" service="Test Service Name"
...
...
examples/dvb_print_si.output.xml
View file @
bb44c0ab
...
...
@@ -140,6 +140,11 @@
<DESC
id=
"0x57"
length=
"15"
value=
"e3ad872b3335393239383638363230"
>
<TELEPHONE_DESC
foreign_availability=
"1"
connection_type=
"3"
country_prefix=
"+"
international_area_code=
"359"
operator_code=
"2"
national_area_code=
""
core_number=
"9868620"
full_telephone=
"+35929868620"
/>
</DESC>
<DESC
id=
"0x5d"
length=
"72"
value=
"656e670a4d2050726f7669646572094d20536572766963656672650a4d2050726f7669646572094d205365727669636562756c0a4d2050726f7669646572094d2053657276696365"
>
<MULTILINGUAL_SERVICE_NAME_DESC
code=
"eng"
provider=
"M Provider"
service=
"M Service"
/>
<MULTILINGUAL_SERVICE_NAME_DESC
code=
"fre"
provider=
"M Provider"
service=
"M Service"
/>
<MULTILINGUAL_SERVICE_NAME_DESC
code=
"bul"
provider=
"M Provider"
service=
"M Service"
/>
</DESC>
<DESC
id=
"0x5f"
length=
"4"
value=
"aabbccdd"
>
<PRIVATE_DATA_SPECIFIER_DESC
specifier=
"0xaabbccdd"
/>
</DESC>
...
...
mpeg/psi/descs_print.h
View file @
bb44c0ab
...
...
@@ -158,6 +158,7 @@ static inline void descl_print(uint8_t *p_descl, uint16_t i_length,
CASE_DESC
(
5
a
)
CASE_DESC_ICONV
(
5
b
)
CASE_DESC_ICONV
(
5
c
)
CASE_DESC_ICONV
(
5
d
)
CASE_DESC
(
6
a
)
#undef CASE_DESC
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment