]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
mpegts: some minor changes to init / shutdown to avoid pointless errors
authorAdam Sutton <dev@adamsutton.me.uk>
Tue, 22 Apr 2014 09:01:09 +0000 (10:01 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Tue, 22 Apr 2014 09:04:35 +0000 (10:04 +0100)
Makefile
src/api/api_idnode.c
src/idnode.c
src/idnode.h
src/input/mpegts.c [new file with mode: 0644]
src/input/mpegts.h
src/main.c
src/tvheadend.h

index d93c70bb204fc5d3d9a78d706b1567740223cd63..466d64057f90de53702e0fcbb6d362e11b09458a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -169,6 +169,7 @@ SRCS += src/muxer.c \
 
 # MPEGTS core
 SRCS-$(CONFIG_MPEGTS) += \
+       src/input/mpegts.c \
        src/input/mpegts/mpegts_input.c \
        src/input/mpegts/mpegts_network.c \
        src/input/mpegts/mpegts_mux.c \
index e8452ac43b980ec106b1967ed95771c3b0608017..3e951ea1b29910c70dd94c1255e61513d9a7fcc2 100644 (file)
@@ -17,9 +17,6 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __TVH_API_IDNODE_H__
-#define __TVH_API_IDNODE_H__
-
 #include "tvheadend.h"
 #include "access.h"
 #include "idnode.h"
@@ -433,6 +430,3 @@ void api_idnode_init ( void )
 
   api_register_all(ah);
 }
-
-
-#endif /* __TVH_API_IDNODE_H__ */
index 15ad9095ad74f5c6d39622bf5374fde47c62f505..f068dba9a6650b64b3745a0072df640fa1f9f065 100644 (file)
@@ -45,9 +45,6 @@ static void*                  idnode_thread(void* p);
 
 SKEL_DECLARE(idclasses_skel, idclass_link_t);
 
-static void
-idclass_register(const idclass_t *idc);
-
 /* **************************************************************************
  * Utilities
  * *************************************************************************/
@@ -787,7 +784,7 @@ ic_cmp ( const idclass_link_t *a, const idclass_link_t *b )
   return strcmp(a->idc->ic_class, b->idc->ic_class);
 }
 
