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
9d4bf9c5
Commit
9d4bf9c5
authored
Dec 14, 2015
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Demux: deprecated and provide hints on howto use chain.h API instead.
parent
619951df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
147 deletions
+41
-147
src/demux.c
src/demux.c
+24
-94
src/demux.h
src/demux.h
+17
-53
No files found.
src/demux.c
View file @
9d4bf9c5
...
...
@@ -43,6 +43,7 @@
#include "dvbpsi_private.h"
#include "psi.h"
#include "demux.h"
#include "chain.h"
/*****************************************************************************
* dvbpsi_AttachDemux
...
...
@@ -53,22 +54,9 @@ bool dvbpsi_AttachDemux(dvbpsi_t * p_dvbpsi,
dvbpsi_demux_new_cb_t
pf_new_cb
,
void
*
p_new_cb_data
)
{
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
->
p_decoder
==
NULL
);
dvbpsi_demux_t
*
p_demux
;
p_demux
=
(
dvbpsi_demux_t
*
)
dvbpsi_decoder_new
(
&
dvbpsi_Demux
,
4096
,
true
,
sizeof
(
dvbpsi_demux_t
));
if
(
p_demux
==
NULL
)
return
false
;
/* Subtables demux configuration */
p_demux
->
p_first_subdec
=
NULL
;
p_demux
->
pf_new_callback
=
pf_new_cb
;
p_demux
->
p_new_cb_data
=
p_new_cb_data
;
p_dvbpsi
->
p_decoder
=
DVBPSI_DECODER
(
p_demux
);
return
true
;
return
dvbpsi_chain_demux_new
(
p_dvbpsi
,
(
dvbpsi_callback_new_t
)
pf_new_cb
,
NULL
,
p_new_cb_data
);
}
/*****************************************************************************
...
...
@@ -76,22 +64,12 @@ bool dvbpsi_AttachDemux(dvbpsi_t * p_dvbpsi,
*****************************************************************************
* Finds a subtable decoder given the table id and extension
*****************************************************************************/
dvbpsi_demux_subdec_t
*
dvbpsi_demuxGetSubDec
(
dvbpsi_demux_t
*
p_demux
,
dvbpsi_demux_subdec_t
*
dvbpsi_demuxGetSubDec
(
dvbpsi_demux_t
*
p_demux
,
uint8_t
i_table_id
,
uint16_t
i_extension
)
{
uint32_t
i_id
=
(
uint32_t
)
i_table_id
<<
16
|
(
uint32_t
)
i_extension
;
dvbpsi_demux_subdec_t
*
p_subdec
=
p_demux
->
p_first_subdec
;
while
(
p_subdec
)
{
if
(
p_subdec
->
i_id
==
i_id
)
break
;
p_subdec
=
p_subdec
->
p_next
;
}
return
p_subdec
;
dvbpsi_t
*
p_dvbpsi
=
(
dvbpsi_t
*
)
p_demux
;
return
(
dvbpsi_demux_subdec_t
*
)
dvbpsi_decoder_chain_get
(
p_dvbpsi
,
i_table_id
,
i_extension
);
}
/*****************************************************************************
...
...
@@ -104,25 +82,9 @@ void dvbpsi_Demux(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section)
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
->
p_decoder
);
dvbpsi_demux_t
*
p_demux
=
(
dvbpsi_demux_t
*
)
p_dvbpsi
->
p_decoder
;
dvbpsi_demux_subdec_t
*
p_subdec
=
dvbpsi_demuxGetSubDec
(
p_demux
,
p_section
->
i_table_id
,
p_section
->
i_extension
);
if
(
p_subdec
==
NULL
)
{
/* Tell the application we found a new subtable, so that it may attach a
* subtable decoder */
p_demux
->
pf_new_callback
(
p_dvbpsi
,
p_section
->
i_table_id
,
p_section
->
i_extension
,
p_demux
->
p_new_cb_data
);
/* Check if a new subtable decoder is available */
p_subdec
=
dvbpsi_demuxGetSubDec
(
p_demux
,
p_section
->
i_table_id
,
p_section
->
i_extension
);
}
if
(
p_subdec
)
p_subdec
->
pf_gather
(
p_dvbpsi
,
p_subdec
->
p_decoder
,
p_section
);
else
dvbpsi_DeletePSISections
(
p_section
);
dvbpsi_decoder_t
*
p_demux
=
(
dvbpsi_decoder_t
*
)
p_dvbpsi
->
p_decoder
;
if
(
p_demux
&&
p_demux
->
pf_gather
)
p_demux
->
pf_gather
(
p_dvbpsi
,
p_section
);
}
/*****************************************************************************
...
...
@@ -135,22 +97,7 @@ void dvbpsi_DetachDemux(dvbpsi_t *p_dvbpsi)
assert
(
p_dvbpsi
);
assert
(
p_dvbpsi
->
p_decoder
);
dvbpsi_demux_t
*
p_demux
=
(
dvbpsi_demux_t
*
)
p_dvbpsi
->
p_decoder
;
dvbpsi_demux_subdec_t
*
p_subdec
=
p_demux
->
p_first_subdec
;
while
(
p_subdec
)
{
dvbpsi_demux_subdec_t
*
p_subdec_temp
=
p_subdec
;
p_subdec
=
p_subdec
->
p_next
;
if
(
p_subdec_temp
->
pf_detach
)
p_subdec_temp
->
pf_detach
(
p_dvbpsi
,
(
p_subdec_temp
->
i_id
>>
16
)
&
0xFFFF
,
p_subdec_temp
->
i_id
&
0xFFFF
);
else
free
(
p_subdec_temp
);
}
dvbpsi_decoder_delete
(
p_dvbpsi
->
p_decoder
);
p_dvbpsi
->
p_decoder
=
NULL
;
dvbpsi_chain_demux_delete
(
p_dvbpsi
);
}
/*****************************************************************************
...
...
@@ -164,22 +111,10 @@ dvbpsi_demux_subdec_t *dvbpsi_NewDemuxSubDecoder(const uint8_t i_table_id,
dvbpsi_demux_gather_cb_t
pf_gather
,
dvbpsi_decoder_t
*
p_decoder
)
{
assert
(
pf_gather
);
assert
(
pf_detach
);
dvbpsi_demux_subdec_t
*
p_subdec
=
calloc
(
1
,
sizeof
(
dvbpsi_demux_subdec_t
));
if
(
p_subdec
==
NULL
)
(
void
)
i_table_id
;
(
void
)
i_extension
;
(
void
*
)
pf_detach
,
(
void
*
)
pf_gather
;
(
void
*
)
p_decoder
;
return
NULL
;
uint32_t
i_id
=
(
uint32_t
)
i_table_id
<<
16
|
(
uint32_t
)
i_extension
;
/* subtable decoder configuration */
p_subdec
->
i_id
=
i_id
;
p_subdec
->
p_decoder
=
p_decoder
;
p_subdec
->
pf_gather
=
pf_gather
;
p_subdec
->
pf_detach
=
pf_detach
;
return
p_subdec
;
}
/*****************************************************************************
...
...
@@ -189,12 +124,9 @@ dvbpsi_demux_subdec_t *dvbpsi_NewDemuxSubDecoder(const uint8_t i_table_id,
*****************************************************************************/
void
dvbpsi_DeleteDemuxSubDecoder
(
dvbpsi_demux_subdec_t
*
p_subdec
)
{
assert
(
0
);
if
(
!
p_subdec
)
return
;
/* FIXME: find a saner way to release private decoder resources */
dvbpsi_decoder_delete
(
p_subdec
->
p_decoder
);
free
(
p_subdec
);
p_subdec
=
NULL
;
}
/*****************************************************************************
...
...
@@ -208,8 +140,10 @@ void dvbpsi_AttachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t
if
(
!
p_demux
||
!
p_subdec
)
abort
();
p_subdec
->
p_next
=
p_demux
->
p_first_subdec
;
p_demux
->
p_first_subdec
=
p_subdec
;
dvbpsi_t
*
p_dvbpsi
=
(
dvbpsi_t
*
)
p_demux
;
dvbpsi_decoder_t
*
p_dec
=
(
dvbpsi_decoder_t
*
)
p_subdec
;
if
(
!
dvbpsi_decoder_chain_add
(
p_dvbpsi
,
p_dec
))
abort
();
}
/*****************************************************************************
...
...
@@ -223,12 +157,8 @@ void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t
if
(
!
p_demux
||
!
p_subdec
)
abort
();
assert
(
p_demux
->
p_first_subdec
);
dvbpsi_demux_subdec_t
**
pp_prev_subdec
;
pp_prev_subdec
=
&
p_demux
->
p_first_subdec
;
while
(
*
pp_prev_subdec
!=
p_subdec
)
pp_prev_subdec
=
&
(
*
pp_prev_subdec
)
->
p_next
;
*
pp_prev_subdec
=
p_subdec
->
p_next
;
dvbpsi_t
*
p_dvbpsi
=
(
dvbpsi_t
*
)
p_demux
;
dvbpsi_decoder_t
*
p_dec
=
(
dvbpsi_decoder_t
*
)
p_subdec
;
if
(
!
dvbpsi_decoder_chain_remove
(
p_dvbpsi
,
p_dec
))
abort
();
}
src/demux.h
View file @
9d4bf9c5
...
...
@@ -26,7 +26,7 @@
/*!
* \file <demux.h>
* \author Johan Bilien <jobi@via.ecp.fr>
* \brief Subtable demutiplexor
.
* \brief Subtable demutiplexor
use @see chain.h instead
*
* Subtable demultiplexor structure
* @note deprecated
...
...
@@ -77,64 +77,29 @@ typedef void (*dvbpsi_demux_detach_cb_t) (dvbpsi_t *p_dvbpsi, /*!< pointer to
/*****************************************************************************
* dvbpsi_demux_subdec_t
*****************************************************************************/
/*!
* \struct dvbpsi_demux_subdec_s
* \brief Subtable decoder structure
*
* This structure contains the data specific to the decoding of one
* subtable.
*/
/*!
* \typedef struct dvbpsi_demux_subdec_s dvbpsi_demux_subdec_t
* \brief dvbpsi_demux_subdec_t
type definition
.
* \brief dvbpsi_demux_subdec_t
is deprecated @see dvbpsi_decoder_t instead
.
*/
typedef
struct
dvbpsi_demux_subdec_s
{
uint32_t
i_id
;
/*!< subtable id */
dvbpsi_demux_gather_cb_t
pf_gather
;
/*!< gather subdec callback */
dvbpsi_decoder_t
*
p_decoder
;
/*!< private decoder for this subdec */
dvbpsi_demux_detach_cb_t
pf_detach
;
/*!< detach subdec callback */
struct
dvbpsi_demux_subdec_s
*
p_next
;
/*!< next subdec */
}
dvbpsi_demux_subdec_t
;
typedef
dvbpsi_decoder_t
dvbpsi_demux_subdec_t
;
/*****************************************************************************
* dvbpsi_demux_s
*****************************************************************************/
/*!
* \struct dvbpsi_demux_s
* \brief subtable demultiplexor structure
*
* This structure contains the subtables demultiplexor data, such as the
* decoders and new subtable callback.
*/
/*!
* \typedef struct dvbpsi_demux_s dvbpsi_demux_t
* \brief dvbpsi_demux_t type definition.
* \brief dvbpsi_demux_t type definition
is deprecated @see dvbpsi_t instead
.
*/
typedef
struct
dvbpsi_demux_s
dvbpsi_demux_t
;
typedef
dvbpsi_t
dvbpsi_demux_t
;
struct
dvbpsi_demux_s
{
DVBPSI_DECODER_COMMON
dvbpsi_demux_subdec_t
*
p_first_subdec
;
/*!< First subtable decoder */
/* New subtable callback */
dvbpsi_demux_new_cb_t
pf_new_callback
;
/*!< New subtable callback */
void
*
p_new_cb_data
;
/*!< Data provided to the
previous callback */
};
/*****************************************************************************
* dvbpsi_AttachDemux
*****************************************************************************/
/*!
* \fn __attribute__((deprecated)) bool dvbpsi_AttachDemux(dvbpsi_t *p_dvbpsi, dvbpsi_demux_new_cb_t pf_new_cb, void * p_new_cb_data)
* \brief Attaches a new demux structure on dvbpsi_t* handle.
* \fn __attribute__((deprecated,unused)) bool dvbpsi_AttachDemux(dvbpsi_t *p_dvbpsi,
* dvbpsi_demux_new_cb_t pf_new_cb, void * p_new_cb_data)
* \brief dvbpsi_AttachDemux is deprecated use @see dvbpsi_demux_chain_new() instead.
* \param p_dvbpsi pointer to dvbpsi_t handle
* \param pf_new_cb A callcack called when a new type of subtable is found.
* \param p_new_cb_data Data given to the previous callback.
...
...
@@ -149,8 +114,8 @@ bool dvbpsi_AttachDemux(dvbpsi_t * p_dvbpsi,
* dvbpsi_DetachDemux
*****************************************************************************/
/*!
* \fn __attribute__((deprecated)) void dvbpsi_DetachDemux(dvbpsi_t *p_dvbpsi)
* \brief
Destroys a demux structure.
* \fn __attribute__((deprecated
,unused
)) void dvbpsi_DetachDemux(dvbpsi_t *p_dvbpsi)
* \brief
dvbpsi_DetachDemux is deprecated use @see dvbpsi_demux_chain_delete() instead
* \param p_dvbpsi The handle of the demux to be destroyed.
* \return nothing
*/
...
...
@@ -161,8 +126,8 @@ void dvbpsi_DetachDemux(dvbpsi_t *p_dvbpsi);
* dvbpsi_demuxGetSubDec
*****************************************************************************/
/*!
* \fn
dvbpsi_demux_subdec_t *
dvbpsi_demuxGetSubDec(dvbpsi_demux_t *, uint8_t, uint16_t)
* \brief
Looks for a subtable decoder, given the subtable ID
.
* \fn
__attribute__((deprecated,unused)) dvbpsi_demux_subdec_t *
dvbpsi_demuxGetSubDec(dvbpsi_demux_t *, uint8_t, uint16_t)
* \brief
dvbpsi_demux_GetSubDec is deprecated use @see dvbpsi_decoder_chain_get() instead
.
* \param p_demux Pointer to the demux structure.
* \param i_table_id Table ID of the wanted subtable.
* \param i_extension Table ID extension of the wanted subtable.
...
...
@@ -180,7 +145,7 @@ dvbpsi_demux_subdec_t * dvbpsi_demuxGetSubDec(dvbpsi_demux_t * p_demux,
/*!
* \fn __attribute__((deprecated)) void dvbpsi_Demux(dvbpsi_t *p_dvbpsi,
dvbpsi_psi_section_t * p_section)
* \brief
Sends the PSI sections to the right subtable decoder according to their table ID and extension
.
* \brief
dvbpsi_Demux is deprecated @see dvbpsi_decoder_chain_demux() instead
.
* \param p_dvbpsi PSI decoder handle.
* \param p_section PSI section.
*/
...
...
@@ -196,7 +161,7 @@ void dvbpsi_Demux(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section);
dvbpsi_demux_detach_cb_t pf_detach,
dvbpsi_demux_gather_cb_t pf_gather,
dvbpsi_decoder_t *p_decoder)
* \brief
Allocates a new demux sub table decoder and initializes it
.
* \brief
dvbpsi_NewDemuxSubDecoder is deprecated use @see dvbpsi_decoder_chain_add() instead
.
* \param i_table_id table id to create subtable decoder for
* \param i_extension table extension to create subtable decoder for
* \param pf_detach pointer to detach function for subtable decoder.
...
...
@@ -216,8 +181,7 @@ dvbpsi_demux_subdec_t *dvbpsi_NewDemuxSubDecoder(const uint8_t i_table_id,
*****************************************************************************/
/*!
* \fn __attribute__((deprecated)) void dvbpsi_DeleteDemuxSubDecoder(dvbpsi_demux_subdec_t *p_subdec)
* \brief Releases memory allocated with @see dvbpsi_NewDemuxSubDecoder. It will
* also release p_cb_data pointer.
* \brief dvbpsi_DeleteDemuxSubDecoder is deprecated use @see dvbpsi_decoder_chain_remove() instead.
* \param p_subdec pointer to demux subtable decoder.
* \return nothing.
*/
...
...
@@ -229,7 +193,7 @@ void dvbpsi_DeleteDemuxSubDecoder(dvbpsi_demux_subdec_t *p_subdec);
*****************************************************************************/
/*!
* \fn __attribute__((deprecated)) void dvbpsi_AttachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t *p_subdec)
* \brief
Attach a subtable decoder to the given demux handle
.
* \brief
dvbpsi_AttachDemuxSubDecoder is deprecated use dvbpsi_<table>_detach() instead
.
* \param p_demux pointer to dvbpsi_demux_t
* \param p_subdec pointer to dvbpsi_demux_subdec_t
* \return nothing
...
...
@@ -242,7 +206,7 @@ void dvbpsi_AttachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t
*****************************************************************************/
/*!
* \fn __attribute__((deprecated)) void dvbpsi_DetachDemuxSubDecoder(dvbpsi_demux_t *p_demux, dvbpsi_demux_subdec_t *p_subdec)
* \brief
Detach a subtable decoder from the given demux pointer
.
* \brief
dvbpsi_DetachDemuxSubDecoder is deprecated use dvbpsi_<table>_detach() instead
.
* \param p_demux pointer to dvbpsi_demux_t
* \param p_subdec pointer to dvbpsi_demux_subdec_t
* \return nothing
...
...
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