Commit ec49b67c authored by Francois Cartegnie's avatar Francois Cartegnie

require libdvbpsi >= 1.0.0

Removes unreadable and unmaintainable ifdefs hacks everywhere
parent 6431ea39
......@@ -1973,7 +1973,7 @@ dnl
dnl libdvbpsi check for ts mux/demux
dnl
have_dvbpsi="no"
PKG_WITH_MODULES([DVBPSI], [libdvbpsi], [have_dvbpsi="yes"])
PKG_WITH_MODULES([DVBPSI], [libdvbpsi >= 1.0.0], [have_dvbpsi="yes"])
AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
......
......@@ -2263,13 +2263,13 @@ int en50221_SetCAPMT( cam_t * p_cam, dvbpsi_pmt_t *p_pmt )
if ( !b_needs_descrambling )
{
dvbpsi_DeletePMT( p_pmt );
dvbpsi_pmt_delete( p_pmt );
p_pmt = p_cam->pp_selected_programs[i];
p_cam->pp_selected_programs[i] = NULL;
}
else if( p_pmt != p_cam->pp_selected_programs[i] )
{
dvbpsi_DeletePMT( p_cam->pp_selected_programs[i] );
dvbpsi_pmt_delete( p_cam->pp_selected_programs[i] );
p_cam->pp_selected_programs[i] = p_pmt;
}
......@@ -2308,7 +2308,7 @@ int en50221_SetCAPMT( cam_t * p_cam, dvbpsi_pmt_t *p_pmt )
if ( !b_needs_descrambling )
{
dvbpsi_DeletePMT( p_pmt );
dvbpsi_pmt_delete( p_pmt );
}
return VLC_SUCCESS;
......@@ -2684,7 +2684,7 @@ void en50221_End( cam_t * p_cam )
{
if( p_cam->pp_selected_programs[i] != NULL )
{
dvbpsi_DeletePMT( p_cam->pp_selected_programs[i] );
dvbpsi_pmt_delete( p_cam->pp_selected_programs[i] );
}
}
......
......@@ -103,15 +103,15 @@ struct scan_session_t
scan_configuration_t cfg;
int i_snr;
dvbpsi_handle pat;
dvbpsi_t *pat;
dvbpsi_pat_t *p_pat;
int i_nit_pid;
dvbpsi_handle sdt;
dvbpsi_t *sdt;
dvbpsi_sdt_t *p_sdt;
#ifdef DVBPSI_USE_NIT
dvbpsi_handle nit;
dvbpsi_t *nit;
dvbpsi_nit_t *p_nit;
#else
# warning NIT is not supported by your libdvbpsi version
......@@ -701,12 +701,12 @@ static void PATCallBack( scan_session_t *p_session, dvbpsi_pat_t *p_pat )
/* */
if( p_session->p_pat && p_session->p_pat->b_current_next )
{
dvbpsi_DeletePAT( p_session->p_pat );
dvbpsi_pat_delete( p_session->p_pat );
p_session->p_pat = NULL;
}
if( p_session->p_pat )
{
dvbpsi_DeletePAT( p_pat );
dvbpsi_pat_delete( p_pat );
return;
}
......@@ -733,12 +733,12 @@ static void SDTCallBack( scan_session_t *p_session, dvbpsi_sdt_t *p_sdt )
if( p_session->p_sdt && p_session->p_sdt->b_current_next )
{
dvbpsi_DeleteSDT( p_session->p_sdt );
dvbpsi_sdt_delete( p_session->p_sdt );
p_session->p_sdt = NULL;
}
if( p_session->p_sdt )
{
dvbpsi_DeleteSDT( p_sdt );
dvbpsi_sdt_delete( p_sdt );
return;
}
......@@ -747,11 +747,7 @@ static void SDTCallBack( scan_session_t *p_session, dvbpsi_sdt_t *p_sdt )
/* */
msg_Dbg( p_obj, "new SDT ts_id=%d version=%d current_next=%d network_id=%d",
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
p_sdt->i_extension,
#else
p_sdt->i_ts_id,
#endif
p_sdt->i_version, p_sdt->b_current_next,
p_sdt->i_network_id );
......@@ -801,12 +797,12 @@ static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit )
/* */
if( p_session->p_nit && p_session->p_nit->b_current_next )
{
dvbpsi_DeleteNIT( p_session->p_nit );
dvbpsi_nit_delete( p_session->p_nit );
p_session->p_nit = NULL;
}
if( p_session->p_nit )
{
dvbpsi_DeleteNIT( p_nit );
dvbpsi_nit_delete( p_nit );
return;
}
......@@ -932,7 +928,6 @@ static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit )
}
#endif
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
static void PSINewTableCallBack( dvbpsi_t *h, uint8_t i_table_id, uint16_t i_extension, void *p_data )
{
scan_session_t *p_session = (scan_session_t *)p_data;
......@@ -948,17 +943,6 @@ static void PSINewTableCallBack( dvbpsi_t *h, uint8_t i_table_id, uint16_t i_ext
msg_Err( p_session->p_obj, "PSINewTableCallback: failed attaching NITCallback" );
}
}
#else
static void PSINewTableCallBack( scan_session_t *p_session, dvbpsi_handle h, uint8_t i_table_id, uint16_t i_extension )
{
if( i_table_id == 0x42 )
dvbpsi_AttachSDT( h, i_table_id, i_extension, (dvbpsi_sdt_callback)SDTCallBack, p_session );
# ifdef DVBPSI_USE_NIT
else if( i_table_id == 0x40 || i_table_id == 0x41 )
dvbpsi_AttachNIT( h, i_table_id, i_extension, (dvbpsi_nit_callback)NITCallBack, p_session );
# endif
}
#endif
scan_session_t *scan_session_New( vlc_object_t *p_obj,
const scan_configuration_t *p_cfg )
......@@ -1096,20 +1080,20 @@ void scan_session_Destroy( scan_t *p_scan, scan_session_t *p_session )
/* */
if( p_session->pat )
dvbpsi_DetachPAT( p_session->pat );
dvbpsi_pat_detach( p_session->pat );
if( p_session->p_pat )
dvbpsi_DeletePAT( p_session->p_pat );
dvbpsi_pat_delete( p_session->p_pat );
if( p_session->sdt )
dvbpsi_DetachDemux( p_session->sdt );
if( p_session->p_sdt )
dvbpsi_DeleteSDT( p_session->p_sdt );
dvbpsi_sdt_delete( p_session->p_sdt );
#ifdef DVBPSI_USE_NIT
if( p_session->nit )
dvbpsi_DetachDemux( p_session->nit );
if( p_session->p_nit )
dvbpsi_DeleteNIT( p_session->p_nit );
dvbpsi_nit_delete( p_session->p_nit );
#endif
free( p_session );
}
......@@ -1227,7 +1211,6 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block )
if( i_pid == 0x00 )
{
if( !p_scan->pat )
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
{
p_scan->pat = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_scan->pat )
......@@ -1244,16 +1227,12 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block )
return false;
}
}
#else
p_scan->pat = dvbpsi_AttachPAT( (dvbpsi_pat_callback)PATCallBack, p_scan );
#endif
if( p_scan->pat )
dvbpsi_PushPacket( p_scan->pat, p_block->p_buffer );
dvbpsi_packet_push( p_scan->pat, p_block->p_buffer );
}
else if( i_pid == 0x11 )
{
if( !p_scan->sdt )
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
{
p_scan->sdt = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_scan->sdt )
......@@ -1270,18 +1249,14 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block )
return false;
}
}
#else
p_scan->sdt = dvbpsi_AttachDemux( (dvbpsi_demux_new_cb_t)PSINewTableCallBack, p_scan );
#endif
if( p_scan->sdt )
dvbpsi_PushPacket( p_scan->sdt, p_block->p_buffer );
dvbpsi_packet_push( p_scan->sdt, p_block->p_buffer );
}
else /*if( i_pid == p_scan->i_nit_pid )*/
{
#ifdef DVBPSI_USE_NIT
if( !p_scan->nit )
# if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
{
p_scan->nit = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_scan->nit )
......@@ -1298,11 +1273,8 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block )
return false;
}
}
# else
p_scan->nit = dvbpsi_AttachDemux( (dvbpsi_demux_new_cb_t)PSINewTableCallBack, p_scan );
# endif
if( p_scan->nit )
dvbpsi_PushPacket( p_scan->nit, p_block->p_buffer );
dvbpsi_packet_push( p_scan->nit, p_block->p_buffer );
#endif
}
......
This diff is collapsed.
......@@ -23,47 +23,6 @@
#ifndef DVBPSI_COMPAT_H
#define DVBPSI_COMPAT_H
/*
* dvbpsi compatibility macros:
* dvbpsi version 1.0.0 and above returns a struct 'dvbpsi_t' as handle
*/
#define DVBPSI_VERSION_WANTED(major,minor,bugfix) (((major)<<16)+((minor)<<8)+(bugfix))
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
# define dvbpsi_handle dvbpsi_t*
# define dvbpsi_PushPacket(handle,data) dvbpsi_packet_push((handle),(data))
/* PAT */
# define dvbpsi_InitPAT(pat,id,version,next) dvbpsi_pat_init((pat),(id),(version),(bool)(next))
# define dvbpsi_PATAddProgram(pat,nr,pid) dvbpsi_pat_program_add((pat),(nr),(pid))
# define dvbpsi_EmptyPAT(pat) dvbpsi_pat_empty((pat))
# define dvbpsi_DeletePAT(table) dvbpsi_pat_delete((table))
# define dvbpsi_DetachPAT(pat) dvbpsi_pat_detach((pat))
/* PMT */
# define dvbpsi_InitPMT(pmt,program,version,next,pcr) \
dvbpsi_pmt_init((pmt),(program),(version),(bool)(next),(pcr))
# define dvbpsi_PMTAddDescriptor(pmt,tag,length,data) \
dvbpsi_pmt_descriptor_add((pmt),(tag),(length),(data))
# define dvbpsi_PMTAddES(pmt,type,pid) \
dvbpsi_pmt_es_add((pmt),(type),(pid))
# define dvbpsi_PMTESAddDescriptor(es,tag,length,data) \
dvbpsi_pmt_es_descriptor_add((es),(tag),(length),(data))
# define dvbpsi_EmptyPMT(pmt) dvbpsi_pmt_empty((pmt))
# define dvbpsi_DeletePMT(table) dvbpsi_pmt_delete((table))
# define dvbpsi_DetachPMT(pmt) dvbpsi_pmt_detach((pmt))
/* SDT */
# define dvbpsi_InitSDT(sdt,id,version,curnext,netid) \
dvbpsi_sdt_init((sdt),(id),(0),(version),(bool)(curnext),(netid))
# define dvbpsi_SDTAddService(sdt,id,schedule,present,status,ca) \
dvbpsi_sdt_service_add((sdt),(id),(bool)(schedule),(bool)(present),(status),(bool)(ca))
# define dvbpsi_EmptySDT(sdt) dvbpsi_sdt_empty((sdt))
# define dvbpsi_DeleteSDT(table) dvbpsi_sdt_delete((table))
/* TOT */
# define dvbpsi_DeleteTOT(table) dvbpsi_tot_delete((table))
/* EIT */
# define dvbpsi_DeleteEIT(table) dvbpsi_eit_delete((table))
/* NIT */
# define dvbpsi_DeleteNIT(table) dvbpsi_nit_delete((table))
static inline void dvbpsi_messages(dvbpsi_t *p_dvbpsi, const dvbpsi_msg_level_t level, const char* msg)
{
vlc_object_t *obj = (vlc_object_t *)p_dvbpsi->p_sys;
......@@ -81,6 +40,5 @@ static inline void dvbpsi_messages(dvbpsi_t *p_dvbpsi, const dvbpsi_msg_level_t
break;
}
}
#endif
#endif
This diff is collapsed.
......@@ -20,12 +20,6 @@
#ifndef _TABLES_H
#define _TABLES_H 1
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
#define DVBPSI_HANDLE_PARAM(a) a,
#else
#define DVBPSI_HANDLE_PARAM(a)
#endif
#define MAX_SDT_DESC 64
typedef struct
......@@ -41,7 +35,7 @@ typedef struct
block_t * WritePSISection( dvbpsi_psi_section_t* p_section );
void BuildPAT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi)
void BuildPAT( dvbpsi_t *p_dvbpsi,
void *p_opaque, PEStoTSCallback pf_callback,
int i_tsid, int i_pat_version_number,
ts_stream_t *p_pat,
......@@ -55,7 +49,7 @@ typedef struct
int i_mapped_prog;
} pes_mapped_stream_t;
void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
void *p_opaque, PEStoTSCallback pf_callback,
int i_tsid, int i_pmt_version_number,
int i_pcr_pid,
......
......@@ -332,9 +332,7 @@ struct sout_mux_sys_t
vlc_mutex_t csa_lock;
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
dvbpsi_t *p_dvbpsi;
#endif
bool b_es_id_pid;
bool b_sdt;
int i_pid_video;
......@@ -538,8 +536,6 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM;
p_sys->i_num_pmt = 1;
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
p_sys->p_dvbpsi = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_sys->p_dvbpsi )
{
......@@ -547,7 +543,6 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM;
}
p_sys->p_dvbpsi->p_sys = (void *) p_mux;
#endif
p_sys->b_es_id_pid = var_GetBool( p_mux, SOUT_CFG_PREFIX "es-id-pid" );
......@@ -745,10 +740,8 @@ static void Close( vlc_object_t * p_this )
sout_mux_t *p_mux = (sout_mux_t*)p_this;
sout_mux_sys_t *p_sys = p_mux->p_sys;
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
if( p_sys->p_dvbpsi )
dvbpsi_delete( p_sys->p_dvbpsi );
#endif
if( p_sys->csa )
{
......@@ -1935,7 +1928,7 @@ void GetPAT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
{
sout_mux_sys_t *p_sys = p_mux->p_sys;
BuildPAT( DVBPSI_HANDLE_PARAM(p_sys->p_dvbpsi)
BuildPAT( p_sys->p_dvbpsi,
c, (PEStoTSCallback)BufferChainAppend,
p_sys->i_tsid, p_sys->i_pat_version_number,
&p_sys->pat,
......@@ -1963,7 +1956,7 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
mappeds[i_stream].ts = &p_stream->ts;
}
BuildPMT( DVBPSI_HANDLE_PARAM(p_sys->p_dvbpsi) VLC_OBJECT(p_mux),
BuildPMT( p_sys->p_dvbpsi, VLC_OBJECT(p_mux),
c, (PEStoTSCallback)BufferChainAppend,
p_sys->i_tsid, p_sys->i_pmt_version_number,
p_sys->i_pcr_pid,
......
Markdown is supported
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