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
834db590
Commit
834db590
authored
Feb 16, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/table/pmt*: Cleanup
- Use bool for structure members that are used as bools - Indentation
parent
dc475fd5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
114 deletions
+107
-114
src/tables/pmt.c
src/tables/pmt.c
+103
-110
src/tables/pmt.h
src/tables/pmt.h
+3
-3
src/tables/pmt_private.h
src/tables/pmt_private.h
+1
-1
No files found.
src/tables/pmt.c
View file @
834db590
...
@@ -71,7 +71,7 @@ bool dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, uint16_t i_program_number,
...
@@ -71,7 +71,7 @@ bool dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, uint16_t i_program_number,
/* PSI decoder initial state */
/* PSI decoder initial state */
p_pmt_decoder
->
i_continuity_counter
=
31
;
p_pmt_decoder
->
i_continuity_counter
=
31
;
p_pmt_decoder
->
b_discontinuity
=
1
;
p_pmt_decoder
->
b_discontinuity
=
true
;
p_pmt_decoder
->
p_current_section
=
NULL
;
p_pmt_decoder
->
p_current_section
=
NULL
;
/* PMT decoder configuration */
/* PMT decoder configuration */
...
@@ -80,7 +80,7 @@ bool dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, uint16_t i_program_number,
...
@@ -80,7 +80,7 @@ bool dvbpsi_AttachPMT(dvbpsi_t *p_dvbpsi, uint16_t i_program_number,
p_pmt_decoder
->
p_cb_data
=
p_cb_data
;
p_pmt_decoder
->
p_cb_data
=
p_cb_data
;
/* PMT decoder initial state */
/* PMT decoder initial state */
p_pmt_decoder
->
b_current_valid
=
0
;
p_pmt_decoder
->
b_current_valid
=
false
;
p_pmt_decoder
->
p_building_pmt
=
NULL
;
p_pmt_decoder
->
p_building_pmt
=
NULL
;
for
(
unsigned
int
i
=
0
;
i
<=
255
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<=
255
;
i
++
)
p_pmt_decoder
->
ap_sections
[
i
]
=
NULL
;
p_pmt_decoder
->
ap_sections
[
i
]
=
NULL
;
...
@@ -120,7 +120,7 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi)
...
@@ -120,7 +120,7 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi)
* Initialize a pre-allocated dvbpsi_pmt_t structure.
* Initialize a pre-allocated dvbpsi_pmt_t structure.
*****************************************************************************/
*****************************************************************************/
void
dvbpsi_InitPMT
(
dvbpsi_pmt_t
*
p_pmt
,
uint16_t
i_program_number
,
void
dvbpsi_InitPMT
(
dvbpsi_pmt_t
*
p_pmt
,
uint16_t
i_program_number
,
uint8_t
i_version
,
int
b_current_next
,
uint16_t
i_pcr_pid
)
uint8_t
i_version
,
bool
b_current_next
,
uint16_t
i_pcr_pid
)
{
{
p_pmt
->
i_program_number
=
i_program_number
;
p_pmt
->
i_program_number
=
i_program_number
;
p_pmt
->
i_version
=
i_version
;
p_pmt
->
i_version
=
i_version
;
...
@@ -247,8 +247,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
...
@@ -247,8 +247,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
dvbpsi_pmt_decoder_t
*
p_pmt_decoder
=
(
dvbpsi_pmt_decoder_t
*
)
p_dvbpsi
->
p_private
;
dvbpsi_pmt_decoder_t
*
p_pmt_decoder
=
(
dvbpsi_pmt_decoder_t
*
)
p_dvbpsi
->
p_private
;
assert
(
p_pmt_decoder
);
assert
(
p_pmt_decoder
);
int
b_append
=
1
;
bool
b_reinit
=
false
;
int
b_reinit
=
0
;
dvbpsi_debug
(
p_dvbpsi
,
"PMT decoder"
,
dvbpsi_debug
(
p_dvbpsi
,
"PMT decoder"
,
"Table version %2d, "
"i_extension %5d, "
"Table version %2d, "
"i_extension %5d, "
...
@@ -263,31 +262,32 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
...
@@ -263,31 +262,32 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
"invalid section (table_id == 0x%02x)"
,
"invalid section (table_id == 0x%02x)"
,
p_section
->
i_table_id
);
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 */
/* Invalid section_syntax_indicator */
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
"invalid section (section_syntax_indicator == 0)"
);
"invalid section (section_syntax_indicator == 0)"
);
b_append
=
0
;
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
}
/* Now if b_append is true then we have a valid PMT section */
/* Now if b_append is true then we have a valid PMT section */
if
(
b_append
&&
(
p_pmt_decoder
->
i_program_number
!=
p_section
->
i_extension
)
)
if
(
p_pmt_decoder
->
i_program_number
!=
p_section
->
i_extension
)
{
{
/* Invalid program_number */
/* Invalid program_number */
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
"'program_number' don't match"
);
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
"'program_number' don't match"
);
b_append
=
0
;
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
}
if
(
b_append
)
{
/* TS discontinuity check */
/* TS discontinuity check */
if
(
p_pmt_decoder
->
b_discontinuity
)
if
(
p_pmt_decoder
->
b_discontinuity
)
{
{
b_reinit
=
1
;
b_reinit
=
true
;
p_pmt_decoder
->
b_discontinuity
=
0
;
p_pmt_decoder
->
b_discontinuity
=
0
;
}
}
else
else
...
@@ -298,19 +298,17 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
...
@@ -298,19 +298,17 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
if
(
p_pmt_decoder
->
p_building_pmt
->
i_version
!=
p_section
->
i_version
)
if
(
p_pmt_decoder
->
p_building_pmt
->
i_version
!=
p_section
->
i_version
)
{
{
/* version_number */
/* version_number */
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
"'version_number' differs"
"'version_number' differs"
" whereas no discontinuity has occured"
);
" whereas no discontinuity has occured"
);
b_reinit
=
1
;
b_reinit
=
true
;
}
}
else
if
(
p_pmt_decoder
->
i_last_section_number
else
if
(
p_pmt_decoder
->
i_last_section_number
!=
p_section
->
i_last_number
)
!=
p_section
->
i_last_number
)
{
{
/* last_section_number */
/* last_section_number */
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
dvbpsi_error
(
p_dvbpsi
,
"PMT decoder"
,
"'last_section_number' differs"
"'last_section_number' differs"
" whereas no discontinuity has occured"
);
" whereas no discontinuity has occured"
);
b_reinit
=
1
;
b_reinit
=
true
;
}
}
}
}
else
else
...
@@ -321,8 +319,11 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
...
@@ -321,8 +319,11 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
p_section
->
b_current_next
))
p_section
->
b_current_next
))
{
{
/* Don't decode since this version is already decoded */
/* Don't decode since this version is already decoded */
b_append
=
0
;
dvbpsi_debug
(
p_dvbpsi
,
"PMT decoder"
,
}
"ignoring already decoded section %d"
,
p_section
->
i_number
);
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
}
}
}
}
}
...
@@ -331,7 +332,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
...
@@ -331,7 +332,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
if
(
b_reinit
)
if
(
b_reinit
)
{
{
/* Force redecoding */
/* Force redecoding */
p_pmt_decoder
->
b_current_valid
=
0
;
p_pmt_decoder
->
b_current_valid
=
false
;
/* Free structures */
/* Free structures */
if
(
p_pmt_decoder
->
p_building_pmt
)
if
(
p_pmt_decoder
->
p_building_pmt
)
...
@@ -352,9 +353,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
...
@@ -352,9 +353,7 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
}
}
/* Append the section to the list if wanted */
/* Append the section to the list if wanted */
if
(
b_append
)
bool
b_complete
=
false
;
{
int
b_complete
;
/* Initialize the structures if it's the first section received */
/* Initialize the structures if it's the first section received */
if
(
!
p_pmt_decoder
->
p_building_pmt
)
if
(
!
p_pmt_decoder
->
p_building_pmt
)
...
@@ -383,21 +382,20 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
...
@@ -383,21 +382,20 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
p_pmt_decoder
->
ap_sections
[
p_section
->
i_number
]
=
p_section
;
p_pmt_decoder
->
ap_sections
[
p_section
->
i_number
]
=
p_section
;
/* Check if we have all the sections */
/* Check if we have all the sections */
b_complete
=
0
;
for
(
unsigned
int
i
=
0
;
i
<=
p_pmt_decoder
->
i_last_section_number
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<=
p_pmt_decoder
->
i_last_section_number
;
i
++
)
{
{
if
(
!
p_pmt_decoder
->
ap_sections
[
i
])
if
(
!
p_pmt_decoder
->
ap_sections
[
i
])
break
;
break
;
if
(
i
==
p_pmt_decoder
->
i_last_section_number
)
if
(
i
==
p_pmt_decoder
->
i_last_section_number
)
b_complete
=
1
;
b_complete
=
true
;
}
}
if
(
b_complete
)
if
(
b_complete
)
{
{
/* Save the current information */
/* Save the current information */
p_pmt_decoder
->
current_pmt
=
*
p_pmt_decoder
->
p_building_pmt
;
p_pmt_decoder
->
current_pmt
=
*
p_pmt_decoder
->
p_building_pmt
;
p_pmt_decoder
->
b_current_valid
=
1
;
p_pmt_decoder
->
b_current_valid
=
true
;
/* Chain the sections */
/* Chain the sections */
if
(
p_pmt_decoder
->
i_last_section_number
)
if
(
p_pmt_decoder
->
i_last_section_number
)
{
{
...
@@ -418,11 +416,6 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
...
@@ -418,11 +416,6 @@ void dvbpsi_GatherPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_sectio
for
(
unsigned
int
i
=
0
;
i
<=
p_pmt_decoder
->
i_last_section_number
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<=
p_pmt_decoder
->
i_last_section_number
;
i
++
)
p_pmt_decoder
->
ap_sections
[
i
]
=
NULL
;
p_pmt_decoder
->
ap_sections
[
i
]
=
NULL
;
}
}
}
else
{
dvbpsi_DeletePSISections
(
p_section
);
}
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -590,8 +583,8 @@ dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_t* p_
...
@@ -590,8 +583,8 @@ dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_t *p_dvbpsi, dvbpsi_pmt_t* p_
p_prev
->
p_next
=
p_current
;
p_prev
->
p_next
=
p_current
;
p_current
->
i_table_id
=
0x02
;
p_current
->
i_table_id
=
0x02
;
p_current
->
b_syntax_indicator
=
1
;
p_current
->
b_syntax_indicator
=
true
;
p_current
->
b_private_indicator
=
0
;
p_current
->
b_private_indicator
=
false
;
p_current
->
i_length
=
13
;
/* header + CRC_32 */
p_current
->
i_length
=
13
;
/* header + CRC_32 */
p_current
->
i_extension
=
p_pmt
->
i_program_number
;
p_current
->
i_extension
=
p_pmt
->
i_program_number
;
p_current
->
i_version
=
p_pmt
->
i_version
;
p_current
->
i_version
=
p_pmt
->
i_version
;
...
...
src/tables/pmt.h
View file @
834db590
...
@@ -82,7 +82,7 @@ typedef struct dvbpsi_pmt_s
...
@@ -82,7 +82,7 @@ typedef struct dvbpsi_pmt_s
{
{
uint16_t
i_program_number
;
/*!< program_number */
uint16_t
i_program_number
;
/*!< program_number */
uint8_t
i_version
;
/*!< version_number */
uint8_t
i_version
;
/*!< version_number */
int
b_current_next
;
/*!< current_next_indicator */
bool
b_current_next
;
/*!< current_next_indicator */
uint16_t
i_pcr_pid
;
/*!< PCR_PID */
uint16_t
i_pcr_pid
;
/*!< PCR_PID */
...
@@ -139,7 +139,7 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi);
...
@@ -139,7 +139,7 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi);
*****************************************************************************/
*****************************************************************************/
/*!
/*!
* \fn void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number,
* \fn void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number,
uint8_t i_version,
int
b_current_next,
uint8_t i_version,
bool
b_current_next,
uint16_t i_pcr_pid)
uint16_t i_pcr_pid)
* \brief Initialize a user-allocated dvbpsi_pmt_t structure.
* \brief Initialize a user-allocated dvbpsi_pmt_t structure.
* \param p_pmt pointer to the PMT structure
* \param p_pmt pointer to the PMT structure
...
@@ -150,7 +150,7 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi);
...
@@ -150,7 +150,7 @@ void dvbpsi_DetachPMT(dvbpsi_t *p_dvbpsi);
* \return nothing.
* \return nothing.
*/
*/
void
dvbpsi_InitPMT
(
dvbpsi_pmt_t
*
p_pmt
,
uint16_t
i_program_number
,
void
dvbpsi_InitPMT
(
dvbpsi_pmt_t
*
p_pmt
,
uint16_t
i_program_number
,
uint8_t
i_version
,
int
b_current_next
,
uint16_t
i_pcr_pid
);
uint8_t
i_version
,
bool
b_current_next
,
uint16_t
i_pcr_pid
);
/*!
/*!
* \def dvbpsi_NewPMT(p_pmt, i_program_number,
* \def dvbpsi_NewPMT(p_pmt, i_program_number,
...
...
src/tables/pmt_private.h
View file @
834db590
...
@@ -45,7 +45,7 @@ typedef struct dvbpsi_pmt_decoder_s
...
@@ -45,7 +45,7 @@ typedef struct dvbpsi_pmt_decoder_s
dvbpsi_pmt_t
current_pmt
;
dvbpsi_pmt_t
current_pmt
;
dvbpsi_pmt_t
*
p_building_pmt
;
dvbpsi_pmt_t
*
p_building_pmt
;
int
b_current_valid
;
bool
b_current_valid
;
uint8_t
i_last_section_number
;
uint8_t
i_last_section_number
;
dvbpsi_psi_section_t
*
ap_sections
[
256
];
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