linuxdvb: ensure that PID filters are not installed early

I thought this was causing stale data to enter the pipelines, turns
out this was not the case (it was just a NIT entry for a mux that
didn't exist colliding with one that did).

However still a useful mod.
(cherry picked from commit a7c7b76e8f8f10ece3af3132964c8afd19b26391)
This commit is contained in:
Adam Sutton 2013-08-27 21:13:22 +01:00
parent 3a1cbb9f53
commit b8e9a65e99
4 changed files with 25 additions and 22 deletions

View file

@ -530,6 +530,9 @@ int mpegts_mux_set_tsid ( mpegts_mux_t *mm, uint16_t tsid );
int mpegts_mux_set_onid ( mpegts_mux_t *mm, uint16_t onid );
int mpegts_mux_set_crid_authority ( mpegts_mux_t *mm, const char *defauth );
void mpegts_mux_open_table ( mpegts_mux_t *mm, mpegts_table_t *mt );
void mpegts_mux_close_table ( mpegts_mux_t *mm, mpegts_table_t *mt );
size_t mpegts_input_recv_packets
(mpegts_input_t *mi, mpegts_mux_instance_t *mmi, uint8_t *tsb, size_t len,
int64_t *pcr, uint16_t *pcr_pid, const char *name);

View file

@ -289,6 +289,9 @@ linuxdvb_frontend_open_pid
struct dmx_pes_filter_params dmx_param;
int fd = tvh_open(lfe->lfe_dmx_path, O_RDWR, 0);
if (!lfe->lfe_locked || lfe->lfe_fullmux)
return -1;
if (!name) {
lfe->mi_display_name((mpegts_input_t*)lfe, buf, sizeof(buf));
name = buf;
@ -432,12 +435,18 @@ linuxdvb_frontend_default_tables
}
static void
linuxdvb_frontend_open_services ( linuxdvb_frontend_t *lfe )
linuxdvb_frontend_open_all
( linuxdvb_frontend_t *lfe, mpegts_mux_t *mm )
{
mpegts_table_t *mt;
service_t *s;
LIST_FOREACH(s, &lfe->mi_transports, s_active_link) {
linuxdvb_frontend_open_service((mpegts_input_t*)lfe,
(mpegts_service_t*)s, 0);
lfe->mi_open_service((mpegts_input_t*)lfe,
(mpegts_service_t*)s, 0);
}
LIST_FOREACH(mt, &mm->mm_tables, mt_link) {
if (mt->mt_fd == -1)
mt->mt_fd = lfe->lfe_open_pid(lfe, mt->mt_pid, NULL);
}
}
@ -539,7 +548,7 @@ linuxdvb_frontend_monitor ( void *aux )
linuxdvb_frontend_default_tables(lfe, (linuxdvb_mux_t*)mm);
/* Services */
linuxdvb_frontend_open_services(lfe);
linuxdvb_frontend_open_all(lfe, mm);
/* Re-arm (quick) */
} else {

View file

@ -429,34 +429,25 @@ linuxdvb_mux_create_instances ( mpegts_mux_t *mm )
static void
linuxdvb_mux_open_table ( mpegts_mux_t *mm, mpegts_table_t *mt )
{
char buf[256];
linuxdvb_frontend_t *lfe;
if (mt->mt_pid >= 0x2000)
return;
mm->mm_display_name(mm, buf, sizeof(buf));
if (!mm->mm_table_filter[mt->mt_pid])
tvhtrace("mpegts", "%s - opened table %s pid %04X (%d)",
buf, mt->mt_name, mt->mt_pid, mt->mt_pid);
mm->mm_table_filter[mt->mt_pid] = 1;
mpegts_mux_open_table(mm, mt);
/* Open DMX */
if (mm->mm_active) {
lfe = (linuxdvb_frontend_t*)mm->mm_active->mmi_input;
mt->mt_fd = lfe->lfe_open_pid(lfe, mt->mt_pid, NULL);
} else {
mt->mt_fd = -1;
}
}
static void
linuxdvb_mux_close_table ( mpegts_mux_t *mm, mpegts_table_t *mt )
{
char buf[256];
if (mt->mt_pid >= 0x2000)
return;
mm->mm_display_name(mm, buf, sizeof(buf));
tvhtrace("mpegts", "%s - closed table %s pid %04X (%d)",
buf, mt->mt_name, mt->mt_pid, mt->mt_pid);
mm->mm_table_filter[mt->mt_pid] = 0;
close(mt->mt_fd);
mpegts_mux_close_table(mm, mt);
if (mt->mt_fd != -1)
close(mt->mt_fd);
}
static void

View file

@ -470,7 +470,7 @@ mpegts_mux_stop ( mpegts_mux_t *mm, void *src, int force )
mm->mm_active = NULL;
}
static void
void
mpegts_mux_open_table ( mpegts_mux_t *mm, mpegts_table_t *mt )
{
char buf[256];
@ -483,7 +483,7 @@ mpegts_mux_open_table ( mpegts_mux_t *mm, mpegts_table_t *mt )
mm->mm_table_filter[mt->mt_pid] = 1;
}
static void
void
mpegts_mux_close_table ( mpegts_mux_t *mm, mpegts_table_t *mt )
{
char buf[256];