Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libdvbpsi
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
libdvbpsi
Commits
b80d45d1
Commit
b80d45d1
authored
Mar 15, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/table/nit*: Cleanup
- Use bool for structure members that are used as bools - Indentation
parent
e950dbfb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
118 deletions
+111
-118
src/tables/nit.c
src/tables/nit.c
+103
-110
src/tables/nit.h
src/tables/nit.h
+6
-6
src/tables/nit_private.h
src/tables/nit_private.h
+2
-2
No files found.
src/tables/nit.c
View file @
b80d45d1
/*****************************************************************************
* nit.c: NIT decoder/generator
*----------------------------------------------------------------------------
* Copyright (C) 2001-201
0
VideoLAN
* Copyright (C) 2001-201
1
VideoLAN
* $Id$
*
* Authors: Johann Hanne
...
...
@@ -101,7 +101,7 @@ bool dvbpsi_AttachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
p_nit_decoder
->
pf_nit_callback
=
pf_callback
;
p_nit_decoder
->
p_cb_data
=
p_cb_data
;
/* NIT decoder initial state */
p_nit_decoder
->
b_current_valid
=
0
;
p_nit_decoder
->
b_current_valid
=
false
;
p_nit_decoder
->
p_building_nit
=
NULL
;
for
(
unsigned
int
i
=
0
;
i
<=
255
;
i
++
)
p_nit_decoder
->
ap_sections
[
i
]
=
NULL
;
...
...
@@ -157,7 +157,7 @@ void dvbpsi_DetachNIT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id,
* Initialize a pre-allocated dvbpsi_nit_t structure.
*****************************************************************************/
void
dvbpsi_InitNIT
(
dvbpsi_nit_t
*
p_nit
,
uint16_t
i_network_id
,
uint8_t
i_version
,
int
b_current_next
)
uint8_t
i_version
,
bool
b_current_next
)
{
p_nit
->
i_network_id
=
i_network_id
;
p_nit
->
i_version
=
i_version
;
...
...
@@ -281,8 +281,8 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
{
dvbpsi_nit_decoder_t
*
p_nit_decoder
=
(
dvbpsi_nit_decoder_t
*
)
p_private_decoder
;
int
b_append
=
1
;
int
b_reinit
=
0
;
assert
(
p_dvbpsi
)
;
dvbpsi_debug
(
p_dvbpsi
,
"NIT decoder"
,
"Table version %2d, "
"i_extension %5d, "
...
...
@@ -297,31 +297,34 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
dvbpsi_error
(
p_dvbpsi
,
"NIT decoder"
,
"invalid section (table_id == 0x%02x)"
,
p_section
->
i_table_id
);
b_append
=
0
;
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
if
(
b_append
&&
!
p_section
->
b_syntax_indicator
)
if
(
!
p_section
->
b_syntax_indicator
)
{
/* Invalid section_syntax_indicator */
dvbpsi_error
(
p_dvbpsi
,
"NIT decoder"
,
"invalid section (section_syntax_indicator == 0)"
);
b_append
=
0
;
"invalid section (section_syntax_indicator == false)"
);
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
/* Now if b_append is true then we have a valid NIT section */
if
(
b_append
&&
(
p_nit_decoder
->
i_network_id
!=
p_section
->
i_extension
)
)
if
(
p_nit_decoder
->
i_network_id
!=
p_section
->
i_extension
)
{
/* Invalid program_number */
dvbpsi_error
(
p_dvbpsi
,
"NIT decoder"
,
"'network_id' don't match"
);
b_append
=
0
;
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
if
(
b_append
)
{
bool
b_reinit
=
false
;
/* TS discontinuity check */
if
(
p_nit_decoder
->
b_discontinuity
)
{
b_reinit
=
1
;
b_reinit
=
true
;
p_nit_decoder
->
b_discontinuity
=
false
;
}
else
...
...
@@ -335,7 +338,7 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
dvbpsi_error
(
p_dvbpsi
,
"NIT decoder"
,
"'version_number' differs"
" whereas no discontinuity has occured"
);
b_reinit
=
1
;
b_reinit
=
true
;
}
else
if
(
p_nit_decoder
->
i_last_section_number
!=
p_section
->
i_last_number
)
...
...
@@ -344,19 +347,18 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
dvbpsi_error
(
p_dvbpsi
,
"NIT decoder"
,
"'last_section_number' differs"
" whereas no discontinuity has occured"
);
b_reinit
=
1
;
b_reinit
=
true
;
}
}
else
{
if
(
(
p_nit_decoder
->
b_current_valid
)
&&
(
p_nit_decoder
->
current_nit
.
i_version
==
p_section
->
i_version
)
&&
(
p_nit_decoder
->
current_nit
.
b_current_next
==
p_section
->
b_current_next
))
&&
(
p_nit_decoder
->
current_nit
.
b_current_next
==
p_section
->
b_current_next
))
{
/* Don't decode since this version is already decoded */
b_append
=
0
;
}
dvbpsi_DeletePSISections
(
p_section
)
;
return
;;
}
}
}
...
...
@@ -365,7 +367,7 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
if
(
b_reinit
)
{
/* Force redecoding */
p_nit_decoder
->
b_current_valid
=
0
;
p_nit_decoder
->
b_current_valid
=
false
;
/* Free structures */
if
(
p_nit_decoder
->
p_building_nit
)
{
...
...
@@ -383,11 +385,6 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
}
}
/* Append the section to the list if wanted */
if
(
b_append
)
{
int
b_complete
;
/* Initialize the structures if it's the first section received */
if
(
!
p_nit_decoder
->
p_building_nit
)
{
...
...
@@ -412,20 +409,21 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
p_nit_decoder
->
ap_sections
[
p_section
->
i_number
]
=
p_section
;
/* Check if we have all the sections */
b_complete
=
0
;
bool
b_complete
=
false
;
for
(
unsigned
int
i
=
0
;
i
<=
p_nit_decoder
->
i_last_section_number
;
i
++
)
{
if
(
!
p_nit_decoder
->
ap_sections
[
i
])
break
;
if
(
i
==
p_nit_decoder
->
i_last_section_number
)
b_complete
=
1
;
b_complete
=
true
;
}
if
(
b_complete
)
{
/* Save the current information */
p_nit_decoder
->
current_nit
=
*
p_nit_decoder
->
p_building_nit
;
p_nit_decoder
->
b_current_valid
=
1
;
p_nit_decoder
->
b_current_valid
=
true
;
/* Chain the sections */
if
(
p_nit_decoder
->
i_last_section_number
)
{
...
...
@@ -446,11 +444,6 @@ void dvbpsi_GatherNITSections(dvbpsi_t *p_dvbpsi,
for
(
unsigned
int
i
=
0
;
i
<=
p_nit_decoder
->
i_last_section_number
;
i
++
)
p_nit_decoder
->
ap_sections
[
i
]
=
NULL
;
}
}
else
{
dvbpsi_DeletePSISections
(
p_section
);
}
}
/*****************************************************************************
...
...
@@ -531,8 +524,8 @@ dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_t *p_dvbpsi,
uint8_t
*
p_transport_stream_loop_length
;
p_current
->
i_table_id
=
i_table_id
;
p_current
->
b_syntax_indicator
=
1
;
p_current
->
b_private_indicator
=
0
;
p_current
->
b_syntax_indicator
=
true
;
p_current
->
b_private_indicator
=
false
;
p_current
->
i_length
=
13
;
/* including CRC_32 */
p_current
->
i_extension
=
p_nit
->
i_network_id
;
p_current
->
i_version
=
p_nit
->
i_version
;
...
...
@@ -564,8 +557,8 @@ dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_t *p_dvbpsi,
p_prev
->
p_next
=
p_current
;
p_current
->
i_table_id
=
i_table_id
;
p_current
->
b_syntax_indicator
=
1
;
p_current
->
b_private_indicator
=
0
;
p_current
->
b_syntax_indicator
=
true
;
p_current
->
b_private_indicator
=
false
;
p_current
->
i_length
=
13
;
/* including CRC_32 */
p_current
->
i_extension
=
p_nit
->
i_network_id
;
p_current
->
i_version
=
p_nit
->
i_version
;
...
...
@@ -635,8 +628,8 @@ dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_t *p_dvbpsi,
p_prev
->
p_next
=
p_current
;
p_current
->
i_table_id
=
i_table_id
;
p_current
->
b_syntax_indicator
=
1
;
p_current
->
b_private_indicator
=
0
;
p_current
->
b_syntax_indicator
=
true
;
p_current
->
b_private_indicator
=
false
;
p_current
->
i_length
=
13
;
/* including CRC_32 */
p_current
->
i_extension
=
p_nit
->
i_network_id
;
p_current
->
i_version
=
p_nit
->
i_version
;
...
...
src/tables/nit.h
View file @
b80d45d1
/*****************************************************************************
* nit.h
* Copyright (C) 2001-201
0
VideoLAN
* Copyright (C) 2001-201
1
VideoLAN
* $Id$
*
* Authors: Johann Hanne
...
...
@@ -84,7 +84,7 @@ typedef struct dvbpsi_nit_s
{
uint16_t
i_network_id
;
/*!< network_id */
uint8_t
i_version
;
/*!< version_number */
int
b_current_next
;
/*!< current_next_indicator */
bool
b_current_next
;
/*!< current_next_indicator */
dvbpsi_descriptor_t
*
p_first_descriptor
;
/*!< descriptor list */
...
...
@@ -141,7 +141,7 @@ void dvbpsi_DetachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
*****************************************************************************/
/*!
* \fn void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id,
uint8_t i_version,
int
b_current_next)
uint8_t i_version,
bool
b_current_next)
* \brief Initialize a user-allocated dvbpsi_nit_t structure.
* \param p_nit pointer to the NIT structure
* \param i_network_id network id
...
...
@@ -150,7 +150,7 @@ void dvbpsi_DetachNIT(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
* \return nothing.
*/
void
dvbpsi_InitNIT
(
dvbpsi_nit_t
*
p_nit
,
uint16_t
i_network_id
,
uint8_t
i_version
,
int
b_current_next
);
uint8_t
i_version
,
bool
b_current_next
);
/*!
* \def dvbpsi_NewNIT(p_nit, i_network_id,
...
...
@@ -208,9 +208,9 @@ do { \
* \param p_data descriptor's data
* \return a pointer to the added descriptor.
*/
dvbpsi_descriptor_t
*
dvbpsi_NITAddDescriptor
(
dvbpsi_nit_t
*
p_nit
,
dvbpsi_descriptor_t
*
dvbpsi_NITAddDescriptor
(
dvbpsi_nit_t
*
p_nit
,
uint8_t
i_tag
,
uint8_t
i_length
,
uint8_t
*
p_data
);
uint8_t
*
p_data
);
/*****************************************************************************
* dvbpsi_NITAddTS
...
...
src/tables/nit_private.h
View file @
b80d45d1
/*****************************************************************************
* nit_private.h: private NIT structures
*----------------------------------------------------------------------------
* Copyright (C) 2001-201
0
VideoLAN
* Copyright (C) 2001-201
1
VideoLAN
* $Id$
*
* Authors: Johann Hanne
...
...
@@ -47,7 +47,7 @@ typedef struct dvbpsi_nit_decoder_s
dvbpsi_nit_t
current_nit
;
dvbpsi_nit_t
*
p_building_nit
;
int
b_current_valid
;
bool
b_current_valid
;
uint8_t
i_last_section_number
;
dvbpsi_psi_section_t
*
ap_sections
[
256
];
...
...
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