Neil,
I didn't feel qualified to reply but as nobody else has - I think the short answer is there has been no change.
I'll just do a dump of my notes here:
I did an experiment myself by hacking a different EIT parser and the "now and next" information definitely updates accurately when the programme starts with UK terrestrial Freeview - this shows how some UK BBC1 programs start a bit early :
---TIME 18:29:11 Channel: 4220 Event: 48928 Start: start="2013-10-03 18:30:00"
---TIME 18:57:54 Channel: 4220 Event: 48453 Start: start="2013-10-03 19:00:00"
This was obtained (as suggested above by Adam) by looking at Section 0 of EIT table 0x4e. The event running_status is set to 4 whenever the programme is running.
I need to study the tvheadend code more to be able to make modifications to add this.
A sketchy braindump of my notes so far are:
eit parser (src/epggrab/module/eit.c) has some kind of reschedule thing in it - what is save2 etc?
/* Find broadcast/
ebc = epg_broadcast_find_by_time(svc->s_ch, start, stop, eid, 1, &save2);
tvhtrace("eit", "eid=%5d, start=%"PRItime_t", stop=%"PRItime_t", ebc=%p",
eid, start, stop, ebc);
if (!ebc) return dllen + 12;
/ Mark re-schedule detect (only now/next)/
if (save2 && tableid < 0x50) resched = 1;
This ultimately calls 'epggrab_resched()' which I don't think does anything.
dvr/dvr_rec.c seems to be the thread that performs dvr recordings and actually writing to the file. It waits for a 'streaming_message' from a 'streaming queue'. This thread calls muxer_write_pkt etc depending on the message received - SMT_START or SMT_MPEGTS etc
The recording thread is created from dvr_rec_subscribe(), which takes a dvr_entry_t. This is called from dvr_timer_start_recording() in dvr_db.c, which in turn is called from dvr_entry_set_timer() which sets a timer via gtimer_arm_abs().
This is set from dvr_entry_link and dvr_entry_update
service_restart() sends the SMT_START service messages. Perhaps store the currently running event_id in the service? This restart message is sent from psi_parse_pmt() which looks for changes in elementary streams etc.
RECORDING STOP:
---------------
When the recording is started a timer is set for the end time.
dvr_thread stops running when an SMT_EXIT message is received. This is created from dvr_rec_unsubscribe via streaming_target_deliver() from dvr_stop_recording() from dvr_timer_stop_recording(). This is called from dvr_timer_start_recording() and sets the timer as the stop time, plus however minutes extra are configured.
DVR_RS_WAIT_PROGRAM_START is a dvr_entry_t->de_rec_state entry
I think that ts_remux() adds SMT_MPEGTS data via streaming_pad_deliver from ts_recv_packet0, from ts_recv_packet1() or ts_recv_packet2 which are called from dvb_adapter_input_dvr() which actually reads data from the /dev/dvrX device and which is created from dvb_adapter_start().
Bit sketchy I know, but just sharing this (quite probably incorrect) brain dump just now in case anyone is interested!
Colin