Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
descrambler: prefcapid_lock - add constants to increase source readab…
…ility
  • Loading branch information
perexg committed Feb 21, 2015
1 parent a50f74c commit a2491ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/descrambler/capmt.c
Expand Up @@ -1664,7 +1664,7 @@ capmt_caid_change(th_descrambler_t *td)
lock_assert(&t->s_stream_mutex);

TAILQ_FOREACH(st, &t->s_filt_components, es_filt_link) {
if (t->s_dvb_prefcapid_lock == 2 &&
if (t->s_dvb_prefcapid_lock == PREFCAPID_FORCE &&
t->s_dvb_prefcapid != st->es_pid)
continue;
LIST_FOREACH(c, &st->es_caids, link) {
Expand Down Expand Up @@ -1954,7 +1954,7 @@ capmt_service_start(caclient_t *cac, service_t *s)

TAILQ_FOREACH(st, &t->s_filt_components, es_filt_link) {
caid_t *c;
if (t->s_dvb_prefcapid_lock == 2 &&
if (t->s_dvb_prefcapid_lock == PREFCAPID_FORCE &&
t->s_dvb_prefcapid != st->es_pid)
continue;
LIST_FOREACH(c, &st->es_caids, link) {
Expand Down
8 changes: 4 additions & 4 deletions src/descrambler/cwc.c
Expand Up @@ -769,7 +769,7 @@ handle_ecm_reply(cwc_service_t *ct, ecm_section_t *es, uint8_t *msg,
ct->td_keystate = DS_FORBIDDEN;
ct->ecm_state = ECM_RESET;
/* this pid is not valid, force full scan */
if (t->s_dvb_prefcapid == ct->cs_channel && t->s_dvb_prefcapid_lock == 0)
if (t->s_dvb_prefcapid == ct->cs_channel && t->s_dvb_prefcapid_lock == PREFCAPID_OFF)
t->s_dvb_prefcapid = 0;
}
return;
Expand All @@ -782,7 +782,7 @@ handle_ecm_reply(cwc_service_t *ct, ecm_section_t *es, uint8_t *msg,

if(t->s_dvb_prefcapid == 0 ||
(t->s_dvb_prefcapid != ct->cs_channel &&
t->s_dvb_prefcapid_lock == 0)) {
t->s_dvb_prefcapid_lock == PREFCAPID_OFF)) {
t->s_dvb_prefcapid = ct->cs_channel;
tvhlog(LOG_DEBUG, "cwc", "Saving prefered PID %d for %s",
t->s_dvb_prefcapid, ct->td_nicename);
Expand Down Expand Up @@ -1639,7 +1639,7 @@ cwc_table_input(void *opaque, int pid, const uint8_t *data, int len)

if (ct->ecm_state == ECM_INIT) {
// Validate prefered ECM PID
if(t->s_dvb_prefcapid != 0) {
if(t->s_dvb_prefcapid != PREFCAPID_OFF) {
struct elementary_stream *prefca
= service_stream_find((service_t*)t, t->s_dvb_prefcapid);
if (!prefca || prefca->es_type != SCT_CA) {
Expand Down Expand Up @@ -1995,7 +1995,7 @@ cwc_service_start(caclient_t *cac, service_t *t)
LIST_FOREACH(pcard, &cwc->cwc_cards, cs_card) {
if (pcard->cwc_caid == 0) continue;
TAILQ_FOREACH(st, &t->s_filt_components, es_filt_link) {
if (((mpegts_service_t *)t)->s_dvb_prefcapid_lock == 2 &&
if (((mpegts_service_t *)t)->s_dvb_prefcapid_lock == PREFCAPID_FORCE &&
((mpegts_service_t *)t)->s_dvb_prefcapid != st->es_pid)
continue;
LIST_FOREACH(c, &st->es_caids, link) {
Expand Down
6 changes: 5 additions & 1 deletion src/input/mpegts.h
Expand Up @@ -450,7 +450,11 @@ struct mpegts_mux
TAILQ_HEAD(, tsdebug_packet) mm_tsdebug_packets;
#endif
};


#define PREFCAPID_OFF 0
#define PREFCAPID_ON 1
#define PREFCAPID_FORCE 2

/* Service */
struct mpegts_service
{
Expand Down

0 comments on commit a2491ff

Please sign in to comment.