mpegts: move active mux check to mpegts_mux_instance_start()
This commit is contained in:
parent
ff0e7ef198
commit
f14d7beda9
3 changed files with 20 additions and 33 deletions
|
@ -301,20 +301,6 @@ linuxdvb_frontend_start_mux
|
|||
( mpegts_input_t *mi, mpegts_mux_instance_t *mmi )
|
||||
{
|
||||
linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)mi;
|
||||
mpegts_mux_instance_t *cur = LIST_FIRST(&lfe->mi_mux_active);
|
||||
|
||||
/* Currently active */
|
||||
if (cur != NULL) {
|
||||
|
||||
/* Already tuned */
|
||||
if (mmi == cur)
|
||||
return 0;
|
||||
|
||||
/* Stop current */
|
||||
cur->mmi_mux->mm_stop(cur->mmi_mux, 1);
|
||||
}
|
||||
assert(LIST_FIRST(&lfe->mi_mux_active) == NULL);
|
||||
|
||||
if (lfe->lfe_satconf)
|
||||
return linuxdvb_satconf_start_mux(lfe->lfe_satconf, mmi);
|
||||
return linuxdvb_frontend_tune1((linuxdvb_frontend_t*)mi, mmi, -1);
|
||||
|
|
|
@ -94,34 +94,47 @@ mpegts_mux_instance_start
|
|||
( mpegts_mux_instance_t **mmiptr )
|
||||
{
|
||||
int r;
|
||||
char buf[256], buf2[256];;
|
||||
char buf[256], buf2[256];
|
||||
mpegts_mux_instance_t *mmi = *mmiptr;
|
||||
mpegts_mux_t *mm = mmi->mmi_mux;
|
||||
mpegts_mux_instance_t *cur;
|
||||
mpegts_mux_t * mm = mmi->mmi_mux;
|
||||
mpegts_input_t * mi = mmi->mmi_input;
|
||||
mpegts_mux_nice_name(mm, buf, sizeof(buf));
|
||||
|
||||
/* Already active */
|
||||
if (mm->mm_active) {
|
||||
*mmiptr = mm->mm_active;
|
||||
tvhdebug("mpegts", "%s - already active", buf);
|
||||
mpegts_mux_scan_active(mm, buf, mmi->mmi_input);
|
||||
mpegts_mux_scan_active(mm, buf, (*mmiptr)->mmi_input);
|
||||
return 0;
|
||||
}
|
||||
|
||||
cur = LIST_FIRST(&mi->mi_mux_active);
|
||||
if (cur != NULL) {
|
||||
/* Already tuned */
|
||||
if (mmi == cur)
|
||||
return 0;
|
||||
|
||||
/* Stop current */
|
||||
cur->mmi_mux->mm_stop(cur->mmi_mux, 1);
|
||||
}
|
||||
assert(LIST_FIRST(&mi->mi_mux_active) == NULL);
|
||||
|
||||
/* Start */
|
||||
mmi->mmi_input->mi_display_name(mmi->mmi_input, buf2, sizeof(buf2));
|
||||
mi->mi_display_name(mi, buf2, sizeof(buf2));
|
||||
tvhinfo("mpegts", "%s - tuning on %s", buf, buf2);
|
||||
r = mmi->mmi_input->mi_start_mux(mmi->mmi_input, mmi);
|
||||
r = mi->mi_start_mux(mi, mmi);
|
||||
if (r) return r;
|
||||
|
||||
/* Start */
|
||||
tvhdebug("mpegts", "%s - started", buf);
|
||||
mmi->mmi_input->mi_started_mux(mmi->mmi_input, mmi);
|
||||
mi->mi_started_mux(mi, mmi);
|
||||
|
||||
/* Event handler */
|
||||
mpegts_fire_event(mm, ml_mux_start);
|
||||
|
||||
/* Link */
|
||||
mpegts_mux_scan_active(mm, buf, mmi->mmi_input);
|
||||
mpegts_mux_scan_active(mm, buf, mi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1312,18 +1312,6 @@ static int
|
|||
satip_frontend_tune0
|
||||
( satip_frontend_t *lfe, mpegts_mux_instance_t *mmi )
|
||||
{
|
||||
mpegts_mux_instance_t *cur = LIST_FIRST(&lfe->mi_mux_active);
|
||||
|
||||
if (cur != NULL) {
|
||||
/* Already tuned */
|
||||
if (mmi == cur)
|
||||
return 0;
|
||||
|
||||
/* Stop current */
|
||||
cur->mmi_mux->mm_stop(cur->mmi_mux, 1);
|
||||
}
|
||||
assert(LIST_FIRST(&lfe->mi_mux_active) == NULL);
|
||||
|
||||
if (udp_bind_double(&lfe->sf_rtp, &lfe->sf_rtcp,
|
||||
"satip", "rtp", "rtpc",
|
||||
satip_frontend_bindaddr(lfe), lfe->sf_udp_rtp_port,
|
||||
|
|
Loading…
Add table
Reference in a new issue