htsp: ensure service type is output to allow XBMC to detect Radio services
This commit is contained in:
parent
49212a2ead
commit
ea64db66d8
5 changed files with 39 additions and 8 deletions
|
@ -559,9 +559,7 @@ htsp_build_channel(channel_t *ch, const char *method, htsp_connection_t *htsp)
|
|||
htsmsg_t *svcmsg = htsmsg_create_map();
|
||||
uint16_t caid;
|
||||
htsmsg_add_str(svcmsg, "name", service_nicename(t));
|
||||
#ifdef TODO_FIX_THIS
|
||||
htsmsg_add_str(svcmsg, "type", service_servicetype_txt(t));
|
||||
#endif
|
||||
if((caid = service_get_encryption(t)) != 0) {
|
||||
htsmsg_add_u32(svcmsg, "caid", caid);
|
||||
htsmsg_add_str(svcmsg, "caname", descrambler_caid2name(caid));
|
||||
|
|
|
@ -91,6 +91,11 @@ struct mpegts_table;
|
|||
#define DVB_DESC_AAC 0x7C
|
||||
#define DVB_DESC_LOCAL_CHAN 0x83
|
||||
|
||||
/* Service type lookup */
|
||||
|
||||
int dvb_servicetype_lookup ( int t );
|
||||
|
||||
|
||||
/* String Extraction */
|
||||
|
||||
typedef struct dvb_string_conv
|
||||
|
|
|
@ -55,6 +55,17 @@ static const int dvb_servicetype_map[][2] = {
|
|||
{ 0xD3, ST_SDTV }, /* SKY TV SDTV */
|
||||
};
|
||||
|
||||
int
|
||||
dvb_servicetype_lookup ( int t )
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(dvb_servicetype_map); i++) {
|
||||
if (dvb_servicetype_map[i][0] == t)
|
||||
return dvb_servicetype_map[i][1];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* **************************************************************************
|
||||
* Descriptors
|
||||
* *************************************************************************/
|
||||
|
@ -926,15 +937,13 @@ dvb_sdt_callback
|
|||
|
||||
/* Update service type */
|
||||
if (stype && s->s_dvb_servicetype != stype) {
|
||||
int i;
|
||||
int r;
|
||||
s->s_dvb_servicetype = stype;
|
||||
save = 1;
|
||||
|
||||
/* Set tvh service type */
|
||||
for (i = 0; i < ARRAY_SIZE(dvb_servicetype_map); i++) {
|
||||
if (dvb_servicetype_map[i][0] == stype)
|
||||
s->s_servicetype = dvb_servicetype_map[i][1];
|
||||
}
|
||||
if ((r = dvb_servicetype_lookup(stype)) != -1)
|
||||
s->s_servicetype = r;
|
||||
}
|
||||
|
||||
/* Update scrambled state */
|
||||
|
|
|
@ -369,6 +369,7 @@ mpegts_service_create0
|
|||
( mpegts_service_t *s, const idclass_t *class, const char *uuid,
|
||||
mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid, htsmsg_t *conf )
|
||||
{
|
||||
int r;
|
||||
char buf[256];
|
||||
service_create0((service_t*)s, class, uuid, S_MPEG_TS, conf);
|
||||
|
||||
|
@ -379,6 +380,8 @@ mpegts_service_create0
|
|||
if (pmt_pid) s->s_pmt_pid = pmt_pid;
|
||||
}
|
||||
s->s_dvb_mux = mm;
|
||||
if ((r = dvb_servicetype_lookup(s->s_dvb_servicetype)) != -1)
|
||||
s->s_servicetype = r;
|
||||
LIST_INSERT_HEAD(&mm->mm_services, s, s_dvb_mux_link);
|
||||
|
||||
s->s_delete = mpegts_service_delete;
|
||||
|
|
|
@ -736,11 +736,12 @@ service_is_radio(service_t *t)
|
|||
return 1;
|
||||
else if (t->s_servicetype == ST_NONE) {
|
||||
elementary_stream_t *st;
|
||||
TAILQ_FOREACH(st, &t->s_components, es_link)
|
||||
TAILQ_FOREACH(st, &t->s_components, es_link) {
|
||||
if (SCT_ISVIDEO(st->es_type))
|
||||
return 0;
|
||||
else if (SCT_ISAUDIO(st->es_type))
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -758,6 +759,21 @@ service_is_encrypted(service_t *t)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* String describing service type
|
||||
*/
|
||||
const char *
|
||||
service_servicetype_txt ( service_t *s )
|
||||
{
|
||||
static const char *types[] = {
|
||||
"HDTV", "SDTV", "Radio", "Other"
|
||||
};
|
||||
if (service_is_hdtv(s)) return types[0];
|
||||
if (service_is_sdtv(s)) return types[1];
|
||||
if (service_is_radio(s)) return types[2];
|
||||
return types[3];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue