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
f53ea0e5
Commit
f53ea0e5
authored
Mar 15, 2011
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/table/sis*: Cleanup
- Use bool for structure members that are used as bools - Indentation
parent
9441b000
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
62 deletions
+52
-62
src/tables/sis.c
src/tables/sis.c
+47
-56
src/tables/sis.h
src/tables/sis.h
+3
-4
src/tables/sis_private.h
src/tables/sis_private.h
+2
-2
No files found.
src/tables/sis.c
View file @
f53ea0e5
/*****************************************************************************
* sis.c: SIS decoder/generator
*----------------------------------------------------------------------------
* Copyright (C) 2010 VideoLAN
* Copyright (C) 2010
-2011
VideoLAN
* $Id:$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
...
...
@@ -153,7 +153,7 @@ void dvbpsi_InitSIS(dvbpsi_sis_t *p_sis, uint8_t i_protocol_version)
p_sis
->
i_protocol_version
=
0
;
/* must be 0 */
/* encryption */
p_sis
->
b_encrypted_packet
=
0
;
p_sis
->
b_encrypted_packet
=
false
;
p_sis
->
i_encryption_algorithm
=
0
;
p_sis
->
i_pts_adjustment
=
(
uint64_t
)
0
;
...
...
@@ -230,8 +230,6 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi,
dvbpsi_demux_t
*
p_demux
=
(
dvbpsi_demux_t
*
)
p_dvbpsi
->
p_private
;
dvbpsi_sis_decoder_t
*
p_sis_decoder
=
(
dvbpsi_sis_decoder_t
*
)
p_private_decoder
;
int
b_append
=
1
;
int
b_reinit
=
0
;
dvbpsi_debug
(
p_dvbpsi
,
"SIS decoder"
,
"Table version %2d, "
"i_table_id %2d, "
"i_extension %5d, "
...
...
@@ -247,54 +245,56 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi,
dvbpsi_error
(
p_dvbpsi
,
"SIS decoder"
,
"invalid section (table_id == 0x%02x)"
,
p_section
->
i_table_id
);
b_append
=
0
;
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
if
(
p_section
->
b_syntax_indicator
!=
0
)
if
(
p_section
->
b_syntax_indicator
)
{
/* Invalid section_syntax_indicator */
dvbpsi_error
(
p_dvbpsi
,
"SIS decoder"
,
"invalid section (section_syntax_indicator != 0)"
);
b_append
=
0
;
"invalid section (section_syntax_indicator != false)"
);
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
if
(
p_section
->
b_private_indicator
!=
0
)
if
(
p_section
->
b_private_indicator
)
{
/* Invalid private_syntax_indicator */
dvbpsi_error
(
p_dvbpsi
,
"SIS decoder"
,
"invalid private section (private_syntax_indicator != 0)"
);
b_append
=
0
;
"invalid private section (private_syntax_indicator != false)"
);
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
/* Now if b_append is true then we have a valid SIS section */
if
(
b_append
)
bool
b_reinit
=
false
;
/* TS discontinuity check */
if
(
p_demux
->
b_discontinuity
)
{
/* TS discontinuity check */
if
(
p_demux
->
b_discontinuity
)
b_reinit
=
true
;
p_demux
->
b_discontinuity
=
false
;
}
else
{
/* Perform a few sanity checks */
if
(
p_sis_decoder
->
p_building_sis
)
{
b_reinit
=
1
;
p_demux
->
b_discontinuity
=
false
;
if
(
p_sis_decoder
->
p_building_sis
->
i_protocol_version
!=
0
)
{
/* transport_stream_id */
dvbpsi_error
(
p_dvbpsi
,
"SIS decoder"
,
"'protocol_version' differs"
);
b_reinit
=
true
;
}
}
else
{
/* Perform a few sanity checks */
if
(
p_sis_decoder
->
p_building_sis
)
if
(
p_sis_decoder
->
b_current_valid
)
{
if
(
p_sis_decoder
->
p_building_sis
->
i_protocol_version
!=
0
)
{
/* transport_stream_id */
dvbpsi_error
(
p_dvbpsi
,
"SIS decoder"
,
"'protocol_version' differs"
);
b_reinit
=
1
;
}
}
else
{
if
(
p_sis_decoder
->
b_current_valid
)
{
/* Don't decode since this version is already decoded */
b_append
=
0
;
}
/* Don't decode since this version is already decoded */
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
}
}
...
...
@@ -303,7 +303,7 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi,
if
(
b_reinit
)
{
/* Force redecoding */
p_sis_decoder
->
b_current_valid
=
0
;
p_sis_decoder
->
b_current_valid
=
false
;
/* Free structures */
if
(
p_sis_decoder
->
p_building_sis
)
...
...
@@ -313,23 +313,14 @@ void dvbpsi_GatherSISSections(dvbpsi_t *p_dvbpsi,
}
}
/* Append the section to the list if wanted */
if
(
b_append
)
{
/* Initialize the structures if it's the first section received */
if
(
!
p_sis_decoder
->
p_building_sis
)
{
p_sis_decoder
->
p_building_sis
=
(
dvbpsi_sis_t
*
)
malloc
(
sizeof
(
dvbpsi_sis_t
));
if
(
p_sis_decoder
->
p_building_sis
)
dvbpsi_InitSIS
(
p_sis_decoder
->
p_building_sis
,
0
);
else
dvbpsi_error
(
p_dvbpsi
,
"SIS decoder"
,
"failed decoding section"
);
}
}
else
/* Initialize the structures if it's the first section received */
if
(
!
p_sis_decoder
->
p_building_sis
)
{
dvbpsi_DeletePSISections
(
p_section
);
p_sis_decoder
->
p_building_sis
=
(
dvbpsi_sis_t
*
)
malloc
(
sizeof
(
dvbpsi_sis_t
));
if
(
p_sis_decoder
->
p_building_sis
)
dvbpsi_InitSIS
(
p_sis_decoder
->
p_building_sis
,
0
);
else
dvbpsi_error
(
p_dvbpsi
,
"SIS decoder"
,
"failed decoding section"
);
}
}
...
...
@@ -351,7 +342,7 @@ void dvbpsi_DecodeSISSections(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis,
p_sis
->
i_protocol_version
=
p_byte
[
3
];
p_sis
->
b_encrypted_packet
=
((
p_byte
[
4
]
&
0x80
)
>>
8
);
/* NOTE: cannot handle encrypted packet */
assert
(
p_sis
->
b_encrypted_packet
==
1
);
assert
(
p_sis
->
b_encrypted_packet
);
p_sis
->
i_encryption_algorithm
=
((
p_byte
[
4
]
&
0x7E
)
>>
1
);
p_sis
->
i_pts_adjustment
=
((((
uint64_t
)
p_byte
[
4
]
&
0x01
)
<<
32
)
|
((
uint64_t
)
p_byte
[
5
]
<<
24
)
|
...
...
@@ -388,7 +379,7 @@ void dvbpsi_DecodeSISSections(dvbpsi_t* p_dvbpsi, dvbpsi_sis_t* p_sis,
p_desc
+=
2
+
i_length
;
}
if
(
p_sis
->
b_encrypted_packet
==
1
)
if
(
p_sis
->
b_encrypted_packet
)
{
/* FIXME: Currently ignored */
/* Calculate crc32 over decoded
...
...
@@ -417,8 +408,8 @@ dvbpsi_psi_section_t *dvbpsi_GenSISSections(dvbpsi_t *p_dvbpsi, dvbpsi_sis_t* p_
dvbpsi_psi_section_t
*
p_current
=
dvbpsi_NewPSISection
(
1024
);
p_current
->
i_table_id
=
0xFC
;
p_current
->
b_syntax_indicator
=
0
;
p_current
->
b_private_indicator
=
0
;
p_current
->
b_syntax_indicator
=
false
;
p_current
->
b_private_indicator
=
false
;
p_current
->
i_length
=
3
;
/* header + CRC_32 */
/* FIXME: looks weird */
...
...
@@ -428,7 +419,7 @@ dvbpsi_psi_section_t *dvbpsi_GenSISSections(dvbpsi_t *p_dvbpsi, dvbpsi_sis_t* p_
p_current
->
p_data
[
3
]
=
p_sis
->
i_protocol_version
;
p_current
->
p_data
[
4
]
=
p_sis
->
b_encrypted_packet
?
0x80
:
0x0
;
/* NOTE: cannot handle encrypted packet */
assert
(
p_sis
->
b_encrypted_packet
==
1
);
assert
(
p_sis
->
b_encrypted_packet
);
p_current
->
p_data
[
4
]
|=
((
p_sis
->
i_encryption_algorithm
<<
1
)
&
0x7E
);
p_current
->
p_data
[
4
]
|=
((
p_sis
->
i_pts_adjustment
&
0x00800
)
>>
32
);
...
...
src/tables/sis.h
View file @
f53ea0e5
/*****************************************************************************
* sis.h
* Copyright (c) 2010 VideoLAN
* Copyright (c) 2010
-2011
VideoLAN
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
...
...
@@ -58,7 +58,7 @@ typedef struct dvbpsi_sis_s
shall be 0 */
/* encryption */
int
b_encrypted_packet
;
/*!< 1 when packet is
bool
b_encrypted_packet
;
/*!< 1 when packet is
encrypted */
uint8_t
i_encryption_algorithm
;
/*!< Encryption algorithm
used */
...
...
@@ -134,8 +134,7 @@ bool dvbpsi_AttachSIS(dvbpsi_t* p_dvbpsi, uint8_t i_table_id, uint16_t i_extensi
* \param i_extension Table ID extension, here TS ID.
* \return nothing.
*/
void
dvbpsi_DetachSIS
(
dvbpsi_t
*
p_dvbpsi
,
uint8_t
i_table_id
,
uint16_t
i_extension
);
void
dvbpsi_DetachSIS
(
dvbpsi_t
*
p_dvbpsi
,
uint8_t
i_table_id
,
uint16_t
i_extension
);
/*****************************************************************************
* dvbpsi_InitSIS/dvbpsi_NewSIS
...
...
src/tables/sis_private.h
View file @
f53ea0e5
/*****************************************************************************
* sis_private.h: private SIS structures
*----------------------------------------------------------------------------
* Copyright (c) 2010 VideoLAN
* Copyright (c) 2010
-2011
VideoLAN
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
...
...
@@ -43,7 +43,7 @@ typedef struct dvbpsi_sis_decoder_s
dvbpsi_sis_t
*
current_sis
;
dvbpsi_sis_t
*
p_building_sis
;
int
b_current_valid
;
bool
b_current_valid
;
}
dvbpsi_sis_decoder_t
;
...
...
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