ts_pid_t *tsp;
void *opaque = NULL;
th_subscription_t *s;
- char txt[50];
-
+ char txt[50], txt2[50], *t;
+
LIST_INIT(&pids);
pthread_mutex_lock(&pvr_mutex);
txt[0] = 0;
}
- syslog(LOG_INFO, "pvr: \"%s\" - Recording started%s",
- pvrr->pvrr_printname, txt);
+ ctime_r(&pvrr->pvrr_stop, txt2);
+ t = strchr(txt2, '\n');
+ if(t != NULL)
+ *t = 0;
+
+ syslog(LOG_INFO, "pvr: \"%s\" - Recording started%s, ends at %s",
+ pvrr->pvrr_printname, txt, txt2);
pvrr->pvrr_status = HTSTV_PVR_STATUS_PAUSED_WAIT_FOR_START;
pvr_inform_status_change(pvrr);
config_get_str("pvrdir", "."), chname, out);
while(1) {
- if(stat(fullname, &st) == -1)
+ if(stat(fullname, &st) == -1) {
+ syslog(LOG_DEBUG, "pvr: File \"%s\" -- %s -- Using for recording",
+ fullname, strerror(errno));
break;
-
+ }
+
tally++;
snprintf(fullname, sizeof(fullname), "%s/%s-%s-%d",
config_get_str("pvrdir", "."), chname, out, tally);
+
+ syslog(LOG_DEBUG, "pvr: Testing filename \"%s\"", fullname);
+
}
pvrr->pvrr_filename = strdup(fullname);
tv_streamtype_t type)
{
pwo_ffmpeg_t *pf = pvrr->pvrr_opaque;
+ th_transport_t *th = s->ths_transport;
uint8_t flags, hlen, x;
int64_t dts = AV_NOPTS_VALUE, pts = AV_NOPTS_VALUE;
int r, rlen, i, g, fs;
switch(pvrr->pvrr_status) {
case HTSTV_PVR_STATUS_PAUSED_WAIT_FOR_START:
case HTSTV_PVR_STATUS_PAUSED_COMMERCIAL:
- break;
+ return 0;
case HTSTV_PVR_STATUS_WAIT_KEY_FRAME:
if(st->codec->codec_type == CODEC_TYPE_VIDEO &&
return 0;
}
break;
+
+ case HTSTV_PVR_STATUS_RECORDING:
+ if(th != NULL && th->tht_tt_commercial_advice == COMMERCIAL_YES) {
+ pvrr->pvrr_status = HTSTV_PVR_STATUS_PAUSED_COMMERCIAL;
+ return 0;
+ }
+
default:
break;
}
#include "tvhead.h"
#include "teletext.h"
-#include "client.h"
-static void teletext_rundown(th_transport_t *t, tt_page_t *ttp);
+static void teletext_rundown(th_transport_t *t, th_channel_t *ch,
+ tt_page_t *ttp);
#define bitreverse(b) \
(((b) * 0x0202020202ULL & 0x010884422010ULL) % 1023)
int page, magidx, i;
tt_mag_t *mag;
th_channel_t *ch = t->tht_channel;
- tt_decoder_t *ttd = &ch->thc_tt;
+ tt_decoder_t *ttd = &ch->ch_tt;
tt_page_t *ttp;
mpag = ham_decode(buf[0], buf[1]);
}
if(update_tt_clock(t, (char *)buf + 34)) {
- if(ch->thc_teletext_rundown != 0) {
- ttp = tt_get_page(ttd, ch->thc_teletext_rundown);
- teletext_rundown(t, ttp);
+ if(ch->ch_teletext_rundown != 0) {
+ ttp = tt_get_page(ttd, ch->ch_teletext_rundown);
+ teletext_rundown(t, ch, ttp);
}
}
break;
}
- if(ttp->ttp_page == ch->thc_teletext_rundown)
- teletext_rundown(t, ttp);
+ if(ttp->ttp_page == ch->ch_teletext_rundown)
+ teletext_rundown(t, ch, ttp);
}
}
return l;
}
+/*
+ * Decode the Swedish TV4 teletext rundown page to figure out if we are
+ * currently in a commercial break
+ */
static void
-teletext_rundown(th_transport_t *t, tt_page_t *ttp)
+teletext_rundown(th_transport_t *t, th_channel_t *ch, tt_page_t *ttp)
{
char r[50];
int i;
time_t ti, d, l;
int curlen = -1;
+ th_commercial_advice_t prev;
+
#if 0
printf("%c", 0x0c);
- printf("%-20s %s",
+ printf("%-20s %s\n",
t->tht_tt_rundown_content_length > 400 ? "real stuff" : "commercial",
ctime(&t->tht_tt_clock));
#endif
/* Currently playing show */
curlen = l;
}
- // printf("%02d|%s|\t(%5lds) : %ld, %d\n", i, r, l, d, curlen);
+ // printf("%02d|%s|\t(%5lds) : %ld, %d\n", i, r, l, d, curlen);
}
t->tht_tt_rundown_content_length = curlen;
+
+ prev = t->tht_tt_commercial_advice;
+
+ if(curlen < 0) {
+ t->tht_tt_commercial_advice = COMMERCIAL_UNKNOWN;
+ return;
+ }
+
if(curlen < 400)
t->tht_tt_commercial_advice = COMMERCIAL_YES;
else
t->tht_tt_commercial_advice = COMMERCIAL_NO;
+
+ if(prev != t->tht_tt_commercial_advice) {
+
+ syslog(LOG_DEBUG,
+ "teletext-rundown: \"%s\" on \"%s\": "
+ "%s commercial break (chunk %ds)",
+ ch->ch_name, t->tht_name,
+ t->tht_tt_commercial_advice == COMMERCIAL_YES ? "In" : "Not in",
+ curlen);
+ }
}