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
4fc878e7
Commit
4fc878e7
authored
Feb 14, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/psi.{c,h}: Cleanup
- Introduce bool for things that are used as bools - Indentation
parent
a0622578
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
64 deletions
+47
-64
src/psi.c
src/psi.c
+43
-53
src/psi.h
src/psi.h
+4
-11
No files found.
src/psi.c
View file @
4fc878e7
/*****************************************************************************
* psi.c: common PSI functions
*----------------------------------------------------------------------------
* Copyright (C) 2001-201
0
VideoLAN
* Copyright (C) 2001-201
1
VideoLAN
* $Id$
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
...
...
@@ -24,7 +24,6 @@
*
*****************************************************************************/
#include "config.h"
#include <stdio.h>
...
...
@@ -41,52 +40,46 @@
#include "dvbpsi_private.h"
#include "psi.h"
/*****************************************************************************
* dvbpsi_NewPSISection
*****************************************************************************
* Creation of a new dvbpsi_psi_section_t structure.
*****************************************************************************/
dvbpsi_psi_section_t
*
dvbpsi_NewPSISection
(
int
i_max_size
)
dvbpsi_psi_section_t
*
dvbpsi_NewPSISection
(
int
i_max_size
)
{
/* Allocate the dvbpsi_psi_section_t structure */
dvbpsi_psi_section_t
*
p_section
=
(
dvbpsi_psi_section_t
*
)
malloc
(
sizeof
(
dvbpsi_psi_section_t
));
if
(
p_section
==
NULL
)
return
NULL
;
if
(
p_section
!=
NULL
)
{
/* Allocate the p_data memory area */
p_section
->
p_data
=
(
uint8_t
*
)
malloc
(
i_max_size
*
sizeof
(
uint8_t
));
if
(
p_section
->
p_data
!=
NULL
)
{
if
(
p_section
->
p_data
!=
NULL
)
p_section
->
p_payload_end
=
p_section
->
p_data
;
}
else
{
free
(
p_section
);
return
NULL
;
}
p_section
->
p_next
=
NULL
;
}
return
p_section
;
}
/*****************************************************************************
* dvbpsi_DeletePSISections
*****************************************************************************
* Destruction of a dvbpsi_psi_section_t structure.
*****************************************************************************/
void
dvbpsi_DeletePSISections
(
dvbpsi_psi_section_t
*
p_section
)
void
dvbpsi_DeletePSISections
(
dvbpsi_psi_section_t
*
p_section
)
{
while
(
p_section
!=
NULL
)
{
dvbpsi_psi_section_t
*
p_next
=
p_section
->
p_next
;
if
(
p_section
->
p_data
!=
NULL
)
if
(
p_section
->
p_data
!=
NULL
)
free
(
p_section
->
p_data
);
free
(
p_section
);
...
...
@@ -94,7 +87,6 @@ void dvbpsi_DeletePSISections(dvbpsi_psi_section_t * p_section)
}
}
/*****************************************************************************
* dvbpsi_ValidPSISection
*****************************************************************************
...
...
@@ -102,7 +94,7 @@ void dvbpsi_DeletePSISections(dvbpsi_psi_section_t * p_section)
*****************************************************************************/
bool
dvbpsi_ValidPSISection
(
dvbpsi_psi_section_t
*
p_section
)
{
if
(
p_section
->
b_syntax_indicator
)
if
(
p_section
->
b_syntax_indicator
)
{
/* Check the CRC_32 if b_syntax_indicator is 0 */
uint32_t
i_crc
=
0xffffffff
;
...
...
@@ -114,7 +106,7 @@ bool dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section)
p_byte
++
;
}
if
(
i_crc
==
0
)
if
(
i_crc
==
0
)
return
true
;
else
return
false
;
...
...
@@ -126,7 +118,6 @@ bool dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section)
}
}
/*****************************************************************************
* dvbpsi_BuildPSISection
*****************************************************************************
...
...
@@ -148,7 +139,7 @@ void dvbpsi_BuildPSISection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section)
p_section
->
p_data
[
2
]
=
p_section
->
i_length
&
0xff
;
/* Optional part of a PSI section */
if
(
p_section
->
b_syntax_indicator
)
if
(
p_section
->
b_syntax_indicator
)
{
/* 8 MSB of table_id_extension */
p_section
->
p_data
[
3
]
=
(
p_section
->
i_extension
>>
8
)
&
0xff
;
...
...
@@ -166,7 +157,7 @@ void dvbpsi_BuildPSISection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section)
/* CRC_32 */
p_section
->
i_crc
=
0xffffffff
;
while
(
p_byte
<
p_section
->
p_payload_end
)
while
(
p_byte
<
p_section
->
p_payload_end
)
{
p_section
->
i_crc
=
(
p_section
->
i_crc
<<
8
)
^
dvbpsi_crc32_table
[(
p_section
->
i_crc
>>
24
)
^
(
*
p_byte
)];
...
...
@@ -178,7 +169,7 @@ void dvbpsi_BuildPSISection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section)
p_section
->
p_payload_end
[
2
]
=
(
p_section
->
i_crc
>>
8
)
&
0xff
;
p_section
->
p_payload_end
[
3
]
=
p_section
->
i_crc
&
0xff
;
if
(
!
dvbpsi_ValidPSISection
(
p_section
))
if
(
!
dvbpsi_ValidPSISection
(
p_section
))
{
dvbpsi_error
(
p_dvbpsi
,
"misc PSI"
,
"********************************************"
);
dvbpsi_error
(
p_dvbpsi
,
"misc PSI"
,
"* Generated PSI section has a bad CRC_32. *"
);
...
...
@@ -188,4 +179,3 @@ void dvbpsi_BuildPSISection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section)
}
}
}
src/psi.h
View file @
4fc878e7
/*****************************************************************************
* psi.h
* Copyright (C) 2001-201
0
VideoLAN
* Copyright (C) 2001-201
1
VideoLAN
* $Id: psi.h,v 1.6 2002/04/02 17:55:30 bozo Exp $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
...
...
@@ -36,7 +36,6 @@
extern
"C"
{
#endif
/*****************************************************************************
* dvbpsi_psi_section_t
*****************************************************************************/
...
...
@@ -70,8 +69,8 @@ struct dvbpsi_psi_section_s
{
/* non-specific section data */
uint8_t
i_table_id
;
/*!< table_id */
int
b_syntax_indicator
;
/*!< section_syntax_indicator */
int
b_private_indicator
;
/*!< private_indicator */
bool
b_syntax_indicator
;
/*!< section_syntax_indicator */
bool
b_private_indicator
;
/*!< private_indicator */
uint16_t
i_length
;
/*!< section_length */
/* used if b_syntax_indicator is true */
...
...
@@ -79,7 +78,7 @@ struct dvbpsi_psi_section_s
/*!< transport_stream_id for a
PAT section */
uint8_t
i_version
;
/*!< version_number */
int
b_current_next
;
/*!< current_next_indicator */
bool
b_current_next
;
/*!< current_next_indicator */
uint8_t
i_number
;
/*!< section_number */
uint8_t
i_last_number
;
/*!< last_section_number */
...
...
@@ -95,10 +94,8 @@ struct dvbpsi_psi_section_s
/* list handling */
struct
dvbpsi_psi_section_s
*
p_next
;
/*!< next element of
the list */
};
/*****************************************************************************
* dvbpsi_NewPSISection
*****************************************************************************/
...
...
@@ -110,7 +107,6 @@ struct dvbpsi_psi_section_s
*/
dvbpsi_psi_section_t
*
dvbpsi_NewPSISection
(
int
i_max_size
);
/*****************************************************************************
* dvbpsi_DeletePSISections
*****************************************************************************/
...
...
@@ -122,7 +118,6 @@ dvbpsi_psi_section_t * dvbpsi_NewPSISection(int i_max_size);
*/
void
dvbpsi_DeletePSISections
(
dvbpsi_psi_section_t
*
p_section
);
/*****************************************************************************
* dvbpsi_ValidPSISection
*****************************************************************************/
...
...
@@ -136,7 +131,6 @@ void dvbpsi_DeletePSISections(dvbpsi_psi_section_t * p_section);
*/
bool
dvbpsi_ValidPSISection
(
dvbpsi_psi_section_t
*
p_section
);
/*****************************************************************************
* dvbpsi_BuildPSISection
*****************************************************************************/
...
...
@@ -149,7 +143,6 @@ bool dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section);
*/
void
dvbpsi_BuildPSISection
(
dvbpsi_t
*
p_dvbpsi
,
dvbpsi_psi_section_t
*
p_section
);
#ifdef __cplusplus
};
#endif
...
...
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