service: some additional fields as per user request

This commit is contained in:
Adam Sutton 2013-09-26 23:09:38 +01:00
parent 1d6562332e
commit 3fec2653ff
2 changed files with 39 additions and 1 deletions

View file

@ -41,12 +41,32 @@ mpegts_service_class_get_mux ( void *ptr )
return &s;
}
static const void *
mpegts_service_class_get_network ( void *ptr )
{
static char buf[512], *s = buf;
mpegts_service_t *ms = ptr;
mpegts_network_t *mn = ms->s_dvb_mux ? ms->s_dvb_mux->mm_network : NULL;
if (mn && mn->mn_display_name)
mn->mn_display_name(mn, buf, sizeof(buf));
else
*buf = 0;
return &s;
}
const idclass_t mpegts_service_class =
{
.ic_super = &service_class,
.ic_class = "mpegts_service",
.ic_caption = "MPEGTS Service",
.ic_properties = (const property_t[]){
{
.type = PT_STR,
.id = "network",
.name = "Network",
.opts = PO_RDONLY | PO_NOSAVE,
.get = mpegts_service_class_get_network,
},
{
.type = PT_STR,
.id = "multiplex",
@ -93,7 +113,7 @@ const idclass_t mpegts_service_class =
.type = PT_U16,
.id = "dvb_servicetype",
.name = "Service Type",
.opts = PO_RDONLY || PO_HIDDEN,
.opts = PO_RDONLY | PO_HIDDEN,
.off = offsetof(mpegts_service_t, s_dvb_servicetype),
},
{

View file

@ -150,6 +150,17 @@ service_class_get_title ( idnode_t *self )
return ret;
}
static const void *
service_class_encrypted_get ( void *p )
{
static int t;
service_t *s = p;
pthread_mutex_lock(&s->s_stream_mutex);
t = service_is_encrypted(s);
pthread_mutex_unlock(&s->s_stream_mutex);
return &t;
}
const idclass_t service_class = {
.ic_class = "service",
.ic_caption = "Service",
@ -173,6 +184,13 @@ const idclass_t service_class = {
.rend = service_class_channel_rend,
.opts = PO_NOSAVE
},
{
.type = PT_BOOL,
.id = "encrypted",
.name = "Encrypted",
.get = service_class_encrypted_get,
.opts = PO_NOSAVE | PO_RDONLY
},
{}
}
};