Commit 42cb58fa authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

demux: ts: encap psi packets push

parent a985c6f6
......@@ -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++)
......
......@@ -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 );
}
......@@ -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 * );
......
......@@ -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,
......
......@@ -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
......@@ -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));
......
......@@ -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 * );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment