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
1f4b9517
Commit
1f4b9517
authored
Nov 26, 2015
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NIT: implement as chained decoder
parent
2daf6707
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
39 deletions
+42
-39
src/tables/nit.c
src/tables/nit.c
+41
-36
src/tables/nit_private.h
src/tables/nit_private.h
+1
-3
No files found.
src/tables/nit.c
View file @
1f4b9517
...
...
@@ -46,7 +46,7 @@
#include "../dvbpsi_private.h"
#include "../psi.h"
#include "../descriptor.h"
#include "../
demux
.h"
#include "../
chain
.h"
#include "nit.h"
#include "nit_private.h"
...
...
@@ -60,11 +60,9 @@ bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
void
*
p_cb_data
)
{
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
->
p_decoder
);
dvbpsi_demux_t
*
p_demux
=
(
dvbpsi_demux_t
*
)
p_dvbpsi
->
p_decoder
;
if
(
dvbpsi_demuxGetSubDec
(
p_demux
,
i_table_id
,
i_extension
))
dvbpsi_decoder_t
*
p_dec
=
dvbpsi_decoder_chain_get
(
p_dvbpsi
,
i_table_id
,
i_extension
);
if
(
p_dec
!=
NULL
)
{
dvbpsi_error
(
p_dvbpsi
,
"NIT decoder"
,
"Already a decoder for (table_id == 0x%02x,"
...
...
@@ -74,30 +72,27 @@ bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
}
dvbpsi_nit_decoder_t
*
p_nit_decoder
;
p_nit_decoder
=
(
dvbpsi_nit_decoder_t
*
)
dvbpsi_decoder_new
(
NULL
,
0
,
true
,
sizeof
(
dvbpsi_nit_decoder_t
));
p_nit_decoder
=
(
dvbpsi_nit_decoder_t
*
)
dvbpsi_decoder_new
(
dvbpsi_nit_sections_gather
,
4096
,
true
,
sizeof
(
dvbpsi_nit_decoder_t
));
if
(
p_nit_decoder
==
NULL
)
return
false
;
/* subtable decoder configuration */
dvbpsi_demux_subdec_t
*
p_subdec
;
p_subdec
=
dvbpsi_NewDemuxSubDecoder
(
i_table_id
,
i_extension
,
dvbpsi_nit_detach
,
dvbpsi_nit_sections_gather
,
DVBPSI_DECODER
(
p_nit_decoder
));
if
(
p_subdec
==
NULL
)
{
dvbpsi_decoder_delete
(
DVBPSI_DECODER
(
p_nit_decoder
));
return
false
;
}
/* Attach the subtable decoder to the demux */
dvbpsi_AttachDemuxSubDecoder
(
p_demux
,
p_subdec
);
/* NIT decoder information */
p_nit_decoder
->
i_network_id
=
i_extension
;
p_nit_decoder
->
pf_nit_callback
=
pf_callback
;
p_nit_decoder
->
p_cb_data
=
p_cb_data
;
p_nit_decoder
->
p_building_nit
=
NULL
;
p_nit_decoder
->
i_table_id
=
i_table_id
;
p_nit_decoder
->
i_extension
=
i_extension
;
/* add sdt decoder to decoder chain */
if
(
!
dvbpsi_decoder_chain_add
(
p_dvbpsi
,
DVBPSI_DECODER
(
p_nit_decoder
)))
{
dvbpsi_decoder_delete
(
DVBPSI_DECODER
(
p_nit_decoder
));
return
false
;
}
return
true
;
}
...
...
@@ -106,13 +101,13 @@ bool dvbpsi_nit_attach(dvbpsi_t* p_dvbpsi, uint8_t i_table_id,
*****************************************************************************
* Close a NIT decoder.
*****************************************************************************/
void
dvbpsi_nit_detach
(
dvbpsi_t
*
p_dvbpsi
,
uint8_t
i_table_id
,
uint16_t
i_extension
)
void
dvbpsi_nit_detach
(
dvbpsi_t
*
p_dvbpsi
,
uint8_t
i_table_id
,
uint16_t
i_extension
)
{
dvbpsi_demux_t
*
p_demux
=
(
dvbpsi_demux_t
*
)
p_dvbpsi
->
p_decoder
;
assert
(
p_dvbpsi
)
;
dvbpsi_demux_subdec_t
*
p_subdec
;
p_subdec
=
dvbpsi_demuxGetSubDec
(
p_demux
,
i_table_id
,
i_extension
);
if
(
p_
sub
dec
==
NULL
)
dvbpsi_decoder_t
*
p_dec
=
dvbpsi_decoder_chain_get
(
p_dvbpsi
,
i_table_id
,
i_extension
);
if
(
p_dec
==
NULL
)
{
dvbpsi_error
(
p_dvbpsi
,
"NIT Decoder"
,
"No such NIT decoder (table_id == 0x%02x,"
...
...
@@ -121,15 +116,21 @@ void dvbpsi_nit_detach(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_exten
return
;
}
dvbpsi_nit_decoder_t
*
p_nit_decoder
;
p_nit_decoder
=
(
dvbpsi_nit_decoder_t
*
)
p_subdec
->
p_decoder
;
if
(
!
dvbpsi_decoder_chain_remove
(
p_dvbpsi
,
p_dec
))
{
dvbpsi_error
(
p_dvbpsi
,
"NIT Decoder"
,
"Failed to remove"
"extension == 0x%02x)"
,
i_table_id
,
i_extension
);
return
;
}
dvbpsi_nit_decoder_t
*
p_nit_decoder
=
(
dvbpsi_nit_decoder_t
*
)
p_dec
;
if
(
p_nit_decoder
->
p_building_nit
)
dvbpsi_nit_delete
(
p_nit_decoder
->
p_building_nit
);
p_nit_decoder
->
p_building_nit
=
NULL
;
/* Free demux sub table decoder */
dvbpsi_DetachDemuxSubDecoder
(
p_demux
,
p_subdec
);
dvbpsi_DeleteDemuxSubDecoder
(
p_subdec
);
dvbpsi_decoder_delete
(
p_dec
);
p_dec
=
NULL
;
}
/****************************************************************************
...
...
@@ -356,9 +357,7 @@ static bool dvbpsi_AddSectionNIT(dvbpsi_t *p_dvbpsi, dvbpsi_nit_decoder_t *p_nit
*****************************************************************************
* Callback for the PSI decoder.
*****************************************************************************/
void
dvbpsi_nit_sections_gather
(
dvbpsi_t
*
p_dvbpsi
,
dvbpsi_decoder_t
*
p_private_decoder
,
dvbpsi_psi_section_t
*
p_section
)
void
dvbpsi_nit_sections_gather
(
dvbpsi_t
*
p_dvbpsi
,
dvbpsi_psi_section_t
*
p_section
)
{
assert
(
p_dvbpsi
);
...
...
@@ -373,8 +372,14 @@ void dvbpsi_nit_sections_gather(dvbpsi_t *p_dvbpsi,
}
/* */
dvbpsi_nit_decoder_t
*
p_nit_decoder
=
(
dvbpsi_nit_decoder_t
*
)
p_private_decoder
;
dvbpsi_nit_decoder_t
*
p_nit_decoder
;
p_nit_decoder
=
(
dvbpsi_nit_decoder_t
*
)
dvbpsi_decoder_chain_get
(
p_dvbpsi
,
i_table_id
,
p_section
->
i_extension
);
if
(
!
p_nit_decoder
)
{
dvbpsi_DeletePSISections
(
p_section
);
return
;
}
/* We have a valid NIT section */
if
(
p_nit_decoder
->
i_network_id
!=
p_section
->
i_extension
)
...
...
src/tables/nit_private.h
View file @
1f4b9517
...
...
@@ -54,9 +54,7 @@ typedef struct dvbpsi_nit_decoder_s
*****************************************************************************
* Callback for the PSI decoder.
*****************************************************************************/
void
dvbpsi_nit_sections_gather
(
dvbpsi_t
*
p_dvbpsi
,
dvbpsi_decoder_t
*
p_private_decoder
,
dvbpsi_psi_section_t
*
p_section
);
void
dvbpsi_nit_sections_gather
(
dvbpsi_t
*
p_dvbpsi
,
dvbpsi_psi_section_t
*
p_section
);
/*****************************************************************************
* dvbpsi_nit_sections_decode
...
...
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