*/
mpegts_mux_list_t mn_muxes;
+ /*
+ * Functions
+ */
+ mpegts_mux_t* (*mn_create_mux)
+ (mpegts_mux_t*, uint16_t onid, uint16_t tsid, void *aux);
+ mpegts_service_t* (*mn_create_service)
+ (mpegts_mux_t*, uint16_t sid, uint16_t pmt_pid);
+
+ // Note: the above are slightly odd in that they take mux instead of
+ // network as initial param. This is intentional as we need to
+ // know the mux and can easily get to network from there
+
#if 0 // TODO: FIXME
int dn_fe_type; // Frontend types for this network (FE_QPSK, etc)
#endif
int (*mm_start) ( mpegts_mux_t *mm, const char *reason, int weight );
void (*mm_open_table) (mpegts_mux_t*,mpegts_table_t*);
void (*mm_close_table) (mpegts_mux_t*,mpegts_table_t*);
+
#if 0
dvb_mux_conf_t dm_conf;
};
-/* Create */
-mpegts_service_t * mpegts_service_create0
- ( size_t alloc, const idclass_t *class, const char *uuid );
-#define mpegts_service_create(uuid)\
- mpegts_service_create0(sizeof(mpegts_service_t), &mpegts_service_class, uuid)
-#define mpegts_service_create1(type, uuid)\
- (type##_t*)mpegts_service_create0(sizeof(type##_t), &type##_class, uuid)
-
/* **************************************************************************
* Physical Network
* *************************************************************************/
(mpegts_mux_t *mm);
void mpegts_table_destroy ( mpegts_table_t *mt );
+mpegts_service_t *mpegts_service_create0
+ ( size_t alloc, const idclass_t *class, const char *uuid,
+ mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid );
+
+/* Create */
+#define mpegts_service_create(t, u, m, s, p)\
+ (struct t*)mpegts_service_create0(sizeof(struct t), &t##_class, u, m, s, p)
+
mpegts_service_t *mpegts_service_find ( mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid, const char *uuid, int *save );
}
/*
- * Find service
+ * Create service
*/
mpegts_service_t *
-mpegts_service_find
- ( mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid, const char *uuid, int *save )
+mpegts_service_create0
+ ( size_t alloc, const idclass_t *class, const char *uuid,
+ mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid )
{
- mpegts_service_t *s;
-
- /* Validate */
- lock_assert(&global_lock);
-
- /* Find existing service */
- LIST_FOREACH(s, &mm->mm_services, s_dvb_mux_link)
- if (s->s_dvb_service_id == sid) {
- if (pmt_pid && pmt_pid != s->s_pmt_pid) {
- s->s_pmt_pid = pmt_pid;
- if (save) *save = 1;
- }
- return s;
- }
-
- /* Ignore */
- if (!pmt_pid)
- return NULL;
+ mpegts_service_t *s = (mpegts_service_t*)idnode_create0(alloc, class, uuid);
/* Create */
tvhlog(LOG_DEBUG, "mpegts", "Add service %04X on %s", sid, "TODO");
- s = service_create(mpegts_service, uuid, S_MPEG_TS);
sbuf_init(&s->s_tsbuf);
pthread_mutex_lock(&s->s_stream_mutex);
// TODO: nice name
pthread_mutex_unlock(&s->s_stream_mutex);
+
+ return s;
+}
+
+/*
+ * Find service
+ */
+mpegts_service_t *
+mpegts_service_find
+ ( mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid,
+ const char *uuid, int *save )
+{
+ mpegts_service_t *s;
+
+ /* Validate */
+ lock_assert(&global_lock);
+
+ /* Find existing service */
+ LIST_FOREACH(s, &mm->mm_services, s_dvb_mux_link)
+ if (s->s_dvb_service_id == sid) {
+ if (pmt_pid && pmt_pid != s->s_pmt_pid) {
+ s->s_pmt_pid = pmt_pid;
+ if (save) *save = 1;
+ }
+ return s;
+ }
+
+ /* Ignore */
+ if (!pmt_pid)
+ return NULL;
+
+ /* Create */
+ s = mm->mm_network->mn_create_service(mm, sid, pmt_pid);
+ if (save) *save = 1;
return s;
}
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "input.h"
#include "tsfile.h"
#include "tsfile_private.h"
+extern const idclass_t mpegts_service_class;
+
static mpegts_network_t *tsfile_network;
LIST_HEAD(,mpegts_input) tsfile_inputs;
+/*
+ * Cannot create muxes
+ */
+static mpegts_mux_t *
+tsfile_network_create_mux
+ ( mpegts_mux_t *src, uint16_t onid, uint16_t tsid, void *aux )
+{
+ return NULL;
+}
+
+/*
+ * Service creation
+ */
+static mpegts_service_t *
+tsfile_network_create_service
+ ( mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid )
+{
+ mpegts_service_t *s = mpegts_service_create0(sizeof(mpegts_service_t),
+ &mpegts_service_class,
+ NULL, mm, sid, pmt_pid);
+ return s;
+}
+
/*
* Initialise
*/
/* Shared network */
tsfile_network = mpegts_network_create0(NULL, "tsfile network");
+ tsfile_network->mn_create_mux = tsfile_network_create_mux;
+ tsfile_network->mn_create_service = tsfile_network_create_service;
/* Create inputs */
for (i = 0; i < tuners; i++) {
printf("tsfile_add_file(%s)\n", path);
/* Create logical instance */
- mm = mpegts_mux_create0(NULL, tsfile_network, MM_ONID_NONE, MM_TSID_NONE);
+ mm = tsfile_mux_create0(NULL, tsfile_network, MM_ONID_NONE, MM_TSID_NONE);
/* Create physical instance (for each tuner) */
LIST_FOREACH(mi, &tsfile_inputs, mi_global_link)
#ifndef __TVH_TSFILE_H__
#define __TVH_TSFILE_H__
+#include <stdint.h>
+
+struct mpegts_mux;
+struct mpegts_network;
+
/* Initialise system (with N tuners) */
void tsfile_init ( int tuners );
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "tsfile.h"
#include "tsfile_private.h"
+extern const idclass_t mpegts_mux_class;
+extern const idclass_t mpegts_service_class;
+
tsfile_mux_instance_t *
tsfile_mux_instance_create
( const char *path, mpegts_input_t *mi, mpegts_mux_t *mm )
return mmi;
}
+mpegts_mux_t *
+tsfile_mux_create0
+ ( const char *uuid, mpegts_network_t *mn, uint16_t onid, uint16_t tsid )
+{
+ mpegts_mux_t *mm = mpegts_mux_create0(NULL, mn, onid, tsid);
+ return mm;
+}
+
/******************************************************************************
* Editor Configuration
{
mpegts_mux_instance_t; ///< Parent obj
+ /*
+ * Timing
+ */
+
+
/*
* File input
*/
tsfile_mux_instance_t *tsfile_mux_instance_create
( const char *path, mpegts_input_t *mi, mpegts_mux_t *mm );
+struct mpegts_mux *
+tsfile_mux_create0
+ ( const char *uuid, struct mpegts_network *mn, uint16_t onid, uint16_t tsid );
+
#endif /* __TVH_TSFILE_PRIVATE_H__ */
/******************************************************************************