From 78668f0a3cc368f342a48a3bbc1c2fa6094c3cb8 Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Sat, 7 Sep 2013 11:36:49 +0100 Subject: [PATCH] input: forgot to commit generic input processing. --- src/input.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/input.c diff --git a/src/input.c b/src/input.c new file mode 100644 index 00000000..9a37fa47 --- /dev/null +++ b/src/input.c @@ -0,0 +1,51 @@ +/* + * TVheadend + * 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 . + */ + +#include "input.h" + +tvh_input_list_t tvh_inputs; + +htsmsg_t * +tvh_input_stream_create_msg + ( tvh_input_stream_t *st ) +{ + htsmsg_t *m = htsmsg_create_map(); + htsmsg_add_str(m, "uuid", st->uuid); + if (st->input_name) + htsmsg_add_str(m, "input", st->input_name); + if (st->stream_name) + htsmsg_add_str(m, "stream", st->stream_name); + htsmsg_add_u32(m, "subs", st->subs_count); + htsmsg_add_u32(m, "weight", st->max_weight); + htsmsg_add_u32(m, "signal", st->stats.signal); + htsmsg_add_u32(m, "ber", st->stats.signal); + htsmsg_add_u32(m, "unc", st->stats.ber); + htsmsg_add_u32(m, "snr", st->stats.snr); + htsmsg_add_u32(m, "unc", st->stats.unc); + htsmsg_add_u32(m, "bps", st->stats.bps); + return m; +} + +void +tvh_input_stream_destroy + ( tvh_input_stream_t *st ) +{ + free(st->uuid); + free(st->input_name); + free(st->stream_name); +}