linuxdvb: mux scanning is now working and I will not re-run unless reqd
This commit is contained in:
parent
7465423cb6
commit
0d82be3664
9 changed files with 50 additions and 22 deletions
|
@ -181,6 +181,7 @@ struct mpegts_network
|
|||
*/
|
||||
uint32_t mn_nid;
|
||||
uint32_t mn_autodiscovery;
|
||||
uint32_t mn_skipinitscan;
|
||||
};
|
||||
|
||||
/* Multiplex */
|
||||
|
@ -194,8 +195,8 @@ struct mpegts_mux
|
|||
|
||||
LIST_ENTRY(mpegts_mux) mm_network_link;
|
||||
mpegts_network_t *mm_network;
|
||||
uint16_t mm_onid;
|
||||
uint16_t mm_tsid;
|
||||
uint32_t mm_onid;
|
||||
uint32_t mm_tsid;
|
||||
|
||||
/*
|
||||
* Services
|
||||
|
@ -214,6 +215,7 @@ struct mpegts_mux
|
|||
MM_SCAN_PENDING, // Waiting to be tuned for initial scan
|
||||
MM_SCAN_CURRENT, // Currently tuned for initial scan
|
||||
} mm_initial_scan_status;
|
||||
int mm_initial_scan_done;
|
||||
|
||||
/*
|
||||
* Physical instances
|
||||
|
@ -438,15 +440,16 @@ int mpegts_network_set_network_name ( mpegts_network_t *mn, const char *name );
|
|||
|
||||
mpegts_mux_t *mpegts_mux_create0
|
||||
( mpegts_mux_t *mm, const idclass_t *class, const char *uuid,
|
||||
mpegts_network_t *mn, uint16_t onid, uint16_t tsid );
|
||||
mpegts_network_t *mn, uint16_t onid, uint16_t tsid,
|
||||
htsmsg_t *conf );
|
||||
|
||||
#define mpegts_mux_create(type, uuid, mn, onid, tsid)\
|
||||
#define mpegts_mux_create(type, uuid, mn, onid, tsid, conf)\
|
||||
(struct type*)mpegts_mux_create0(calloc(1, sizeof(struct type)),\
|
||||
&type##_class, uuid,\
|
||||
mn, onid, tsid)
|
||||
#define mpegts_mux_create1(uuid, mn, onid, tsid)\
|
||||
mn, onid, tsid, conf)
|
||||
#define mpegts_mux_create1(uuid, mn, onid, tsid, conf)\
|
||||
mpegts_mux_create0(calloc(1, sizeof(mpegts_mux_t)), &mpegts_mux_class, uuid,\
|
||||
mn, onid, tsid)
|
||||
mn, onid, tsid, conf)
|
||||
|
||||
void mpegts_mux_initial_scan_done ( mpegts_mux_t *mm );
|
||||
|
||||
|
|
|
@ -177,6 +177,7 @@ dvb_desc_cable_del
|
|||
}
|
||||
|
||||
memset(&dmc, 0, sizeof(dmc));
|
||||
dmc.dmc_fe_delsys = SYS_DVBC_ANNEX_B;
|
||||
dmc.dmc_fe_params.inversion = INVERSION_AUTO;
|
||||
dmc.dmc_fe_params.frequency = frequency * 100;
|
||||
|
||||
|
@ -245,6 +246,7 @@ dvb_desc_terr_del
|
|||
}
|
||||
|
||||
memset(&dmc, 0, sizeof(dmc));
|
||||
dmc.dmc_fe_delsys = SYS_DVBT;
|
||||
dmc.dmc_fe_params.frequency = frequency * 10;
|
||||
|
||||
dmc.dmc_fe_params.u.ofdm.bandwidth = btab[(ptr[4] >> 5) & 0x7];
|
||||
|
|
|
@ -478,7 +478,6 @@ linuxdvb_frontend_create0
|
|||
|
||||
if (!htsmsg_get_u32(conf, "enabled", &u32) && u32)
|
||||
lfe->mi_enabled = u32;
|
||||
printf("LFE ENABLED = %d\n", lfe->mi_enabled);
|
||||
if (!htsmsg_get_u32(conf, "number", &u32))
|
||||
lfe->lfe_number = u32;
|
||||
if ((str = htsmsg_get_str(conf, "network"))) {
|
||||
|
|
|
@ -147,7 +147,7 @@ linuxdvb_mux_t *
|
|||
linuxdvb_mux_create0
|
||||
( linuxdvb_network_t *ln,
|
||||
uint16_t onid, uint16_t tsid, const dvb_mux_conf_t *dmc,
|
||||
const char *uuid )
|
||||
const char *uuid, htsmsg_t *conf )
|
||||
{
|
||||
const idclass_t *idc;
|
||||
mpegts_mux_t *mm;
|
||||
|
@ -171,7 +171,7 @@ linuxdvb_mux_create0
|
|||
|
||||
/* Create */
|
||||
if (!(mm = mpegts_mux_create0(calloc(1, sizeof(linuxdvb_mux_t)), idc, uuid,
|
||||
(mpegts_network_t*)ln, onid, tsid)))
|
||||
(mpegts_network_t*)ln, onid, tsid, conf)))
|
||||
return NULL;
|
||||
lm = (linuxdvb_mux_t*)mm;
|
||||
memcpy(&lm->lm_tuning, dmc, sizeof(dvb_mux_conf_t));
|
||||
|
@ -204,7 +204,7 @@ linuxdvb_mux_create1
|
|||
}
|
||||
|
||||
lm = linuxdvb_mux_create0(ln, MPEGTS_ONID_NONE,
|
||||
MPEGTS_TSID_NONE, &dmc, uuid);
|
||||
MPEGTS_TSID_NONE, &dmc, uuid, conf);
|
||||
if (!lm) return NULL;
|
||||
|
||||
/* No config */
|
||||
|
@ -212,7 +212,6 @@ linuxdvb_mux_create1
|
|||
return lm;
|
||||
|
||||
/* Config */
|
||||
idnode_load(&lm->mm_id, conf);
|
||||
memcpy(&lm->lm_tuning, &dmc, sizeof(dmc));
|
||||
|
||||
/* Services */
|
||||
|
@ -226,7 +225,5 @@ linuxdvb_mux_create1
|
|||
htsmsg_destroy(c);
|
||||
}
|
||||
|
||||
lm->mm_config_save((mpegts_mux_t*)lm);
|
||||
|
||||
return lm;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ linuxdvb_network_create_mux
|
|||
linuxdvb_network_t *ln = (linuxdvb_network_t*)mm->mm_network;
|
||||
mm = linuxdvb_network_find_mux(ln, dmc);
|
||||
if (!mm) {
|
||||
mm = (mpegts_mux_t*)linuxdvb_mux_create0(ln, onid, tsid, dmc, NULL);
|
||||
mm = (mpegts_mux_t*)linuxdvb_mux_create0(ln, onid, tsid, dmc, NULL, NULL);
|
||||
if (mm)
|
||||
mm->mm_config_save(mm);
|
||||
}
|
||||
|
@ -164,5 +164,4 @@ void linuxdvb_network_init ( void )
|
|||
(void)linuxdvb_network_create0(f->hmf_name, e);
|
||||
}
|
||||
htsmsg_destroy(c);
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ struct linuxdvb_mux
|
|||
|
||||
linuxdvb_mux_t *linuxdvb_mux_create0
|
||||
(linuxdvb_network_t *ln, uint16_t onid, uint16_t tsid,
|
||||
const dvb_mux_conf_t *dmc, const char *uuid);
|
||||
const dvb_mux_conf_t *dmc, const char *uuid, htsmsg_t *conf);
|
||||
linuxdvb_mux_t *linuxdvb_mux_create1
|
||||
(linuxdvb_network_t *ln, const char *uuid, htsmsg_t *conf);
|
||||
|
||||
|
|
|
@ -60,6 +60,8 @@ const idclass_t mpegts_mux_class =
|
|||
PT_INT, mpegts_mux_t, mm_tsid) },
|
||||
{ PROPDEF2("crid_authority", "CRID Authority",
|
||||
PT_STR, mpegts_mux_t, mm_crid_authority, 1) },
|
||||
{ PROPDEF2("init_scan_done", "Initial Scan Complete",
|
||||
PT_BOOL, mpegts_mux_t, mm_initial_scan_done, 1) },
|
||||
{}
|
||||
}
|
||||
};
|
||||
|
@ -85,27 +87,39 @@ mpegts_mux_is_enabled ( mpegts_mux_t *mm )
|
|||
int
|
||||
mpegts_mux_set_onid ( mpegts_mux_t *mm, uint16_t onid )
|
||||
{
|
||||
char buf[256];
|
||||
if (onid == mm->mm_onid)
|
||||
return 0;
|
||||
mm->mm_onid = onid;
|
||||
mm->mm_display_name(mm, buf, sizeof(buf));
|
||||
mm->mm_config_save(mm);
|
||||
tvhtrace("mpegts", "%s onid set to %d", buf, onid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
mpegts_mux_set_tsid ( mpegts_mux_t *mm, uint16_t tsid )
|
||||
{
|
||||
char buf[256];
|
||||
if (tsid == mm->mm_tsid)
|
||||
return 0;
|
||||
mm->mm_tsid = tsid;
|
||||
mm->mm_display_name(mm, buf, sizeof(buf));
|
||||
mm->mm_config_save(mm);
|
||||
tvhtrace("mpegts", "%s tsid set to %d", buf, tsid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
mpegts_mux_set_crid_authority ( mpegts_mux_t *mm, const char *defauth )
|
||||
{
|
||||
char buf[256];
|
||||
if (defauth && !strcmp(defauth, mm->mm_crid_authority ?: ""))
|
||||
return 0;
|
||||
tvh_str_update(&mm->mm_crid_authority, defauth);
|
||||
mm->mm_display_name(mm, buf, sizeof(buf));
|
||||
mm->mm_config_save(mm);
|
||||
tvhtrace("mpegts", "%s crid authority set to %s", buf, defauth);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -163,7 +177,9 @@ mpegts_mux_initial_scan_done ( mpegts_mux_t *mm )
|
|||
if (!mpegts_mux_has_subscribers(mm))
|
||||
mm->mm_stop(mm);
|
||||
|
||||
// TODO: save
|
||||
/* Save */
|
||||
mm->mm_initial_scan_done = 1;
|
||||
mm->mm_config_save(mm);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -341,10 +357,13 @@ mpegts_mux_load_one ( mpegts_mux_t *mm, htsmsg_t *c )
|
|||
mpegts_mux_t *
|
||||
mpegts_mux_create0
|
||||
( mpegts_mux_t *mm, const idclass_t *class, const char *uuid,
|
||||
mpegts_network_t *mn, uint16_t onid, uint16_t tsid )
|
||||
mpegts_network_t *mn, uint16_t onid, uint16_t tsid, htsmsg_t *conf )
|
||||
{
|
||||
idnode_insert(&mm->mm_id, uuid, class);
|
||||
|
||||
/* Enabled by default */
|
||||
mm->mm_enabled = 1;
|
||||
|
||||
/* Identification */
|
||||
mm->mm_onid = onid;
|
||||
mm->mm_tsid = tsid;
|
||||
|
@ -352,7 +371,6 @@ mpegts_mux_create0
|
|||
/* Add to network */
|
||||
LIST_INSERT_HEAD(&mn->mn_muxes, mm, mm_network_link);
|
||||
mm->mm_network = mn;
|
||||
mpegts_mux_initial_scan_link(mm);
|
||||
|
||||
/* Debug/Config */
|
||||
mm->mm_display_name = mpegts_mux_display_name;
|
||||
|
@ -369,6 +387,14 @@ mpegts_mux_create0
|
|||
mm->mm_close_table = mpegts_mux_close_table;
|
||||
TAILQ_INIT(&mm->mm_table_queue);
|
||||
|
||||
/* Configuration */
|
||||
if (conf)
|
||||
idnode_load(&mm->mm_id, conf);
|
||||
|
||||
/* Initial scan */
|
||||
if (!mm->mm_initial_scan_done || !mn->mn_skipinitscan)
|
||||
mpegts_mux_initial_scan_link(mm);
|
||||
|
||||
return mm;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ const idclass_t mpegts_network_class =
|
|||
PT_INT, mpegts_network_t, mn_nid) },
|
||||
{ PROPDEF1("autodiscovery", "Network Discovery",
|
||||
PT_BOOL, mpegts_network_t, mn_autodiscovery) },
|
||||
{ PROPDEF1("skipinitscan", "Skip Initial Scan",
|
||||
PT_BOOL, mpegts_network_t, mn_skipinitscan) },
|
||||
{}
|
||||
}
|
||||
};
|
||||
|
@ -122,7 +124,7 @@ int
|
|||
mpegts_network_set_network_name
|
||||
( mpegts_network_t *mn, const char *name )
|
||||
{
|
||||
if (!name || !strcmp(name, mn->mn_network_name))
|
||||
if (!name || !strcmp(name, mn->mn_network_name ?: ""))
|
||||
return 0;
|
||||
tvh_str_update(&mn->mn_network_name, name);
|
||||
return 1;
|
||||
|
|
|
@ -40,7 +40,7 @@ mpegts_mux_t *
|
|||
tsfile_mux_create ( mpegts_network_t *mn )
|
||||
{
|
||||
mpegts_mux_t *mm
|
||||
= mpegts_mux_create1(NULL, mn, MPEGTS_ONID_NONE, MPEGTS_TSID_NONE);
|
||||
= mpegts_mux_create1(NULL, mn, MPEGTS_ONID_NONE, MPEGTS_TSID_NONE, NULL);
|
||||
tvhtrace("tsfile", "mm created %p", mm);
|
||||
return mm;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue