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 ...@@ -1973,7 +1973,7 @@ dnl
dnl libdvbpsi check for ts mux/demux dnl libdvbpsi check for ts mux/demux
dnl dnl
have_dvbpsi="no" 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"]) AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
......
...@@ -2263,13 +2263,13 @@ int en50221_SetCAPMT( cam_t * p_cam, dvbpsi_pmt_t *p_pmt ) ...@@ -2263,13 +2263,13 @@ int en50221_SetCAPMT( cam_t * p_cam, dvbpsi_pmt_t *p_pmt )
if ( !b_needs_descrambling ) if ( !b_needs_descrambling )
{ {
dvbpsi_DeletePMT( p_pmt ); dvbpsi_pmt_delete( p_pmt );
p_pmt = p_cam->pp_selected_programs[i]; p_pmt = p_cam->pp_selected_programs[i];
p_cam->pp_selected_programs[i] = NULL; p_cam->pp_selected_programs[i] = NULL;
} }
else if( p_pmt != p_cam->pp_selected_programs[i] ) 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; p_cam->pp_selected_programs[i] = p_pmt;
} }
...@@ -2308,7 +2308,7 @@ int en50221_SetCAPMT( cam_t * p_cam, dvbpsi_pmt_t *p_pmt ) ...@@ -2308,7 +2308,7 @@ int en50221_SetCAPMT( cam_t * p_cam, dvbpsi_pmt_t *p_pmt )
if ( !b_needs_descrambling ) if ( !b_needs_descrambling )
{ {
dvbpsi_DeletePMT( p_pmt ); dvbpsi_pmt_delete( p_pmt );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -2684,7 +2684,7 @@ void en50221_End( cam_t * p_cam ) ...@@ -2684,7 +2684,7 @@ void en50221_End( cam_t * p_cam )
{ {
if( p_cam->pp_selected_programs[i] != NULL ) 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 ...@@ -103,15 +103,15 @@ struct scan_session_t
scan_configuration_t cfg; scan_configuration_t cfg;
int i_snr; int i_snr;
dvbpsi_handle pat; dvbpsi_t *pat;
dvbpsi_pat_t *p_pat; dvbpsi_pat_t *p_pat;
int i_nit_pid; int i_nit_pid;
dvbpsi_handle sdt; dvbpsi_t *sdt;
dvbpsi_sdt_t *p_sdt; dvbpsi_sdt_t *p_sdt;
#ifdef DVBPSI_USE_NIT #ifdef DVBPSI_USE_NIT
dvbpsi_handle nit; dvbpsi_t *nit;
dvbpsi_nit_t *p_nit; dvbpsi_nit_t *p_nit;
#else #else
# warning NIT is not supported by your libdvbpsi version # 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 ) ...@@ -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 ) 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; p_session->p_pat = NULL;
} }
if( p_session->p_pat ) if( p_session->p_pat )
{ {
dvbpsi_DeletePAT( p_pat ); dvbpsi_pat_delete( p_pat );
return; return;
} }
...@@ -733,12 +733,12 @@ static void SDTCallBack( scan_session_t *p_session, dvbpsi_sdt_t *p_sdt ) ...@@ -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 ) 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; p_session->p_sdt = NULL;
} }
if( p_session->p_sdt ) if( p_session->p_sdt )
{ {
dvbpsi_DeleteSDT( p_sdt ); dvbpsi_sdt_delete( p_sdt );
return; return;
} }
...@@ -747,11 +747,7 @@ static void SDTCallBack( scan_session_t *p_session, dvbpsi_sdt_t *p_sdt ) ...@@ -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", 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, p_sdt->i_extension,
#else
p_sdt->i_ts_id,
#endif
p_sdt->i_version, p_sdt->b_current_next, p_sdt->i_version, p_sdt->b_current_next,
p_sdt->i_network_id ); p_sdt->i_network_id );
...@@ -801,12 +797,12 @@ static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit ) ...@@ -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 ) 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; p_session->p_nit = NULL;
} }
if( p_session->p_nit ) if( p_session->p_nit )
{ {
dvbpsi_DeleteNIT( p_nit ); dvbpsi_nit_delete( p_nit );
return; return;
} }
...@@ -932,7 +928,6 @@ static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit ) ...@@ -932,7 +928,6 @@ static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit )
} }
#endif #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 ) 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; 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 ...@@ -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" ); 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, scan_session_t *scan_session_New( vlc_object_t *p_obj,
const scan_configuration_t *p_cfg ) const scan_configuration_t *p_cfg )
...@@ -1096,20 +1080,20 @@ void scan_session_Destroy( scan_t *p_scan, scan_session_t *p_session ) ...@@ -1096,20 +1080,20 @@ void scan_session_Destroy( scan_t *p_scan, scan_session_t *p_session )
/* */ /* */
if( p_session->pat ) if( p_session->pat )
dvbpsi_DetachPAT( p_session->pat ); dvbpsi_pat_detach( p_session->pat );
if( p_session->p_pat ) if( p_session->p_pat )
dvbpsi_DeletePAT( p_session->p_pat ); dvbpsi_pat_delete( p_session->p_pat );
if( p_session->sdt ) if( p_session->sdt )
dvbpsi_DetachDemux( p_session->sdt ); dvbpsi_DetachDemux( p_session->sdt );
if( p_session->p_sdt ) if( p_session->p_sdt )
dvbpsi_DeleteSDT( p_session->p_sdt ); dvbpsi_sdt_delete( p_session->p_sdt );
#ifdef DVBPSI_USE_NIT #ifdef DVBPSI_USE_NIT
if( p_session->nit ) if( p_session->nit )
dvbpsi_DetachDemux( p_session->nit ); dvbpsi_DetachDemux( p_session->nit );
if( p_session->p_nit ) if( p_session->p_nit )
dvbpsi_DeleteNIT( p_session->p_nit ); dvbpsi_nit_delete( p_session->p_nit );
#endif #endif
free( p_session ); free( p_session );
} }
...@@ -1227,7 +1211,6 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block ) ...@@ -1227,7 +1211,6 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block )
if( i_pid == 0x00 ) if( i_pid == 0x00 )
{ {
if( !p_scan->pat ) if( !p_scan->pat )
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
{ {
p_scan->pat = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG ); p_scan->pat = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_scan->pat ) if( !p_scan->pat )
...@@ -1244,16 +1227,12 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block ) ...@@ -1244,16 +1227,12 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block )
return false; return false;
} }
} }
#else
p_scan->pat = dvbpsi_AttachPAT( (dvbpsi_pat_callback)PATCallBack, p_scan );
#endif
if( p_scan->pat ) 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 ) else if( i_pid == 0x11 )
{ {
if( !p_scan->sdt ) if( !p_scan->sdt )
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
{ {
p_scan->sdt = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG ); p_scan->sdt = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_scan->sdt ) if( !p_scan->sdt )
...@@ -1270,18 +1249,14 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block ) ...@@ -1270,18 +1249,14 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block )
return false; return false;
} }
} }
#else
p_scan->sdt = dvbpsi_AttachDemux( (dvbpsi_demux_new_cb_t)PSINewTableCallBack, p_scan );
#endif
if( p_scan->sdt ) 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 )*/ else /*if( i_pid == p_scan->i_nit_pid )*/
{ {
#ifdef DVBPSI_USE_NIT #ifdef DVBPSI_USE_NIT
if( !p_scan->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 ); p_scan->nit = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_scan->nit ) if( !p_scan->nit )
...@@ -1298,11 +1273,8 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block ) ...@@ -1298,11 +1273,8 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block )
return false; return false;
} }
} }
# else
p_scan->nit = dvbpsi_AttachDemux( (dvbpsi_demux_new_cb_t)PSINewTableCallBack, p_scan );
# endif
if( p_scan->nit ) if( p_scan->nit )
dvbpsi_PushPacket( p_scan->nit, p_block->p_buffer ); dvbpsi_packet_push( p_scan->nit, p_block->p_buffer );
#endif #endif
} }
......
...@@ -235,7 +235,7 @@ typedef struct ...@@ -235,7 +235,7 @@ typedef struct
typedef struct typedef struct
{ {
dvbpsi_handle handle; dvbpsi_t *handle;
int i_version; int i_version;
int i_number; int i_number;
int i_pid_pcr; int i_pid_pcr;
...@@ -260,7 +260,7 @@ typedef struct ...@@ -260,7 +260,7 @@ typedef struct
typedef struct typedef struct
{ {
/* for special PAT/SDT case */ /* for special PAT/SDT case */
dvbpsi_handle handle; /* PAT/SDT/EIT */ dvbpsi_t *handle; /* PAT/SDT/EIT */
int i_pat_version; int i_pat_version;
int i_sdt_version; int i_sdt_version;
int i_ts_id; int i_ts_id;
...@@ -429,13 +429,8 @@ static void PIDFillFormat( es_format_t *fmt, int i_stream_type ); ...@@ -429,13 +429,8 @@ static void PIDFillFormat( es_format_t *fmt, int i_stream_type );
static void PATCallBack( void*, dvbpsi_pat_t * ); static void PATCallBack( void*, dvbpsi_pat_t * );
static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt ); static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
static void PSINewTableCallBack( dvbpsi_t *handle, uint8_t i_table_id, static void PSINewTableCallBack( dvbpsi_t *handle, uint8_t i_table_id,
uint16_t i_extension, demux_t * ); uint16_t i_extension, demux_t * );
#else
static void PSINewTableCallBack( demux_t *, dvbpsi_handle,
uint8_t i_table_id, uint16_t i_extension );
#endif
static int ChangeKeyCallback( vlc_object_t *, char const *, vlc_value_t, vlc_value_t, void * ); static int ChangeKeyCallback( vlc_object_t *, char const *, vlc_value_t, vlc_value_t, void * );
...@@ -621,7 +616,6 @@ static int DetectPVRHeadersAndHeaderSize( demux_t *p_demux, int *pi_header_size, ...@@ -621,7 +616,6 @@ static int DetectPVRHeadersAndHeaderSize( demux_t *p_demux, int *pi_header_size,
return DetectPacketSize( p_demux, pi_header_size, 0 ); return DetectPacketSize( p_demux, pi_header_size, 0 );
} }
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
static void vlc_dvbpsi_reset( demux_t *p_demux ) static void vlc_dvbpsi_reset( demux_t *p_demux )
{ {
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
...@@ -663,7 +657,6 @@ static void vlc_dvbpsi_reset( demux_t *p_demux ) ...@@ -663,7 +657,6 @@ static void vlc_dvbpsi_reset( demux_t *p_demux )
tdt->psi->handle = NULL; tdt->psi->handle = NULL;
} }
} }
#endif
static inline mtime_t ExtractPESTimestamp( const uint8_t *p_data ) static inline mtime_t ExtractPESTimestamp( const uint8_t *p_data )
{ {
...@@ -857,7 +850,7 @@ static void ProbePES( demux_t *p_demux, ts_pid_t *pid, const uint8_t *p_pesstart ...@@ -857,7 +850,7 @@ static void ProbePES( demux_t *p_demux, ts_pid_t *pid, const uint8_t *p_pesstart
static void BuildPATCallback( void *p_opaque, block_t *p_block ) static void BuildPATCallback( void *p_opaque, block_t *p_block )
{ {
ts_pid_t *pat_pid = (ts_pid_t *) p_opaque; ts_pid_t *pat_pid = (ts_pid_t *) p_opaque;
dvbpsi_PushPacket( pat_pid->psi->handle, p_block->p_buffer ); dvbpsi_packet_push( pat_pid->psi->handle, p_block->p_buffer );
} }
static void BuildPMTCallback( void *p_opaque, block_t *p_block ) static void BuildPMTCallback( void *p_opaque, block_t *p_block )
...@@ -867,7 +860,7 @@ static void BuildPMTCallback( void *p_opaque, block_t *p_block ) ...@@ -867,7 +860,7 @@ static void BuildPMTCallback( void *p_opaque, block_t *p_block )
{ {
for( int i_prg = 0; i_prg < program_pid->psi->i_prg; i_prg++ ) for( int i_prg = 0; i_prg < program_pid->psi->i_prg; i_prg++ )
{ {
dvbpsi_PushPacket( program_pid->psi->prg[i_prg]->handle, dvbpsi_packet_push( program_pid->psi->prg[i_prg]->handle,
p_block->p_buffer ); p_block->p_buffer );
} }
p_block = p_block->p_next; p_block = p_block->p_next;
...@@ -920,7 +913,7 @@ static void MissingPATPMTFixup( demux_t *p_demux ) ...@@ -920,7 +913,7 @@ static void MissingPATPMTFixup( demux_t *p_demux )
.b_discontinuity = false .b_discontinuity = false
}; };
BuildPAT( DVBPSI_HANDLE_PARAM(p_sys->pid[0].psi->handle) BuildPAT( p_sys->pid[0].psi->handle,
&p_sys->pid[0], BuildPATCallback, &p_sys->pid[0], BuildPATCallback,
0, 1, 0, 1,
&patstream, &patstream,
...@@ -958,7 +951,7 @@ static void MissingPATPMTFixup( demux_t *p_demux ) ...@@ -958,7 +951,7 @@ static void MissingPATPMTFixup( demux_t *p_demux )
j++; j++;
} }
BuildPMT( DVBPSI_HANDLE_PARAM(p_sys->pid[0].psi->handle) VLC_OBJECT(p_demux), BuildPMT( p_sys->pid[0].psi->handle, VLC_OBJECT(p_demux),
&p_sys->pid[i_program_pid], BuildPMTCallback, &p_sys->pid[i_program_pid], BuildPMTCallback,
0, 1, 0, 1,
i_pcr_pid, i_pcr_pid,
...@@ -1031,7 +1024,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -1031,7 +1024,6 @@ static int Open( vlc_object_t *p_this )
p_sys->csa = NULL; p_sys->csa = NULL;
p_sys->b_start_record = false; p_sys->b_start_record = false;
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
# define VLC_DVBPSI_DEMUX_TABLE_INIT(table,obj) \ # define VLC_DVBPSI_DEMUX_TABLE_INIT(table,obj) \
do { \ do { \
(table)->psi->handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG ); \ (table)->psi->handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG ); \
...@@ -1050,12 +1042,10 @@ static int Open( vlc_object_t *p_this ) ...@@ -1050,12 +1042,10 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC; \ return VLC_EGENERIC; \
} \ } \
} while (0); } while (0);
#endif
/* Init PAT handler */ /* Init PAT handler */
pat = &p_sys->pid[0]; pat = &p_sys->pid[0];
PIDInit( pat, true, NULL ); PIDInit( pat, true, NULL );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
pat->psi->handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG ); pat->psi->handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !pat->psi->handle ) if( !pat->psi->handle )
{ {
...@@ -1071,39 +1061,21 @@ static int Open( vlc_object_t *p_this ) ...@@ -1071,39 +1061,21 @@ static int Open( vlc_object_t *p_this )
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
#else
pat->psi->handle = dvbpsi_AttachPAT( PATCallBack, p_demux );
#endif
if( p_sys->b_dvb_meta ) if( p_sys->b_dvb_meta )
{ {
ts_pid_t *sdt = &p_sys->pid[0x11]; ts_pid_t *sdt = &p_sys->pid[0x11];
ts_pid_t *eit = &p_sys->pid[0x12]; ts_pid_t *eit = &p_sys->pid[0x12];
PIDInit( sdt, true, NULL ); PIDInit( sdt, true, NULL );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
VLC_DVBPSI_DEMUX_TABLE_INIT( sdt, p_demux ) VLC_DVBPSI_DEMUX_TABLE_INIT( sdt, p_demux )
#else
sdt->psi->handle =
dvbpsi_AttachDemux( (dvbpsi_demux_new_cb_t)PSINewTableCallBack,
p_demux );
#endif
PIDInit( eit, true, NULL ); PIDInit( eit, true, NULL );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
VLC_DVBPSI_DEMUX_TABLE_INIT( eit, p_demux ) VLC_DVBPSI_DEMUX_TABLE_INIT( eit, p_demux )
#else
eit->psi->handle =
dvbpsi_AttachDemux( (dvbpsi_demux_new_cb_t)PSINewTableCallBack,
p_demux );
#endif
ts_pid_t *tdt = &p_sys->pid[0x14]; ts_pid_t *tdt = &p_sys->pid[0x14];
PIDInit( tdt, true, NULL ); PIDInit( tdt, true, NULL );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
VLC_DVBPSI_DEMUX_TABLE_INIT( tdt, p_demux ) VLC_DVBPSI_DEMUX_TABLE_INIT( tdt, p_demux )
#else
tdt->psi->handle =
dvbpsi_AttachDemux( (dvbpsi_demux_new_cb_t)PSINewTableCallBack,
p_demux );
#endif
if( p_sys->b_access_control ) if( p_sys->b_access_control )
{ {
...@@ -1114,9 +1086,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -1114,9 +1086,7 @@ static int Open( vlc_object_t *p_this )
} }
} }
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
# undef VLC_DVBPSI_DEMUX_TABLE_INIT # undef VLC_DVBPSI_DEMUX_TABLE_INIT
#endif
/* Init PMT array */ /* Init PMT array */
TAB_INIT( p_sys->i_pmt, p_sys->pmt ); TAB_INIT( p_sys->i_pmt, p_sys->pmt );
...@@ -1225,14 +1195,10 @@ static void Close( vlc_object_t *p_this ) ...@@ -1225,14 +1195,10 @@ static void Close( vlc_object_t *p_this )
switch( pid->i_pid ) switch( pid->i_pid )
{ {
case 0: /* PAT */ case 0: /* PAT */
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
if( dvbpsi_decoder_present( pid->psi->handle ) ) if( dvbpsi_decoder_present( pid->psi->handle ) )
dvbpsi_pat_detach( pid->psi->handle ); dvbpsi_pat_detach( pid->psi->handle );
dvbpsi_delete( pid->psi->handle ); dvbpsi_delete( pid->psi->handle );
pid->psi->handle = NULL; pid->psi->handle = NULL;
#else
dvbpsi_DetachPAT( pid->psi->handle );
#endif
free( pid->psi ); free( pid->psi );
break; break;
case 1: /* CAT */ case 1: /* CAT */
...@@ -1243,10 +1209,8 @@ static void Close( vlc_object_t *p_this ) ...@@ -1243,10 +1209,8 @@ static void Close( vlc_object_t *p_this )
{ {
/* SDT or EIT or TDT */ /* SDT or EIT or TDT */
dvbpsi_DetachDemux( pid->psi->handle ); dvbpsi_DetachDemux( pid->psi->handle );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
dvbpsi_delete( pid->psi->handle ); dvbpsi_delete( pid->psi->handle );
pid->psi->handle = NULL; pid->psi->handle = NULL;
#endif
free( pid->psi ); free( pid->psi );
} }
else else
...@@ -1369,13 +1333,13 @@ static int Demux( demux_t *p_demux ) ...@@ -1369,13 +1333,13 @@ static int Demux( demux_t *p_demux )
{ {
if( p_pid->i_pid == 0 || ( p_sys->b_dvb_meta && ( p_pid->i_pid == 0x11 || p_pid->i_pid == 0x12 || p_pid->i_pid == 0x14 ) ) ) if( p_pid->i_pid == 0 || ( p_sys->b_dvb_meta && ( p_pid->i_pid == 0x11 || p_pid->i_pid == 0x12 || p_pid->i_pid == 0x14 ) ) )
{ {
dvbpsi_PushPacket( p_pid->psi->handle, p_pkt->p_buffer ); dvbpsi_packet_push( p_pid->psi->handle, p_pkt->p_buffer );
} }
else else
{ {
for( int i_prg = 0; i_prg < p_pid->psi->i_prg; i_prg++ ) for( int i_prg = 0; i_prg < p_pid->psi->i_prg; i_prg++ )
{ {
dvbpsi_PushPacket( p_pid->psi->prg[i_prg]->handle, dvbpsi_packet_push( p_pid->psi->prg[i_prg]->handle,
p_pkt->p_buffer ); p_pkt->p_buffer );
} }
} }
...@@ -1736,7 +1700,6 @@ static int UserPmt( demux_t *p_demux, const char *psz_fmt ) ...@@ -1736,7 +1700,6 @@ static int UserPmt( demux_t *p_demux, const char *psz_fmt )
prg->i_pid_pmt = -1; prg->i_pid_pmt = -1;
prg->i_version = -1; prg->i_version = -1;
prg->i_number = i_number != 0 ? i_number : TS_USER_PMT_NUMBER; prg->i_number = i_number != 0 ? i_number : TS_USER_PMT_NUMBER;
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
prg->handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG ); prg->handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !prg->handle ) if( !prg->handle )
goto error; goto error;
...@@ -1749,11 +1712,6 @@ static int UserPmt( demux_t *p_demux, const char *psz_fmt ) ...@@ -1749,11 +1712,6 @@ static int UserPmt( demux_t *p_demux, const char *psz_fmt )
prg->handle = NULL; prg->handle = NULL;
goto error; goto error;
} }
#else
prg->handle = dvbpsi_AttachPMT(
((i_number != TS_USER_PMT_NUMBER) ? i_number : 1),
PMTCallBack, p_demux );
#endif
TAB_APPEND( pmt->psi->i_prg, pmt->psi->prg, prg ); TAB_APPEND( pmt->psi->i_prg, pmt->psi->prg, prg );
psz = strchr( psz, '=' ); psz = strchr( psz, '=' );
...@@ -1975,14 +1933,10 @@ static void PIDClean( demux_t *p_demux, ts_pid_t *pid ) ...@@ -1975,14 +1933,10 @@ static void PIDClean( demux_t *p_demux, ts_pid_t *pid )
{ {
if( pid->psi->handle ) if( pid->psi->handle )
{ {
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
if( dvbpsi_decoder_present( pid->psi->handle ) ) if( dvbpsi_decoder_present( pid->psi->handle ) )
dvbpsi_pmt_detach( pid->psi->handle ); dvbpsi_pmt_detach( pid->psi->handle );
dvbpsi_delete( pid->psi->handle ); dvbpsi_delete( pid->psi->handle );
pid->psi->handle = NULL; pid->psi->handle = NULL;
#else
dvbpsi_DetachPMT( pid->psi->handle );
#endif
} }
for( int i = 0; i < pid->psi->i_prg; i++ ) for( int i = 0; i < pid->psi->i_prg; i++ )
{ {
...@@ -1990,13 +1944,9 @@ static void PIDClean( demux_t *p_demux, ts_pid_t *pid ) ...@@ -1990,13 +1944,9 @@ static void PIDClean( demux_t *p_demux, ts_pid_t *pid )
IODFree( pid->psi->prg[i]->iod ); IODFree( pid->psi->prg[i]->iod );
if( pid->psi->prg[i]->handle ) if( pid->psi->prg[i]->handle )
{ {
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
if( dvbpsi_decoder_present( pid->psi->prg[i]->handle ) ) if( dvbpsi_decoder_present( pid->psi->prg[i]->handle ) )
dvbpsi_pmt_detach( pid->psi->prg[i]->handle ); dvbpsi_pmt_detach( pid->psi->prg[i]->handle );
dvbpsi_delete( pid->psi->prg[i]->handle ); dvbpsi_delete( pid->psi->prg[i]->handle );
#else
dvbpsi_DetachPMT( pid->psi->prg[i]->handle );
#endif
} }
free( pid->psi->prg[i] ); free( pid->psi->prg[i] );
} }
...@@ -3628,14 +3578,9 @@ static void ValidateDVBMeta( demux_t *p_demux, int i_pid ) ...@@ -3628,14 +3578,9 @@ static void ValidateDVBMeta( demux_t *p_demux, int i_pid )
ts_pid_t *p_pid = &p_sys->pid[i]; ts_pid_t *p_pid = &p_sys->pid[i];
if( p_pid->psi ) if( p_pid->psi )
{ {
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
if( dvbpsi_decoder_present( p_pid->psi->handle )) if( dvbpsi_decoder_present( p_pid->psi->handle ))
dvbpsi_DetachDemux( p_pid->psi->handle ); dvbpsi_DetachDemux( p_pid->psi->handle );
dvbpsi_delete( p_pid->psi->handle ); dvbpsi_delete( p_pid->psi->handle );
#else
dvbpsi_DetachDemux( p_pid->psi->handle );
#endif
free( p_pid->psi ); free( p_pid->psi );
p_pid->psi = NULL; p_pid->psi = NULL;
p_pid->b_valid = false; p_pid->b_valid = false;
...@@ -3706,17 +3651,13 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt ) ...@@ -3706,17 +3651,13 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt )
!p_sdt->b_current_next || !p_sdt->b_current_next ||
p_sdt->i_version == sdt->psi->i_sdt_version ) p_sdt->i_version == sdt->psi->i_sdt_version )
{ {
dvbpsi_DeleteSDT( p_sdt ); dvbpsi_sdt_delete( p_sdt );
return; return;
} }
msg_Dbg( p_demux, "new SDT ts_id=%d version=%d current_next=%d " msg_Dbg( p_demux, "new SDT ts_id=%d version=%d current_next=%d "
"network_id=%d", "network_id=%d",
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
p_sdt->i_extension, p_sdt->i_extension,
#else
p_sdt->i_ts_id,
#endif
p_sdt->i_version, p_sdt->b_current_next, p_sdt->i_version, p_sdt->b_current_next,
p_sdt->i_network_id ); p_sdt->i_network_id );
...@@ -3838,7 +3779,7 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt ) ...@@ -3838,7 +3779,7 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt )
} }
sdt->psi->i_sdt_version = p_sdt->i_version; sdt->psi->i_sdt_version = p_sdt->i_version;
dvbpsi_DeleteSDT( p_sdt ); dvbpsi_sdt_delete( p_sdt );
} }
/* i_year: year - 1900 i_month: 0-11 i_mday: 1-31 i_hour: 0-23 i_minute: 0-59 i_second: 0-59 */ /* i_year: year - 1900 i_month: 0-11 i_mday: 1-31 i_hour: 0-23 i_minute: 0-59 i_second: 0-59 */
...@@ -3906,7 +3847,7 @@ static void TDTCallBack( demux_t *p_demux, dvbpsi_tot_t *p_tdt ) ...@@ -3906,7 +3847,7 @@ static void TDTCallBack( demux_t *p_demux, dvbpsi_tot_t *p_tdt )
p_sys->i_tdt_delta = CLOCK_FREQ * EITConvertStartTime( p_tdt->i_utc_time ) p_sys->i_tdt_delta = CLOCK_FREQ * EITConvertStartTime( p_tdt->i_utc_time )
- mdate(); - mdate();
dvbpsi_DeleteTOT(p_tdt); dvbpsi_tot_delete(p_tdt);
} }
...@@ -3920,18 +3861,14 @@ static void EITCallBack( demux_t *p_demux, ...@@ -3920,18 +3861,14 @@ static void EITCallBack( demux_t *p_demux,
msg_Dbg( p_demux, "EITCallBack called" ); msg_Dbg( p_demux, "EITCallBack called" );
if( !p_eit->b_current_next ) if( !p_eit->b_current_next )
{ {
dvbpsi_DeleteEIT( p_eit ); dvbpsi_eit_delete( p_eit );
return; return;
} }
msg_Dbg( p_demux, "new EIT service_id=%d version=%d current_next=%d " msg_Dbg( p_demux, "new EIT service_id=%d version=%d current_next=%d "
"ts_id=%d network_id=%d segment_last_section_number=%d " "ts_id=%d network_id=%d segment_last_section_number=%d "
"last_table_id=%d", "last_table_id=%d",
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
p_eit->i_extension, p_eit->i_extension,
#else
p_eit->i_service_id,
#endif
p_eit->i_version, p_eit->b_current_next, p_eit->i_version, p_eit->b_current_next,
p_eit->i_ts_id, p_eit->i_network_id, p_eit->i_ts_id, p_eit->i_network_id,
p_eit->i_segment_last_section_number, p_eit->i_last_table_id ); p_eit->i_segment_last_section_number, p_eit->i_last_table_id );
...@@ -4102,11 +4039,7 @@ static void EITCallBack( demux_t *p_demux, ...@@ -4102,11 +4039,7 @@ static void EITCallBack( demux_t *p_demux,
if( b_current_following && if( b_current_following &&
( p_sys->programs.i_size == 0 || ( p_sys->programs.i_size == 0 ||
p_sys->programs.p_elems[0] == p_sys->programs.p_elems[0] ==
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
p_eit->i_extension p_eit->i_extension
#else
p_eit->i_service_id
#endif
) ) ) )
{ {
p_sys->i_dvb_length = 0; p_sys->i_dvb_length = 0;
...@@ -4119,16 +4052,12 @@ static void EITCallBack( demux_t *p_demux, ...@@ -4119,16 +4052,12 @@ static void EITCallBack( demux_t *p_demux,
} }
} }
es_out_Control( p_demux->out, ES_OUT_SET_GROUP_EPG, es_out_Control( p_demux->out, ES_OUT_SET_GROUP_EPG,
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
p_eit->i_extension, p_eit->i_extension,
#else
p_eit->i_service_id,
#endif
p_epg ); p_epg );
} }
vlc_epg_Delete( p_epg ); vlc_epg_Delete( p_epg );
dvbpsi_DeleteEIT( p_eit ); dvbpsi_eit_delete( p_eit );
} }
static void EITCallBackCurrentFollowing( demux_t *p_demux, dvbpsi_eit_t *p_eit ) static void EITCallBackCurrentFollowing( demux_t *p_demux, dvbpsi_eit_t *p_eit )
{ {
...@@ -4139,13 +4068,8 @@ static void EITCallBackSchedule( demux_t *p_demux, dvbpsi_eit_t *p_eit ) ...@@ -4139,13 +4068,8 @@ static void EITCallBackSchedule( demux_t *p_demux, dvbpsi_eit_t *p_eit )
EITCallBack( p_demux, p_eit, false ); EITCallBack( p_demux, p_eit, false );
} }
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
static void PSINewTableCallBack( dvbpsi_t *h, uint8_t i_table_id, static void PSINewTableCallBack( dvbpsi_t *h, uint8_t i_table_id,
uint16_t i_extension, demux_t *p_demux ) uint16_t i_extension, demux_t *p_demux )
#else
static void PSINewTableCallBack( demux_t *p_demux, dvbpsi_handle h,
uint8_t i_table_id, uint16_t i_extension )
#endif
{ {
assert( h ); assert( h );
#if 0 #if 0
...@@ -4156,13 +4080,9 @@ static void PSINewTableCallBack( demux_t *p_demux, dvbpsi_handle h, ...@@ -4156,13 +4080,9 @@ static void PSINewTableCallBack( demux_t *p_demux, dvbpsi_handle h,
{ {
msg_Dbg( p_demux, "PSINewTableCallBack: table 0x%x(%d) ext=0x%x(%d)", msg_Dbg( p_demux, "PSINewTableCallBack: table 0x%x(%d) ext=0x%x(%d)",
i_table_id, i_table_id, i_extension, i_extension ); i_table_id, i_table_id, i_extension, i_extension );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
if( !dvbpsi_sdt_attach( h, i_table_id, i_extension, (dvbpsi_sdt_callback)SDTCallBack, p_demux ) ) if( !dvbpsi_sdt_attach( h, i_table_id, i_extension, (dvbpsi_sdt_callback)SDTCallBack, p_demux ) )
msg_Err( p_demux, "PSINewTableCallback: failed attaching SDTCallback" ); msg_Err( p_demux, "PSINewTableCallback: failed attaching SDTCallback" );
#else
dvbpsi_AttachSDT( h, i_table_id, i_extension,
(dvbpsi_sdt_callback)SDTCallBack, p_demux );
#endif
} }
else if( p_demux->p_sys->pid[0x11].psi->i_sdt_version != -1 && else if( p_demux->p_sys->pid[0x11].psi->i_sdt_version != -1 &&
( i_table_id == 0x4e || /* Current/Following */ ( i_table_id == 0x4e || /* Current/Following */
...@@ -4174,25 +4094,18 @@ static void PSINewTableCallBack( demux_t *p_demux, dvbpsi_handle h, ...@@ -4174,25 +4094,18 @@ static void PSINewTableCallBack( demux_t *p_demux, dvbpsi_handle h,
dvbpsi_eit_callback cb = i_table_id == 0x4e ? dvbpsi_eit_callback cb = i_table_id == 0x4e ?
(dvbpsi_eit_callback)EITCallBackCurrentFollowing : (dvbpsi_eit_callback)EITCallBackCurrentFollowing :
(dvbpsi_eit_callback)EITCallBackSchedule; (dvbpsi_eit_callback)EITCallBackSchedule;
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
if( !dvbpsi_eit_attach( h, i_table_id, i_extension, cb, p_demux ) ) if( !dvbpsi_eit_attach( h, i_table_id, i_extension, cb, p_demux ) )
msg_Err( p_demux, "PSINewTableCallback: failed attaching EITCallback" ); msg_Err( p_demux, "PSINewTableCallback: failed attaching EITCallback" );
#else
dvbpsi_AttachEIT( h, i_table_id, i_extension, cb, p_demux );
#endif
} }
else if( p_demux->p_sys->pid[0x11].psi->i_sdt_version != -1 && else if( p_demux->p_sys->pid[0x11].psi->i_sdt_version != -1 &&
(i_table_id == 0x70 /* TDT */ || i_table_id == 0x73 /* TOT */) ) (i_table_id == 0x70 /* TDT */ || i_table_id == 0x73 /* TOT */) )
{ {
msg_Dbg( p_demux, "PSINewTableCallBack: table 0x%x(%d) ext=0x%x(%d)", msg_Dbg( p_demux, "PSINewTableCallBack: table 0x%x(%d) ext=0x%x(%d)",
i_table_id, i_table_id, i_extension, i_extension ); i_table_id, i_table_id, i_extension, i_extension );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
if( !dvbpsi_tot_attach( h, i_table_id, i_extension, (dvbpsi_tot_callback)TDTCallBack, p_demux ) ) if( !dvbpsi_tot_attach( h, i_table_id, i_extension, (dvbpsi_tot_callback)TDTCallBack, p_demux ) )
msg_Err( p_demux, "PSINewTableCallback: failed attaching TDTCallback" ); msg_Err( p_demux, "PSINewTableCallback: failed attaching TDTCallback" );
#else
dvbpsi_AttachTOT( h, i_table_id, i_extension,
(dvbpsi_tot_callback)TDTCallBack, p_demux);
#endif
} }
} }
...@@ -4381,8 +4294,6 @@ static void PMTSetupEsTeletext( demux_t *p_demux, ts_pid_t *pid, ...@@ -4381,8 +4294,6 @@ static void PMTSetupEsTeletext( demux_t *p_demux, ts_pid_t *pid,
unsigned i_page = 0; unsigned i_page = 0;
/* Gather pages information */ /* Gather pages information */
#if defined _DVBPSI_DR_56_H_ && \
defined DVBPSI_VERSION && DVBPSI_VERSION_INT > DVBPSI_VERSION_WANTED(0,1,5)
for( unsigned i_tag_idx = 0; i_tag_idx < 2; i_tag_idx++ ) for( unsigned i_tag_idx = 0; i_tag_idx < 2; i_tag_idx++ )
{ {
dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_es, i_tag_idx == 0 ? 0x46 : 0x56 ); dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_es, i_tag_idx == 0 ? 0x46 : 0x56 );
...@@ -4411,7 +4322,6 @@ static void PMTSetupEsTeletext( demux_t *p_demux, ts_pid_t *pid, ...@@ -4411,7 +4322,6 @@ static void PMTSetupEsTeletext( demux_t *p_demux, ts_pid_t *pid,
memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 ); memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 );
} }
} }
#endif
dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_es, 0x59 ); dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_es, 0x59 );
if( p_dr ) if( p_dr )
...@@ -5204,7 +5114,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt ) ...@@ -5204,7 +5114,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
if( pmt == NULL ) if( pmt == NULL )
{ {
msg_Warn( p_demux, "unreferenced program (broken stream)" ); msg_Warn( p_demux, "unreferenced program (broken stream)" );
dvbpsi_DeletePMT(p_pmt); dvbpsi_pmt_delete(p_pmt);
return; return;
} }
...@@ -5213,7 +5123,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt ) ...@@ -5213,7 +5123,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
if( prg->i_version != -1 && if( prg->i_version != -1 &&
( !p_pmt->b_current_next || prg->i_version == p_pmt->i_version ) ) ( !p_pmt->b_current_next || prg->i_version == p_pmt->i_version ) )
{ {
dvbpsi_DeletePMT( p_pmt ); dvbpsi_pmt_delete( p_pmt );
return; return;
} }
...@@ -5552,7 +5462,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt ) ...@@ -5552,7 +5462,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
/* Set CAM descrambling */ /* Set CAM descrambling */
if( !ProgramIsSelected( p_demux, prg->i_number ) ) if( !ProgramIsSelected( p_demux, prg->i_number ) )
{ {
dvbpsi_DeletePMT( p_pmt ); dvbpsi_pmt_delete( p_pmt );
} }
else if( stream_Control( p_sys->stream, STREAM_SET_PRIVATE_ID_CA, else if( stream_Control( p_sys->stream, STREAM_SET_PRIVATE_ID_CA,
p_pmt ) != VLC_SUCCESS ) p_pmt ) != VLC_SUCCESS )
...@@ -5562,8 +5472,8 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt ) ...@@ -5562,8 +5472,8 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
p_sys->arib.b25stream = stream_FilterNew( p_demux->s, "aribcam" ); p_sys->arib.b25stream = stream_FilterNew( p_demux->s, "aribcam" );
p_sys->stream = ( p_sys->arib.b25stream ) ? p_sys->arib.b25stream : p_demux->s; p_sys->stream = ( p_sys->arib.b25stream ) ? p_sys->arib.b25stream : p_demux->s;
if (!p_sys->arib.b25stream) if (!p_sys->arib.b25stream)
dvbpsi_DeletePMT( p_pmt ); dvbpsi_pmt_delete( p_pmt );
} else dvbpsi_DeletePMT( p_pmt ); } else dvbpsi_pmt_delete( p_pmt );
} }
for( int i = 0; i < i_clean; i++ ) for( int i = 0; i < i_clean; i++ )
...@@ -5629,7 +5539,7 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_pat ) ...@@ -5629,7 +5539,7 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_pat )
( pat->psi->i_ts_id != -1 && p_pat->i_ts_id != pat->psi->i_ts_id ) || ( pat->psi->i_ts_id != -1 && p_pat->i_ts_id != pat->psi->i_ts_id ) ||
p_sys->b_user_pmt || PATCheck( p_demux, p_pat ) ) p_sys->b_user_pmt || PATCheck( p_demux, p_pat ) )
{ {
dvbpsi_DeletePAT( p_pat ); dvbpsi_pat_delete( p_pat );
return; return;
} }
...@@ -5739,20 +5649,17 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_pat ) ...@@ -5739,20 +5649,17 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_pat )
PIDInit( pmt, true, pat->psi ); PIDInit( pmt, true, pat->psi );
ts_prg_psi_t *prg = pmt->psi->prg[pmt->psi->i_prg-1]; ts_prg_psi_t *prg = pmt->psi->prg[pmt->psi->i_prg-1];
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
prg->handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG ); prg->handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !prg->handle ) if( !prg->handle )
{ {
dvbpsi_DeletePAT( p_pat ); dvbpsi_pat_delete( p_pat );
return; return;
} }
prg->handle->p_sys = (void *) VLC_OBJECT(p_demux); prg->handle->p_sys = (void *) VLC_OBJECT(p_demux);
if( !dvbpsi_pmt_attach( prg->handle, p_program->i_number, PMTCallBack, p_demux ) ) if( !dvbpsi_pmt_attach( prg->handle, p_program->i_number, PMTCallBack, p_demux ) )
msg_Err( p_demux, "PATCallback failed attaching PMTCallback to program %d", msg_Err( p_demux, "PATCallback failed attaching PMTCallback to program %d",
p_program->i_number ); p_program->i_number );
#else
prg->handle = dvbpsi_AttachPMT( p_program->i_number, PMTCallBack, p_demux );
#endif
prg->i_number = p_program->i_number; prg->i_number = p_program->i_number;
prg->i_pid_pmt = p_program->i_pid; prg->i_pid_pmt = p_program->i_pid;
...@@ -5775,5 +5682,5 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_pat ) ...@@ -5775,5 +5682,5 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_pat )
pat->psi->i_pat_version = p_pat->i_version; pat->psi->i_pat_version = p_pat->i_version;
pat->psi->i_ts_id = p_pat->i_ts_id; pat->psi->i_ts_id = p_pat->i_ts_id;
dvbpsi_DeletePAT( p_pat ); dvbpsi_pat_delete( p_pat );
} }
...@@ -23,47 +23,6 @@ ...@@ -23,47 +23,6 @@
#ifndef DVBPSI_COMPAT_H #ifndef DVBPSI_COMPAT_H
#define 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) 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; 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 ...@@ -81,6 +40,5 @@ static inline void dvbpsi_messages(dvbpsi_t *p_dvbpsi, const dvbpsi_msg_level_t
break; break;
} }
} }
#endif
#endif #endif
...@@ -77,7 +77,7 @@ error: ...@@ -77,7 +77,7 @@ error:
return NULL; return NULL;
} }
void BuildPAT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) void BuildPAT( dvbpsi_t *p_dvbpsi,
void *p_opaque, PEStoTSCallback pf_callback, void *p_opaque, PEStoTSCallback pf_callback,
int i_tsid, int i_pat_version_number, int i_tsid, int i_pat_version_number,
ts_stream_t *p_pat, ts_stream_t *p_pat,
...@@ -86,23 +86,19 @@ void BuildPAT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) ...@@ -86,23 +86,19 @@ void BuildPAT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi)
dvbpsi_pat_t patpsi; dvbpsi_pat_t patpsi;
dvbpsi_psi_section_t *p_section; dvbpsi_psi_section_t *p_section;
dvbpsi_InitPAT( &patpsi, i_tsid, i_pat_version_number, 1 /* b_current_next */ ); dvbpsi_pat_init( &patpsi, i_tsid, i_pat_version_number, true /* b_current_next */ );
/* add all programs */ /* add all programs */
for (unsigned i = 0; i < i_programs; i++ ) for (unsigned i = 0; i < i_programs; i++ )
dvbpsi_PATAddProgram( &patpsi, pi_programs_number[i], p_pmt[i].i_pid ); dvbpsi_pat_program_add( &patpsi, pi_programs_number[i], p_pmt[i].i_pid );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
p_section = dvbpsi_pat_sections_generate( p_dvbpsi, &patpsi, 0 ); p_section = dvbpsi_pat_sections_generate( p_dvbpsi, &patpsi, 0 );
#else
p_section = dvbpsi_GenPATSections( &patpsi, 0 /* max program per section */ );
#endif
block_t *p_block = WritePSISection( p_section ); block_t *p_block = WritePSISection( p_section );
PEStoTS( p_opaque, pf_callback, p_block, p_pat->i_pid, PEStoTS( p_opaque, pf_callback, p_block, p_pat->i_pid,
&p_pat->b_discontinuity, &p_pat->i_continuity_counter ); &p_pat->b_discontinuity, &p_pat->i_continuity_counter );
dvbpsi_DeletePSISections( p_section ); dvbpsi_DeletePSISections( p_section );
dvbpsi_EmptyPAT( &patpsi ); dvbpsi_pat_empty( &patpsi );
} }
#if 1 #if 1
...@@ -248,10 +244,10 @@ static void GetPMTmpeg4( vlc_object_t *p_object, dvbpsi_pmt_t *p_dvbpmt, ...@@ -248,10 +244,10 @@ static void GetPMTmpeg4( vlc_object_t *p_object, dvbpsi_pmt_t *p_dvbpmt,
bits_write( &bits_fix_IOD, 24, bits_write( &bits_fix_IOD, 24,
GetDescriptorLength24b(bits.i_data - bits_fix_IOD.i_data - 3 )); GetDescriptorLength24b(bits.i_data - bits_fix_IOD.i_data - 3 ));
dvbpsi_PMTAddDescriptor(&p_dvbpmt[0], 0x1d, bits.i_data, bits.p_data); dvbpsi_pmt_descriptor_add(&p_dvbpmt[0], 0x1d, bits.i_data, bits.p_data);
} }
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, void *p_opaque, PEStoTSCallback pf_callback,
int i_tsid, int i_pmt_version_number, int i_tsid, int i_pmt_version_number,
int i_pcr_pid, int i_pcr_pid,
...@@ -265,25 +261,25 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -265,25 +261,25 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
dvbpsi_sdt_t sdtpsi; dvbpsi_sdt_t sdtpsi;
if( p_sdt ) if( p_sdt )
dvbpsi_InitSDT( &sdtpsi, i_tsid, 1, 1, p_sdt->i_netid ); dvbpsi_sdt_init( &sdtpsi, i_tsid, 0, 1, true, p_sdt->i_netid );
for (unsigned i = 0; i < i_programs; i++ ) for (unsigned i = 0; i < i_programs; i++ )
{ {
dvbpsi_InitPMT( &dvbpmt[i], dvbpsi_pmt_init( &dvbpmt[i],
pi_programs_number[i], /* program number */ pi_programs_number[i], /* program number */
i_pmt_version_number, i_pmt_version_number,
1, /* b_current_next */ true, /* b_current_next */
i_pcr_pid ); i_pcr_pid );
if( !p_sdt ) if( !p_sdt )
continue; continue;
dvbpsi_sdt_service_t *p_service = dvbpsi_SDTAddService( &sdtpsi, dvbpsi_sdt_service_t *p_service = dvbpsi_sdt_service_add( &sdtpsi,
pi_programs_number[i], /* service id */ pi_programs_number[i], /* service id */
0, /* eit schedule */ false, /* eit schedule */
0, /* eit present */ false, /* eit present */
4, /* running status ("4=RUNNING") */ 4, /* running status ("4=RUNNING") */
0 ); /* free ca */ false ); /* free ca */
const char *psz_sdtprov = p_sdt->desc[i].psz_provider; const char *psz_sdtprov = p_sdt->desc[i].psz_provider;
const char *psz_sdtserv = p_sdt->desc[i].psz_service_name; const char *psz_sdtserv = p_sdt->desc[i].psz_service_name;
...@@ -305,14 +301,9 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -305,14 +301,9 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
psz_sdt_desc[ 2 + provlen ] = (char)servlen; psz_sdt_desc[ 2 + provlen ] = (char)servlen;
memcpy( &psz_sdt_desc[3+provlen], psz_sdtserv, servlen ); memcpy( &psz_sdt_desc[3+provlen], psz_sdtserv, servlen );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
dvbpsi_sdt_service_descriptor_add( p_service, 0x48, dvbpsi_sdt_service_descriptor_add( p_service, 0x48,
(3 + provlen + servlen), (3 + provlen + servlen),
psz_sdt_desc ); psz_sdt_desc );
#else
dvbpsi_SDTServiceAddDescriptor( p_service, 0x48,
3 + provlen + servlen, psz_sdt_desc );
#endif
} }
for (unsigned i = 0; i < i_mapped_streams; i++ ) for (unsigned i = 0; i < i_mapped_streams; i++ )
...@@ -332,7 +323,7 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -332,7 +323,7 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
{ {
const pes_mapped_stream_t *p_stream = &p_mapped_streams[i]; const pes_mapped_stream_t *p_stream = &p_mapped_streams[i];
dvbpsi_pmt_es_t *p_es = dvbpsi_PMTAddES( &dvbpmt[p_stream->i_mapped_prog], dvbpsi_pmt_es_t *p_es = dvbpsi_pmt_es_add( &dvbpmt[p_stream->i_mapped_prog],
p_stream->pes->i_stream_type, p_stream->ts->i_pid ); p_stream->pes->i_stream_type, p_stream->ts->i_pid );
if( p_stream->pes->i_stream_id == 0xfa || p_stream->pes->i_stream_id == 0xfb ) if( p_stream->pes->i_stream_id == 0xfa || p_stream->pes->i_stream_id == 0xfb )
...@@ -342,7 +333,7 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -342,7 +333,7 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
/* SL descriptor */ /* SL descriptor */
es_id[0] = (p_stream->pes->i_es_id >> 8)&0xff; es_id[0] = (p_stream->pes->i_es_id >> 8)&0xff;
es_id[1] = (p_stream->pes->i_es_id)&0xff; es_id[1] = (p_stream->pes->i_es_id)&0xff;
dvbpsi_PMTESAddDescriptor( p_es, 0x1f, 2, es_id ); dvbpsi_pmt_es_descriptor_add( p_es, 0x1f, 2, es_id );
} }
else if( p_stream->pes->i_stream_type == 0xa0 ) else if( p_stream->pes->i_stream_type == 0xa0 )
{ {
...@@ -363,21 +354,21 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -363,21 +354,21 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
} }
/* 0xa0 is private */ /* 0xa0 is private */
dvbpsi_PMTESAddDescriptor( p_es, 0xa0, i_extra + 10, data ); dvbpsi_pmt_es_descriptor_add( p_es, 0xa0, i_extra + 10, data );
} }
else if( p_stream->pes->i_stream_type == 0x81 ) else if( p_stream->pes->i_stream_type == 0x81 )
{ {
uint8_t format[4] = { 'A', 'C', '-', '3'}; uint8_t format[4] = { 'A', 'C', '-', '3'};
/* "registration" descriptor : "AC-3" */ /* "registration" descriptor : "AC-3" */
dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, format ); dvbpsi_pmt_es_descriptor_add( p_es, 0x05, 4, format );
} }
else if( p_stream->pes->i_codec == VLC_CODEC_DIRAC ) else if( p_stream->pes->i_codec == VLC_CODEC_DIRAC )
{ {
/* Dirac registration descriptor */ /* Dirac registration descriptor */
uint8_t data[4] = { 'd', 'r', 'a', 'c' }; uint8_t data[4] = { 'd', 'r', 'a', 'c' };
dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, data ); dvbpsi_pmt_es_descriptor_add( p_es, 0x05, 4, data );
} }
else if( p_stream->pes->i_codec == VLC_CODEC_DTS ) else if( p_stream->pes->i_codec == VLC_CODEC_DTS )
{ {
...@@ -385,12 +376,12 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -385,12 +376,12 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
/* DTS format identifier, frame size 1024 - FIXME */ /* DTS format identifier, frame size 1024 - FIXME */
uint8_t data[4] = { 'D', 'T', 'S', '2' }; uint8_t data[4] = { 'D', 'T', 'S', '2' };
dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, data ); dvbpsi_pmt_es_descriptor_add( p_es, 0x05, 4, data );
} }
else if( p_stream->pes->i_codec == VLC_CODEC_EAC3 ) else if( p_stream->pes->i_codec == VLC_CODEC_EAC3 )
{ {
uint8_t data[1] = { 0x00 }; uint8_t data[1] = { 0x00 };
dvbpsi_PMTESAddDescriptor( p_es, 0x7a, 1, data ); dvbpsi_pmt_es_descriptor_add( p_es, 0x7a, 1, data );
} }
else if( p_stream->pes->i_codec == VLC_CODEC_OPUS ) else if( p_stream->pes->i_codec == VLC_CODEC_OPUS )
{ {
...@@ -398,16 +389,16 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -398,16 +389,16 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
0x80, /* tag extension */ 0x80, /* tag extension */
p_stream->fmt->audio.i_channels p_stream->fmt->audio.i_channels
}; };
dvbpsi_PMTESAddDescriptor( p_es, 0x7f, 2, data ); dvbpsi_pmt_es_descriptor_add( p_es, 0x7f, 2, data );
uint8_t format[4] = { 'O', 'p', 'u', 's'}; uint8_t format[4] = { 'O', 'p', 'u', 's'};
/* "registration" descriptor : "Opus" */ /* "registration" descriptor : "Opus" */
dvbpsi_PMTESAddDescriptor( p_es, 0x05, 4, format ); dvbpsi_pmt_es_descriptor_add( p_es, 0x05, 4, format );
} }
else if( p_stream->pes->i_codec == VLC_CODEC_TELETEXT ) else if( p_stream->pes->i_codec == VLC_CODEC_TELETEXT )
{ {
if( p_stream->pes->i_extra ) if( p_stream->pes->i_extra )
{ {
dvbpsi_PMTESAddDescriptor( p_es, 0x56, dvbpsi_pmt_es_descriptor_add( p_es, 0x56,
p_stream->pes->i_extra, p_stream->pes->i_extra,
p_stream->pes->p_extra ); p_stream->pes->p_extra );
} }
...@@ -419,7 +410,7 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -419,7 +410,7 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
if( p_stream->pes->i_extra ) if( p_stream->pes->i_extra )
{ {
/* pass-through from the TS demux */ /* pass-through from the TS demux */
dvbpsi_PMTESAddDescriptor( p_es, 0x59, dvbpsi_pmt_es_descriptor_add( p_es, 0x59,
p_stream->pes->i_extra, p_stream->pes->i_extra,
p_stream->pes->p_extra ); p_stream->pes->p_extra );
} }
...@@ -440,7 +431,7 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -440,7 +431,7 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
p_descr = dvbpsi_GenSubtitlingDr( &descr, 0 ); p_descr = dvbpsi_GenSubtitlingDr( &descr, 0 );
/* Work around bug in old libdvbpsi */ p_descr->i_length = 8; /* Work around bug in old libdvbpsi */ p_descr->i_length = 8;
dvbpsi_PMTESAddDescriptor( p_es, p_descr->i_tag, dvbpsi_pmt_es_descriptor_add( p_es, p_descr->i_tag,
p_descr->i_length, p_descr->p_data ); p_descr->i_length, p_descr->p_data );
} }
continue; continue;
...@@ -448,39 +439,29 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object, ...@@ -448,39 +439,29 @@ void BuildPMT( DVBPSI_HANDLE_PARAM(dvbpsi_t *p_dvbpsi) vlc_object_t *p_object,
if( p_stream->pes->i_langs ) if( p_stream->pes->i_langs )
{ {
dvbpsi_PMTESAddDescriptor( p_es, 0x0a, 4*p_stream->pes->i_langs, dvbpsi_pmt_es_descriptor_add( p_es, 0x0a, 4*p_stream->pes->i_langs,
p_stream->pes->lang); p_stream->pes->lang);
} }
} }
for (unsigned i = 0; i < i_programs; i++ ) for (unsigned i = 0; i < i_programs; i++ )
{ {
dvbpsi_psi_section_t *sect; dvbpsi_psi_section_t *sect = dvbpsi_pmt_sections_generate( p_dvbpsi, &dvbpmt[i] );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
sect = dvbpsi_pmt_sections_generate( p_dvbpsi, &dvbpmt[i] );
#else
sect = dvbpsi_GenPMTSections( &dvbpmt[i] );
#endif
block_t *pmt = WritePSISection( sect ); block_t *pmt = WritePSISection( sect );
PEStoTS( p_opaque, pf_callback, pmt, p_pmt[i].i_pid, PEStoTS( p_opaque, pf_callback, pmt, p_pmt[i].i_pid,
&p_pmt[i].b_discontinuity, &p_pmt[i].i_continuity_counter ); &p_pmt[i].b_discontinuity, &p_pmt[i].i_continuity_counter );
dvbpsi_DeletePSISections(sect); dvbpsi_DeletePSISections(sect);
dvbpsi_EmptyPMT( &dvbpmt[i] ); dvbpsi_pmt_empty( &dvbpmt[i] );
} }
if( p_sdt ) if( p_sdt )
{ {
dvbpsi_psi_section_t *sect; dvbpsi_psi_section_t *sect = dvbpsi_sdt_sections_generate( p_dvbpsi, &sdtpsi );
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
sect = dvbpsi_sdt_sections_generate( p_dvbpsi, &sdtpsi );
#else
sect = dvbpsi_GenSDTSections( &sdtpsi );
#endif
block_t *p_sdtblock = WritePSISection( sect ); block_t *p_sdtblock = WritePSISection( sect );
PEStoTS( p_opaque, pf_callback, p_sdtblock, p_sdt->ts.i_pid, PEStoTS( p_opaque, pf_callback, p_sdtblock, p_sdt->ts.i_pid,
&p_sdt->ts.b_discontinuity, &p_sdt->ts.i_continuity_counter ); &p_sdt->ts.b_discontinuity, &p_sdt->ts.i_continuity_counter );
dvbpsi_DeletePSISections( sect ); dvbpsi_DeletePSISections( sect );
dvbpsi_EmptySDT( &sdtpsi ); dvbpsi_sdt_empty( &sdtpsi );
} }
free( dvbpmt ); free( dvbpmt );
......
...@@ -20,12 +20,6 @@ ...@@ -20,12 +20,6 @@
#ifndef _TABLES_H #ifndef _TABLES_H
#define _TABLES_H 1 #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 #define MAX_SDT_DESC 64
typedef struct typedef struct
...@@ -41,7 +35,7 @@ typedef struct ...@@ -41,7 +35,7 @@ typedef struct
block_t * WritePSISection( dvbpsi_psi_section_t* p_section ); 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, void *p_opaque, PEStoTSCallback pf_callback,
int i_tsid, int i_pat_version_number, int i_tsid, int i_pat_version_number,
ts_stream_t *p_pat, ts_stream_t *p_pat,
...@@ -55,7 +49,7 @@ typedef struct ...@@ -55,7 +49,7 @@ typedef struct
int i_mapped_prog; int i_mapped_prog;
} pes_mapped_stream_t; } 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, void *p_opaque, PEStoTSCallback pf_callback,
int i_tsid, int i_pmt_version_number, int i_tsid, int i_pmt_version_number,
int i_pcr_pid, int i_pcr_pid,
......
...@@ -332,9 +332,7 @@ struct sout_mux_sys_t ...@@ -332,9 +332,7 @@ struct sout_mux_sys_t
vlc_mutex_t csa_lock; vlc_mutex_t csa_lock;
#if (DVBPSI_VERSION_INT >= DVBPSI_VERSION_WANTED(1,0,0))
dvbpsi_t *p_dvbpsi; dvbpsi_t *p_dvbpsi;
#endif
bool b_es_id_pid; bool b_es_id_pid;
bool b_sdt; bool b_sdt;
int i_pid_video; int i_pid_video;
...@@ -538,8 +536,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -538,8 +536,6 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
p_sys->i_num_pmt = 1; 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 ); p_sys->p_dvbpsi = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_sys->p_dvbpsi ) if( !p_sys->p_dvbpsi )
{ {
...@@ -547,7 +543,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -547,7 +543,6 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
p_sys->p_dvbpsi->p_sys = (void *) p_mux; 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" ); 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 ) ...@@ -745,10 +740,8 @@ static void Close( vlc_object_t * p_this )
sout_mux_t *p_mux = (sout_mux_t*)p_this; sout_mux_t *p_mux = (sout_mux_t*)p_this;
sout_mux_sys_t *p_sys = p_mux->p_sys; 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 ) if( p_sys->p_dvbpsi )
dvbpsi_delete( p_sys->p_dvbpsi ); dvbpsi_delete( p_sys->p_dvbpsi );
#endif
if( p_sys->csa ) if( p_sys->csa )
{ {
...@@ -1935,7 +1928,7 @@ void GetPAT( sout_mux_t *p_mux, sout_buffer_chain_t *c ) ...@@ -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; 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, c, (PEStoTSCallback)BufferChainAppend,
p_sys->i_tsid, p_sys->i_pat_version_number, p_sys->i_tsid, p_sys->i_pat_version_number,
&p_sys->pat, &p_sys->pat,
...@@ -1963,7 +1956,7 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c ) ...@@ -1963,7 +1956,7 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
mappeds[i_stream].ts = &p_stream->ts; 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, c, (PEStoTSCallback)BufferChainAppend,
p_sys->i_tsid, p_sys->i_pmt_version_number, p_sys->i_tsid, p_sys->i_pmt_version_number,
p_sys->i_pcr_pid, 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