Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts: consolidate dvb network list
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
  • Loading branch information
swegener authored and perexg committed Nov 9, 2015
1 parent 0e8a933 commit 44746cf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 37 deletions.
14 changes: 1 addition & 13 deletions src/input/mpegts/linuxdvb/linuxdvb_frontend.c
Expand Up @@ -529,23 +529,11 @@ static idnode_set_t *
linuxdvb_frontend_network_list ( mpegts_input_t *mi )
{
linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)mi;
const idclass_t *idc;

tvhtrace("linuxdvb", "%s: network list for %s",
mi->mi_name ?: "", dvb_type2str(lfe->lfe_type));

if (lfe->lfe_type == DVB_TYPE_T)
idc = &dvb_network_dvbt_class;
else if (lfe->lfe_type == DVB_TYPE_C)
idc = &dvb_network_dvbc_class;
else if (lfe->lfe_type == DVB_TYPE_S)
idc = &dvb_network_dvbs_class;
else if (lfe->lfe_type == DVB_TYPE_ATSC)
idc = &dvb_network_atsc_class;
else
return NULL;

return idnode_find_all(idc, NULL);
return dvb_network_list_by_fe_type(lfe->lfe_type);
}

/* **************************************************************************
Expand Down
2 changes: 2 additions & 0 deletions src/input/mpegts/mpegts_dvb.h
Expand Up @@ -59,6 +59,8 @@ static inline dvb_network_t *dvb_network_find_by_uuid(const char *uuid)
const idclass_t *dvb_network_class_by_fe_type(dvb_fe_type_t type);
dvb_fe_type_t dvb_fe_type_by_network_class(const idclass_t *idc);

idnode_set_t *dvb_network_list_by_fe_type(dvb_fe_type_t type);

dvb_network_t *dvb_network_create0
( const char *uuid, const idclass_t *idc, htsmsg_t *conf );

Expand Down
10 changes: 10 additions & 0 deletions src/input/mpegts/mpegts_network_dvb.c
Expand Up @@ -738,6 +738,16 @@ dvb_fe_type_t dvb_fe_type_by_network_class(const idclass_t *idc)
return DVB_TYPE_NONE;
}

idnode_set_t *dvb_network_list_by_fe_type(dvb_fe_type_t type)
{
const idclass_t *idc = dvb_network_class_by_fe_type(type);

if (!idc)
return NULL;

return idnode_find_all(idc, NULL);
}

int dvb_network_get_orbital_pos(mpegts_network_t *mn)
{
dvb_network_t *ln = (dvb_network_t *)mn;
Expand Down
14 changes: 1 addition & 13 deletions src/input/mpegts/satip/satip_frontend.c
Expand Up @@ -574,20 +574,8 @@ static idnode_set_t *
satip_frontend_network_list ( mpegts_input_t *mi )
{
satip_frontend_t *lfe = (satip_frontend_t*)mi;
const idclass_t *idc;

if (lfe->sf_type == DVB_TYPE_T)
idc = &dvb_network_dvbt_class;
else if (lfe->sf_type == DVB_TYPE_S)
idc = &dvb_network_dvbs_class;
else if (lfe->sf_type == DVB_TYPE_C)
idc = &dvb_network_dvbc_class;
else if (lfe->sf_type == DVB_TYPE_ATSC)
idc = &dvb_network_atsc_class;
else
return NULL;

return idnode_find_all(idc, NULL);
return dvb_network_list_by_fe_type(lfe->sf_type);
}

/* **************************************************************************
Expand Down
12 changes: 1 addition & 11 deletions src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c
Expand Up @@ -507,18 +507,8 @@ static idnode_set_t *
tvhdhomerun_frontend_network_list ( mpegts_input_t *mi )
{
tvhdhomerun_frontend_t *hfe = (tvhdhomerun_frontend_t*)mi;
const idclass_t *idc;

if (hfe->hf_type == DVB_TYPE_T)
idc = &dvb_network_dvbt_class;
else if (hfe->hf_type == DVB_TYPE_C)
idc = &dvb_network_dvbc_class;
else if (hfe->hf_type == DVB_TYPE_ATSC)
idc = &dvb_network_atsc_class;
else
return NULL;

return idnode_find_all(idc, NULL);
return dvb_network_list_by_fe_type(hfe->hf_type);
}

static void
Expand Down

0 comments on commit 44746cf

Please sign in to comment.