[vlc-commits] demux: ts: encap psi packets push
Francois Cartegnie
git at videolan.org
Thu Mar 3 18:16:18 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 2 17:51:14 2016 +0100| [42cb58fa03a0fc56d71fcb4e6b71bbc65c132981] | committer: Francois Cartegnie
demux: ts: encap psi packets push
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=42cb58fa03a0fc56d71fcb4e6b71bbc65c132981
---
modules/demux/mpeg/ts.c | 26 ++++----------------------
modules/demux/mpeg/ts_psi.c | 8 ++++++++
modules/demux/mpeg/ts_psi.h | 1 +
modules/demux/mpeg/ts_psi_eit.c | 7 +++++++
modules/demux/mpeg/ts_psi_eit.h | 4 ++++
modules/demux/mpeg/ts_psip.c | 6 ++++++
modules/demux/mpeg/ts_psip.h | 4 ++++
7 files changed, 34 insertions(+), 22 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 2ca7785..12907f9 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -35,19 +35,12 @@
#include <vlc_access.h> /* DVB-specific things */
#include <vlc_demux.h>
-/* Include dvbpsi headers */
-#ifndef _DVBPSI_DVBPSI_H_
- # include <dvbpsi/dvbpsi.h>
-#endif
-# include <dvbpsi/descriptor.h>
-# include <dvbpsi/pat.h>
-# include <dvbpsi/pmt.h>
-
#include "ts_pid.h"
#include "ts_streams.h"
#include "ts_streams_private.h"
#include "ts_psi.h"
#include "ts_psi_eit.h"
+#include "ts_psip.h"
#include "ts_hotfixes.h"
#include "ts_sl.h"
@@ -680,12 +673,8 @@ static int Demux( demux_t *p_demux )
switch( p_pid->type )
{
case TYPE_PAT:
- dvbpsi_packet_push( p_pid->u.p_pat->handle, p_pkt->p_buffer );
- block_Release( p_pkt );
- break;
-
case TYPE_PMT:
- dvbpsi_packet_push( p_pid->u.p_pmt->handle, p_pkt->p_buffer );
+ ts_psi_Packet_Push( p_pid, p_pkt->p_buffer );
block_Release( p_pkt );
break;
@@ -710,14 +699,12 @@ static int Demux( demux_t *p_demux )
break;
case TYPE_SI:
- if( p_sys->b_dvb_meta && p_pid->u.p_si->handle->p_decoder )
- dvbpsi_packet_push( p_pid->u.p_si->handle, p_pkt->p_buffer );
+ ts_si_Packet_Push( p_pid, p_pkt->p_buffer );
block_Release( p_pkt );
break;
case TYPE_PSIP:
- if( p_pid->u.p_psip->handle->p_decoder )
- dvbpsi_packet_push( p_pid->u.p_psip->handle, p_pkt->p_buffer );
+ ts_psip_Packet_Push( p_pid, p_pkt->p_buffer );
block_Release( p_pkt );
break;
@@ -2430,11 +2417,6 @@ static bool GatherPESData( demux_t *p_demux, ts_pid_t *pid, block_t *p_pkt,
return i_ret;
}
-/****************************************************************************
- ****************************************************************************
- ** libdvbpsi callbacks
- ****************************************************************************
- ****************************************************************************/
bool ProgramIsSelected( demux_sys_t *p_sys, uint16_t i_pgrm )
{
for(int i=0; i<p_sys->programs.i_size; i++)
diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index 95c3aa1..824db6d 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -1836,3 +1836,11 @@ bool ts_psi_PAT_Attach( ts_pid_t *patpid, void *cbdata )
return false;
return dvbpsi_pat_attach( patpid->u.p_pat->handle, PATCallBack, cbdata );
}
+
+void ts_psi_Packet_Push( ts_pid_t *p_pid, const uint8_t *p_pktbuffer )
+{
+ if( p_pid->type == TYPE_PAT )
+ dvbpsi_packet_push( p_pid->u.p_pat->handle, (uint8_t *) p_pktbuffer );
+ else if( p_pid->type == TYPE_PMT )
+ dvbpsi_packet_push( p_pid->u.p_pmt->handle, (uint8_t *) p_pktbuffer );
+}
diff --git a/modules/demux/mpeg/ts_psi.h b/modules/demux/mpeg/ts_psi.h
index 62c1286..fe2bbe5 100644
--- a/modules/demux/mpeg/ts_psi.h
+++ b/modules/demux/mpeg/ts_psi.h
@@ -30,6 +30,7 @@ typedef enum
} ts_pmt_registration_type_t;
bool ts_psi_PAT_Attach( ts_pid_t *, void * );
+void ts_psi_Packet_Push( ts_pid_t *, const uint8_t * );
int UserPmt( demux_t *p_demux, const char * );
diff --git a/modules/demux/mpeg/ts_psi_eit.c b/modules/demux/mpeg/ts_psi_eit.c
index 674944a..a807512 100644
--- a/modules/demux/mpeg/ts_psi_eit.c
+++ b/modules/demux/mpeg/ts_psi_eit.c
@@ -65,6 +65,13 @@
static void SINewTableCallBack( dvbpsi_t *h, uint8_t i_table_id,
uint16_t i_extension, void *p_pid_cbdata );
+void ts_si_Packet_Push( ts_pid_t *p_pid, const uint8_t *p_pktbuffer )
+{
+ if( likely(p_pid->type == TYPE_SI) &&
+ dvbpsi_decoder_present( p_pid->u.p_si->handle ) )
+ dvbpsi_packet_push( p_pid->u.p_si->handle, (uint8_t *) p_pktbuffer );
+}
+
static char *EITConvertToUTF8( demux_t *p_demux,
const unsigned char *psz_instring,
size_t i_length,
diff --git a/modules/demux/mpeg/ts_psi_eit.h b/modules/demux/mpeg/ts_psi_eit.h
index 46ad956..204deb1 100644
--- a/modules/demux/mpeg/ts_psi_eit.h
+++ b/modules/demux/mpeg/ts_psi_eit.h
@@ -19,6 +19,8 @@
#ifndef VLC_TS_PSI_EIT_H
#define VLC_TS_PSI_EIT_H
+#include "ts_pid_fwd.h"
+
//#define PSI_DEBUG_EIT
#define TS_SI_SDT_PID 0x11
@@ -35,6 +37,8 @@
#define TS_SI_RUNSTATUS_RUNNING 0x04
#define TS_SI_RUNSTATUS_OFF_AIR 0x05
+void ts_si_Packet_Push( ts_pid_t *, const uint8_t * );
+
bool ts_attach_SI_Tables_Decoders( dvbpsi_t *p_handle, void * );
#endif
diff --git a/modules/demux/mpeg/ts_psip.c b/modules/demux/mpeg/ts_psip.c
index 9c32b3e..36bc4f9c 100644
--- a/modules/demux/mpeg/ts_psip.c
+++ b/modules/demux/mpeg/ts_psip.c
@@ -73,6 +73,12 @@ struct ts_psip_context_t
DECL_ARRAY(dvbpsi_atsc_eit_t *) eits; /* For EIT pid, used on new ETT update */
};
+void ts_psip_Packet_Push( ts_pid_t *p_pid, const uint8_t *p_pktbuffer )
+{
+ if( p_pid->u.p_psip->handle->p_decoder && likely(p_pid->type == TYPE_PSIP) )
+ dvbpsi_packet_push( p_pid->u.p_psip->handle, (uint8_t *) p_pktbuffer );
+}
+
ts_psip_context_t * ts_psip_context_New()
{
ts_psip_context_t *p_ctx = malloc(sizeof(*p_ctx));
diff --git a/modules/demux/mpeg/ts_psip.h b/modules/demux/mpeg/ts_psip.h
index 2676a01..e01b9c7 100644
--- a/modules/demux/mpeg/ts_psip.h
+++ b/modules/demux/mpeg/ts_psip.h
@@ -19,6 +19,8 @@
#ifndef VLC_ATSC_PSIP_H
#define VLC_ATSC_PSIP_H
+#include "ts_pid_fwd.h"
+
#ifndef _DVBPSI_DVBPSI_H_
#include <dvbpsi/dvbpsi.h>
#endif
@@ -56,6 +58,8 @@
typedef struct ts_psip_context_t ts_psip_context_t;
+void ts_psip_Packet_Push( ts_pid_t *, const uint8_t * );
+
ts_psip_context_t * ts_psip_context_New( void );
void ts_psip_context_Delete( ts_psip_context_t * );
More information about the vlc-commits
mailing list