elementary_stream_init(elementary_stream_t *es)
{
es->es_cc = -1;
-
- if (es->es_type == SCT_HBBTV && es->es_psi.mt_name == NULL)
- dvb_table_parse_init(&es->es_psi, "hbbtv", LS_TS, es->es_pid,
- DVB_HBBTV_BASE, DVB_HBBTV_MASK, es);
}
/**
elementary_stream_clean(elementary_stream_t *es)
{
tvhlog_limit_reset(&es->es_cc_log);
-
- if (es->es_psi.mt_name)
- dvb_table_reset(&es->es_psi);
}
/**
elementary_stream_t *es1;
caid_t *c;
- if (es->es_psi.mt_name)
- dvb_table_parse_done(&es->es_psi);
-
if (set->set_last_es == es) {
set->set_last_pid = -1;
set->set_last_es = NULL;
tvhlog_limit_t es_cc_log; /* CC error log limiter */
uint32_t es_filter; /* Filter temporary variable */
-
- mpegts_psi_table_t es_psi; /* HBBTV PSI table (AIT) */
};
/*
#define MPS_TABLES 0x40
#define MPS_NOPOSTDEMUX 0x80
int mps_type;
-#define MPS_WEIGHT_PAT 1000
-#define MPS_WEIGHT_CAT 999
-#define MPS_WEIGHT_SDT 999
-#define MPS_WEIGHT_NIT 999
-#define MPS_WEIGHT_BAT 999
-#define MPS_WEIGHT_VCT 999
-#define MPS_WEIGHT_EIT 999
-#define MPS_WEIGHT_ETT 999
-#define MPS_WEIGHT_MGT 999
-#define MPS_WEIGHT_PMT 998
-#define MPS_WEIGHT_PCR 997
-#define MPS_WEIGHT_CA 996
-#define MPS_WEIGHT_VIDEO 900
-#define MPS_WEIGHT_AUDIO 800
-#define MPS_WEIGHT_SUBTITLE 700
-#define MPS_WEIGHT_ESOTHER 500
-#define MPS_WEIGHT_RAW 400
-#define MPS_WEIGHT_NIT2 300
-#define MPS_WEIGHT_SDT2 300
-#define MPS_WEIGHT_ALLLIMIT 200 /* values under this limit does not switch */
- /* input to the unfiltered PIDs (all) mode */
-#define MPS_WEIGHT_TDT 101
-#define MPS_WEIGHT_STT 101
-#define MPS_WEIGHT_PMT_SCAN 100
+#define MPS_WEIGHT_PAT 1000
+#define MPS_WEIGHT_CAT 999
+#define MPS_WEIGHT_SDT 999
+#define MPS_WEIGHT_NIT 999
+#define MPS_WEIGHT_BAT 999
+#define MPS_WEIGHT_VCT 999
+#define MPS_WEIGHT_EIT 999
+#define MPS_WEIGHT_ETT 999
+#define MPS_WEIGHT_MGT 999
+#define MPS_WEIGHT_PMT 998
+#define MPS_WEIGHT_PCR 997
+#define MPS_WEIGHT_CA 996
+#define MPS_WEIGHT_VIDEO 900
+#define MPS_WEIGHT_AUDIO 800
+#define MPS_WEIGHT_SUBTITLE 700
+#define MPS_WEIGHT_ESOTHER 500
+#define MPS_WEIGHT_RAW 400
+#define MPS_WEIGHT_NIT2 300
+#define MPS_WEIGHT_SDT2 300
+#define MPS_WEIGHT_ALLLIMIT 200 /* values under this limit does not switch */
+ /* input to the unfiltered PIDs (all) mode */
+#define MPS_WEIGHT_TDT 102
+#define MPS_WEIGHT_STT 102
+#define MPS_WEIGHT_PMT_SCAN 101
+#define MPS_WEIGHT_HBBTV_SCAN 100
int mps_weight;
void *mps_owner;
} mpegts_pid_sub_t;
#include "tvheadend.h"
#include "service.h"
+#include "input.h"
#include "dvb_psi_hbbtv.h"
/**
* Extract Hbbtv
*/
htsmsg_t *
-ts_recv_hbbtv(mpegts_psi_table_t *mt, elementary_stream_t *st,
- const uint8_t *buf, int len, int *_sect)
+dvb_psi_parse_hbbtv
+ (mpegts_psi_table_t *mt, const uint8_t *buf, int len, int *_sect)
{
static const char *visibility_table[4] = {
"none",
}
void
-ts_recv_hbbtv_cb(mpegts_psi_table_t *mt, const uint8_t *buf, int len)
+dvb_psi_hbbtv_cb(mpegts_psi_table_t *mt, const uint8_t *buf, int len)
{
elementary_stream_t *st = (elementary_stream_t *)mt->mt_opaque;
service_t *t = st->es_service;
int sect;
- htsmsg_t *apps = ts_recv_hbbtv(mt, st, buf, len, §);
+ htsmsg_t *apps = dvb_psi_parse_hbbtv(mt, buf, len, §);
if (apps == NULL)
return;
if (t->s_hbbtv == NULL)
service_request_save(t);
}
}
+
+int
+dvb_hbbtv_callback(mpegts_table_t *mt, const uint8_t *buf, int len, int tableid)
+{
+ dvb_psi_hbbtv_cb((mpegts_psi_table_t *)mt, buf, len);
+ return 0;
+}
#include "descrambler/caid.h"
#include "descrambler/dvbcam.h"
#include "dvb_psi_pmt.h"
+#include "dvb_psi_hbbtv.h"
/*
* PMT processing
dvb_pmt_callback
(mpegts_table_t *mt, const uint8_t *ptr, int len, int tableid)
{
- int r, sect, last, ver, restart;
+ int r, sect, last, ver, restart, hbbtv = 0;
uint32_t update;
uint16_t sid;
mpegts_mux_t *mm = mt->mt_mux;
mpegts_service_t *s;
+ elementary_stream_t *es;
mpegts_psi_table_state_t *st = NULL;
+ uint16_t hbbtv_pids[16];
/* Start */
if (len < 2) return -1;
if (update) {
if (s->s_status == SERVICE_RUNNING)
elementary_set_filter_build(&s->s_components);
+ TAILQ_FOREACH(es, &s->s_components.set_filter, es_filter_link) {
+ if (hbbtv >= ARRAY_SIZE(hbbtv_pids)) break;
+ hbbtv_pids[hbbtv++] = es->es_pid;
+ }
service_request_save((service_t*)s);
}
/* Only restart if something that our clients worry about did change */
if (update & (PMT_UPDATE_NEW_CA_STREAM|PMT_UPDATE_NEW_CAID|
PMT_UPDATE_CAID_DELETED|PMT_UPDATE_CAID_PID))
descrambler_caid_changed((service_t *)s);
+ for (r = 0; r < hbbtv; r++)
+ mpegts_table_add(mm, DVB_HBBTV_BASE, DVB_HBBTV_MASK,
+ dvb_hbbtv_callback, NULL, "hbbtv", LS_TBL_BASE,
+ MT_CRC | MT_FULL | MT_QUICKREQ | MT_ONESHOT | MT_SCANSUBS,
+ hbbtv_pids[r], MPS_WEIGHT_HBBTV_SCAN);
#if ENABLE_LINUXDVB_CA
dvbcam_pmt_data(s, ptr, len);
if (tsb2[3] & 0xc0) /* scrambled */
continue;
-
- if (st->es_type == SCT_HBBTV) {
- dvb_table_parse(&st->es_psi, "ts", tsb2, 188, 1, 0, ts_recv_hbbtv_cb);
- continue;
- }
}
if (!t->s_scrambled_pass && (st->es_type == SCT_CA || st->es_type == SCT_CAT))
{
parser_es_t *pes = (parser_es_t *)mt->mt_opaque;
parser_t *prs = pes->es_parser;
- htsmsg_t *apps = ts_recv_hbbtv(mt, (elementary_stream_t *)pes, buf, len, NULL);
+ htsmsg_t *apps = dvb_psi_parse_hbbtv(mt, buf, len, NULL);
if (apps) {
void *bin;
{
parser_t *prs = (parser_t *)pad;
elementary_stream_t *es;
+ parser_es_t *pes;
- TAILQ_FOREACH(es, &prs->prs_components.set_all, es_link)
- parser_clean_es((parser_es_t *)es);
+ TAILQ_FOREACH(es, &prs->prs_components.set_all, es_link) {
+ pes = (parser_es_t *)es;
+ parser_clean_es(pes);
+ if (pes->es_psi.mt_name)
+ dvb_table_parse_done(&pes->es_psi);
+ }
elementary_set_clean(&prs->prs_components);
free(prs);
}
struct th_pkt *es_curpkt;
struct streaming_message_queue es_backlog;
tvhlog_limit_t es_pes_log;
+ mpegts_psi_table_t es_psi;
/* Clocks */
int64_t es_curpts;
int64_t es_curdts;