[vlc-commits] access: dvb: scan: let scan set filters
Francois Cartegnie
git at videolan.org
Fri Apr 22 18:20:00 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Apr 22 15:26:26 2016 +0200| [2b33e83ee182d009590a2839aac153f8987d70ce] | committer: Francois Cartegnie
access: dvb: scan: let scan set filters
We'll need to add some pids
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2b33e83ee182d009590a2839aac153f8987d70ce
---
modules/access/dvb/access.c | 19 +++++++++++++------
modules/access/dvb/scan.c | 8 ++++++++
modules/access/dvb/scan.h | 3 ++-
3 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/modules/access/dvb/access.c b/modules/access/dvb/access.c
index 4f945e8..e993c40 100644
--- a/modules/access/dvb/access.c
+++ b/modules/access/dvb/access.c
@@ -105,6 +105,7 @@ static void VarInit( access_t * );
static int ParseMRL( access_t * );
static int ScanFrontendTuningHandler( scan_t *, void *, const scan_tuner_config_t * );
+static int ScanFilterHandler( scan_t *, void *, uint16_t, bool );
static int ScanStatsCallback( scan_t *p_scan, void *p_privdata, int *pi_snr );
static int ScanReadCallback( scan_t *, void *, unsigned, size_t, uint8_t *, size_t *);
@@ -165,16 +166,11 @@ static int Open( vlc_object_t *p_this )
parameter.b_use_nit = var_InheritBool( p_access, "dvb-scan-nit" );
- msg_Dbg( p_access, "setting filter on PAT/NIT/SDT (DVB only)" );
- FilterSet( p_access, 0x00, OTHER_TYPE ); // PAT
- FilterSet( p_access, 0x11, OTHER_TYPE ); // SDT
- if( parameter.b_use_nit )
- FilterSet( p_access, 0x10, OTHER_TYPE ); // NIT
-
if( FrontendFillScanParameter( p_access, ¶meter ) ||
(p_scan = scan_New( VLC_OBJECT(p_access), ¶meter,
ScanFrontendTuningHandler,
ScanStatsCallback,
+ ScanFilterHandler,
ScanReadCallback,
p_access )) == NULL )
{
@@ -254,6 +250,17 @@ static int ScanStatsCallback( scan_t *p_scan, void *p_privdata, int *pi_snr )
return VLC_EGENERIC;
}
+static int ScanFilterHandler( scan_t *p_scan, void *p_privdata, uint16_t i_pid, bool b_set )
+{
+ access_t *p_access = (access_t *) p_privdata;
+ VLC_UNUSED(p_scan);
+
+ if( b_set )
+ FilterSet( p_access, i_pid, OTHER_TYPE );
+
+ return VLC_SUCCESS;
+}
+
static int ScanReadCallback( scan_t *p_scan, void *p_privdata,
unsigned i_probe_timeout, size_t i_packets_max,
uint8_t *p_packet, size_t *pi_count )
diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index c757013..340779d 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -108,6 +108,7 @@ struct scan_t
{
vlc_object_t *p_obj;
scan_frontend_tune_cb pf_tune;
+ scan_demux_filter_cb pf_filter;
scan_frontend_stats_cb pf_stats;
scan_demux_read_cb pf_read;
void *p_cbdata;
@@ -374,6 +375,7 @@ static void scan_Debug_Parameters( vlc_object_t *p_obj, const scan_parameter_t *
scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter,
scan_frontend_tune_cb pf_frontend,
scan_frontend_stats_cb pf_status,
+ scan_demux_filter_cb pf_filter,
scan_demux_read_cb pf_read,
void *p_cbdata )
{
@@ -388,6 +390,7 @@ scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter,
p_scan->pf_tune = pf_frontend;
p_scan->pf_stats = pf_status;
p_scan->pf_read = pf_read;
+ p_scan->pf_filter = pf_filter;
p_scan->p_cbdata = p_cbdata;
p_scan->i_index = 0;
p_scan->p_dialog_id = NULL;
@@ -831,6 +834,11 @@ int scan_Run( scan_t *p_scan )
return VLC_EGENERIC;
}
+ p_scan->pf_filter( p_scan, p_scan->p_cbdata, 0x00, true );
+ p_scan->pf_filter( p_scan, p_scan->p_cbdata, 0x10, true );
+ if( p_scan->parameter.b_use_nit )
+ p_scan->pf_filter( p_scan, p_scan->p_cbdata, 0x11, true );
+
/* */
uint8_t packet[TS_PACKET_SIZE * SCAN_READ_BUFFER_COUNT];
int64_t i_scan_start = mdate();
diff --git a/modules/access/dvb/scan.h b/modules/access/dvb/scan.h
index 577753e..dd72482 100644
--- a/modules/access/dvb/scan.h
+++ b/modules/access/dvb/scan.h
@@ -78,7 +78,7 @@ typedef struct scan_parameter_t
typedef struct scan_t scan_t;
typedef int (*scan_frontend_tune_cb)( scan_t *, void *, const scan_tuner_config_t * );
typedef int (*scan_frontend_stats_cb)( scan_t *, void *, int * );
-typedef int (*scan_demux_filter_cb)( scan_t *, void *, uint16_t );
+typedef int (*scan_demux_filter_cb)( scan_t *, void *, uint16_t, bool );
typedef int (*scan_demux_read_cb)( scan_t *, void *, unsigned, size_t, uint8_t *, size_t * );
void scan_parameter_Init( scan_parameter_t * );
@@ -87,6 +87,7 @@ void scan_parameter_Clean( scan_parameter_t * );
scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter,
scan_frontend_tune_cb,
scan_frontend_stats_cb,
+ scan_demux_filter_cb,
scan_demux_read_cb,
void * );
void scan_Destroy( scan_t *p_scan );
More information about the vlc-commits
mailing list