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
b02260c9
Commit
b02260c9
authored
Oct 10, 2011
by
Christophe Massiot
Committed by
Georgi Chorbadzhiyski
Oct 10, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dvb/si: Move NIT functions to dvb/si/nit{_print}.h
parent
1d417a2e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
385 additions
and
288 deletions
+385
-288
dvb/si.h
dvb/si.h
+1
-219
dvb/si/nit.h
dvb/si/nit.h
+268
-0
dvb/si/nit_print.h
dvb/si/nit_print.h
+115
-0
dvb/si_print.h
dvb/si_print.h
+1
-69
No files found.
dvb/si.h
View file @
b02260c9
...
...
@@ -40,6 +40,7 @@
#include <bitstream/dvb/si/numbers.h>
#include <bitstream/dvb/si/datetime.h>
#include <bitstream/dvb/si/strings.h>
#include <bitstream/dvb/si/nit.h>
#ifdef __cplusplus
extern
"C"
...
...
@@ -1022,225 +1023,6 @@ static inline void desc88p28_init(uint8_t *p_desc)
#define desc88p28_validate desc83p28_validate
#define desc88p28_print desc83p28_print
/*****************************************************************************
* Network Information Table
*****************************************************************************/
#define NIT_PID 0x10
#define NIT_TABLE_ID_ACTUAL 0x40
#define NIT_TABLE_ID_OTHER 0x41
#define NIT_HEADER_SIZE (PSI_HEADER_SIZE_SYNTAX1 + 2)
#define NIT_HEADER2_SIZE 2
#define NIT_TS_SIZE 6
#define nit_set_nid psi_set_tableidext
#define nit_get_nid psi_get_tableidext
static
inline
void
nit_init
(
uint8_t
*
p_nit
,
bool
b_actual
)
{
psi_init
(
p_nit
,
true
);
psi_set_tableid
(
p_nit
,
b_actual
?
NIT_TABLE_ID_ACTUAL
:
NIT_TABLE_ID_OTHER
);
p_nit
[
8
]
=
0xf0
;
}
static
inline
void
nit_set_length
(
uint8_t
*
p_nit
,
uint16_t
i_nit_length
)
{
psi_set_length
(
p_nit
,
NIT_HEADER_SIZE
+
PSI_CRC_SIZE
-
PSI_HEADER_SIZE
+
i_nit_length
);
}
static
inline
void
nit_set_desclength
(
uint8_t
*
p_nit
,
uint16_t
i_length
)
{
p_nit
[
8
]
&=
~
0xf
;
p_nit
[
8
]
|=
i_length
>>
8
;
p_nit
[
9
]
=
i_length
&
0xff
;
}
static
inline
uint16_t
nit_get_desclength
(
const
uint8_t
*
p_nit
)
{
return
((
p_nit
[
8
]
&
0xf
)
<<
8
)
|
p_nit
[
9
];
}
static
inline
uint8_t
*
nit_get_descs
(
uint8_t
*
p_nit
)
{
return
&
p_nit
[
8
];
}
static
inline
void
nith_init
(
uint8_t
*
p_nit_h
)
{
p_nit_h
[
0
]
=
0xf0
;
}
static
inline
void
nith_set_tslength
(
uint8_t
*
p_nit_h
,
uint16_t
i_length
)
{
p_nit_h
[
0
]
&=
~
0xf
;
p_nit_h
[
0
]
|=
i_length
>>
8
;
p_nit_h
[
1
]
=
i_length
&
0xff
;
}
static
inline
uint16_t
nith_get_tslength
(
const
uint8_t
*
p_nit_h
)
{
return
((
p_nit_h
[
0
]
&
0xf
)
<<
8
)
|
p_nit_h
[
1
];
}
static
inline
void
nitn_init
(
uint8_t
*
p_nit_n
)
{
p_nit_n
[
4
]
=
0xf0
;
}
static
inline
void
nitn_set_tsid
(
uint8_t
*
p_nit_n
,
uint16_t
i_tsid
)
{
p_nit_n
[
0
]
=
i_tsid
>>
8
;
p_nit_n
[
1
]
=
i_tsid
&
0xff
;
}
static
inline
uint16_t
nitn_get_tsid
(
const
uint8_t
*
p_nit_n
)
{
return
(
p_nit_n
[
0
]
<<
8
)
|
p_nit_n
[
1
];
}
static
inline
void
nitn_set_onid
(
uint8_t
*
p_nit_n
,
uint16_t
i_onid
)
{
p_nit_n
[
2
]
=
i_onid
>>
8
;
p_nit_n
[
3
]
=
i_onid
&
0xff
;
}
static
inline
uint16_t
nitn_get_onid
(
const
uint8_t
*
p_nit_n
)
{
return
(
p_nit_n
[
2
]
<<
8
)
|
p_nit_n
[
3
];
}
static
inline
void
nitn_set_desclength
(
uint8_t
*
p_nit_n
,
uint16_t
i_length
)
{
p_nit_n
[
4
]
&=
~
0xf
;
p_nit_n
[
4
]
|=
i_length
>>
8
;
p_nit_n
[
5
]
=
i_length
&
0xff
;
}
static
inline
uint16_t
nitn_get_desclength
(
const
uint8_t
*
p_nit_n
)
{
return
((
p_nit_n
[
4
]
&
0xf
)
<<
8
)
|
p_nit_n
[
5
];
}
static
inline
uint8_t
*
nitn_get_descs
(
uint8_t
*
p_nit_n
)
{
return
&
p_nit_n
[
4
];
}
static
inline
uint8_t
*
nit_get_header2
(
uint8_t
*
p_nit
)
{
return
p_nit
+
NIT_HEADER_SIZE
+
nit_get_desclength
(
p_nit
);
}
static
inline
uint8_t
*
nit_get_ts
(
uint8_t
*
p_nit
,
uint8_t
n
)
{
uint16_t
i_section_size
=
psi_get_length
(
p_nit
)
+
PSI_HEADER_SIZE
-
PSI_CRC_SIZE
;
uint8_t
*
p_nit_n
=
p_nit
+
NIT_HEADER_SIZE
+
nit_get_desclength
(
p_nit
)
+
NIT_HEADER2_SIZE
;
if
(
p_nit_n
-
p_nit
>
i_section_size
)
return
NULL
;
while
(
n
)
{
if
(
p_nit_n
+
NIT_TS_SIZE
-
p_nit
>
i_section_size
)
return
NULL
;
p_nit_n
+=
NIT_TS_SIZE
+
nitn_get_desclength
(
p_nit_n
);
n
--
;
}
if
(
p_nit_n
-
p_nit
>=
i_section_size
)
return
NULL
;
return
p_nit_n
;
}
static
inline
bool
nit_validate_ts
(
const
uint8_t
*
p_nit
,
const
uint8_t
*
p_nit_n
,
uint16_t
i_desclength
)
{
uint16_t
i_section_size
=
psi_get_length
(
p_nit
)
+
PSI_HEADER_SIZE
-
PSI_CRC_SIZE
;
return
(
p_nit_n
+
NIT_TS_SIZE
+
i_desclength
<=
p_nit
+
i_section_size
);
}
static
inline
bool
nit_validate
(
const
uint8_t
*
p_nit
)
{
uint16_t
i_section_size
=
psi_get_length
(
p_nit
)
+
PSI_HEADER_SIZE
-
PSI_CRC_SIZE
;
const
uint8_t
*
p_nit_n
;
if
(
!
psi_get_syntax
(
p_nit
)
||
(
psi_get_tableid
(
p_nit
)
!=
NIT_TABLE_ID_ACTUAL
&&
psi_get_tableid
(
p_nit
)
!=
NIT_TABLE_ID_OTHER
))
return
false
;
if
(
i_section_size
<
NIT_HEADER_SIZE
||
i_section_size
<
NIT_HEADER_SIZE
+
nit_get_desclength
(
p_nit
))
return
false
;
if
(
!
descs_validate
(
p_nit
+
8
))
return
false
;
p_nit_n
=
p_nit
+
NIT_HEADER_SIZE
+
nit_get_desclength
(
p_nit
);
if
(
nith_get_tslength
(
p_nit_n
)
!=
p_nit
+
i_section_size
-
p_nit_n
-
NIT_HEADER2_SIZE
)
return
false
;
p_nit_n
+=
NIT_HEADER2_SIZE
;
while
(
p_nit_n
+
NIT_TS_SIZE
-
p_nit
<=
i_section_size
&&
p_nit_n
+
NIT_TS_SIZE
+
nitn_get_desclength
(
p_nit_n
)
-
p_nit
<=
i_section_size
)
{
if
(
!
descs_validate
(
p_nit_n
+
4
))
return
false
;
p_nit_n
+=
NIT_TS_SIZE
+
nitn_get_desclength
(
p_nit_n
);
}
return
(
p_nit_n
-
p_nit
==
i_section_size
);
}
static
inline
uint8_t
*
nit_table_find_ts
(
uint8_t
**
pp_sections
,
uint16_t
i_tsid
,
uint16_t
i_onid
)
{
uint8_t
i_last_section
=
psi_table_get_lastsection
(
pp_sections
);
uint8_t
i
;
for
(
i
=
0
;
i
<=
i_last_section
;
i
++
)
{
uint8_t
*
p_section
=
psi_table_get_section
(
pp_sections
,
i
);
uint8_t
*
p_ts
;
int
j
=
0
;
while
((
p_ts
=
nit_get_ts
(
p_section
,
j
))
!=
NULL
)
{
j
++
;
if
(
nitn_get_tsid
(
p_ts
)
==
i_tsid
&&
nitn_get_onid
(
p_ts
)
==
i_onid
)
return
p_ts
;
}
}
return
NULL
;
}
static
inline
bool
nit_table_validate
(
uint8_t
**
pp_sections
)
{
uint8_t
i_last_section
=
psi_table_get_lastsection
(
pp_sections
);
uint8_t
i
;
for
(
i
=
0
;
i
<=
i_last_section
;
i
++
)
{
uint8_t
*
p_section
=
psi_table_get_section
(
pp_sections
,
i
);
uint8_t
*
p_ts
;
int
j
=
0
;
if
(
!
psi_check_crc
(
p_section
))
return
false
;
while
((
p_ts
=
nit_get_ts
(
p_section
,
j
))
!=
NULL
)
{
j
++
;
/* check that the TS is not already in the table */
if
(
nit_table_find_ts
(
pp_sections
,
nitn_get_tsid
(
p_ts
),
nitn_get_onid
(
p_ts
))
!=
p_ts
)
return
false
;
}
}
return
true
;
}
/*****************************************************************************
* Service Description Table
*****************************************************************************/
...
...
dvb/si/nit.h
0 → 100644
View file @
b02260c9
/*****************************************************************************
* nit.h: ETSI EN 300 468 Network Information Table (NIT)
*****************************************************************************
* Copyright (C) 2009-2010 VideoLAN
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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_NIT_H__
#define __BITSTREAM_DVB_NIT_H__
#include <bitstream/common.h>
#include <bitstream/mpeg/psi/psi.h>
#include <bitstream/mpeg/psi/descriptors.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/*****************************************************************************
* Network Information Table
*****************************************************************************/
#define NIT_PID 0x10
#define NIT_TABLE_ID_ACTUAL 0x40
#define NIT_TABLE_ID_OTHER 0x41
#define NIT_HEADER_SIZE (PSI_HEADER_SIZE_SYNTAX1 + 2)
#define NIT_HEADER2_SIZE 2
#define NIT_TS_SIZE 6
#define nit_set_nid psi_set_tableidext
#define nit_get_nid psi_get_tableidext
static
inline
void
nit_init
(
uint8_t
*
p_nit
,
bool
b_actual
)
{
psi_init
(
p_nit
,
true
);
psi_set_tableid
(
p_nit
,
b_actual
?
NIT_TABLE_ID_ACTUAL
:
NIT_TABLE_ID_OTHER
);
p_nit
[
8
]
=
0xf0
;
}
static
inline
void
nit_set_length
(
uint8_t
*
p_nit
,
uint16_t
i_nit_length
)
{
psi_set_length
(
p_nit
,
NIT_HEADER_SIZE
+
PSI_CRC_SIZE
-
PSI_HEADER_SIZE
+
i_nit_length
);
}
static
inline
void
nit_set_desclength
(
uint8_t
*
p_nit
,
uint16_t
i_length
)
{
p_nit
[
8
]
&=
~
0xf
;
p_nit
[
8
]
|=
i_length
>>
8
;
p_nit
[
9
]
=
i_length
&
0xff
;
}
static
inline
uint16_t
nit_get_desclength
(
const
uint8_t
*
p_nit
)
{
return
((
p_nit
[
8
]
&
0xf
)
<<
8
)
|
p_nit
[
9
];
}
static
inline
uint8_t
*
nit_get_descs
(
uint8_t
*
p_nit
)
{
return
&
p_nit
[
8
];
}
static
inline
void
nith_init
(
uint8_t
*
p_nit_h
)
{
p_nit_h
[
0
]
=
0xf0
;
}
static
inline
void
nith_set_tslength
(
uint8_t
*
p_nit_h
,
uint16_t
i_length
)
{
p_nit_h
[
0
]
&=
~
0xf
;
p_nit_h
[
0
]
|=
i_length
>>
8
;
p_nit_h
[
1
]
=
i_length
&
0xff
;
}
static
inline
uint16_t
nith_get_tslength
(
const
uint8_t
*
p_nit_h
)
{
return
((
p_nit_h
[
0
]
&
0xf
)
<<
8
)
|
p_nit_h
[
1
];
}
static
inline
void
nitn_init
(
uint8_t
*
p_nit_n
)
{
p_nit_n
[
4
]
=
0xf0
;
}
static
inline
void
nitn_set_tsid
(
uint8_t
*
p_nit_n
,
uint16_t
i_tsid
)
{
p_nit_n
[
0
]
=
i_tsid
>>
8
;
p_nit_n
[
1
]
=
i_tsid
&
0xff
;
}
static
inline
uint16_t
nitn_get_tsid
(
const
uint8_t
*
p_nit_n
)
{
return
(
p_nit_n
[
0
]
<<
8
)
|
p_nit_n
[
1
];
}
static
inline
void
nitn_set_onid
(
uint8_t
*
p_nit_n
,
uint16_t
i_onid
)
{
p_nit_n
[
2
]
=
i_onid
>>
8
;
p_nit_n
[
3
]
=
i_onid
&
0xff
;
}
static
inline
uint16_t
nitn_get_onid
(
const
uint8_t
*
p_nit_n
)
{
return
(
p_nit_n
[
2
]
<<
8
)
|
p_nit_n
[
3
];
}
static
inline
void
nitn_set_desclength
(
uint8_t
*
p_nit_n
,
uint16_t
i_length
)
{
p_nit_n
[
4
]
&=
~
0xf
;
p_nit_n
[
4
]
|=
i_length
>>
8
;
p_nit_n
[
5
]
=
i_length
&
0xff
;
}
static
inline
uint16_t
nitn_get_desclength
(
const
uint8_t
*
p_nit_n
)
{
return
((
p_nit_n
[
4
]
&
0xf
)
<<
8
)
|
p_nit_n
[
5
];
}
static
inline
uint8_t
*
nitn_get_descs
(
uint8_t
*
p_nit_n
)
{
return
&
p_nit_n
[
4
];
}
static
inline
uint8_t
*
nit_get_header2
(
uint8_t
*
p_nit
)
{
return
p_nit
+
NIT_HEADER_SIZE
+
nit_get_desclength
(
p_nit
);
}
static
inline
uint8_t
*
nit_get_ts
(
uint8_t
*
p_nit
,
uint8_t
n
)
{
uint16_t
i_section_size
=
psi_get_length
(
p_nit
)
+
PSI_HEADER_SIZE
-
PSI_CRC_SIZE
;
uint8_t
*
p_nit_n
=
p_nit
+
NIT_HEADER_SIZE
+
nit_get_desclength
(
p_nit
)
+
NIT_HEADER2_SIZE
;
if
(
p_nit_n
-
p_nit
>
i_section_size
)
return
NULL
;
while
(
n
)
{
if
(
p_nit_n
+
NIT_TS_SIZE
-
p_nit
>
i_section_size
)
return
NULL
;
p_nit_n
+=
NIT_TS_SIZE
+
nitn_get_desclength
(
p_nit_n
);
n
--
;
}
if
(
p_nit_n
-
p_nit
>=
i_section_size
)
return
NULL
;
return
p_nit_n
;
}
static
inline
bool
nit_validate_ts
(
const
uint8_t
*
p_nit
,
const
uint8_t
*
p_nit_n
,
uint16_t
i_desclength
)
{
uint16_t
i_section_size
=
psi_get_length
(
p_nit
)
+
PSI_HEADER_SIZE
-
PSI_CRC_SIZE
;
return
(
p_nit_n
+
NIT_TS_SIZE
+
i_desclength
<=
p_nit
+
i_section_size
);
}
static
inline
bool
nit_validate
(
const
uint8_t
*
p_nit
)
{
uint16_t
i_section_size
=
psi_get_length
(
p_nit
)
+
PSI_HEADER_SIZE
-
PSI_CRC_SIZE
;
const
uint8_t
*
p_nit_n
;
if
(
!
psi_get_syntax
(
p_nit
)
||
(
psi_get_tableid
(
p_nit
)
!=
NIT_TABLE_ID_ACTUAL
&&
psi_get_tableid
(
p_nit
)
!=
NIT_TABLE_ID_OTHER
))
return
false
;
if
(
i_section_size
<
NIT_HEADER_SIZE
||
i_section_size
<
NIT_HEADER_SIZE
+
nit_get_desclength
(
p_nit
))
return
false
;
if
(
!
descs_validate
(
p_nit
+
8
))
return
false
;
p_nit_n
=
p_nit
+
NIT_HEADER_SIZE
+
nit_get_desclength
(
p_nit
);
if
(
nith_get_tslength
(
p_nit_n
)
!=
p_nit
+
i_section_size
-
p_nit_n
-
NIT_HEADER2_SIZE
)
return
false
;
p_nit_n
+=
NIT_HEADER2_SIZE
;
while
(
p_nit_n
+
NIT_TS_SIZE
-
p_nit
<=
i_section_size
&&
p_nit_n
+
NIT_TS_SIZE
+
nitn_get_desclength
(
p_nit_n
)
-
p_nit
<=
i_section_size
)
{
if
(
!
descs_validate
(
p_nit_n
+
4
))
return
false
;
p_nit_n
+=
NIT_TS_SIZE
+
nitn_get_desclength
(
p_nit_n
);
}
return
(
p_nit_n
-
p_nit
==
i_section_size
);
}
static
inline
uint8_t
*
nit_table_find_ts
(
uint8_t
**
pp_sections
,
uint16_t
i_tsid
,
uint16_t
i_onid
)
{
uint8_t
i_last_section
=
psi_table_get_lastsection
(
pp_sections
);
uint8_t
i
;
for
(
i
=
0
;
i
<=
i_last_section
;
i
++
)
{
uint8_t
*
p_section
=
psi_table_get_section
(
pp_sections
,
i
);
uint8_t
*
p_ts
;
int
j
=
0
;
while
((
p_ts
=
nit_get_ts
(
p_section
,
j
))
!=
NULL
)
{
j
++
;
if
(
nitn_get_tsid
(
p_ts
)
==
i_tsid
&&
nitn_get_onid
(
p_ts
)
==
i_onid
)
return
p_ts
;
}
}
return
NULL
;
}
static
inline
bool
nit_table_validate
(
uint8_t
**
pp_sections
)
{
uint8_t
i_last_section
=
psi_table_get_lastsection
(
pp_sections
);
uint8_t
i
;
for
(
i
=
0
;
i
<=
i_last_section
;
i
++
)
{
uint8_t
*
p_section
=
psi_table_get_section
(
pp_sections
,
i
);
uint8_t
*
p_ts
;
int
j
=
0
;
if
(
!
psi_check_crc
(
p_section
))
return
false
;
while
((
p_ts
=
nit_get_ts
(
p_section
,
j
))
!=
NULL
)
{
j
++
;
/* check that the TS is not already in the table */
if
(
nit_table_find_ts
(
pp_sections
,
nitn_get_tsid
(
p_ts
),
nitn_get_onid
(
p_ts
))
!=
p_ts
)
return
false
;
}
}
return
true
;
}
#ifdef __cplusplus
}
#endif
#endif
dvb/si/nit_print.h
0 → 100644
View file @
b02260c9
/*****************************************************************************
* nit_print.h: ETSI EN 300 468 Network Information Table (NIT) (printing)
*****************************************************************************
* Copyright (C) 2010 VideoLAN
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* 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.
*****************************************************************************/
#ifndef __BITSTREAM_DVB_NIT_PRINT_H__
#define __BITSTREAM_DVB_NIT_PRINT_H__
#include <bitstream/common.h>
#include <bitstream/mpeg/psi/psi.h>
#include <bitstream/mpeg/psi/descs_print.h>
#include <bitstream/dvb/si/nit.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/*****************************************************************************
* Network Information Table
*****************************************************************************/
static
inline
void
nit_table_print
(
uint8_t
**
pp_sections
,
f_print
pf_print
,
void
*
print_opaque
,
f_iconv
pf_iconv
,
void
*
iconv_opaque
,
print_type_t
i_print_type
)
{
uint8_t
i_last_section
=
psi_table_get_lastsection
(
pp_sections
);
uint8_t
i
;
switch
(
i_print_type
)
{
case
PRINT_XML
:
pf_print
(
print_opaque
,
"<NIT tid=
\"
%hhu
\"
networkid=
\"
%hu
\"
version=
\"
%hhu
\"
current_next=
\"
%d
\"
>"
,
psi_table_get_tableid
(
pp_sections
),
psi_table_get_tableidext
(
pp_sections
),
psi_table_get_version
(
pp_sections
),
!
psi_table_get_current
(
pp_sections
)
?
0
:
1
);
break
;
default:
pf_print
(
print_opaque
,
"new NIT %s networkid=%hu version=%hhu%s"
,
psi_table_get_tableid
(
pp_sections
)
==
NIT_TABLE_ID_ACTUAL
?
"actual"
:
"other"
,
psi_table_get_tableidext
(
pp_sections
),
psi_table_get_version
(
pp_sections
),
!
psi_table_get_current
(
pp_sections
)
?
" (next)"
:
""
);
}
descs_print
(
nit_get_descs
(
psi_table_get_section
(
pp_sections
,
0
)),
pf_print
,
print_opaque
,
pf_iconv
,
iconv_opaque
,
i_print_type
);
for
(
i
=
0
;
i
<=
i_last_section
;
i
++
)
{
uint8_t
*
p_section
=
psi_table_get_section
(
pp_sections
,
i
);
uint8_t
*
p_ts
;
int
j
=
0
;
while
((
p_ts
=
nit_get_ts
(
p_section
,
j
))
!=
NULL
)
{
j
++
;
switch
(
i_print_type
)
{
case
PRINT_XML
:
pf_print
(
print_opaque
,
"<TS tsid=
\"
%hu
\"
onid=
\"
%hu
\"
>"
,
nitn_get_tsid
(
p_ts
),
nitn_get_onid
(
p_ts
));
break
;
default:
pf_print
(
print_opaque
,
" * ts tsid=%hu onid=%hu"
,
nitn_get_tsid
(
p_ts
),
nitn_get_onid
(
p_ts
));
}
descs_print
(
nitn_get_descs
(
p_ts
),
pf_print
,
print_opaque
,
pf_iconv
,
iconv_opaque
,
i_print_type
);
switch
(
i_print_type
)
{
case
PRINT_XML
:
pf_print
(
print_opaque
,
"</TS>"
);
break
;
default:
break
;
}
}
}
switch
(
i_print_type
)
{
case
PRINT_XML
:
pf_print
(
print_opaque
,
"</NIT>"
);
break
;
default:
pf_print
(
print_opaque
,
"end NIT"
);
}
}
#ifdef __cplusplus
}
#endif
#endif
dvb/si_print.h
View file @
b02260c9
...
...
@@ -149,75 +149,7 @@ static inline void descs_print(uint8_t *p_descs,
pf_print
,
print_opaque
,
pf_iconv
,
iconv_opaque
,
i_print_type
);
}
/*****************************************************************************
* Network Information Table
*****************************************************************************/
static
inline
void
nit_table_print
(
uint8_t
**
pp_sections
,
f_print
pf_print
,
void
*
print_opaque
,
f_iconv
pf_iconv
,
void
*
iconv_opaque
,
print_type_t
i_print_type
)
{
uint8_t
i_last_section
=
psi_table_get_lastsection
(
pp_sections
);
uint8_t
i
;
switch
(
i_print_type
)
{
case
PRINT_XML
:
pf_print
(
print_opaque
,
"<NIT tid=
\"
%hhu
\"
networkid=
\"
%hu
\"
version=
\"
%hhu
\"
current_next=
\"
%d
\"
>"
,
psi_table_get_tableid
(
pp_sections
),
psi_table_get_tableidext
(
pp_sections
),
psi_table_get_version
(
pp_sections
),
!
psi_table_get_current
(
pp_sections
)
?
0
:
1
);
break
;
default:
pf_print
(
print_opaque
,
"new NIT %s networkid=%hu version=%hhu%s"
,
psi_table_get_tableid
(
pp_sections
)
==
NIT_TABLE_ID_ACTUAL
?
"actual"
:
"other"
,
psi_table_get_tableidext
(
pp_sections
),
psi_table_get_version
(
pp_sections
),
!
psi_table_get_current
(
pp_sections
)
?
" (next)"
:
""
);
}
descs_print
(
nit_get_descs
(
psi_table_get_section
(
pp_sections
,
0
)),
pf_print
,
print_opaque
,
pf_iconv
,
iconv_opaque
,
i_print_type
);
for
(
i
=
0
;
i
<=
i_last_section
;
i
++
)
{
uint8_t
*
p_section
=
psi_table_get_section
(
pp_sections
,
i
);
uint8_t
*
p_ts
;
int
j
=
0
;
while
((
p_ts
=
nit_get_ts
(
p_section
,
j
))
!=
NULL
)
{
j
++
;
switch
(
i_print_type
)
{
case
PRINT_XML
:
pf_print
(
print_opaque
,
"<TS tsid=
\"
%hu
\"
onid=
\"
%hu
\"
>"
,
nitn_get_tsid
(
p_ts
),
nitn_get_onid
(
p_ts
));
break
;
default:
pf_print
(
print_opaque
,
" * ts tsid=%hu onid=%hu"
,
nitn_get_tsid
(
p_ts
),
nitn_get_onid
(
p_ts
));
}
descs_print
(
nitn_get_descs
(
p_ts
),
pf_print
,
print_opaque
,
pf_iconv
,
iconv_opaque
,
i_print_type
);
switch
(
i_print_type
)
{
case
PRINT_XML
:
pf_print
(
print_opaque
,
"</TS>"
);
break
;
default:
break
;
}
}
}
switch
(
i_print_type
)
{
case
PRINT_XML
:
pf_print
(
print_opaque
,
"</NIT>"
);
break
;
default:
pf_print
(
print_opaque
,
"end NIT"
);
}
}
#include <bitstream/dvb/si/nit_print.h>
/*****************************************************************************
* Service Description Table
...
...
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