diff --git a/channels.c b/channels.c index 0384734f..1023fc89 100644 --- a/channels.c +++ b/channels.c @@ -186,6 +186,9 @@ transport_set_channel(th_transport_t *t, th_channel_t *ch) th_stream_t *st; char *chname; const char *n; + + char pid[30]; + char lang[30]; t->tht_channel = ch; LIST_INSERT_SORTED(&ch->ch_transports, t, tht_channel_link, transportcmp); @@ -201,7 +204,19 @@ transport_set_channel(th_transport_t *t, th_channel_t *ch) } else { n = htstvstreamtype2txt(st->st_type); } - syslog(LOG_DEBUG, " Stream [%s] - pid %d", n, st->st_pid); + if(st->st_pid < 8192) { + snprintf(pid, sizeof(pid), " on pid [%d]", st->st_pid); + } else { + pid[0] = 0; + } + + if(st->st_lang[0]) { + snprintf(lang, sizeof(lang), ", language \"%s\"", st->st_lang); + } else { + lang[0] = 0; + } + + syslog(LOG_DEBUG, " Stream \"%s\"%s%s", n, lang, pid); } return 0; diff --git a/dvb_support.h b/dvb_support.h index 2538934d..bef1ca9a 100644 --- a/dvb_support.h +++ b/dvb_support.h @@ -27,6 +27,7 @@ #define DVB_SUPPORT_H #define DVB_DESC_CA 0x09 +#define DVB_DESC_LANGUAGE 0x0a /* Descriptors defined in EN 300 468 */ diff --git a/psi.c b/psi.c index b5488d9c..e05e9b4e 100644 --- a/psi.c +++ b/psi.c @@ -176,6 +176,7 @@ psi_parse_pmt(th_transport_t *t, uint8_t *ptr, int len, int chksvcid) uint16_t sid; tv_streamtype_t hts_stream_type; th_stream_t *st; + char lang[4]; if(len < 9) return -1; @@ -242,6 +243,8 @@ psi_parse_pmt(th_transport_t *t, uint8_t *ptr, int len, int chksvcid) break; } + memset(lang, 0, 4); + while(dllen > 1) { dtag = ptr[0]; dlen = ptr[1]; @@ -251,24 +254,30 @@ psi_parse_pmt(th_transport_t *t, uint8_t *ptr, int len, int chksvcid) break; switch(dtag) { + case DVB_DESC_LANGUAGE: + memcpy(lang, ptr, 3); + break; + case DVB_DESC_TELETEXT: if(estype == 0x06) hts_stream_type = HTSTV_TELETEXT; break; - case DVB_DESC_SUBTITLE: - break; - case DVB_DESC_AC3: if(estype == 0x06 || estype == 0x81) hts_stream_type = HTSTV_AC3; break; + + default: + break; } len -= dlen; ptr += dlen; dllen -= dlen; } - if(hts_stream_type != 0) - transport_add_stream(t, pid, hts_stream_type); + if(hts_stream_type != 0) { + st = transport_add_stream(t, pid, hts_stream_type); + memcpy(st->st_lang, lang, 4); + } } t->tht_pmt_seen = 1; diff --git a/tvhead.h b/tvhead.h index 67aead27..0f4759c1 100644 --- a/tvhead.h +++ b/tvhead.h @@ -320,6 +320,8 @@ typedef struct th_stream { uint16_t st_caid; + char st_lang[4]; /* ISO 639 3-letter language code */ + } th_stream_t;