Move the linuxdvb service code to the shared mpegts service code

... introduce $CFG/input/dvb/networks/... structure
This commit is contained in:
Jaroslav Kysela 2014-03-27 12:23:18 +01:00
parent c36c733519
commit 8b98f9c4a6
7 changed files with 27 additions and 82 deletions

View file

@ -191,7 +191,6 @@ SRCS-${CONFIG_LINUXDVB} += \
src/input/mpegts/linuxdvb/linuxdvb_frontend.c \
src/input/mpegts/linuxdvb/linuxdvb_network.c \
src/input/mpegts/linuxdvb/linuxdvb_mux.c \
src/input/mpegts/linuxdvb/linuxdvb_service.c \
src/input/mpegts/linuxdvb/linuxdvb_satconf.c \
src/input/mpegts/linuxdvb/linuxdvb_lnb.c \
src/input/mpegts/linuxdvb/linuxdvb_switch.c \

View file

@ -689,8 +689,6 @@ mpegts_service_t *mpegts_service_create0
mpegts_service_t *mpegts_service_find
( mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid, int create, int *save );
void mpegts_service_save ( mpegts_service_t *s, htsmsg_t *c );
void mpegts_service_delete ( service_t *s, int delconf );
/*

View file

@ -664,6 +664,8 @@ linuxdvb_mux_create0
linuxdvb_mux_t *lm;
htsmsg_t *c, *e;
htsmsg_field_t *f;
mpegts_service_t *ts;
int move = 0;
/* Class */
if (ln->ln_type == DVB_TYPE_S)
@ -710,15 +712,27 @@ linuxdvb_mux_create0
if (!conf) return lm;
/* Services */
c = hts_settings_load_r(1, "input/linuxdvb/networks/%s/muxes/%s/services",
c = hts_settings_load_r(1, "input/dvb/networks/%s/muxes/%s/services",
idnode_uuid_as_str(&ln->mn_id),
idnode_uuid_as_str(&mm->mm_id));
if (!c) {
move = 1;
c = hts_settings_load_r(1, "input/linuxdvb/networks/%s/muxes/%s/services",
idnode_uuid_as_str(&ln->mn_id),
idnode_uuid_as_str(&mm->mm_id));
}
if (c) {
HTSMSG_FOREACH(f, c) {
if (!(e = htsmsg_get_map_by_field(f))) continue;
(void)linuxdvb_service_create0(lm, 0, 0, f->hmf_name, e);
ts = mpegts_service_create1(f->hmf_name, (mpegts_mux_t *)lm, 0, 0, e);
if (ts && move)
ts->s_config_save((service_t *)ts);
}
htsmsg_destroy(c);
if (move)
hts_settings_remove("input/linuxdvb/networks/%s/muxes/%s/services",
idnode_uuid_as_str(&ln->mn_id),
idnode_uuid_as_str(&mm->mm_id));
}
return lm;

View file

@ -265,8 +265,7 @@ static mpegts_service_t *
linuxdvb_network_create_service
( mpegts_mux_t *mm, uint16_t sid, uint16_t pmt_pid )
{
return linuxdvb_service_create0((linuxdvb_mux_t*)mm, sid,
pmt_pid, NULL, NULL);
return mpegts_service_create1(NULL, mm, sid, pmt_pid, NULL);
}
static const idclass_t *

View file

@ -284,13 +284,6 @@ linuxdvb_mux_t *linuxdvb_mux_create0
linuxdvb_mux_create0(n, MPEGTS_ONID_NONE, MPEGTS_TSID_NONE,\
NULL, u, c)
/*
* Service
*/
mpegts_service_t *linuxdvb_service_create0
(linuxdvb_mux_t *lm, uint16_t sid, uint16_t pmt_pid,
const char *uuid, htsmsg_t *conf);
/*
* Diseqc gear
*/

View file

@ -1,57 +0,0 @@
/*
* Tvheadend - Linux DVB Service
*
* Copyright (C) 2013 Adam Sutton
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tvheadend.h"
#include "input.h"
#include "linuxdvb_private.h"
#include "queue.h"
#include "settings.h"
#include <sys/types.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdlib.h>
#include <dirent.h>
#include <fcntl.h>
static void
linuxdvb_service_config_save ( service_t *t )
{
htsmsg_t *c = htsmsg_create_map();
mpegts_service_t *s = (mpegts_service_t*)t;
mpegts_service_save(s, c);
hts_settings_save(c, "input/linuxdvb/networks/%s/muxes/%s/services/%s",
idnode_uuid_as_str(&s->s_dvb_mux->mm_network->mn_id),
idnode_uuid_as_str(&s->s_dvb_mux->mm_id),
idnode_uuid_as_str(&s->s_id));
htsmsg_destroy(c);
}
mpegts_service_t *
linuxdvb_service_create0
( linuxdvb_mux_t *mm, uint16_t sid, uint16_t pmt_pid,
const char *uuid, htsmsg_t *conf )
{
extern const idclass_t mpegts_service_class;
mpegts_service_t *s
= mpegts_service_create1(uuid, (mpegts_mux_t*)mm, sid, pmt_pid, conf);
if (s)
s->s_config_save = linuxdvb_service_config_save;
return s;
}

View file

@ -148,8 +148,16 @@ mpegts_service_is_enabled(service_t *t)
* Save
*/
static void
mpegts_service_config_save(service_t *t)
mpegts_service_config_save ( service_t *t )
{
htsmsg_t *c = htsmsg_create_map();
mpegts_service_t *s = (mpegts_service_t*)t;
service_save(t, c);
hts_settings_save(c, "input/dvb/networks/%s/muxes/%s/services/%s",
idnode_uuid_as_str(&s->s_dvb_mux->mm_network->mn_id),
idnode_uuid_as_str(&s->s_dvb_mux->mm_id),
idnode_uuid_as_str(&s->s_id));
htsmsg_destroy(c);
}
/*
@ -348,7 +356,7 @@ mpegts_service_delete ( service_t *t, int delconf )
/* Remove config */
if (delconf)
hts_settings_remove("input/linuxdvb/networks/%s/muxes/%s/services/%s",
hts_settings_remove("input/dvb/networks/%s/muxes/%s/services/%s",
idnode_uuid_as_str(&mm->mm_network->mn_id),
idnode_uuid_as_str(&mm->mm_id),
idnode_uuid_as_str(&t->s_id));
@ -451,15 +459,6 @@ mpegts_service_find
return s;
}
/*
* Save
*/
void
mpegts_service_save ( mpegts_service_t *s, htsmsg_t *c )
{
service_save((service_t*)s, c);
}
/******************************************************************************
* Editor Configuration
*