[vlc-commits] access: dvb: scan: add scanlists

Francois Cartegnie git at videolan.org
Sun Apr 10 13:56:11 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr  5 15:09:51 2016 +0200| [e51246e2b95db156ebcdcc21ecdd6ea130533548] | committer: Francois Cartegnie

access: dvb: scan: add scanlists

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e51246e2b95db156ebcdcc21ecdd6ea130533548
---

 modules/access/Makefile.am     |    1 +
 modules/access/dvb/scan.c      |   11 +++++
 modules/access/dvb/scan_list.c |   90 ++++++++++++++++++++++++++++++++++++++++
 modules/access/dvb/scan_list.h |   58 ++++++++++++++++++++++++++
 4 files changed, 160 insertions(+)

diff --git a/modules/access/Makefile.am b/modules/access/Makefile.am
index fa23bd8..af87ada 100644
--- a/modules/access/Makefile.am
+++ b/modules/access/Makefile.am
@@ -341,6 +341,7 @@ libdvb_plugin_la_SOURCES = \
 	access/dvb/access.c \
 	access/dvb/linux_dvb.c \
 	access/dvb/scan.c access/dvb/scan.h \
+	access/dvb/scan_list.c access/dvb/scan_list.h \
 	access/dvb/dvb.h
 libdvb_plugin_la_CFLAGS = $(AM_CFLAGS)
 if HAVE_LINUX_DVB
diff --git a/modules/access/dvb/scan.c b/modules/access/dvb/scan.c
index 168f006..6338657 100644
--- a/modules/access/dvb/scan.c
+++ b/modules/access/dvb/scan.c
@@ -51,6 +51,7 @@
 
 #include "dvb.h"
 #include "scan.h"
+#include "scan_list.h"
 #include "../../demux/dvb-text.h"
 #include "../../mux/mpeg/dvbpsi_compat.h"
 
@@ -103,6 +104,10 @@ struct scan_t
     /* dvbv3 list file */
     scan_dvbs_transponder_t *p_transponders;
     unsigned                 i_transponders;
+
+    scan_list_entry_t *p_scanlist;
+    size_t             i_scanlist;
+    const scan_list_entry_t *p_current;
 };
 
 struct scan_session_t
@@ -239,6 +244,9 @@ scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter )
     scan_parameter_Init( &p_scan->parameter );
     scan_parameter_Copy( p_parameter, &p_scan->parameter );
     p_scan->i_time_start = mdate();
+    p_scan->p_scanlist = NULL;
+    p_scan->p_current = p_scan->p_scanlist;
+    p_scan->i_scanlist = 0;
 
     scan_Debug_Parameters( p_obj, p_parameter );
 
@@ -257,6 +265,9 @@ void scan_Destroy( scan_t *p_scan )
     for( int i = 0; i < p_scan->i_service; i++ )
         scan_service_Delete( p_scan->pp_service[i] );
     TAB_CLEAN( p_scan->i_service, p_scan->pp_service );
+
+    scan_list_entries_release( p_scan->p_scanlist );
+
     free( p_scan );
 }
 
diff --git a/modules/access/dvb/scan_list.c b/modules/access/dvb/scan_list.c
index e69de29..0e2a8ba 100644
--- a/modules/access/dvb/scan_list.c
+++ b/modules/access/dvb/scan_list.c
@@ -0,0 +1,90 @@
+/*****************************************************************************
+ * scan_list.c : Scanning parameters and transponders list
+ *****************************************************************************
+ * Copyright (C) 2016 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA    02111, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_fs.h>
+
+#include "scan_list.h"
+
+static scan_list_entry_t * scan_list_entry_New()
+{
+    scan_list_entry_t *p_entry = calloc(1, sizeof(scan_list_entry_t));
+    if( likely(p_entry) )
+    {
+        p_entry->i_service = -1;
+        p_entry->i_stream_id = -1;
+    }
+    return p_entry;
+}
+
+static void scan_list_entry_Delete( scan_list_entry_t *p_entry )
+{
+    free( p_entry->psz_channel );
+    free( p_entry );
+}
+
+static bool scan_list_entry_validate( const scan_list_entry_t *p_entry )
+{
+    switch( p_entry->delivery )
+    {
+        case DELIVERY_DVBS:
+        case DELIVERY_DVBS2:
+            return p_entry->i_freq && p_entry->i_rate && p_entry->i_fec;
+
+        case DELIVERY_DVBT:
+        case DELIVERY_DVBT2:
+        case DELIVERY_ISDBT:
+            return p_entry->i_freq && p_entry->i_bw;
+
+        case DELIVERY_DVBC:
+            return p_entry->i_freq && p_entry->i_rate;
+
+        case DELIVERY_UNKNOWN:
+        default:
+            break;
+    }
+    return false;
+}
+
+static bool scan_list_entry_add( scan_list_entry_t ***ppp_last, scan_list_entry_t *p_entry )
+{
+    if( scan_list_entry_validate( p_entry ) )
+    {
+         **ppp_last = p_entry;
+         *ppp_last = &p_entry->p_next;
+        return true;
+    }
+
+    scan_list_entry_Delete( p_entry );
+    return false;
+}
+
+void scan_list_entries_release( scan_list_entry_t *p_list )
+{
+    while( p_list )
+    {
+        scan_list_entry_t *p_next = p_list->p_next;
+        scan_list_entry_Delete( p_list );
+        p_list = p_next;
+    }
+}
diff --git a/modules/access/dvb/scan_list.h b/modules/access/dvb/scan_list.h
index e69de29..6fd45ea 100644
--- a/modules/access/dvb/scan_list.h
+++ b/modules/access/dvb/scan_list.h
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * scan_list.h : Scanning parameters and transponders list
+ *****************************************************************************
+ * Copyright (C) 2016 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA    02111, USA.
+ *****************************************************************************/
+#ifndef VLC_SCAN_LIST_H
+#define VLC_SCAN_LIST_H
+
+typedef struct scan_list_entry_t scan_list_entry_t;
+
+typedef struct scan_list_entry_t
+{
+    char *psz_channel;
+    int   i_service;
+    int   i_stream_id;
+    unsigned i_freq;
+    unsigned i_bw;
+
+    unsigned i_rate;
+    uint8_t  i_fec;
+    enum
+    {
+        POLARIZATION_VERTICAL = 0,
+        POLARIZATION_HORIZONTAL
+    } polarization;
+
+    enum
+    {
+        DELIVERY_UNKNOWN = 0,
+        DELIVERY_DVBT,
+        DELIVERY_DVBT2,
+        DELIVERY_DVBS,
+        DELIVERY_DVBS2,
+        DELIVERY_DVBC,
+        DELIVERY_ISDBT,
+    } delivery;
+
+    scan_list_entry_t *p_next;
+
+} scan_list_entry_t;
+
+void scan_list_entries_release( scan_list_entry_t * );
+
+#endif



More information about the vlc-commits mailing list