esfilter: add logical stream index, enhance the CA type filtering

- add the logical stream index - see help
- add the PID filtering for the CA type
- fix the service info dialog (do not show some filtered CAIDs)
This commit is contained in:
Jaroslav Kysela 2014-07-31 11:36:25 +02:00
parent 8ca95e9d79
commit a1811747d2
5 changed files with 59 additions and 9 deletions

View file

@ -67,9 +67,17 @@ The columns have the following functions:
<dt>CA Provider
<dd>The CA provider to compare. Empty field means any.
<dt>Stream Index
<dd>The logical stream index to compare. Note that this index is computed
using all filters. Example: If filter is set to AC3 audio type and
the language to 'eng' and there are two AC3 'eng' streams in
the service, the first stream could be identified using number 1
and the second using number 2.
<dt>PID
<dd>Program identification (PID) number to compare. Zero means any.
This comparison is processed only when service comparison is active.
This comparison is processed only when service comparison is active
and for the Conditional Access filter.
<dt>Action
<dd>The rule action defines the operation when all comparisons succeeds.

View file

@ -93,7 +93,7 @@ api_service_mapper_notify ( void )
}
static htsmsg_t *
api_service_streams_get_one ( elementary_stream_t *es )
api_service_streams_get_one ( elementary_stream_t *es, int use_filter )
{
htsmsg_t *e = htsmsg_create_map();
htsmsg_add_u32(e, "index", es->es_index);
@ -115,6 +115,8 @@ api_service_streams_get_one ( elementary_stream_t *es )
caid_t *ca;
htsmsg_t *e2, *l2 = htsmsg_create_list();
LIST_FOREACH(ca, &es->es_caids, link) {
if (use_filter && !ca->use)
continue;
e2 = htsmsg_create_map();
htsmsg_add_u32(e2, "caid", ca->caid);
htsmsg_add_u32(e2, "provider", ca->providerid);
@ -163,12 +165,12 @@ api_service_streams
htsmsg_add_msg(st, NULL, e);
}
TAILQ_FOREACH(es, &s->s_components, es_link)
htsmsg_add_msg(st, NULL, api_service_streams_get_one(es));
htsmsg_add_msg(st, NULL, api_service_streams_get_one(es, 0));
if (TAILQ_FIRST(&s->s_filt_components) == NULL ||
s->s_status == SERVICE_IDLE)
service_build_filter(s);
TAILQ_FOREACH(es, &s->s_filt_components, es_filt_link)
htsmsg_add_msg(stf, NULL, api_service_streams_get_one(es));
htsmsg_add_msg(stf, NULL, api_service_streams_get_one(es, 1));
*resp = htsmsg_create_map();
htsmsg_add_str(*resp, "name", s->s_nicename);
htsmsg_add_msg(*resp, "streams", st);

View file

@ -642,6 +642,12 @@ const idclass_t esfilter_class_video = {
.set = esfilter_class_service_set,
.list = esfilter_class_service_enum,
},
{
.type = PT_INT,
.id = "sindex",
.name = "Stream Index",
.off = offsetof(esfilter_t, esf_sindex),
},
{
.type = PT_INT,
.id = "pid",
@ -703,6 +709,12 @@ const idclass_t esfilter_class_audio = {
.set = esfilter_class_service_set,
.list = esfilter_class_service_enum,
},
{
.type = PT_INT,
.id = "sindex",
.name = "Stream Index",
.off = offsetof(esfilter_t, esf_sindex),
},
{
.type = PT_INT,
.id = "pid",
@ -764,6 +776,12 @@ const idclass_t esfilter_class_teletext = {
.set = esfilter_class_service_set,
.list = esfilter_class_service_enum,
},
{
.type = PT_INT,
.id = "sindex",
.name = "Stream Index",
.off = offsetof(esfilter_t, esf_sindex),
},
{
.type = PT_INT,
.id = "pid",
@ -825,6 +843,12 @@ const idclass_t esfilter_class_subtit = {
.set = esfilter_class_service_set,
.list = esfilter_class_service_enum,
},
{
.type = PT_INT,
.id = "sindex",
.name = "Stream Index",
.off = offsetof(esfilter_t, esf_sindex),
},
{
.type = PT_INT,
.id = "pid",
@ -894,6 +918,12 @@ const idclass_t esfilter_class_ca = {
.set = esfilter_class_service_set,
.list = esfilter_class_service_enum,
},
{
.type = PT_INT,
.id = "sindex",
.name = "Stream Index",
.off = offsetof(esfilter_t, esf_sindex),
},
{
.type = PT_INT,
.id = "pid",

View file

@ -91,6 +91,7 @@ typedef struct esfilter {
uint32_t esf_type;
char esf_language[4];
char esf_service[UUID_HEX_SIZE];
int esf_sindex;
int esf_pid;
uint16_t esf_caid;
uint32_t esf_caprovider;

View file

@ -346,7 +346,7 @@ service_build_filter(service_t *t)
elementary_stream_t *st, *st2, **sta;
esfilter_t *esf;
caid_t *ca, *ca2;
int i, n, p, o, exclusive;
int i, n, p, o, exclusive, sindex;
uint32_t mask;
/* rebuild the filtered and ordered components */
@ -387,6 +387,7 @@ filter:
TAILQ_FOREACH(esf, &esfilters[i], esf_link) {
if (!esf->esf_enabled)
continue;
sindex = 0;
TAILQ_FOREACH(st, &t->s_components, es_link) {
if ((mask & SCT_MASK(st->es_type)) == 0)
continue;
@ -402,6 +403,8 @@ filter:
continue;
}
if (i == ESF_CLASS_CA) {
if (esf->esf_pid && esf->esf_pid != st->es_pid)
continue;
ca = NULL;
if ((esf->esf_caid != (uint16_t)-1 || esf->esf_caprovider != -1)) {
LIST_FOREACH(ca, &st->es_caids, link) {
@ -414,9 +417,12 @@ filter:
if (ca == NULL)
continue;
}
sindex++;
if (esf->esf_sindex && esf->esf_sindex != sindex)
continue;
if (esf->esf_log)
tvhlog(LOG_INFO, "service", "esfilter: %s %03d %05d %04x %06x \"%s\" %s",
esfilter_class2txt(i), esf->esf_index, st->es_pid,
tvhlog(LOG_INFO, "service", "esfilter: %s %03d %03d %05d %04x %06x \"%s\" %s",
esfilter_class2txt(i), st->es_index, esf->esf_index, st->es_pid,
esf->esf_caid, esf->esf_caprovider, t->s_nicename,
esfilter_action2txt(esf->esf_action));
switch (esf->esf_action) {
@ -464,9 +470,12 @@ ca_ignore:
break;
}
} else {
sindex++;
if (esf->esf_sindex && esf->esf_sindex != sindex)
continue;
if (esf->esf_log)
tvhlog(LOG_INFO, "service", "esfilter: %s %03d %05d %s %s \"%s\" %s",
esfilter_class2txt(i), esf->esf_index,
tvhlog(LOG_INFO, "service", "esfilter: %s %03d %03d %05d %s %s \"%s\" %s",
esfilter_class2txt(i), st->es_index, esf->esf_index,
st->es_pid, streaming_component_type2txt(st->es_type),
lang_code_get(st->es_lang), t->s_nicename,
esfilter_action2txt(esf->esf_action));