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
9441b000
Commit
9441b000
authored
Mar 15, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/table/sdt*: Cleanup
- Use bool for structure members that are used as bools - Indentation
parent
b80d45d1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
120 deletions
+114
-120
src/tables/sdt.c
src/tables/sdt.c
+100
-106
src/tables/sdt.h
src/tables/sdt.h
+12
-12
src/tables/sdt_private.h
src/tables/sdt_private.h
+2
-2
No files found.
src/tables/sdt.c
View file @
9441b000
/*****************************************************************************
* sdt.c: SDT decoder/generator
*----------------------------------------------------------------------------
* Copyright (C) 2001-201
0
VideoLAN
* Copyright (C) 2001-201
1
VideoLAN
* $Id$
*
* Authors: Johan Bilien <jobi@via.ecp.fr>\
...
...
@@ -98,7 +98,7 @@ bool dvbpsi_AttachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
p_sdt_decoder
->
p_cb_data
=
p_cb_data
;
/* SDT decoder initial state */
p_sdt_decoder
->
b_current_valid
=
0
;
p_sdt_decoder
->
b_current_valid
=
false
;
p_sdt_decoder
->
p_building_sdt
=
NULL
;
for
(
unsigned
int
i
=
0
;
i
<=
255
;
i
++
)
p_sdt_decoder
->
ap_sections
[
i
]
=
NULL
;
...
...
@@ -156,7 +156,7 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
* Initialize a pre-allocated dvbpsi_sdt_t structure.
*****************************************************************************/
void
dvbpsi_InitSDT
(
dvbpsi_sdt_t
*
p_sdt
,
uint16_t
i_ts_id
,
uint8_t
i_version
,
int
b_current_next
,
uint16_t
i_network_id
)
bool
b_current_next
,
uint16_t
i_network_id
)
{
p_sdt
->
i_ts_id
=
i_ts_id
;
p_sdt
->
i_version
=
i_version
;
...
...
@@ -191,10 +191,10 @@ void dvbpsi_EmptySDT(dvbpsi_sdt_t* p_sdt)
*****************************************************************************/
dvbpsi_sdt_service_t
*
dvbpsi_SDTAddService
(
dvbpsi_sdt_t
*
p_sdt
,
uint16_t
i_service_id
,
int
b_eit_schedule
,
int
b_eit_present
,
bool
b_eit_schedule
,
bool
b_eit_present
,
uint8_t
i_running_status
,
int
b_free_ca
)
bool
b_free_ca
)
{
dvbpsi_sdt_service_t
*
p_service
;
p_service
=
(
dvbpsi_sdt_service_t
*
)
malloc
(
sizeof
(
dvbpsi_sdt_service_t
));
...
...
@@ -258,13 +258,13 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
void
*
p_private_decoder
,
dvbpsi_psi_section_t
*
p_section
)
{
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
->
p_private
);
dvbpsi_demux_t
*
p_demux
=
(
dvbpsi_demux_t
*
)
p_dvbpsi
->
p_private
;
dvbpsi_sdt_decoder_t
*
p_sdt_decoder
=
(
dvbpsi_sdt_decoder_t
*
)
p_private_decoder
;
int
b_append
=
1
;
int
b_reinit
=
0
;
dvbpsi_debug
(
p_dvbpsi
,
"SDT decoder"
,
"Table version %2d, "
"i_table_id %2d, "
"i_extension %5d, "
"section %3d up to %3d, "
"current %1d"
,
...
...
@@ -278,16 +278,16 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
/* Invalid section_syntax_indicator */
dvbpsi_error
(
p_dvbpsi
,
"SDT decoder"
,
"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 SDT section */
if
(
b_append
)
{
bool
b_reinit
=
false
;
/* TS discontinuity check */
if
(
p_demux
->
b_discontinuity
)
{
b_reinit
=
1
;
b_reinit
=
true
;
p_demux
->
b_discontinuity
=
false
;
}
else
...
...
@@ -301,7 +301,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
dvbpsi_error
(
p_dvbpsi
,
"SDT decoder"
,
"'transport_stream_id' differs"
" whereas no TS discontinuity has occured"
);
b_reinit
=
1
;
b_reinit
=
true
;
}
else
if
(
p_sdt_decoder
->
p_building_sdt
->
i_version
!=
p_section
->
i_version
)
{
...
...
@@ -309,7 +309,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
dvbpsi_error
(
p_dvbpsi
,
"SDT decoder"
,
"'version_number' differs"
" whereas no discontinuity has occured"
);
b_reinit
=
1
;
b_reinit
=
true
;
}
else
if
(
p_sdt_decoder
->
i_last_section_number
!=
p_section
->
i_last_number
)
{
...
...
@@ -317,7 +317,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
dvbpsi_error
(
p_dvbpsi
,
"SDT decoder"
,
"'last_section_number' differs"
" whereas no discontinuity has occured"
);
b_reinit
=
1
;
b_reinit
=
true
;
}
}
else
...
...
@@ -327,8 +327,8 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
&&
(
p_sdt_decoder
->
current_sdt
.
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
;
}
}
}
...
...
@@ -337,7 +337,7 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
if
(
b_reinit
)
{
/* Force redecoding */
p_sdt_decoder
->
b_current_valid
=
0
;
p_sdt_decoder
->
b_current_valid
=
false
;
/* Free structures */
if
(
p_sdt_decoder
->
p_building_sdt
)
{
...
...
@@ -355,16 +355,12 @@ void dvbpsi_GatherSDTSections(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_sdt_decoder
->
p_building_sdt
)
{
p_sdt_decoder
->
p_building_sdt
=
(
dvbpsi_sdt_t
*
)
calloc
(
1
,
sizeof
(
dvbpsi_sdt_t
));
p_sdt_decoder
->
p_building_sdt
=
(
dvbpsi_sdt_t
*
)
calloc
(
1
,
sizeof
(
dvbpsi_sdt_t
));
if
(
p_sdt_decoder
->
p_building_sdt
)
{
dvbpsi_InitSDT
(
p_sdt_decoder
->
p_building_sdt
,
p_section
->
i_extension
,
p_section
->
i_version
,
...
...
@@ -373,6 +369,9 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
|
p_section
->
p_payload_start
[
1
]);
p_sdt_decoder
->
i_last_section_number
=
p_section
->
i_last_number
;
}
else
dvbpsi_debug
(
p_dvbpsi
,
"SDT decoder"
,
"failed decoding section"
);
}
/* Fill the section array */
if
(
p_sdt_decoder
->
ap_sections
[
p_section
->
i_number
]
!=
NULL
)
...
...
@@ -384,21 +383,21 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
p_sdt_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_sdt_decoder
->
i_last_section_number
;
i
++
)
{
if
(
!
p_sdt_decoder
->
ap_sections
[
i
])
break
;
if
(
i
==
p_sdt_decoder
->
i_last_section_number
)
b_complete
=
1
;
b_complete
=
true
;
}
if
(
b_complete
)
{
/* Save the current information */
p_sdt_decoder
->
current_sdt
=
*
p_sdt_decoder
->
p_building_sdt
;
p_sdt_decoder
->
b_current_valid
=
1
;
p_sdt_decoder
->
b_current_valid
=
true
;
/* Chain the sections */
if
(
p_sdt_decoder
->
i_last_section_number
)
{
...
...
@@ -418,11 +417,6 @@ void dvbpsi_GatherSDTSections(dvbpsi_t *p_dvbpsi,
for
(
unsigned
int
i
=
0
;
i
<=
p_sdt_decoder
->
i_last_section_number
;
i
++
)
p_sdt_decoder
->
ap_sections
[
i
]
=
NULL
;
}
}
else
{
dvbpsi_DeletePSISections
(
p_section
);
}
}
/*****************************************************************************
...
...
@@ -441,10 +435,10 @@ void dvbpsi_DecodeSDTSections(dvbpsi_sdt_t* p_sdt,
p_byte
+
4
<
p_section
->
p_payload_end
;)
{
uint16_t
i_service_id
=
((
uint16_t
)(
p_byte
[
0
])
<<
8
)
|
p_byte
[
1
];
int
b_eit_schedule
=
(
int
)
((
p_byte
[
2
]
&
0x2
)
>>
1
);
int
b_eit_present
=
(
int
)
((
p_byte
[
2
])
&
0x1
);
bool
b_eit_schedule
=
((
p_byte
[
2
]
&
0x2
)
>>
1
);
bool
b_eit_present
=
((
p_byte
[
2
])
&
0x1
);
uint8_t
i_running_status
=
(
uint8_t
)(
p_byte
[
3
])
>>
5
;
int
b_free_ca
=
(
int
)
((
p_byte
[
3
]
&
0x10
)
>>
4
);
bool
b_free_ca
=
((
p_byte
[
3
]
&
0x10
)
>>
4
);
uint16_t
i_srv_length
=
((
uint16_t
)(
p_byte
[
3
]
&
0xf
)
<<
8
)
|
p_byte
[
4
];
dvbpsi_sdt_service_t
*
p_service
=
dvbpsi_SDTAddService
(
p_sdt
,
i_service_id
,
b_eit_schedule
,
b_eit_present
,
...
...
@@ -482,8 +476,8 @@ dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_t* p_
dvbpsi_sdt_service_t
*
p_service
=
p_sdt
->
p_first_service
;
p_current
->
i_table_id
=
0x42
;
p_current
->
b_syntax_indicator
=
1
;
p_current
->
b_private_indicator
=
1
;
p_current
->
b_syntax_indicator
=
true
;
p_current
->
b_private_indicator
=
true
;
p_current
->
i_length
=
12
;
/* header + CRC_32 */
p_current
->
i_extension
=
p_sdt
->
i_ts_id
;
p_current
->
i_version
=
p_sdt
->
i_version
;
...
...
@@ -521,8 +515,8 @@ dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_t *p_dvbpsi, dvbpsi_sdt_t* p_
p_prev
->
p_next
=
p_current
;
p_current
->
i_table_id
=
0x42
;
p_current
->
b_syntax_indicator
=
1
;
p_current
->
b_private_indicator
=
1
;
p_current
->
b_syntax_indicator
=
true
;
p_current
->
b_private_indicator
=
true
;
p_current
->
i_length
=
12
;
/* header + CRC_32 */
p_current
->
i_extension
=
p_sdt
->
i_ts_id
;;
p_current
->
i_version
=
p_sdt
->
i_version
;
...
...
src/tables/sdt.h
View file @
9441b000
/*****************************************************************************
* sdt.h
* Copyright (C) 2001-201
0
VideoLAN
* Copyright (C) 2001-201
1
VideoLAN
* $Id$
*
* Authors: Johan Bilien <jobi@via.ecp.fr>
...
...
@@ -55,11 +55,11 @@ extern "C" {
typedef
struct
dvbpsi_sdt_service_s
{
uint16_t
i_service_id
;
/*!< service_id */
int
b_eit_schedule
;
/*!< EIT schedule flag */
int
b_eit_present
;
/*!< EIT present/following
bool
b_eit_schedule
;
/*!< EIT schedule flag */
bool
b_eit_present
;
/*!< EIT present/following
flag */
uint8_t
i_running_status
;
/*!< Running status */
int
b_free_ca
;
/*!< Free CA mode flag */
bool
b_free_ca
;
/*!< Free CA mode flag */
uint16_t
i_descriptors_length
;
/*!< Descriptors loop
length */
dvbpsi_descriptor_t
*
p_first_descriptor
;
/*!< First of the following
...
...
@@ -88,7 +88,7 @@ typedef struct dvbpsi_sdt_s
{
uint16_t
i_ts_id
;
/*!< transport_stream_id */
uint8_t
i_version
;
/*!< version_number */
int
b_current_next
;
/*!< current_next_indicator */
bool
b_current_next
;
/*!< current_next_indicator */
uint16_t
i_network_id
;
/*!< original network id */
dvbpsi_sdt_service_t
*
p_first_service
;
/*!< service description
...
...
@@ -143,7 +143,7 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
*****************************************************************************/
/*!
* \fn void dvbpsi_InitSDT(dvbpsi_sdt_t* p_sdt, uint16_t i_ts_id,
uint8_t i_version,
int
b_current_next, uint16_t i_network_id)
uint8_t i_version,
bool
b_current_next, uint16_t i_network_id)
* \brief Initialize a user-allocated dvbpsi_sdt_t structure.
* \param p_sdt pointer to the SDT structure
* \param i_ts_id transport stream ID
...
...
@@ -153,7 +153,7 @@ void dvbpsi_DetachSDT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
* \return nothing.
*/
void
dvbpsi_InitSDT
(
dvbpsi_sdt_t
*
p_sdt
,
uint16_t
i_ts_id
,
uint8_t
i_version
,
int
b_current_next
,
uint16_t
i_network_id
);
bool
b_current_next
,
uint16_t
i_network_id
);
/*!
* \def dvbpsi_NewSDT(p_sdt, i_ts_id, i_version, b_current_next, i_network_id)
...
...
@@ -201,10 +201,10 @@ do { \
/*!
* \fn dvbpsi_sdt_service_t* dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt,
uint16_t i_service_id,
int
b_eit_schedule,
int
b_eit_present,
bool
b_eit_schedule,
bool
b_eit_present,
uint8_t i_running_status,
int
b_free_ca)
bool
b_free_ca)
* \brief Add a service description at the end of the SDT.
* \param p_sdt pointer to the SDT structure
* \param i_service_id Service ID
...
...
@@ -215,8 +215,8 @@ do { \
* \return a pointer to the added service description.
*/
dvbpsi_sdt_service_t
*
dvbpsi_SDTAddService
(
dvbpsi_sdt_t
*
p_sdt
,
uint16_t
i_service_id
,
int
b_eit_schedule
,
int
b_eit_present
,
uint8_t
i_running_status
,
int
b_free_ca
);
uint16_t
i_service_id
,
bool
b_eit_schedule
,
bool
b_eit_present
,
uint8_t
i_running_status
,
bool
b_free_ca
);
/*****************************************************************************
* dvbpsi_SDTServiceAddDescriptor
...
...
src/tables/sdt_private.h
View file @
9441b000
/*****************************************************************************
* sdt_private.h: private SDT structures
*----------------------------------------------------------------------------
* Copyright (C) 2001-201
0
VideoLAN
* Copyright (C) 2001-201
1
VideoLAN
* $Id: sdt_private.h,v 1.1 2002/12/11 13:04:57 jobi Exp $
*
* Authors: Johan Bilien <jobi@via.ecp.fr>
...
...
@@ -43,7 +43,7 @@ typedef struct dvbpsi_sdt_decoder_s
dvbpsi_sdt_t
current_sdt
;
dvbpsi_sdt_t
*
p_building_sdt
;
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