From fdb9fd64d5d3a93673fb38e3d317e78f240d647c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 23 Jun 2014 15:59:21 +0200 Subject: [PATCH] elementary stream: add es_pid_opened to watch the opened PIDs --- src/input/mpegts/mpegts_input.c | 10 +++++++--- src/service.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/input/mpegts/mpegts_input.c b/src/input/mpegts/mpegts_input.c index 7bac4e15..3ef01afa 100644 --- a/src/input/mpegts/mpegts_input.c +++ b/src/input/mpegts/mpegts_input.c @@ -318,8 +318,10 @@ mpegts_input_open_service ( mpegts_input_t *mi, mpegts_service_t *s, int init ) mi->mi_open_pid(mi, s->s_dvb_mux, s->s_pcr_pid, MPS_STREAM, s); /* Open only filtered components here */ TAILQ_FOREACH(st, &s->s_filt_components, es_filt_link) { - if (st->es_type != SCT_CA) + if (st->es_type != SCT_CA) { + st->es_pid_opened = 1; mi->mi_open_pid(mi, s->s_dvb_mux, st->es_pid, MPS_STREAM, s); + } } pthread_mutex_unlock(&s->s_stream_mutex); @@ -353,10 +355,12 @@ mpegts_input_close_service ( mpegts_input_t *mi, mpegts_service_t *s ) pthread_mutex_lock(&s->s_stream_mutex); mi->mi_close_pid(mi, s->s_dvb_mux, s->s_pmt_pid, MPS_STREAM, s); mi->mi_close_pid(mi, s->s_dvb_mux, s->s_pcr_pid, MPS_STREAM, s); - /* Close all PIDs (the component filter may be changed at runtime) */ + /* Close all opened PIDs (the component filter may be changed at runtime) */ TAILQ_FOREACH(st, &s->s_components, es_link) { - if (st->es_type != SCT_CA) + if (st->es_pid_opened) { + st->es_pid_opened = 0; mi->mi_close_pid(mi, s->s_dvb_mux, st->es_pid, MPS_STREAM, s); + } } diff --git a/src/service.h b/src/service.h index 5e9e446e..68b1797a 100644 --- a/src/service.h +++ b/src/service.h @@ -55,6 +55,7 @@ typedef struct elementary_stream { uint16_t es_parent_pid; /* For subtitle streams originating from a teletext stream. this is the pid of the teletext stream */ + int8_t es_pid_opened; /* PID is opened */ int8_t es_cc; /* Last CC */