Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SAT>IP Client: simplify the PID handling using mpegts_apid fcns
  • Loading branch information
perexg committed Mar 17, 2015
1 parent e1a14df commit ecf91c3
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 260 deletions.
4 changes: 2 additions & 2 deletions src/input/mpegts.h
Expand Up @@ -701,7 +701,7 @@ struct mpegts_input
void (*mi_open_service) (mpegts_input_t*,mpegts_service_t*,int flags, int first);
void (*mi_close_service) (mpegts_input_t*,mpegts_service_t*);
mpegts_pid_t *(*mi_open_pid)(mpegts_input_t*,mpegts_mux_t*,int,int,void*);
void (*mi_close_pid) (mpegts_input_t*,mpegts_mux_t*,int,int,void*);
int (*mi_close_pid) (mpegts_input_t*,mpegts_mux_t*,int,int,void*);
void (*mi_create_mux_instance) (mpegts_input_t*,mpegts_mux_t*);
void (*mi_started_mux) (mpegts_input_t*,mpegts_mux_instance_t*);
void (*mi_stopping_mux) (mpegts_input_t*,mpegts_mux_instance_t*);
Expand Down Expand Up @@ -901,7 +901,7 @@ void mpegts_input_flush_mux ( mpegts_input_t *mi, mpegts_mux_t *mm );
mpegts_pid_t * mpegts_input_open_pid
( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner );

void mpegts_input_close_pid
int mpegts_input_close_pid
( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner );

void mpegts_input_close_pids
Expand Down
10 changes: 6 additions & 4 deletions src/input/mpegts/mpegts_input.c
Expand Up @@ -469,7 +469,7 @@ mpegts_input_open_pid
return mp;
}

void
int
mpegts_input_close_pid
( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner )
{
Expand All @@ -480,12 +480,12 @@ mpegts_input_close_pid
assert(owner != NULL);
lock_assert(&mi->mi_output_lock);
if (!(mp = mpegts_mux_find_pid(mm, pid, 0)))
return;
return -1;
if (pid == MPEGTS_FULLMUX_PID || pid == MPEGTS_TABLES_PID) {
mpegts_mux_nice_name(mm, buf, sizeof(buf));
LIST_FOREACH(mps, &mm->mm_all_subs, mps_svcraw_link)
if (mps->mps_owner == owner) break;
if (mps == NULL) return;
if (mps == NULL) return -1;
tvhdebug("mpegts", "%s - close PID %s subscription [%04x/%p]",
buf, pid == MPEGTS_TABLES_PID ? "tables" : "fullmux",
type, owner);
Expand All @@ -496,7 +496,7 @@ mpegts_input_close_pid
mask = pid == MPEGTS_FULLMUX_PID ? MPS_ALL : MPS_TABLES;
LIST_FOREACH(mps, &mm->mm_all_subs, mps_svcraw_link)
if (mps->mps_type & mask) break;
if (mps) return;
if (mps) return 0;
} else {
skel.mps_type = type;
skel.mps_owner = owner;
Expand All @@ -520,12 +520,14 @@ mpegts_input_close_pid
if (mp->mp_fd != -1)
linuxdvb_filter_close(mp->mp_fd);
free(mp);
return 1;
} else {
type = 0;
RB_FOREACH(mps, &mp->mp_subs, mps_link)
type |= mps->mps_type;
mp->mp_type = type;
}
return 0;
}

void
Expand Down

0 comments on commit ecf91c3

Please sign in to comment.