]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
move streaming defines from tvheadend.h to streaming.h
authorJaroslav Kysela <perex@perex.cz>
Tue, 6 Mar 2018 17:24:46 +0000 (18:24 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 23 Mar 2018 17:05:29 +0000 (18:05 +0100)
16 files changed:
src/esstream.h
src/input.h
src/input/mpegts.h
src/libav.h
src/muxer.h
src/packet.c
src/packet.h
src/parsers.h
src/parsers/parser_teletext.c
src/service.h
src/streaming.c
src/streaming.h
src/timeshift.h
src/transcoding/transcode.h
src/transcoding/transcode/transcoder.c
src/tvheadend.h

index 4113479d7f590e7ffae056b538f8d4f135c3bffc..63209999b1e34695cdaa1346c21df5d9562ccdbd 100644 (file)
 /**
  *
  */
-
 typedef struct service service_t;
 typedef struct streaming_start streaming_start_t;
 
+typedef enum streaming_component_type streaming_component_type_t;
 typedef struct elementary_stream elementary_stream_t;
 typedef struct elementary_set elementary_set_t;
 
+/**
+ * Stream component types
+ */
+enum streaming_component_type {
+  SCT_NONE = -1,
+  SCT_UNKNOWN = 0,
+  SCT_RAW = 1,
+  SCT_PCR,     /* MPEG-TS PCR data */
+  SCT_CAT,     /* MPEG-TS CAT (EMM) data */
+  SCT_CA,      /* MPEG-TS ECM data */
+  SCT_HBBTV,   /* HBBTV info */
+  /* standard codecs */
+  SCT_MPEG2VIDEO,
+  SCT_MPEG2AUDIO,
+  SCT_H264,
+  SCT_AC3,
+  SCT_TELETEXT,
+  SCT_DVBSUB,
+  SCT_AAC,     /* AAC-LATM in MPEG-TS, ADTS + AAC in packet form */
+  SCT_MPEGTS,
+  SCT_TEXTSUB,
+  SCT_EAC3,
+  SCT_MP4A,    /* ADTS + AAC in MPEG-TS and packet form */
+  SCT_VP8,
+  SCT_VORBIS,
+  SCT_HEVC,
+  SCT_VP9,
+  SCT_THEORA,
+  SCT_OPUS,
+  SCT_FLAC,
+  SCT_LAST = SCT_FLAC
+};
+
+#define SCT_MASK(t) (1 << (t))
+
+#define SCT_ISVIDEO(t) ((t) == SCT_MPEG2VIDEO || (t) == SCT_H264 || \
+                       (t) == SCT_VP8 || (t) == SCT_HEVC || \
+                       (t) == SCT_VP9 || (t) == SCT_THEORA)
+
+#define SCT_ISAUDIO(t) ((t) == SCT_MPEG2AUDIO || (t) == SCT_AC3 || \
+                       (t) == SCT_AAC  || (t) == SCT_MP4A || \
+                       (t) == SCT_EAC3 || (t) == SCT_VORBIS || \
+                       (t) == SCT_OPUS || (t) == SCT_FLAC)
+
+#define SCT_ISAV(t) (SCT_ISVIDEO(t) || SCT_ISAUDIO(t))
+
+#define SCT_ISSUBTITLE(t) ((t) == SCT_TEXTSUB || (t) == SCT_DVBSUB)
+
 /**
  * Stream, one media component for a service.
  */
index 595980f98ce489372bed574a04a40b42316a3989..516f850ef9193117dc9c8a8005a15ea05f5f6977 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "idnode.h"
 #include "queue.h"
+#include "streaming.h"
 
 struct htsmsg;
 
index 6473b373fe164328530e4ad4404a3b93edbae832..e9fb8c0703e00d31b695bbc02de2f20322952dc6 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #include "atomic.h"
+#include "sbuf.h"
 #include "input.h"
 #include "service.h"
 #include "mpegts/dvb.h"
index fbe4b3acd7a470faaa85694af977b9387b38fc4d..ea9af51693eb7aaa8d742b776a945d55ece454c6 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <libavformat/avformat.h>
 #include <libavfilter/avfilter.h>