-static void
+void
 idclass_register(const idclass_t *idc)
 {
   while (idc) {
index 20d41901588da3bce29048fb4562be308449152e..4bab5b9c2b811e4ee8df95f6dccb7a566a899607 100644 (file)
@@ -130,6 +130,7 @@ void idnode_notify
 void idnode_notify_simple (void *in);
 void idnode_notify_title_changed (void *in);
 
+void idclass_register ( const idclass_t *idc );
 const idclass_t *idclass_find ( const char *name );
 htsmsg_t *idclass_serialize0 (const idclass_t *idc, int optmask);
 htsmsg_t *idnode_serialize0  (idnode_t *self, int optmask);
diff --git a/src/input/mpegts.c b/src/input/mpegts.c
new file mode 100644 (file)
index 0000000..8f2a0a5
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ *  TVheadend
+ *  Copyright (C) 2013 Adam Sutton
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "input.h"
+
+void
+mpegts_init ( int linuxdvb_mask, str_list_t *tsfiles, int tstuners )
+{
+  /* Register classes (avoid API 400 errors due to not yet defined) */
+  idclass_register(&mpegts_network_class);
+  idclass_register(&mpegts_mux_class);
+  idclass_register(&mpegts_service_class);
+
+  /* Setup DVB networks */
+#if ENABLE_MPEGTS_DVB
+  dvb_network_init();
+#endif
+
+  /* TS files */
+#if ENABLE_TSFILE
+  if(tsfiles->num) {
+    int i;
+    tsfile_init(tstuners ?: tsfiles->num);
+    for (i = 0; i < tsfiles->num; i++)
+      tsfile_add_file(tsfiles->str[i]);
+  }
+#endif
+
+  /* IPTV */
+#if ENABLE_IPTV
+  iptv_init();
+#endif
+
+  /* Linux DVB */
+#if ENABLE_LINUXDVB
+  linuxdvb_init(linuxdvb_mask);
+#endif
+
+  /* Mux schedulers */
+#if ENABLE_MPEGTS
+  mpegts_mux_sched_init();
+#endif
+
+}
+
+void
+mpegts_done ( void )
+{
+  tvhftrace("main", mpegts_mux_sched_done);
+#if ENABLE_MPEGTS_DVB
+  tvhftrace("main", dvb_network_done);
+#endif
+#if ENABLE_IPTV
+  tvhftrace("main", iptv_done);
+#endif
+#if ENABLE_LINUXDVB
+  tvhftrace("main", linuxdvb_done);
+#endif
+#if ENABLE_TSFILE
+  tvhftrace("main", tsfile_done);
+#endif
+}
+
+/******************************************************************************
+ * Editor Configuration
+ *
+ * vim:sts=2:ts=2:sw=2:et
+ *****************************************************************************/
index 321c22ae8e9b0fa9b31aa2486a0dc3a7a6d187ad..a919f8807576e32999d9db13c2a776c337c9e31a 100644 (file)
@@ -64,6 +64,13 @@ extern const idclass_t mpegts_mux_class;
 extern const idclass_t mpegts_service_class;
 extern const idclass_t mpegts_input_class;
 
+/* **************************************************************************
+ * Setup / Tear down
+ * *************************************************************************/
+
+void mpegts_init ( int linuxdvb_mask, str_list_t *tsfiles, int tstuners );
+void mpegts_done ( void );
+
 /* **************************************************************************
  * Data / SI processing
  * *************************************************************************/
index f23bec0e250ca7f57c0c22fe21495e208927caa9..6f818d1863b5feeeccd3a0e2fec5481601e6e4d9 100644 (file)
 pthread_t main_tid;
 
 /* Command line option struct */
-typedef struct str_list
-{
-  int max;
-  int num;
-  char **str;
-} str_list_t;
 typedef struct {
   const char  sopt;
   const char *lopt;
@@ -755,24 +749,8 @@ main(int argc, char **argv)
 
   service_init();
 
-#if ENABLE_TSFILE
-  if(opt_tsfile.num) {
-    tsfile_init(opt_tsfile_tuner ?: opt_tsfile.num);
-    for (i = 0; i < opt_tsfile.num; i++)
-      tsfile_add_file(opt_tsfile.str[i]);
-  }
-#endif
-#if ENABLE_MPEGTS_DVB
-  dvb_network_init();
-#endif
-#if ENABLE_IPTV
-  iptv_init();
-#endif
-#if ENABLE_LINUXDVB
-  linuxdvb_init(adapter_mask);
-#endif
 #if ENABLE_MPEGTS
-  mpegts_mux_sched_init();
+  mpegts_init(adapter_mask, &opt_tsfile, opt_tsfile_tuner);
 #endif
 
   channel_init();
@@ -841,19 +819,7 @@ main(int argc, char **argv)
   tvhftrace("main", http_client_done);
   tvhftrace("main", fsmonitor_done);
 #if ENABLE_MPEGTS
-  tvhftrace("main", mpegts_mux_sched_done);
-#endif
-#if ENABLE_MPEGTS_DVB
-  tvhftrace("main", dvb_network_done);
-#endif
-#if ENABLE_IPTV
-  tvhftrace("main", iptv_done);
-#endif
-#if ENABLE_LINUXDVB
-  tvhftrace("main", linuxdvb_done);
-#endif
-#if ENABLE_TSFILE
-  tvhftrace("main", tsfile_done);
+  tvhftrace("main", mpegts_done);
 #endif
 
   // Note: the locking is obviously a bit redundant, but without
index 858c10c9e385ca65c8da690559e7e2cd11b41fbb..15031f4552ec251817a70bd2d06b31649252bcca 100644 (file)
@@ -68,6 +68,13 @@ static inline htsmsg_t *tvheadend_capabilities_list(int check)
   return r;
 }
 
+typedef struct str_list
+{
+  int max;
+  int num;
+  char **str;
+} str_list_t;
+
 #define PTS_UNSET INT64_C(0x8000000000000000)
 
 extern int tvheadend_running;