Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bitstream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
bitstream
Commits
4b14313e
Commit
4b14313e
authored
Oct 07, 2011
by
Georgi Chorbadzhiyski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dvb/si: Add support for descriptor 0x45 (VBI data descriptor).
parent
f3edf7b5
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
271 additions
and
2 deletions
+271
-2
README
README
+1
-0
TODO
TODO
+0
-1
dvb/si/desc_45.h
dvb/si/desc_45.h
+208
-0
dvb/si/descs_list.h
dvb/si/descs_list.h
+1
-0
examples/dvb_gen_si.c
examples/dvb_gen_si.c
+60
-1
mpeg/psi/descs_print.h
mpeg/psi/descs_print.h
+1
-0
No files found.
README
View file @
4b14313e
...
@@ -102,6 +102,7 @@ Supported DVB descriptors
...
@@ -102,6 +102,7 @@ Supported DVB descriptors
* Descriptor 0x41: Service list descriptor
* Descriptor 0x41: Service list descriptor
* Descriptor 0x43: Satellite delivery system descriptor
* Descriptor 0x43: Satellite delivery system descriptor
* Descriptor 0x44: Cable delivery system descriptor
* Descriptor 0x44: Cable delivery system descriptor
* Descriptor 0x45: VBI data descriptor
* Descriptor 0x46: VBI teletext descriptor
* Descriptor 0x46: VBI teletext descriptor
* Descriptor 0x47: Bouquet name descriptor
* Descriptor 0x47: Bouquet name descriptor
* Descriptor 0x48: Service descriptor
* Descriptor 0x48: Service descriptor
...
...
TODO
View file @
4b14313e
...
@@ -14,7 +14,6 @@ so if you like something just do it and send a patch.
...
@@ -14,7 +14,6 @@ so if you like something just do it and send a patch.
- Descriptor 0x6a: AC-3 descriptor
- Descriptor 0x6a: AC-3 descriptor
- Add support (parser, generator, example) for these DVB descriptors:
- Add support (parser, generator, example) for these DVB descriptors:
- Descriptor 0x45: VBI data descriptor
- Descriptor 0x49: Country availability descriptor
- Descriptor 0x49: Country availability descriptor
- Descriptor 0x4b: NVOD_reference_descriptor
- Descriptor 0x4b: NVOD_reference_descriptor
- Descriptor 0x4c: time_shifted_service_descriptor
- Descriptor 0x4c: time_shifted_service_descriptor
...
...
dvb/si/desc_45.h
0 → 100644
View file @
4b14313e
/*****************************************************************************
* desc_45.h: ETSI EN 300 458 Descriptor 0x45: VBI 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 458 V1.11.1 (2010-04) (SI in DVB systems)
*/
#ifndef __BITSTREAM_DVB_DESC_45_H__
#define __BITSTREAM_DVB_DESC_45_H__
#include <bitstream/common.h>
#include <bitstream/mpeg/psi/descriptors.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/*****************************************************************************
* Descriptor 0x45: VBI data descriptor
*****************************************************************************/
#define DESC45_HEADER_SIZE DESC_HEADER_SIZE
#define DESC45_DATA_SIZE 2
static
inline
void
desc45_init
(
uint8_t
*
p_desc
)
{
desc_set_tag
(
p_desc
,
0x45
);
}
static
inline
void
desc45n_set_service_id
(
uint8_t
*
p_desc_n
,
uint8_t
i_service_id
)
{
p_desc_n
[
0
]
=
i_service_id
;
}
static
inline
uint8_t
desc45n_get_service_id
(
const
uint8_t
*
p_desc_n
)
{
return
p_desc_n
[
0
];
}
static
inline
void
desc45n_set_data_length
(
uint8_t
*
p_desc_n
,
uint8_t
i_length
)
{
p_desc_n
[
1
]
=
i_length
;
}
static
inline
uint8_t
desc45n_get_data_length
(
const
uint8_t
*
p_desc_n
)
{
return
p_desc_n
[
1
];
}
static
inline
char
*
desc45_get_service_id_txt
(
uint8_t
i_service_id
)
{
return
i_service_id
==
0x00
?
"reserved"
:
i_service_id
==
0x01
?
"EBU teletext"
:
i_service_id
==
0x02
?
"inverted teletext"
:
i_service_id
==
0x03
?
"reserved"
:
i_service_id
==
0x04
?
"VPS"
:
i_service_id
==
0x05
?
"WSS"
:
i_service_id
==
0x06
?
"Closed Captioning"
:
i_service_id
==
0x07
?
"Mono 4:2:2 samples"
:
"reserved"
;
}
static
inline
uint8_t
desc45n_get_byte
(
uint8_t
*
p_desc_n
,
uint8_t
idx
)
{
return
p_desc_n
[
idx
+
2
];
}
static
inline
void
desc45n_set_byte
(
uint8_t
*
p_desc_n
,
uint8_t
idx
,
uint8_t
i_byte
)
{
p_desc_n
[
idx
+
2
]
=
i_byte
;
}
static
inline
bool
desc45n_get_field_parity
(
const
uint8_t
*
p_desc_n
,
uint8_t
idx
)
{
return
(
p_desc_n
[
idx
+
2
]
&
0x20
)
==
0x20
;
}
static
inline
void
desc45n_set_field_parity
(
uint8_t
*
p_desc_n
,
uint8_t
idx
,
bool
b_parity
)
{
p_desc_n
[
idx
+
2
]
=
0xc0
|
(
b_parity
?
(
p_desc_n
[
idx
+
2
]
|
0x20
)
:
(
p_desc_n
[
idx
+
2
]
&~
0x20
));
}
static
inline
uint8_t
desc45n_get_line_offset
(
const
uint8_t
*
p_desc_n
,
uint8_t
idx
)
{
return
p_desc_n
[
idx
+
2
]
&
0x1f
;
}
static
inline
void
desc45n_set_line_offset
(
uint8_t
*
p_desc_n
,
uint8_t
idx
,
uint8_t
i_line_offset
)
{
p_desc_n
[
idx
+
2
]
=
0xc0
|
(
p_desc_n
[
idx
+
2
]
&
0x20
)
|
(
i_line_offset
&
0x1f
);
}
static
inline
uint8_t
*
desc45_get_data
(
uint8_t
*
p_desc
,
uint8_t
n
)
{
uint8_t
*
p_desc_n
=
p_desc
+
DESC45_HEADER_SIZE
;
uint8_t
i_desc_size
=
desc_get_length
(
p_desc
);
while
(
n
)
{
if
(
p_desc_n
+
DESC45_DATA_SIZE
-
p_desc
>
i_desc_size
)
return
NULL
;
p_desc_n
+=
DESC45_DATA_SIZE
+
desc45n_get_data_length
(
p_desc_n
);
n
--
;
}
if
(
p_desc_n
-
p_desc
>
i_desc_size
)
return
NULL
;
return
p_desc_n
;
}
static
inline
bool
desc45_validate
(
const
uint8_t
*
p_desc
)
{
const
uint8_t
*
p_desc_n
=
p_desc
+
DESC45_HEADER_SIZE
;
int
i_desc_size
=
desc_get_length
(
p_desc
);
while
(
i_desc_size
>
0
)
{
uint8_t
i_data_sz
=
DESC45_DATA_SIZE
+
desc45n_get_data_length
(
p_desc_n
);
i_desc_size
-=
i_data_sz
;
p_desc_n
+=
i_data_sz
;
}
return
i_desc_size
==
0
;
}
static
inline
void
desc45_print
(
uint8_t
*
p_desc
,
f_print
pf_print
,
void
*
opaque
,
print_type_t
i_print_type
)
{
uint8_t
j
=
0
;
uint8_t
*
p_desc_n
;
if
(
i_print_type
==
PRINT_XML
)
pf_print
(
opaque
,
"<VBI_DATA_DESC>"
);
while
((
p_desc_n
=
desc45_get_data
(
p_desc
,
j
++
))
!=
NULL
)
{
uint8_t
k
;
uint8_t
i_service_id
=
desc45n_get_service_id
(
p_desc_n
);
uint8_t
i_service_len
=
desc45n_get_data_length
(
p_desc_n
);
switch
(
i_print_type
)
{
case
PRINT_XML
:
pf_print
(
opaque
,
"<VBI_DATA_SERVICE service_id=
\"
0x%02x
\"
length=
\"
%u
\"
service_txt=
\"
%s
\"
>"
,
i_service_id
,
i_service_len
,
desc45_get_service_id_txt
(
i_service_id
)
);
for
(
k
=
0
;
k
<
i_service_len
;
k
++
)
{
if
(
i_service_id
>=
1
&&
i_service_id
<=
7
&&
i_service_id
!=
3
)
{
pf_print
(
opaque
,
"<VBI_DATA field_parity=
\"
%u
\"
line_offset=
\"
%u
\"
/>"
,
desc45n_get_field_parity
(
p_desc_n
,
k
),
desc45n_get_line_offset
(
p_desc_n
,
k
));
}
else
{
pf_print
(
opaque
,
"<VBI_DATA reserved_byte=
\"
0x%02x
\"
/>"
,
desc45n_get_byte
(
p_desc_n
,
k
));
}
}
pf_print
(
opaque
,
"</VBI_DATA_SERVICE>"
);
break
;
default:
pf_print
(
opaque
,
" - desc 45 vbi_data service_id=0x%02x length=%u service_txt=
\"
%s
\"
"
,
i_service_id
,
i_service_len
,
desc45_get_service_id_txt
(
i_service_id
));
for
(
k
=
0
;
k
<
i_service_len
;
k
++
)
{
if
(
i_service_id
>=
1
&&
i_service_id
<=
7
&&
i_service_id
!=
3
)
{
pf_print
(
opaque
,
" - vbi_data field_parity=%u line_offset=%u"
,
desc45n_get_field_parity
(
p_desc_n
,
k
),
desc45n_get_line_offset
(
p_desc_n
,
k
));
}
else
{
pf_print
(
opaque
,
" - vbi_data reserved_byte=0x%02x"
,
desc45n_get_byte
(
p_desc_n
,
k
));
}
}
}
}
if
(
i_print_type
==
PRINT_XML
)
pf_print
(
opaque
,
"</VBI_DATA_DESC>"
);
}
#ifdef __cplusplus
}
#endif
#endif
dvb/si/descs_list.h
View file @
4b14313e
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include <bitstream/dvb/si/desc_42.h>
#include <bitstream/dvb/si/desc_42.h>
#include <bitstream/dvb/si/desc_43.h>
#include <bitstream/dvb/si/desc_43.h>
#include <bitstream/dvb/si/desc_44.h>
#include <bitstream/dvb/si/desc_44.h>
#include <bitstream/dvb/si/desc_45.h>
#include <bitstream/dvb/si/desc_46.h>
#include <bitstream/dvb/si/desc_46.h>
#include <bitstream/dvb/si/desc_47.h>
#include <bitstream/dvb/si/desc_47.h>
#include <bitstream/dvb/si/desc_48.h>
#include <bitstream/dvb/si/desc_48.h>
...
...
examples/dvb_gen_si.c
View file @
4b14313e
...
@@ -407,7 +407,63 @@ static void build_desc44(uint8_t *desc) {
...
@@ -407,7 +407,63 @@ static void build_desc44(uint8_t *desc) {
desc44_set_fecinner
(
desc
,
6
);
// 8/9
desc44_set_fecinner
(
desc
,
6
);
// 8/9
}
}
/* --- Descriptor 0x45: VBI data descriptor */
/* DVB Descriptor 0x45: VBI data descriptor */
static
void
build_desc45
(
uint8_t
*
desc
)
{
uint8_t
k
=
0
;
uint8_t
*
data_n
;
desc45_init
(
desc
);
desc_set_length
(
desc
,
255
);
data_n
=
desc45_get_data
(
desc
,
k
++
);
desc45n_set_service_id
(
data_n
,
0x01
);
// EBU teletext
desc45n_set_data_length
(
data_n
,
8
);
// How much bytes are after this
{
uint8_t
j
,
max_j
=
desc45n_get_data_length
(
data_n
);
for
(
j
=
0
;
j
<
max_j
;
j
++
)
{
desc45n_set_field_parity
(
data_n
,
j
,
(
j
%
2
)
==
0
);
desc45n_set_line_offset
(
data_n
,
j
,
j
);
}
}
data_n
=
desc45_get_data
(
desc
,
k
++
);
desc45n_set_service_id
(
data_n
,
0x03
);
// Reserved
desc45n_set_data_length
(
data_n
,
4
);
// How much bytes are after this
desc45n_set_byte
(
data_n
,
0
,
0x12
);
desc45n_set_byte
(
data_n
,
1
,
0x34
);
desc45n_set_byte
(
data_n
,
2
,
0x56
);
desc45n_set_byte
(
data_n
,
3
,
0x78
);
data_n
=
desc45_get_data
(
desc
,
k
++
);
desc45n_set_service_id
(
data_n
,
0x04
);
// VPS
desc45n_set_data_length
(
data_n
,
1
);
// How much bytes are after this
{
uint8_t
j
,
max_j
=
desc45n_get_data_length
(
data_n
);
for
(
j
=
0
;
j
<
max_j
;
j
++
)
{
desc45n_set_field_parity
(
data_n
,
j
,
(
j
%
2
)
==
2
);
desc45n_set_line_offset
(
data_n
,
j
,
j
+
10
);
}
}
data_n
=
desc45_get_data
(
desc
,
k
++
);
desc45n_set_service_id
(
data_n
,
0x05
);
// WSS
desc45n_set_data_length
(
data_n
,
4
);
// How much bytes are after this
{
uint8_t
j
,
max_j
=
desc45n_get_data_length
(
data_n
);
for
(
j
=
0
;
j
<
max_j
;
j
++
)
{
desc45n_set_field_parity
(
data_n
,
j
,
(
j
%
2
)
==
1
);
desc45n_set_line_offset
(
data_n
,
j
,
j
+
20
);
}
}
data_n
=
desc45_get_data
(
desc
,
k
++
);
desc45n_set_service_id
(
data_n
,
0x06
);
// Closed Captioning
desc45n_set_data_length
(
data_n
,
0
);
// How much bytes are after this
data_n
=
desc45_get_data
(
desc
,
k
);
desc_set_length
(
desc
,
data_n
-
desc
-
DESC45_HEADER_SIZE
);
}
/* DVB Descriptor 0x46: VBI teletext descriptor */
/* DVB Descriptor 0x46: VBI teletext descriptor */
static
void
build_desc46
(
uint8_t
*
desc
)
{
static
void
build_desc46
(
uint8_t
*
desc
)
{
uint8_t
k
=
0
;
uint8_t
k
=
0
;
...
@@ -1681,6 +1737,9 @@ static void generate_pmt(void) {
...
@@ -1681,6 +1737,9 @@ static void generate_pmt(void) {
desc
=
descs_get_desc
(
desc_loop
,
desc_counter
++
);
desc
=
descs_get_desc
(
desc_loop
,
desc_counter
++
);
build_desc46
(
desc
);
build_desc46
(
desc
);
desc
=
descs_get_desc
(
desc_loop
,
desc_counter
++
);
build_desc45
(
desc
);
// Finish descriptor generation
// Finish descriptor generation
desc
=
descs_get_desc
(
desc_loop
,
desc_counter
);
// Get next descriptor pos
desc
=
descs_get_desc
(
desc_loop
,
desc_counter
);
// Get next descriptor pos
descs_set_length
(
desc_loop
,
desc
-
desc_loop
-
DESCS_HEADER_SIZE
);
descs_set_length
(
desc_loop
,
desc
-
desc_loop
-
DESCS_HEADER_SIZE
);
...
...
mpeg/psi/descs_print.h
View file @
4b14313e
...
@@ -134,6 +134,7 @@ static inline void descl_print(uint8_t *p_descl, uint16_t i_length,
...
@@ -134,6 +134,7 @@ static inline void descl_print(uint8_t *p_descl, uint16_t i_length,
CASE_DESC
(
42
)
CASE_DESC
(
42
)
CASE_DESC
(
43
)
CASE_DESC
(
43
)
CASE_DESC
(
44
)
CASE_DESC
(
44
)
CASE_DESC
(
45
)
CASE_DESC
(
46
)
CASE_DESC
(
46
)
CASE_DESC_ICONV
(
47
)
CASE_DESC_ICONV
(
47
)
CASE_DESC_ICONV
(
48
)
CASE_DESC_ICONV
(
48
)
...
...
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