Commit c86ee9a0 authored by Laurent Aimar's avatar Laurent Aimar

Added check against NIT dvbpsi support.

It is not mandatory but NIT support is better.
parent 671198a8
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
# include <dvbpsi/psi.h> # include <dvbpsi/psi.h>
# include <dvbpsi/demux.h> # include <dvbpsi/demux.h>
# include <dvbpsi/sdt.h> # include <dvbpsi/sdt.h>
# include <dvbpsi/nit.h>
#else #else
# include "dvbpsi.h" # include "dvbpsi.h"
# include "descriptor.h" # include "descriptor.h"
...@@ -66,7 +65,6 @@ ...@@ -66,7 +65,6 @@
# include "psi.h" # include "psi.h"
# include "demux.h" # include "demux.h"
# include "sdt.h" # include "sdt.h"
# include "nit.h"
#endif #endif
#ifdef ENABLE_HTTPD #ifdef ENABLE_HTTPD
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
# include <dvbpsi/psi.h> # include <dvbpsi/psi.h>
# include <dvbpsi/demux.h> # include <dvbpsi/demux.h>
# include <dvbpsi/sdt.h> # include <dvbpsi/sdt.h>
# include <dvbpsi/nit.h>
#else #else
# include "dvbpsi.h" # include "dvbpsi.h"
# include "descriptor.h" # include "descriptor.h"
...@@ -67,7 +66,6 @@ ...@@ -67,7 +66,6 @@
# include "psi.h" # include "psi.h"
# include "demux.h" # include "demux.h"
# include "sdt.h" # include "sdt.h"
# include "nit.h"
#endif #endif
#ifdef ENABLE_HTTPD #ifdef ENABLE_HTTPD
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
# include <dvbpsi/psi.h> # include <dvbpsi/psi.h>
# include <dvbpsi/demux.h> # include <dvbpsi/demux.h>
# include <dvbpsi/sdt.h> # include <dvbpsi/sdt.h>
# include <dvbpsi/nit.h>
#else #else
# include "dvbpsi.h" # include "dvbpsi.h"
# include "descriptor.h" # include "descriptor.h"
...@@ -60,7 +59,6 @@ ...@@ -60,7 +59,6 @@
# include "psi.h" # include "psi.h"
# include "demux.h" # include "demux.h"
# include "sdt.h" # include "sdt.h"
# include "nit.h"
#endif #endif
#ifdef ENABLE_HTTPD #ifdef ENABLE_HTTPD
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
# include <dvbpsi/psi.h> # include <dvbpsi/psi.h>
# include <dvbpsi/demux.h> # include <dvbpsi/demux.h>
# include <dvbpsi/sdt.h> # include <dvbpsi/sdt.h>
# include <dvbpsi/nit.h>
#else #else
# include "dvbpsi.h" # include "dvbpsi.h"
# include "descriptor.h" # include "descriptor.h"
...@@ -67,7 +66,6 @@ ...@@ -67,7 +66,6 @@
# include "psi.h" # include "psi.h"
# include "demux.h" # include "demux.h"
# include "sdt.h" # include "sdt.h"
# include "nit.h"
#endif #endif
#ifdef ENABLE_HTTPD #ifdef ENABLE_HTTPD
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
# include <dvbpsi/psi.h> # include <dvbpsi/psi.h>
# include <dvbpsi/demux.h> # include <dvbpsi/demux.h>
# include <dvbpsi/sdt.h> # include <dvbpsi/sdt.h>
# include <dvbpsi/nit.h>
#else #else
# include "dvbpsi.h" # include "dvbpsi.h"
# include "descriptor.h" # include "descriptor.h"
...@@ -62,7 +61,6 @@ ...@@ -62,7 +61,6 @@
# include "psi.h" # include "psi.h"
# include "demux.h" # include "demux.h"
# include "sdt.h" # include "sdt.h"
# include "nit.h"
#endif #endif
#ifdef ENABLE_HTTPD #ifdef ENABLE_HTTPD
...@@ -388,6 +386,7 @@ static void SDTCallBack( scan_session_t *p_session, dvbpsi_sdt_t *p_sdt ) ...@@ -388,6 +386,7 @@ static void SDTCallBack( scan_session_t *p_session, dvbpsi_sdt_t *p_sdt )
} }
} }
#ifdef DVBPSI_USE_NIT
static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit ) static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit )
{ {
vlc_object_t *p_obj = p_session->p_obj; vlc_object_t *p_obj = p_session->p_obj;
...@@ -498,13 +497,16 @@ static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit ) ...@@ -498,13 +497,16 @@ static void NITCallBack( scan_session_t *p_session, dvbpsi_nit_t *p_nit )
} }
} }
} }
#endif
static void PSINewTableCallBack( scan_session_t *p_session, dvbpsi_handle h, uint8_t i_table_id, uint16_t i_extension ) 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 ) if( i_table_id == 0x42 )
dvbpsi_AttachSDT( h, i_table_id, i_extension, (dvbpsi_sdt_callback)SDTCallBack, p_session ); dvbpsi_AttachSDT( h, i_table_id, i_extension, (dvbpsi_sdt_callback)SDTCallBack, p_session );
#ifdef DVBPSI_USE_NIT
else if( i_table_id == 0x40 ) else if( i_table_id == 0x40 )
dvbpsi_AttachNIT( h, i_table_id, i_extension, (dvbpsi_nit_callback)NITCallBack, p_session ); dvbpsi_AttachNIT( h, i_table_id, i_extension, (dvbpsi_nit_callback)NITCallBack, p_session );
#endif
} }
...@@ -520,9 +522,10 @@ int scan_session_Init( vlc_object_t *p_obj, scan_session_t *p_session, const sca ...@@ -520,9 +522,10 @@ int scan_session_Init( vlc_object_t *p_obj, scan_session_t *p_session, const sca
p_session->i_nit_pid = -1; p_session->i_nit_pid = -1;
p_session->sdt = NULL; p_session->sdt = NULL;
p_session->p_sdt = NULL; p_session->p_sdt = NULL;
#ifdef DVBPSI_USE_NIT
p_session->nit = NULL; p_session->nit = NULL;
p_session->p_nit = NULL; p_session->p_nit = NULL;
#endif
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -532,7 +535,10 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session ) ...@@ -532,7 +535,10 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session )
dvbpsi_pat_t *p_pat = p_session->p_pat; dvbpsi_pat_t *p_pat = p_session->p_pat;
dvbpsi_sdt_t *p_sdt = p_session->p_sdt; dvbpsi_sdt_t *p_sdt = p_session->p_sdt;
#ifdef DVBPSI_USE_NIT
dvbpsi_nit_t *p_nit = p_session->p_nit; dvbpsi_nit_t *p_nit = p_session->p_nit;
#endif
if( p_pat ) if( p_pat )
{ {
...@@ -586,6 +592,7 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session ) ...@@ -586,6 +592,7 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session )
} }
} }
#ifdef DVBPSI_USE_NIT
/* Parse NIT */ /* Parse NIT */
if( p_pat && p_nit ) if( p_pat && p_nit )
{ {
...@@ -619,6 +626,7 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session ) ...@@ -619,6 +626,7 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session )
} }
} }
} }
#endif
/* */ /* */
for( int i = i_service_start; i < p_scan->i_service; i++ ) for( int i = i_service_start; i < p_scan->i_service; i++ )
...@@ -626,13 +634,15 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session ) ...@@ -626,13 +634,15 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session )
scan_service_t *p_srv = p_scan->pp_service[i]; scan_service_t *p_srv = p_scan->pp_service[i];
p_srv->i_snr = p_session->i_snr; p_srv->i_snr = p_session->i_snr;
if( p_sdt )
p_srv->i_sdt_version = p_sdt->i_version;
#ifdef DVBPSI_USE_NIT
if( p_nit ) if( p_nit )
{ {
p_srv->i_network_id = p_nit->i_network_id; p_srv->i_network_id = p_nit->i_network_id;
p_srv->i_nit_version = p_nit->i_version; p_srv->i_nit_version = p_nit->i_version;
} }
if( p_sdt ) #endif
p_srv->i_sdt_version = p_sdt->i_version;
} }
...@@ -646,10 +656,12 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session ) ...@@ -646,10 +656,12 @@ void scan_session_Clean( scan_t *p_scan, scan_session_t *p_session )
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_DeleteSDT( p_session->p_sdt );
#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_DeleteNIT( p_session->p_nit );
#endif
} }
static int ScanServiceCmp( const void *a, const void *b ) static int ScanServiceCmp( const void *a, const void *b )
...@@ -772,16 +784,23 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block ) ...@@ -772,16 +784,23 @@ bool scan_session_Push( scan_session_t *p_scan, block_t *p_block )
} }
else if( i_pid == p_scan->i_nit_pid ) else if( i_pid == p_scan->i_nit_pid )
{ {
#ifdef DVBPSI_USE_NIT
if( !p_scan->nit ) if( !p_scan->nit )
p_scan->nit = dvbpsi_AttachDemux( (dvbpsi_demux_new_cb_t)PSINewTableCallBack, p_scan ); p_scan->nit = dvbpsi_AttachDemux( (dvbpsi_demux_new_cb_t)PSINewTableCallBack, p_scan );
if( p_scan->nit ) if( p_scan->nit )
dvbpsi_PushPacket( p_scan->nit, p_block->p_buffer ); dvbpsi_PushPacket( p_scan->nit, p_block->p_buffer );
#endif
} }
block_Release( p_block ); block_Release( p_block );
return p_scan->p_pat && p_scan->p_sdt && p_scan->p_nit; return p_scan->p_pat && p_scan->p_sdt &&
#ifdef DVBPSI_USE_NIT
p_scan->p_nit;
#else
true;
#endif
} }
void scan_service_SetSNR( scan_session_t *p_session, int i_snr ) void scan_service_SetSNR( scan_session_t *p_session, int i_snr )
......
...@@ -20,6 +20,22 @@ ...@@ -20,6 +20,22 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#ifdef HAVE_DVBPSI_DR_H
#ifdef _DVBPSI_DR_43_H_
# define DVBPSI_USE_NIT 1
# include <dvbpsi/nit.h>
#endif
#else
#ifdef _DVBPSI_DR_43_H_
# define DVBPSI_USE_NIT 1
# include "nit.h"
#endif
#endif
#ifndef DVBPSI_USE_NIT
# warning NIT is not supported by your libdvbpsi version
#endif
typedef enum typedef enum
{ {
SCAN_NONE, SCAN_NONE,
...@@ -101,8 +117,10 @@ typedef struct ...@@ -101,8 +117,10 @@ typedef struct
dvbpsi_handle sdt; dvbpsi_handle sdt;
dvbpsi_sdt_t *p_sdt; dvbpsi_sdt_t *p_sdt;
#ifdef DVBPSI_USE_NIT
dvbpsi_handle nit; dvbpsi_handle nit;
dvbpsi_nit_t *p_nit; dvbpsi_nit_t *p_nit;
#endif
} scan_session_t; } scan_session_t;
......
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