-#include "tvheadend.h"
+#include "esstream.h"
 
 /*
 Older versions of ffmpeg/libav don't have the AV_* prefix
index aa4b17d326b3eb259d60f41cdcb87759fc8fedec..9b3ba408ced7f5cef4fdb87eb95d1540e5679e94 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef MUXER_H_
 #define MUXER_H_
 
+#include "streaming.h"
 #include "htsmsg.h"
 
 #define MC_IS_EOS_ERROR(e) ((e) == EPIPE || (e) == ECONNRESET)
index 3ad2569e1a38857b84886ee89529fc5c8a397c07..58f8419560e09148c54e562e5b0d5dfa5d506417 100644 (file)
@@ -18,6 +18,7 @@
 
 
 #include "tvheadend.h"
+#include "streaming.h"
 #include "packet.h"
 #include "string.h"
 #include "atomic.h"
index ec6239541ca256ce11dbe229accea8994bd1b35a..25a3c0431ba98baff7cf2a67b3b2bec66c2b35dd 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef PACKET_H_
 #define PACKET_H_
 
+#include "esstream.h"
+
 struct memoryinfo;
 
 /**
index 54136f6ccd606fa9fe2e89a6b40a69c82b13d933..f247e743f372db5df53b6f2a08d17bac68f1c054 100644 (file)
@@ -20,6 +20,7 @@
 #define PARSERS_H
 
 #include "tvheadend.h"
+#include "sbuf.h"
 #include "streaming.h"
 #include "subscriptions.h"
 #include "packet.h"
@@ -91,7 +92,7 @@ struct parser {
   uint8_t  prs_current_pcr_guess;
 
   /* Teletext */
-  th_commercial_advice_t prs_tt_commercial_advice;
+  commercial_advice_t prs_tt_commercial_advice;
   time_t prs_tt_clock;   /* Network clock as determined by teletext decoder */
 
 };
index c0bd51248aaca5ec01cb93ed0587ca6c1f489ca0..268f78b722eb165fd06a77ca28bd38545a999fc2 100644 (file)
@@ -1036,7 +1036,7 @@ teletext_rundown_scan(parser_t *prs, tt_private_t *ttp)
   uint8_t *l;
   mpegts_service_t *t;
   time_t now = prs->prs_tt_clock, start, stop;
-  th_commercial_advice_t ca;
+  commercial_advice_t ca;
 
   if(ttp->ttp_rundown_valid == 0)
     return;
index 760aded59f9ce7799de2771a136bddf747cc7e9d..d9c69363c1d431d1301cf6a728297b60b1c6561d 100644 (file)
 #define SERVICE_H__
 
 #include "esstream.h"
-#include "sbuf.h"
+#include "streaming.h"
 #include "htsmsg.h"
 #include "idnode.h"
-#include "profile.h"
 
+/**
+ *
+ */
 extern const idclass_t service_class;
 extern const idclass_t service_raw_class;
 
@@ -32,27 +34,19 @@ extern struct service_queue service_all;
 extern struct service_queue service_raw_all;
 extern struct service_queue service_raw_remove;
 
+/**
+ *
+ */
 struct channel;
 struct tvh_input;
 struct mpegts_apids;
+struct profile_chain;
+struct source_info;
+struct descramble_info;
 
 /**
- * Source information
+ *
  */
-typedef struct source_info {
-  tvh_uuid_t si_adapter_uuid;
-  tvh_uuid_t si_network_uuid;
-  tvh_uuid_t si_mux_uuid;
-  char *si_adapter;
-  char *si_network;
-  char *si_network_type;
-  char *si_satpos;
-  char *si_mux;
-  char *si_provider;
-  char *si_service;
-  int   si_type;
-} source_info_t;
-
 typedef TAILQ_HEAD(service_instance_list, service_instance) service_instance_list_t;
 
 /**
@@ -61,25 +55,19 @@ typedef TAILQ_HEAD(service_instance_list, service_instance) service_instance_lis
 typedef struct service_instance {
 
   TAILQ_ENTRY(service_instance) si_link;
-
-  int si_prio;
-
-  struct service *si_s; // A reference is held
-  int si_instance;       // Discriminator when having multiple adapters, etc
-
-  int si_error;        /* Set if subscription layer deem this cand
-                          to be broken. We typically set this if we
-                          have not seen any demuxed packets after
-                          the grace period has expired.
-                          The actual value is current time
-                       */
-
+  struct service *si_s; /* A reference is held */
+
+  int si_prio;          /* Priority (higher value has more weight) */
+  int si_instance;      /* Discriminator when having multiple adapters, etc */
+  int si_error;         /* Set if subscription layer deem this cand
+                         * to be broken. We typically set this if we
+                         * have not seen any demuxed packets after
+                         * the grace period has expired.
+                         * The actual value is current time
+                         */
   time_t si_error_time;
-
-
-  int si_weight;         // Highest weight that holds this cand
-
-  int si_mark;           // For mark & sweep
+  int si_weight;        /* Highest weight that holds this cand */
+  int si_mark;          /* For mark & sweep */
 
   char si_source[128];
 
