From d76c1e19f072b3e7a72648e56b3bb5c8d7ce42c4 Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Mon, 17 Jun 2013 12:54:36 +0100 Subject: [PATCH] csa: added back in SCT_CA processing This is a bit of a hack really, since its now the only SI data that's handled as an elementary stream. However I think it has to be that way else it'll get messy. --- src/input/mpegts/dvb_psi.c | 3 --- src/input/mpegts/tsdemux.c | 31 ++++++++----------------------- src/service.c | 1 + src/service.h | 2 ++ src/streaming.c | 1 - src/tvheadend.h | 1 - 6 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/input/mpegts/dvb_psi.c b/src/input/mpegts/dvb_psi.c index bdb6dee8..128756b0 100644 --- a/src/input/mpegts/dvb_psi.c +++ b/src/input/mpegts/dvb_psi.c @@ -1005,9 +1005,6 @@ psi_parse_pmt /* Mark all streams for deletion */ TAILQ_FOREACH(st, &t->s_components, es_link) { - if(st->es_type == SCT_PMT) - continue; - st->es_delete_me = 1; LIST_FOREACH(c, &st->es_caids, link) diff --git a/src/input/mpegts/tsdemux.c b/src/input/mpegts/tsdemux.c index 8818ec4c..7e1f3b5b 100644 --- a/src/input/mpegts/tsdemux.c +++ b/src/input/mpegts/tsdemux.c @@ -47,32 +47,24 @@ static void ts_remux(mpegts_service_t *t, const uint8_t *tsb); /** * Code for dealing with a complete section */ -#if TODO_MOVE_THIS static void -got_section(const uint8_t *data, size_t len, void *opaque) +got_ca_section(const uint8_t *data, size_t len, void *opaque) { th_descrambler_t *td; elementary_stream_t *st = opaque; assert(st->es_service->s_source_type == S_MPEG_TS); mpegts_service_t *t = (mpegts_service_t*)st->es_service; - if(st->es_type == SCT_CA) { - LIST_FOREACH(td, &t->s_descramblers, td_service_link) - td->td_table(td, (service_t*)t, st, data, len); -#if TODO_FIXME - } else if(st->es_got_section != NULL) { - st->es_got_section(t, st, data, len); -#endif - } + LIST_FOREACH(td, &t->s_descramblers, td_service_link) + td->td_table(td, (service_t*)t, st, data, len); } -#endif - /** * Continue processing of transport stream packets */ static void -ts_recv_packet0(mpegts_service_t *t, elementary_stream_t *st, const uint8_t *tsb) +ts_recv_packet0 + (mpegts_service_t *t, elementary_stream_t *st, const uint8_t *tsb) { int off, pusi, cc, error; @@ -108,15 +100,9 @@ ts_recv_packet0(mpegts_service_t *t, elementary_stream_t *st, const uint8_t *tsb switch(st->es_type) { case SCT_CA: - case SCT_PMT: -#if TODO_MOVE_THIS - break; // TODO: we should not receive these if(st->es_section == NULL) - st->es_section = calloc(1, sizeof(struct psi_section)); - - psi_section_reassemble(st->es_section, tsb, st->es_section_docrc, - got_section, st); -#endif + st->es_section = calloc(1, sizeof(mpegts_psi_section_t)); + mpegts_psi_section_reassemble(st->es_section, tsb, 1, got_ca_section, st); break; default: @@ -243,8 +229,7 @@ ts_recv_packet1(mpegts_service_t *t, const uint8_t *tsb, int64_t *pcrp) avgstat_add(&t->s_rate, 188, dispatch_clock); if((tsb[3] & 0xc0) || - (t->s_scrambled_seen && st->es_type != SCT_CA && - st->es_type != SCT_PMT)) { + (t->s_scrambled_seen && st->es_type != SCT_CA)) { /** * Lock for descrambling, but only if packet was not in error diff --git a/src/service.c b/src/service.c index dcbe7701..e06ebf8a 100644 --- a/src/service.c +++ b/src/service.c @@ -150,6 +150,7 @@ service_stream_destroy(service_t *t, elementary_stream_t *es) avgstat_flush(&es->es_cc_errors); TAILQ_REMOVE(&t->s_components, es, es_link); + free(es->es_section); free(es->es_nicename); free(es); } diff --git a/src/service.h b/src/service.h index d16150aa..8cf2c492 100644 --- a/src/service.h +++ b/src/service.h @@ -117,6 +117,8 @@ typedef struct elementary_stream { /* Teletext subtitle */ char es_blank; // Last subtitle was blank + /* SI section processing (horrible hack) */ + void *es_section; } elementary_stream_t; diff --git a/src/streaming.c b/src/streaming.c index 1565b8a0..6f6c1261 100644 --- a/src/streaming.c +++ b/src/streaming.c @@ -505,7 +505,6 @@ static struct strtab streamtypetab[] = { { "TELETEXT", SCT_TELETEXT }, { "DVBSUB", SCT_DVBSUB }, { "CA", SCT_CA }, - { "PMT", SCT_PMT }, { "AAC", SCT_AAC }, { "MPEGTS", SCT_MPEGTS }, { "TEXTSUB", SCT_TEXTSUB }, diff --git a/src/tvheadend.h b/src/tvheadend.h index 831e72e8..730e9cae 100644 --- a/src/tvheadend.h +++ b/src/tvheadend.h @@ -194,7 +194,6 @@ typedef enum { SCT_TELETEXT, SCT_DVBSUB, SCT_CA, - SCT_PMT, SCT_AAC, SCT_MPEGTS, SCT_TEXTSUB,