char *desc; ///< Event description
uint8_t cat; ///< Event category
uint16_t serieslink; ///< Series link ID
+ int cid; ///< Channel ID
} opentv_event_t;
/* Queued (unresolved) event entry */
free(ev->desc);
}
-/* Compare event id codes */
+/* Compare event id and channel id codes */
static int _entry_cmp ( void *a, void *b )
{
- return (int)(((opentv_entry_t*)a)->event.eid) -
- (int)(((opentv_entry_t*)b)->event.eid);
+ int eid_cmp, cid_cmp;
+
+ eid_cmp = (int)(((opentv_entry_t*)a)->event.eid) -
+ (int)(((opentv_entry_t*)b)->event.eid);
+
+ cid_cmp = ((opentv_entry_t*)a)->event.cid -
+ ((opentv_entry_t*)b)->event.cid;
+
+ return eid_cmp != 0 ? eid_cmp : cid_cmp;
}
/* Find event entry */
-static opentv_entry_t *opentv_find_entry(opentv_status_t *sta, uint16_t eid)
+static opentv_entry_t *opentv_find_entry(opentv_status_t *sta, uint16_t eid, int cid)
{
opentv_entry_t *oe, _tmp;
if (sta == NULL) return NULL;
_tmp.event.eid = eid;
+ _tmp.event.cid = cid;
oe = RB_FIND(&sta->os_entries, &_tmp, link, _entry_cmp);
return oe;
}
}
ev->eid = ((uint16_t)buf[0] << 8) | buf[1];
+ ev->cid = cid;
/* Process records */
while (i < slen+4) {
if (ebc) {
save |= opentv_do_event(mod, ebc, &ev, ch, lang, &changes);
if (!merge) {
- entry = opentv_find_entry(mod->sta, ev.eid);
+ entry = opentv_find_entry(mod->sta, ev.eid, cid);
if (entry) {
save |= opentv_do_event(mod, ebc, &entry->event, ch, lang, &changes);
opentv_remove_entry(mod->sta, entry);