Fix problems with OpenTV processing.

This commit is contained in:
Adam Sutton 2012-07-11 15:52:59 +01:00
parent 53eea46c4a
commit ed237c86fd
3 changed files with 17 additions and 11 deletions

View file

@ -1107,14 +1107,19 @@ static epg_broadcast_t *_epg_channel_add_broadcast
// Note: sets updated
_epg_object_getref(ret);
/* No change */
} else if ( ret->stop == (*bcast)->stop ) {
return ret;
/* Extend in time */
/* Existing */
} else {
ret->stop = (*bcast)->stop;
_epg_object_set_updated(ret);
*save |= _epg_object_set_u16(ret, &ret->dvb_eid, (*bcast)->dvb_eid, NULL);
/* No time change */
if ( ret->stop == (*bcast)->stop ) {
return ret;
/* Extend in time */
} else {
ret->stop = (*bcast)->stop;
_epg_object_set_updated(ret);
}
}
}
@ -1198,6 +1203,7 @@ epg_broadcast_t* epg_broadcast_find_by_time
ebc = _epg_broadcast_skel();
(*ebc)->start = start;
(*ebc)->stop = stop;
(*ebc)->dvb_eid = eid;
return _epg_channel_add_broadcast(channel, ebc, create, save);
}
@ -1209,7 +1215,7 @@ epg_broadcast_t *epg_broadcast_find_by_id ( uint64_t id, channel_t *ch )
return (epg_broadcast_t*)_epg_object_find_by_id(id, EPG_BROADCAST);
}
epg_broadcast_t *epg_broadcast_find_by_eid ( channel_t *ch, int eid )
epg_broadcast_t *epg_broadcast_find_by_eid ( channel_t *ch, uint16_t eid )
{
epg_broadcast_t *e;
RB_FOREACH(e, &ch->ch_epg_schedule, sched_link) {

View file

@ -343,7 +343,7 @@ struct epg_broadcast
{
epg_object_t; ///< Parent object
int dvb_eid; ///< DVB Event ID
uint16_t dvb_eid; ///< DVB Event ID
time_t start; ///< Start time
time_t stop; ///< End time
@ -373,7 +373,7 @@ struct epg_broadcast
epg_broadcast_t *epg_broadcast_find_by_time
( struct channel *ch, time_t start, time_t stop,
uint16_t eid, int create, int *save );
epg_broadcast_t *epg_broadcast_find_by_eid ( struct channel *ch, int eid );
epg_broadcast_t *epg_broadcast_find_by_eid ( struct channel *ch, uint16_t eid );
epg_broadcast_t *epg_broadcast_find_by_id ( uint64_t id, struct channel *ch );
/* Mutators */

View file

@ -378,7 +378,7 @@ static int _opentv_parse_event_section
1, &save);
/* Store */
} else {
} else if (!(ebc = epg_broadcast_find_by_eid(ec->channel, ev.eid))) {
opentv_event_t *skel = malloc(sizeof(opentv_event_t));
memcpy(skel, &ev, sizeof(opentv_event_t));
assert(!RB_INSERT_SORTED(&sta->events, skel, ev_link, _ev_cmp));