Clear some more redundant code from the channel structure.

This commit is contained in:
Adam Sutton 2012-05-18 17:32:17 +01:00
parent 28c3bd8ffb
commit 1e21969095
5 changed files with 26 additions and 17 deletions

View file

@ -175,8 +175,12 @@ channel_create(const char *name, int number)
}
ch = calloc(1, sizeof(channel_t));
#if TODO_EPG_CHANNEL
RB_INIT(&ch->ch_epg_events);
//LIST_INSERT_HEAD(&channels_not_xmltv_mapped, ch, ch_xc_link);
#endif
#if TODO_XMLTV
LIST_INSERT_HEAD(&channels_not_xmltv_mapped, ch, ch_xc_link);
#endif
channel_set_name(ch, name);
ch->ch_number = number;
@ -186,7 +190,7 @@ channel_create(const char *name, int number)
assert(x == NULL);
#if 0
#if TODO_XMLTV
if((xc = xmltv_channel_find_by_displayname(name)) != NULL) {
channel_set_xmltv_source(ch, xc);
if(xc->xc_icon != NULL)
@ -258,11 +262,13 @@ channel_load_one(htsmsg_t *c, int id)
return;
}
#if TODO_EPG_CHANNEL
RB_INIT(&ch->ch_epg_events);
#endif
channel_set_name(ch, name);
#if 0
#if TODO_XMLTV
if((s = htsmsg_get_str(c, "xmltv-channel")) != NULL &&
(ch->ch_xc = xmltv_channel_find(s, 0)) != NULL) {
LIST_INSERT_HEAD(&ch->ch_xc->xc_channels, ch, ch_xc_link);
@ -326,7 +332,7 @@ channel_save(channel_t *ch)
htsmsg_add_str(m, "name", ch->ch_name);
#if 0
#if TODO_XMLTV
if(ch->ch_xc != NULL)
htsmsg_add_str(m, "xmltv-channel", ch->ch_xc->xc_identifier);
#endif
@ -511,7 +517,7 @@ channel_set_number(channel_t *ch, int number)
/**
*
*/
#if 0
#if TODO_XMLTV
void
channel_set_xmltv_source(channel_t *ch, xmltv_channel_t *xc)
{

View file

@ -44,7 +44,7 @@ typedef struct channel {
LIST_HEAD(, th_subscription) ch_subscriptions;
struct epg_channel *ch_epg_channel;
#if 1 //TODO_REMOVE_THESE
#if TODO_EPG_CHANNEL
struct event_tree ch_epg_events;
struct event *ch_epg_current;
struct event *ch_epg_next;

View file

@ -511,6 +511,7 @@ dvr_autorec_check_event(event_t *e)
static void
dvr_autorec_changed(dvr_autorec_entry_t *dae)
{
#if TODO_DVR
channel_t *ch;
event_t *e;
@ -522,6 +523,7 @@ dvr_autorec_changed(dvr_autorec_entry_t *dae)
dvr_entry_create_by_autorec(e, dae);
}
}
#endif
}

View file

@ -1418,18 +1418,17 @@ htsp_async_send(htsmsg_t *m)
void
htsp_channel_update_current(channel_t *ch)
{
epg_broadcast_t *now, *next;
htsmsg_t *m;
time_t now;
time(&now);
m = htsmsg_create_map();
htsmsg_add_str(m, "method", "channelUpdate");
htsmsg_add_u32(m, "channelId", ch->ch_id);
htsmsg_add_u32(m, "eventId",
ch->ch_epg_current ? ch->ch_epg_current->e_id : 0);
htsmsg_add_u32(m, "nextEventId",
ch->ch_epg_next ? ch->ch_epg_next->e_id : 0);
now = epg_channel_get_current_broadcast(ch->ch_epg_channel);
next = epg_broadcast_get_next(now);
htsmsg_add_u32(m, "eventId", now ? now->eb_id : 0);
htsmsg_add_u32(m, "nextEventId", next ? next->eb_id : 0);
htsp_async_send(m);
}

View file

@ -39,6 +39,7 @@
#include "psi.h"
#include "plumbing/tsfix.h"
#include "plumbing/globalheaders.h"
#include "epg.h"
struct filebundle *filebundles;
@ -179,13 +180,14 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq, th_subscription_t
run = !mk_mux_write_pkt(mkm, sm->sm_data);
sm->sm_data = NULL;
event_t *e = NULL;
if(s->ths_channel)
e = s->ths_channel->ch_epg_current;
epg_broadcast_t *e = NULL;
if(s->ths_channel) e = epg_channel_get_current_broadcast(s->ths_channel->ch_epg_channel);
if(e && event_id != e->e_id) {
event_id = e->e_id;
if(e && event_id != e->eb_id) {
event_id = e->eb_id;
#if TODO_EVENT
run = !mk_mux_append_meta(mkm, e);
#endif
}
break;
}