commit 3b1862cf391a0d0235c38284935a4bbfc08f70b8 (refs/heads/hack/opentv-autosetup) Author: Adam Sutton Date: Sun Nov 3 20:11:17 2013 +0000 opentv: a hack to test auto setup with opentv BAT diff --git a/src/epggrab/module/opentv.c b/src/epggrab/module/opentv.c index cc6584b..125ea2f 100644 --- a/src/epggrab/module/opentv.c +++ b/src/epggrab/module/opentv.c @@ -378,6 +378,7 @@ done: static int opentv_desc_channels ( mpegts_table_t *mt, mpegts_mux_t *mm, + uint16_t bid, const char *bname, const uint8_t dtag, const uint8_t *buf, int len ) { opentv_status_t *sta = mt->mt_opaque; @@ -385,22 +386,33 @@ opentv_desc_channels epggrab_channel_t *ec; epggrab_channel_link_t *ecl; mpegts_service_t *svc; - int sid, cid, cnum; + int16_t region, cnum; + int sid, cid; int save = 0; int i = 2; + region = ((int16_t)buf[0] << 8) | buf[1]; + tvhtrace(mt->mt_name, " region %04X (%d)", region, region); while (i < len) { sid = ((int)buf[i] << 8) | buf[i+1]; cid = ((int)buf[i+3] << 8) | buf[i+4]; - cnum = ((int)buf[i+5] << 8) | buf[i+6]; - tvhtrace(mt->mt_name, " sid %04X cid %04X cnum %d", sid, cid, cnum); + cnum = ((int16_t)buf[i+5] << 8) | buf[i+6]; + tvhtrace(mt->mt_name, " sid %04X cid %04X cnum %d", sid, cid, cnum); /* Find the service */ svc = mpegts_service_find(mm, sid, 0, 0, NULL); - tvhtrace(mt->mt_name, " svc %p [%s]", svc, svc ? svc->s_nicename : NULL); + tvhtrace(mt->mt_name, " svc %p [%s]", svc, svc ? svc->s_nicename : NULL); + // TODO: total hack to get something! + if (svc && cnum != -1 && bid == 4101 && (region == -1 || region == 2)) { + if (svc->s_dvb_channel_num != cnum) { + svc->s_dvb_channel_num = cnum; + svc->s_config_save((service_t*)svc); + } + } + if (svc && LIST_FIRST(&svc->s_channels)) { ec =_opentv_find_epggrab_channel(mod, cid, 1, &save); ecl = LIST_FIRST(&ec->channels); - tvhtrace(mt->mt_name, " ec = %p, ecl = %p", ec, ecl); + tvhtrace(mt->mt_name, " ec = %p, ecl = %p", ec, ecl); if (!ecl) { ecl = calloc(1, sizeof(epggrab_channel_link_t)); LIST_INSERT_HEAD(&ec->channels, ecl, link); diff --git a/src/input/mpegts.h b/src/input/mpegts.h index 0498494..2529783 100644 --- a/src/input/mpegts.h +++ b/src/input/mpegts.h @@ -68,6 +68,7 @@ struct mpegts_table_mux_cb { int tag; int (*cb) ( mpegts_table_t*, mpegts_mux_t *mm, + uint16_t id, const char *name, const uint8_t dtag, const uint8_t *dptr, int dlen ); }; diff --git a/src/input/mpegts/dvb_psi.c b/src/input/mpegts/dvb_psi.c index 31495ed..1597d68 100644 --- a/src/input/mpegts/dvb_psi.c +++ b/src/input/mpegts/dvb_psi.c @@ -813,7 +813,7 @@ dvb_nit_callback i++; } if (mt->mt_mux_cb[i].cb) { - if (mt->mt_mux_cb[i].cb(mt, mux, dtag, dptr, dlen)) + if (mt->mt_mux_cb[i].cb(mt, mux, nbid, name, dtag, dptr, dlen)) return -1; dtag = 0; }