@@ -272,7 +260,7 @@ typedef struct service {
   /**
    * Teletext...
    */
-  th_commercial_advice_t s_tt_commercial_advice;
+  commercial_advice_t s_tt_commercial_advice;
   time_t s_tt_clock;   /* Network clock as determined by teletext decoder */
  
   /**
@@ -382,7 +370,7 @@ typedef struct service {
   uint8_t s_scrambled_pass;
   th_descrambler_runtime_t *s_descramble;
   void *s_descrambler; /* last active descrambler */
-  descramble_info_t *s_descramble_info;
+  struct descramble_info *s_descramble_info;
 
   /**
    * Set of all and filtered components.
@@ -437,7 +425,7 @@ static inline service_t *service_find_by_uuid0(tvh_uuid_t *uuid)
 service_instance_t *service_find_instance(struct service *s,
                                           struct channel *ch,
                                           struct tvh_input *source,
-                                          profile_chain_t *prch,
+                                          struct profile_chain *prch,
                                           service_instance_list_t *sil,
                                           int *error, int weight,
                                           int flags, int timeout,
index 4ea670c66b8b797b02f481eab68eb39972c79d6b..e47dcfa2569285425dfd5ab71a601eb0f87619df 100644 (file)
@@ -613,6 +613,20 @@ streaming_component_audio_type2desc(int audio_type)
   return N_("Reserved");
 }
 
+static struct strtab signal_statetab[] = {
+  { "GOOD",       SIGNAL_GOOD    },
+  { "BAD",        SIGNAL_BAD     },
+  { "FAINT",      SIGNAL_FAINT   },
+  { "NONE",       SIGNAL_NONE    },
+};
+
+const char *signal2str(signal_state_t st)
+{
+  const char *r = val2str(st, signal_statetab);
+  if (!r) r = "UNKNOWN";
+  return r;
+}
+
 /*
  *
  */
index 549e7ca1d79b153589f0b51f8e7a08b6cf5df1e3..bdff51b2a1fbba73ba29830d77dbfef2b8f6dada 100644 (file)
 
 #include "packet.h"
 #include "htsmsg.h"
-#include "service.h"
 
+/**
+ *
+ */
+struct service;
+
+/**
+ *
+ */
+typedef enum commercial_advice commercial_advice_t;
+typedef enum signal_status_scale signal_status_scale_t;
+typedef struct signal_status signal_status_t;
+typedef struct descramble_info descramble_info_t;
+typedef struct timeshift_status timeshift_status_t;
+typedef struct streaming_skip streaming_skip_t;
+typedef struct streaming_pad streaming_pad_t;
+typedef enum streaming_message_type streaming_message_type_t;
+typedef enum signal_state signal_state_t;
+typedef struct streaming_message streaming_message_t;
+typedef struct streaming_ops streaming_ops_t;
+typedef struct streaming_queue streaming_queue_t;
+typedef struct source_info source_info_t;
+typedef struct streaming_start_component streaming_start_component_t;
+typedef struct streaming_start streaming_start_t;
+
+/**
+ *
+ */
+LIST_HEAD(streaming_target_list, streaming_target);
+TAILQ_HEAD(streaming_message_queue, streaming_message);
+
+/*
+ * Commercial status
+ */
+enum commercial_advice {
+  COMMERCIAL_UNKNOWN,
+  COMMERCIAL_YES,
+  COMMERCIAL_NO,
+};
+
+/*
+ * Scales for signal status values
+ */
+enum signal_status_scale {
+  SIGNAL_STATUS_SCALE_UNKNOWN = 0,
+  SIGNAL_STATUS_SCALE_RELATIVE, // value is unsigned, where 0 means 0% and 65535 means 100%
+  SIGNAL_STATUS_SCALE_DECIBEL   // value is measured in dB * 1000
+};
+
+/**
+ * The signal status of a tuner
+ */
+struct signal_status {
+  const char *status_text; /* adapter status text */
+  int snr;      /* signal/noise ratio */
+  signal_status_scale_t snr_scale;
+  int signal;   /* signal strength */
+  signal_status_scale_t signal_scale;
+  int ber;      /* bit error rate */
+  int unc;      /* uncorrected blocks */
+  int ec_bit;   /* error bit count */
+  int tc_bit;   /* total bit count */
+  int ec_block; /* error block count */
+  int tc_block; /* total block count */
+};
+
+/**
+ * Descramble info
+ */
+struct descramble_info {
+  uint16_t pid;
+  uint16_t caid;
+  uint32_t provid;
+  uint32_t ecmtime;
+  uint16_t hops;
+  char cardsystem[128];
+  char reader    [128];
+  char from      [128];
+  char protocol  [128];
+};
+
+/**
+ *
+ */
+struct timeshift_status
+{
+  int     full;
+  int64_t shift;
+  int64_t pts_start;
+  int64_t pts_end;
+};
+
+/**
+ * Streaming skip
+ */
+struct streaming_skip
+{
+  enum {
+    SMT_SKIP_ERROR,
+    SMT_SKIP_REL_TIME,
+    SMT_SKIP_ABS_TIME,
+    SMT_SKIP_REL_SIZE,
+    SMT_SKIP_ABS_SIZE,
+    SMT_SKIP_LIVE
+  } type;
+  union {
+    off_t   size;
+    int64_t time;
+  };
+#if ENABLE_TIMESHIFT
+  timeshift_status_t timeshift;
+#endif
+};
+
+
+/**
+ * A streaming pad generates data.
+ * It has one or more streaming targets attached to it.
+ *
+ * We support two different streaming target types:
+ * One is callback driven and the other uses a queue + thread.
+ *
+ * Targets which already has a queueing intrastructure in place (such
+ * as HTSP) does not need any interim queues so it would be a waste. That
+ * is why we have the callback target.
+ *
+ */
+struct streaming_pad {
+  struct streaming_target_list sp_targets;
+  int sp_ntargets;
+  int sp_reject_filter;
+};
+
+/**
+ * Streaming messages types
+ */
+enum streaming_message_type {
+
+  /**
+   * Packet with data.
+   *
+   * sm_data points to a th_pkt. th_pkt will be unref'ed when
+   * the message is destroyed
+   */
+  SMT_PACKET,
+
+  /**
+   * Stream grace period
+   *
+   * sm_code contains number of seconds to settle things down
+   */
+
+  SMT_GRACE,
+
+  /**
+   * Stream start
+   *
+   * sm_data points to a stream_start struct.
+   * See transport_build_stream_start()
+   */
+
+  SMT_START,
+
+  /**
+   * Service status
+   *
+   * Notification about status of source, see TSS_ flags
+   */
+  SMT_SERVICE_STATUS,
+
+  /**
+   * Signal status
+   *
+   * Notification about frontend signal status
+   */
+  SMT_SIGNAL_STATUS,
+
+  /**
+   * Descrambler info message
+   *
+   * Notification about descrambler
+   */
+  SMT_DESCRAMBLE_INFO,
+
+  /**
+   * Streaming stop.
+   *
+   * End of streaming. If sm_code is 0 this was a result to an
+   * unsubscription. Otherwise the reason was external and the
+   * subscription scheduler will attempt to start a new streaming
+   * session.
+   */
+  SMT_STOP,
+
+  /**
+   * Streaming unable to start.
+   *
+   * sm_code indicates reason. Scheduler will try to restart
+   */
+  SMT_NOSTART,
+
+  /**
+   * Streaming unable to start (non-fatal).
+   *
+   * sm_code indicates reason. Scheduler will try to restart
+   */
+  SMT_NOSTART_WARN,
+
+  /**
+   * Raw MPEG TS data
+   */
+  SMT_MPEGTS,
+
+  /**
+   * Internal message to exit receiver
+   */
+  SMT_EXIT,
+
+  /**
+   * Set stream speed
+   */
+  SMT_SPEED,
+
+  /**
+   * Skip the stream
+   */
+  SMT_SKIP,
+
+  /**
+   * Timeshift status
+   */
+  SMT_TIMESHIFT_STATUS,
+
+};
+
+#define SMT_TO_MASK(x) (1 << ((unsigned int)x))
+
+/**
+ * Streaming codes
+ */
+#define SM_CODE_OK                        0
+
+#define SM_CODE_UNDEFINED_ERROR           1
+
+#define SM_CODE_FORCE_OK                  10
+
+#define SM_CODE_SOURCE_RECONFIGURED       100
+#define SM_CODE_BAD_SOURCE                101
+#define SM_CODE_SOURCE_DELETED            102
+#define SM_CODE_SUBSCRIPTION_OVERRIDDEN   103
+#define SM_CODE_INVALID_TARGET            104
+#define SM_CODE_USER_ACCESS               105
+#define SM_CODE_USER_LIMIT                106
+#define SM_CODE_WEAK_STREAM               107
+#define SM_CODE_USER_REQUEST              108
+#define SM_CODE_PREVIOUSLY_RECORDED       109
+
+#define SM_CODE_NO_FREE_ADAPTER           200
+#define SM_CODE_MUX_NOT_ENABLED           201
+#define SM_CODE_NOT_FREE                  202
+#define SM_CODE_TUNING_FAILED             203
+#define SM_CODE_SVC_NOT_ENABLED           204
+#define SM_CODE_BAD_SIGNAL                205
+#define SM_CODE_NO_SOURCE                 206
+#define SM_CODE_NO_SERVICE                207
+#define SM_CODE_NO_VALID_ADAPTER          208
+#define SM_CODE_NO_ADAPTERS               209
+#define SM_CODE_INVALID_SERVICE           210
+#define SM_CODE_CHN_NOT_ENABLED           211
+
+#define SM_CODE_ABORTED                   300
+
+#define SM_CODE_NO_DESCRAMBLER            400
+#define SM_CODE_NO_ACCESS                 401
+#define SM_CODE_NO_INPUT                  402
+#define SM_CODE_NO_SPACE                  403
+
+/**
+ * Signal
+ */
+enum signal_state
+{
+  SIGNAL_UNKNOWN,
+  SIGNAL_GOOD,
+  SIGNAL_BAD,
+  SIGNAL_FAINT,
+  SIGNAL_NONE
+};
+
+const char * signal2str ( signal_state_t st );
+
+/**
+ * Streaming messages are sent from the pad to its receivers
+ */
+struct streaming_message {
+  TAILQ_ENTRY(streaming_message) sm_link;
+  streaming_message_type_t sm_type;
+#if ENABLE_TIMESHIFT
+  int64_t sm_time;
+#endif
+  union {
+    void *sm_data;
+    int sm_code;
+  };
+};
+
+/**
+ * A streaming target receives data.
+ */
+typedef void (st_callback_t)(void *opaque, streaming_message_t *sm);
+
+struct streaming_ops {
+  st_callback_t *st_cb;
+  htsmsg_t *(*st_info)(void *opaque, htsmsg_t *list);
+};
 
-typedef struct streaming_start_component {
+typedef struct streaming_target {
+  LIST_ENTRY(streaming_target) st_link;
+  streaming_pad_t *st_pad;               /* Source we are linked to */
+  streaming_ops_t st_ops;
+  void *st_opaque;
+  int st_reject_filter;
+} streaming_target_t;
+
+/**
+ *
+ */
+struct streaming_queue {
+
+  streaming_target_t sq_st;
+
+  pthread_mutex_t sq_mutex;    /* Protects sp_queue */
+  tvh_cond_t  sq_cond;         /* Condvar for signalling new packets */
+
+  size_t          sq_maxsize;  /* Max queue size (bytes) */
+  size_t          sq_size;     /* Actual queue size (bytes) - only data */
+
+  struct streaming_message_queue sq_queue;
+
+};
+
+streaming_component_type_t streaming_component_txt2type(const char *str);
+const char *streaming_component_type2txt(streaming_component_type_t s);
+streaming_component_type_t streaming_component_txt2type(const char *s);
+const char *streaming_component_audio_type2desc(int audio_type);
+
+/**
+ * Source information
+ */
+struct source_info {
+  tvh_uuid_t si_adapter_uuid;
+  tvh_uuid_t si_network_uuid;
+  tvh_uuid_t si_mux_uuid;
+  char *si_adapter;
+  char *si_network;
+  char *si_network_type;
+  char *si_satpos;
+  char *si_mux;
+  char *si_provider;
+  char *si_service;
+  int   si_type;
+};
+
+/**
+ *
+ */
+struct streaming_start_component {
   int ssc_index;
   int ssc_type;
   char ssc_lang[4];
@@ -47,11 +410,10 @@ typedef struct streaming_start_component {
 
   int ssc_frameduration;
 
-} streaming_start_component_t;
+};
 
 
-
-typedef struct streaming_start {
+struct streaming_start {
   int ss_refcount;
 
   int ss_num_components;
@@ -64,8 +426,7 @@ typedef struct streaming_start {
 
   streaming_start_component_t ss_components[0];
 
-} streaming_start_t;
-
+};
 
 /**
  *
@@ -91,7 +452,7 @@ void streaming_target_disconnect(streaming_pad_t *sp, streaming_target_t *st);
 
 void streaming_pad_deliver(streaming_pad_t *sp, streaming_message_t *sm);
 
-void streaming_service_deliver(service_t *t, streaming_message_t *sm);
+void streaming_service_deliver(struct service *t, streaming_message_t *sm);
 
 void streaming_msg_free(streaming_message_t *sm);
 
index 27e313d43601c561f9d4cbc8854637898e681ce2..a97621cb540d5d25fdb25791111d44ac1d7c9adf 100644 (file)
@@ -20,6 +20,7 @@
 #define __TVH_TIMESHIFT_H__
 
 #include "idnode.h"
+#include "streaming.h"
 #include "memoryinfo.h"
 
 typedef struct timeshift_conf {
index 0d528f7781938d3f84b6139e239f77c0d0e49a39..4708919bcdb23cade996454090e524e8ba0e228b 100644 (file)
@@ -23,6 +23,7 @@
 
 
 #include "tvheadend.h"
+#include "streaming.h"
 
 
 /* TVHTranscoder ============================================================ */
index ad185c7887a71fdc13b97d559f23c7b7618fbff1..3a6a4c632da5dbef103bf76fd6d67c6a742d6b28 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "internals.h"
 #include "../codec/internals.h"
+#include "service.h"
 
 
 static TVHCodecProfile _codec_profile_copy = { .name = (char *)"copy" };
index eeb61f66a65c0c5f38e884413cef53be5326a2e0..310a0bc3c08592de8c77a596d13ed611b77647ed 100644 (file)
@@ -119,16 +119,6 @@ typedef struct {
 } tvh_cond_t;
 
 
-/*
- * Commercial status
- */
-typedef enum {
-  COMMERCIAL_UNKNOWN,
-  COMMERCIAL_YES,
-  COMMERCIAL_NO,
-} th_commercial_advice_t;
-
-
 /*
  *
  */
@@ -262,7 +252,6 @@ TAILQ_HEAD(th_muxpkt_queue, th_muxpkt);
 LIST_HEAD(dvr_autorec_entry_list, dvr_autorec_entry);
 LIST_HEAD(dvr_timerec_entry_list, dvr_timerec_entry);
 TAILQ_HEAD(th_pktref_queue, th_pktref);
-LIST_HEAD(streaming_target_list, streaming_target);
 
 /**
  *
@@ -276,373 +265,6 @@ LIST_HEAD(streaming_target_list, streaming_target);
 
 int tvh_kill_to_sig(int tvh_kill);
 
-/**
- * Stream component types
- */
-typedef enum {
-  SCT_NONE = -1,
-  SCT_UNKNOWN = 0,
-  SCT_RAW = 1,
-  SCT_PCR,     /* MPEG-TS PCR data */
-  SCT_CAT,     /* MPEG-TS CAT (EMM) data */
-  SCT_CA,      /* MPEG-TS ECM data */
-  SCT_HBBTV,   /* HBBTV info */
-  /* standard codecs */
-  SCT_MPEG2VIDEO,
-  SCT_MPEG2AUDIO,
-  SCT_H264,
-  SCT_AC3,
-  SCT_TELETEXT,
-  SCT_DVBSUB,
-  SCT_AAC,     /* AAC-LATM in MPEG-TS, ADTS + AAC in packet form */
-  SCT_MPEGTS,
-  SCT_TEXTSUB,
-  SCT_EAC3,
-  SCT_MP4A,    /* ADTS + AAC in MPEG-TS and packet form */
-  SCT_VP8,
-  SCT_VORBIS,
-  SCT_HEVC,
-  SCT_VP9,
-  SCT_THEORA,
-  SCT_OPUS,
-  SCT_FLAC,
-  SCT_LAST = SCT_FLAC
-} streaming_component_type_t;
-
-#define SCT_MASK(t) (1 << (t))
-
-#define SCT_ISVIDEO(t) ((t) == SCT_MPEG2VIDEO || (t) == SCT_H264 || \
-                       (t) == SCT_VP8 || (t) == SCT_HEVC || \
-                       (t) == SCT_VP9 || (t) == SCT_THEORA)
-
-#define SCT_ISAUDIO(t) ((t) == SCT_MPEG2AUDIO || (t) == SCT_AC3 || \
-                       (t) == SCT_AAC  || (t) == SCT_MP4A || \
-                       (t) == SCT_EAC3 || (t) == SCT_VORBIS || \
-                       (t) == SCT_OPUS || (t) == SCT_FLAC)
-
-#define SCT_ISAV(t) (SCT_ISVIDEO(t) || SCT_ISAUDIO(t))
-
-#define SCT_ISSUBTITLE(t) ((t) == SCT_TEXTSUB || (t) == SCT_DVBSUB)
-
-/*
- * Scales for signal status values
- */
-typedef enum {
-  SIGNAL_STATUS_SCALE_UNKNOWN = 0,
-  SIGNAL_STATUS_SCALE_RELATIVE, // value is unsigned, where 0 means 0% and 65535 means 100%
-  SIGNAL_STATUS_SCALE_DECIBEL   // value is measured in dB * 1000
-} signal_status_scale_t;
-
-/**
- * The signal status of a tuner
- */
-typedef struct signal_status {
-  const char *status_text; /* adapter status text */
-  int snr;      /* signal/noise ratio */
-  signal_status_scale_t snr_scale;
-  int signal;   /* signal strength */
-  signal_status_scale_t signal_scale;
-  int ber;      /* bit error rate */
-  int unc;      /* uncorrected blocks */
-  int ec_bit;   /* error bit count */
-  int tc_bit;   /* total bit count */
-  int ec_block; /* error block count */
-  int tc_block; /* total block count */
-} signal_status_t;
-
-/**
- * Descramble info
- */
-typedef struct descramble_info {
-  uint16_t pid;
-  uint16_t caid;
-  uint32_t provid;
-  uint32_t ecmtime;
-  uint16_t hops;
-  char cardsystem[128];
-  char reader    [128];
-  char from      [128];
-  char protocol  [128];
-} descramble_info_t;
-
-/**
- *
- */
-typedef struct timeshift_status
-{
-  int     full;
-  int64_t shift;
-  int64_t pts_start;
-  int64_t pts_end;
-} timeshift_status_t;
-
-/**
- * Streaming skip
- */
-typedef struct streaming_skip
-{
-  enum {
-    SMT_SKIP_ERROR,
-    SMT_SKIP_REL_TIME,
-    SMT_SKIP_ABS_TIME,
-    SMT_SKIP_REL_SIZE,
-    SMT_SKIP_ABS_SIZE,
-    SMT_SKIP_LIVE
-  } type;
-  union {
-    off_t   size;
-    int64_t time;
-  };
-#if ENABLE_TIMESHIFT
-  timeshift_status_t timeshift;
-#endif
-} streaming_skip_t;
-
-
-/**
- * A streaming pad generates data.
- * It has one or more streaming targets attached to it.
- *
- * We support two different streaming target types:
- * One is callback driven and the other uses a queue + thread.
- *
- * Targets which already has a queueing intrastructure in place (such
- * as HTSP) does not need any interim queues so it would be a waste. That
- * is why we have the callback target.
- *
- */
-typedef struct streaming_pad {
-  struct streaming_target_list sp_targets;
-  int sp_ntargets;
-  int sp_reject_filter;
-} streaming_pad_t;
-
-
-TAILQ_HEAD(streaming_message_queue, streaming_message);
-
-/**
- * Streaming messages types
- */
-typedef enum {
-
-  /**
-   * Packet with data.
-   *
-   * sm_data points to a th_pkt. th_pkt will be unref'ed when
-   * the message is destroyed
-   */
-  SMT_PACKET,
-
-  /**
-   * Stream grace period
-   *
-   * sm_code contains number of seconds to settle things down
-   */
-
-  SMT_GRACE,
-
-  /**
-   * Stream start
-   *
-   * sm_data points to a stream_start struct.
-   * See transport_build_stream_start()
-   */
-
-  SMT_START,
-
-  /**
-   * Service status
-   *
-   * Notification about status of source, see TSS_ flags
-   */
-  SMT_SERVICE_STATUS,
-
-  /**
-   * Signal status
-   *
-   * Notification about frontend signal status
-   */
-  SMT_SIGNAL_STATUS,
-
-  /**
-   * Descrambler info message
-   *
-   * Notification about descrambler
-   */
-  SMT_DESCRAMBLE_INFO,
-
-  /**
-   * Streaming stop.
-   *
-   * End of streaming. If sm_code is 0 this was a result to an
-   * unsubscription. Otherwise the reason was external and the
-   * subscription scheduler will attempt to start a new streaming
-   * session.
-   */
-  SMT_STOP,
-
-  /**
-   * Streaming unable to start.
-   *
-   * sm_code indicates reason. Scheduler will try to restart
-   */
-  SMT_NOSTART,
-
-  /**
-   * Streaming unable to start (non-fatal).
-   *
-   * sm_code indicates reason. Scheduler will try to restart
-   */
-  SMT_NOSTART_WARN,
-
-  /**
-   * Raw MPEG TS data
-   */
-  SMT_MPEGTS,
-
-  /**
-   * Internal message to exit receiver
-   */
-  SMT_EXIT,
-
-  /**
-   * Set stream speed
-   */
-  SMT_SPEED,
-
-  /**
-   * Skip the stream
-   */
-  SMT_SKIP,
-
-  /**
-   * Timeshift status
-   */
-  SMT_TIMESHIFT_STATUS,
-
-} streaming_message_type_t;
-
-#define SMT_TO_MASK(x) (1 << ((unsigned int)x))
-
-
-#define SM_CODE_OK                        0
-
-#define SM_CODE_UNDEFINED_ERROR           1
-
-#define SM_CODE_FORCE_OK                  10
-
-#define SM_CODE_SOURCE_RECONFIGURED       100
-#define SM_CODE_BAD_SOURCE                101
-#define SM_CODE_SOURCE_DELETED            102
-#define SM_CODE_SUBSCRIPTION_OVERRIDDEN   103
-#define SM_CODE_INVALID_TARGET            104
-#define SM_CODE_USER_ACCESS               105
-#define SM_CODE_USER_LIMIT                106
-#define SM_CODE_WEAK_STREAM               107
-#define SM_CODE_USER_REQUEST              108
-#define SM_CODE_PREVIOUSLY_RECORDED       109
-
-#define SM_CODE_NO_FREE_ADAPTER           200
-#define SM_CODE_MUX_NOT_ENABLED           201
-#define SM_CODE_NOT_FREE                  202
-#define SM_CODE_TUNING_FAILED             203
-#define SM_CODE_SVC_NOT_ENABLED           204
-#define SM_CODE_BAD_SIGNAL                205
-#define SM_CODE_NO_SOURCE                 206
-#define SM_CODE_NO_SERVICE                207
-#define SM_CODE_NO_VALID_ADAPTER          208
-#define SM_CODE_NO_ADAPTERS               209
-#define SM_CODE_INVALID_SERVICE           210
-#define SM_CODE_CHN_NOT_ENABLED           211
-
-#define SM_CODE_ABORTED                   300
-
-#define SM_CODE_NO_DESCRAMBLER            400
-#define SM_CODE_NO_ACCESS                 401
-#define SM_CODE_NO_INPUT                  402
-#define SM_CODE_NO_SPACE                  403
-
-typedef enum
-{
-  SIGNAL_UNKNOWN,
-  SIGNAL_GOOD,
-  SIGNAL_BAD,
-  SIGNAL_FAINT,
-  SIGNAL_NONE
-} signal_state_t;
-
-static struct strtab signal_statetab[] = {
-  { "GOOD",       SIGNAL_GOOD    },
-  { "BAD",        SIGNAL_BAD     },
-  { "FAINT",      SIGNAL_FAINT   },
-  { "NONE",       SIGNAL_NONE    },
-};
-
-static inline const char * signal2str ( signal_state_t st )
-{
-  const char *r = val2str(st, signal_statetab);
-  if (!r) r = "UNKNOWN";
-  return r;
-}
-
-/**
- * Streaming messages are sent from the pad to its receivers
- */
-typedef struct streaming_message {
-  TAILQ_ENTRY(streaming_message) sm_link;
-  streaming_message_type_t sm_type;
-#if ENABLE_TIMESHIFT
-  int64_t sm_time;
-#endif
-  union {
-    void *sm_data;
-    int sm_code;
-  };
-} streaming_message_t;
-
-/**
- * A streaming target receives data.
- */
-
-typedef void (st_callback_t)(void *opaque, streaming_message_t *sm);
-
-typedef struct {
-  st_callback_t *st_cb;
-  htsmsg_t *(*st_info)(void *opaque, htsmsg_t *list);
-} streaming_ops_t;
-
-typedef struct streaming_target {
-  LIST_ENTRY(streaming_target) st_link;
-  streaming_pad_t *st_pad;               /* Source we are linked to */
-  streaming_ops_t st_ops;
-  void *st_opaque;
-  int st_reject_filter;
-} streaming_target_t;
-
-
-/**
- *
- */
-typedef struct streaming_queue {
-
-  streaming_target_t sq_st;
-
-  pthread_mutex_t sq_mutex;    /* Protects sp_queue */
-  tvh_cond_t  sq_cond;         /* Condvar for signalling new packets */
-
-  size_t          sq_maxsize;  /* Max queue size (bytes) */
-  size_t          sq_size;     /* Actual queue size (bytes) - only data */
-
-  struct streaming_message_queue sq_queue;
-
-} streaming_queue_t;
-
-
-streaming_component_type_t streaming_component_txt2type(const char *str);
-const char *streaming_component_type2txt(streaming_component_type_t s);
-streaming_component_type_t streaming_component_txt2type(const char *s);
-const char *streaming_component_audio_type2desc(int audio_type);
-
 static inline unsigned int tvh_strhash(const char *s, unsigned int mod)
 {
   unsigned int v = 5381;
@@ -666,8 +288,6 @@ int tvh_str_update(char **strp, const char *src);
 int sri_to_rate(int sri);
 int rate_to_sri(int rate);
 
-extern struct service_list all_transports;
-
 extern void scopedunlock(pthread_mutex_t **mtxp);
 
 #define scopedlock(mtx) \