elementary stream: add es_pid_opened to watch the opened PIDs

This commit is contained in:
Jaroslav Kysela 2014-06-23 15:59:21 +02:00
parent f8399f8306
commit fdb9fd64d5
2 changed files with 8 additions and 3 deletions

View file

@ -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);
}
}

View file

@ -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 */