Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts: add # Channels to networks and muxes, fixes #2366
  • Loading branch information
perexg committed Oct 16, 2014
1 parent a4d364b commit b72ad69
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/input/mpegts/mpegts_mux.c
Expand Up @@ -21,6 +21,7 @@
#include "queue.h"
#include "input.h"
#include "subscriptions.h"
#include "channels.h"
#include "access.h"
#include "dvb_charset.h"

Expand Down Expand Up @@ -201,6 +202,22 @@ mpegts_mux_class_get_num_svc ( void *ptr )
return &n;
}

static const void *
mpegts_mux_class_get_num_chn ( void *ptr )
{
static int n;
mpegts_mux_t *mm = ptr;
mpegts_service_t *s;
channel_service_mapping_t *csm;

n = 0;
LIST_FOREACH(s, &mm->mm_services, s_dvb_mux_link)
LIST_FOREACH(csm, &s->s_channels, csm_svc_link)
n++;

return &n;
}

static const void *
mpegts_mux_class_get_network ( void *ptr )
{
Expand Down Expand Up @@ -409,6 +426,13 @@ const idclass_t mpegts_mux_class =
.opts = PO_RDONLY | PO_NOSAVE,
.get = mpegts_mux_class_get_num_svc,
},
{
.type = PT_INT,
.id = "num_chn",
.name = "# Channels",
.opts = PO_RDONLY | PO_NOSAVE,
.get = mpegts_mux_class_get_num_chn,
},
{
.type = PT_BOOL,
.id = "pmt_06_ac3",
Expand Down
26 changes: 26 additions & 0 deletions src/input/mpegts/mpegts_network.c
Expand Up @@ -18,6 +18,7 @@

#include "input.h"
#include "subscriptions.h"
#include "channels.h"
#include "access.h"
#include "dvb_charset.h"

Expand Down Expand Up @@ -77,6 +78,24 @@ mpegts_network_class_get_num_svc ( void *ptr )
return &n;
}

static const void *
mpegts_network_class_get_num_chn ( void *ptr )
{
static int n;
mpegts_mux_t *mm;
mpegts_service_t *s;
mpegts_network_t *mn = ptr;
channel_service_mapping_t *csm;

n = 0;
LIST_FOREACH(mm, &mn->mn_muxes, mm_network_link)
LIST_FOREACH(s, &mm->mm_services, s_dvb_mux_link)
LIST_FOREACH(csm, &s->s_channels, csm_svc_link)
n++;

return &n;
}

static const void *
mpegts_network_class_get_scanq_length ( void *ptr )
{
Expand Down Expand Up @@ -180,6 +199,13 @@ const idclass_t mpegts_network_class =
.opts = PO_RDONLY | PO_NOSAVE,
.get = mpegts_network_class_get_num_svc,
},
{
.type = PT_INT,
.id = "num_chn",
.name = "# Channels",
.opts = PO_RDONLY | PO_NOSAVE,
.get = mpegts_network_class_get_num_chn,
},
{
.type = PT_INT,
.id = "scanq_length",
Expand Down

0 comments on commit b72ad69

Please sign in to comment.