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
f359d18b
Commit
f359d18b
authored
Nov 26, 2015
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATSC ETT: implement as chained decoder
parent
fc75bed3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
41 deletions
+32
-41
src/tables/atsc_ett.c
src/tables/atsc_ett.c
+32
-41
No files found.
src/tables/atsc_ett.c
View file @
f359d18b
...
@@ -40,7 +40,7 @@ Decode PSIP Extended Text Table.
...
@@ -40,7 +40,7 @@ Decode PSIP Extended Text Table.
#include "../dvbpsi_private.h"
#include "../dvbpsi_private.h"
#include "../psi.h"
#include "../psi.h"
#include "../descriptor.h"
#include "../descriptor.h"
#include "../
demux
.h"
#include "../
chain
.h"
#include "atsc_ett.h"
#include "atsc_ett.h"
...
@@ -67,7 +67,6 @@ typedef struct dvbpsi_atsc_ett_decoder_s
...
@@ -67,7 +67,6 @@ typedef struct dvbpsi_atsc_ett_decoder_s
* Callback for the PSI decoder.
* Callback for the PSI decoder.
*****************************************************************************/
*****************************************************************************/
static
void
dvbpsi_atsc_GatherETTSections
(
dvbpsi_t
*
p_dvbpsi
,
static
void
dvbpsi_atsc_GatherETTSections
(
dvbpsi_t
*
p_dvbpsi
,
dvbpsi_decoder_t
*
p_decoder
,
dvbpsi_psi_section_t
*
p_section
);
dvbpsi_psi_section_t
*
p_section
);
/*****************************************************************************
/*****************************************************************************
...
@@ -87,11 +86,9 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
...
@@ -87,11 +86,9 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
dvbpsi_atsc_ett_callback
pf_callback
,
void
*
p_cb_data
)
dvbpsi_atsc_ett_callback
pf_callback
,
void
*
p_cb_data
)
{
{
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
->
p_decoder
);
dvbpsi_demux_t
*
p_demux
=
(
dvbpsi_demux_t
*
)
p_dvbpsi
->
p_decoder
;
dvbpsi_decoder_t
*
p_dec
=
dvbpsi_decoder_chain_get
(
p_dvbpsi
,
i_table_id
,
i_extension
);
if
(
p_dec
!=
NULL
)
if
(
dvbpsi_demuxGetSubDec
(
p_demux
,
i_table_id
,
i_extension
))
{
{
dvbpsi_error
(
p_dvbpsi
,
"ATSC ETT decoder"
,
dvbpsi_error
(
p_dvbpsi
,
"ATSC ETT decoder"
,
"Already a decoder for (table_id == 0x%02x extension == 0x%04x)"
,
"Already a decoder for (table_id == 0x%02x extension == 0x%04x)"
,
...
@@ -100,29 +97,26 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
...
@@ -100,29 +97,26 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
}
}
dvbpsi_atsc_ett_decoder_t
*
p_ett_decoder
;
dvbpsi_atsc_ett_decoder_t
*
p_ett_decoder
;
p_ett_decoder
=
(
dvbpsi_atsc_ett_decoder_t
*
)
dvbpsi_decoder_new
(
NULL
,
p_ett_decoder
=
(
dvbpsi_atsc_ett_decoder_t
*
)
dvbpsi_decoder_new
(
dvbpsi_atsc_GatherETTSections
,
0
,
true
,
sizeof
(
dvbpsi_atsc_ett_decoder_t
));
4096
,
true
,
sizeof
(
dvbpsi_atsc_ett_decoder_t
));
if
(
p_ett_decoder
==
NULL
)
if
(
p_ett_decoder
==
NULL
)
return
false
;
return
false
;
/* PSI decoder configuration */
dvbpsi_demux_subdec_t
*
p_subdec
;
p_subdec
=
dvbpsi_NewDemuxSubDecoder
(
i_table_id
,
i_extension
,
dvbpsi_atsc_DetachETT
,
dvbpsi_atsc_GatherETTSections
,
DVBPSI_DECODER
(
p_ett_decoder
));
if
(
p_subdec
==
NULL
)
{
dvbpsi_decoder_delete
(
DVBPSI_DECODER
(
p_ett_decoder
));
return
false
;
}
/* Attach the subtable decoder to the demux */
dvbpsi_AttachDemuxSubDecoder
(
p_demux
,
p_subdec
);
/* ETT decoder information */
/* ETT decoder information */
p_ett_decoder
->
pf_ett_callback
=
pf_callback
;
p_ett_decoder
->
pf_ett_callback
=
pf_callback
;
p_ett_decoder
->
p_cb_data
=
p_cb_data
;
p_ett_decoder
->
p_cb_data
=
p_cb_data
;
p_ett_decoder
->
p_building_ett
=
NULL
;
p_ett_decoder
->
p_building_ett
=
NULL
;
p_ett_decoder
->
i_table_id
=
i_table_id
;
p_ett_decoder
->
i_extension
=
i_extension
;
/* add decoder to decoder chain */
if
(
!
dvbpsi_decoder_chain_add
(
p_dvbpsi
,
DVBPSI_DECODER
(
p_ett_decoder
)))
{
dvbpsi_decoder_delete
(
DVBPSI_DECODER
(
p_ett_decoder
));
return
false
;
}
return
true
;
return
true
;
}
}
...
@@ -134,13 +128,9 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
...
@@ -134,13 +128,9 @@ bool dvbpsi_atsc_AttachETT(dvbpsi_t * p_dvbpsi, uint8_t i_table_id, uint16_t i_e
void
dvbpsi_atsc_DetachETT
(
dvbpsi_t
*
p_dvbpsi
,
uint8_t
i_table_id
,
uint16_t
i_extension
)
void
dvbpsi_atsc_DetachETT
(
dvbpsi_t
*
p_dvbpsi
,
uint8_t
i_table_id
,
uint16_t
i_extension
)
{
{
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
->
p_decoder
);
dvbpsi_demux_t
*
p_demux
=
(
dvbpsi_demux_t
*
)
p_dvbpsi
->
p_decoder
;
dvbpsi_decoder_t
*
p_dec
=
dvbpsi_decoder_chain_get
(
p_dvbpsi
,
i_table_id
,
i_extension
);
if
(
p_dec
==
NULL
)
dvbpsi_demux_subdec_t
*
p_subdec
;
p_subdec
=
dvbpsi_demuxGetSubDec
(
p_demux
,
i_table_id
,
i_extension
);
if
(
p_subdec
==
NULL
)
{
{
dvbpsi_error
(
p_dvbpsi
,
"ATSC ETT Decoder"
,
dvbpsi_error
(
p_dvbpsi
,
"ATSC ETT Decoder"
,
"No such ETT decoder (table_id == 0x%02x,"
"No such ETT decoder (table_id == 0x%02x,"
...
@@ -149,17 +139,22 @@ void dvbpsi_atsc_DetachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
...
@@ -149,17 +139,22 @@ void dvbpsi_atsc_DetachETT(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_ex
return
;
return
;
}
}
dvbpsi_atsc_ett_decoder_t
*
p_ett_decoder
;
/* Remove table decoder from decoder chain */
p_ett_decoder
=
(
dvbpsi_atsc_ett_decoder_t
*
)
p_subdec
->
p_decoder
;
if
(
!
dvbpsi_decoder_chain_remove
(
p_dvbpsi
,
p_dec
))
if
(
!
p_ett_decoder
)
{
dvbpsi_error
(
p_dvbpsi
,
"ATSC ETT Decoder"
,
"Failed to remove"
"extension == 0x%02x)"
,
i_table_id
,
i_extension
);
return
;
return
;
}
dvbpsi_atsc_ett_decoder_t
*
p_ett_decoder
=
(
dvbpsi_atsc_ett_decoder_t
*
)
p_dec
;
if
(
p_ett_decoder
->
p_building_ett
)
if
(
p_ett_decoder
->
p_building_ett
)
dvbpsi_atsc_DeleteETT
(
p_ett_decoder
->
p_building_ett
);
dvbpsi_atsc_DeleteETT
(
p_ett_decoder
->
p_building_ett
);
p_ett_decoder
->
p_building_ett
=
NULL
;
p_ett_decoder
->
p_building_ett
=
NULL
;
dvbpsi_decoder_delete
(
p_dec
);
dvbpsi_DetachDemuxSubDecoder
(
p_demux
,
p_subdec
);
p_dec
=
NULL
;
dvbpsi_DeleteDemuxSubDecoder
(
p_subdec
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -318,11 +313,9 @@ static bool dvbpsi_AddSectionETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t *
...
@@ -318,11 +313,9 @@ static bool dvbpsi_AddSectionETT(dvbpsi_t *p_dvbpsi, dvbpsi_atsc_ett_decoder_t *
* Callback for the PSI decoder.
* Callback for the PSI decoder.
*****************************************************************************/
*****************************************************************************/
static
void
dvbpsi_atsc_GatherETTSections
(
dvbpsi_t
*
p_dvbpsi
,
static
void
dvbpsi_atsc_GatherETTSections
(
dvbpsi_t
*
p_dvbpsi
,
dvbpsi_decoder_t
*
p_decoder
,
dvbpsi_psi_section_t
*
p_section
)
dvbpsi_psi_section_t
*
p_section
)
{
{
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
->
p_decoder
);
if
(
!
dvbpsi_CheckPSISection
(
p_dvbpsi
,
p_section
,
0xCC
,
"ATSC ETT decoder"
))
if
(
!
dvbpsi_CheckPSISection
(
p_dvbpsi
,
p_section
,
0xCC
,
"ATSC ETT decoder"
))
{
{
...
@@ -331,21 +324,19 @@ static void dvbpsi_atsc_GatherETTSections(dvbpsi_t* p_dvbpsi,
...
@@ -331,21 +324,19 @@ static void dvbpsi_atsc_GatherETTSections(dvbpsi_t* p_dvbpsi,
}
}
/* We have a valid ETT section */
/* We have a valid ETT section */
dvbpsi_demux_t
*
p_demux
=
(
dvbpsi_demux_t
*
)
p_dvbpsi
->
p_decoder
;
dvbpsi_decoder_t
*
p_dec
=
dvbpsi_decoder_chain_get
(
p_dvbpsi
,
p_section
->
i_table_id
,
p_section
->
i_extension
);
dvbpsi_atsc_ett_decoder_t
*
p_ett_decoder
=
(
dvbpsi_atsc_ett_decoder_t
*
)
p_decoder
;
if
(
!
p_dec
)
if
(
!
p_ett_decoder
)
{
{
dvbpsi_error
(
p_dvbpsi
,
"ATSC ETT decoder"
,
"No decoder specified"
);
dvbpsi_DeletePSISections
(
p_section
);
dvbpsi_DeletePSISections
(
p_section
);
return
;
return
;
}
}
/* TS discontinuity check */
/* TS discontinuity check */
if
(
p_demux
->
b_discontinuity
)
dvbpsi_atsc_ett_decoder_t
*
p_ett_decoder
=
(
dvbpsi_atsc_ett_decoder_t
*
)
p_dec
;
if
(
p_ett_decoder
->
b_discontinuity
)
{
{
dvbpsi_ReInitETT
(
p_ett_decoder
,
true
);
dvbpsi_ReInitETT
(
p_ett_decoder
,
true
);
p_ett_decoder
->
b_discontinuity
=
false
;
p_ett_decoder
->
b_discontinuity
=
false
;
p_demux
->
b_discontinuity
=
false
;
}
}
else
else
{
{
...
...
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