]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix problems with OpenTV processing.
authorAdam Sutton <dev@adamsutton.me.uk>
Wed, 11 Jul 2012 14:52:59 +0000 (15:52 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Mon, 30 Jul 2012 15:03:16 +0000 (16:03 +0100)
src/epg.c
src/epg.h
src/epggrab/module/opentv.c

index ca72334b2b235b2dc56603752c4ce79e65907678..fce65a5347a9e825bf7fc586f124cacb61438e3f 100644 (file)
--- a/src/epg.c
+++ b/src/epg.c
@@ -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) {
index 0735718408580efa84f6dfa9bac552caa1365628..97dcd7a70c5b5db3e896471a29e80bb679cd6a71 100644 (file)
--- a/src/epg.h
+++ b/src/epg.h
@@ -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 */
index ab03bc8fda5f3c5c2b8e5063698fa9475c5bcf98..f07782b1e40453220b17540fee8010f1ec04e7e4 100644 (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));