#include "tcp.h"
#include "settings.h"
#include "htsstr.h"
+#include "channels.h"
#include <sys/socket.h>
#include <sys/types.h>
.name = N_("URL"),
.off = offsetof(iptv_network_t, in_url),
},
+ {
+ .type = PT_S64,
+ .intsplit = CHANNEL_SPLIT,
+ .id = "channel_number",
+ .name = N_("Channel numbers from"),
+ .off = offsetof(iptv_network_t, in_channel_number),
+ },
{
.type = PT_U32,
.id = "refetch_period",
#include "tvheadend.h"
#include "http.h"
#include "iptv_private.h"
+#include "channels.h"
#include <fcntl.h>
#include <sys/stat.h>
iptv_auto_network_process_m3u_item(iptv_network_t *in,
const http_arg_list_t *remove_args,
const char *url, const char *name,
- int *total, int *count)
+ int64_t chnum, int *total, int *count)
{
htsmsg_t *conf;
mpegts_mux_t *mm;
strncmp(url, "https://", 8)))
return;
+ if (chnum) {
+ if (chnum % CHANNEL_SPLIT)
+ chnum += *total;
+ else
+ chnum += (int64_t)*total * CHANNEL_SPLIT;
+ }
+
memset(&u, 0, sizeof(u));
if (urlparse(url, &u))
return;
im->mm_iptv_svcname = name ? strdup(name) : NULL;
change = 1;
}
+ if (im->mm_iptv_chnum != chnum) {
+ im->mm_iptv_chnum = chnum;
+ change = 1;
+ }
if (change)
idnode_notify_changed(&im->mm_id);
(*total)++;
*/
static int
iptv_auto_network_process_m3u(iptv_network_t *in, char *data,
- http_arg_list_t *remove_args)
+ http_arg_list_t *remove_args,
+ int64_t chnum)
{
char *url, *name = NULL;
int total = 0, count = 0;
while (*data && *data != '\n') data++;
if (*data) { *data = '\0'; data++; }
if (*url)
- iptv_auto_network_process_m3u_item(in, remove_args, url, name, &total, &count);
+ iptv_auto_network_process_m3u_item(in, remove_args, url, name,
+ chnum, &total, &count);
}
if (total == 0)
while (*data && *data <= ' ') data++;
if (!strncmp(data, "#EXTM3U", 7))
- r = iptv_auto_network_process_m3u(in, data, &remove_args);
+ r = iptv_auto_network_process_m3u(in, data, &remove_args, in->in_channel_number);
if (r == 0) {
count = 0;
#include "iptv_private.h"
#include "settings.h"
+#include "channels.h"
/*
* Class
.name = N_("Mux Name"),
.off = offsetof(iptv_mux_t, mm_iptv_muxname),
},
+ {
+ .type = PT_S64,
+ .intsplit = CHANNEL_SPLIT,
+ .id = "channel_number",
+ .name = N_("Channel number"),
+ .off = offsetof(iptv_mux_t, mm_iptv_chnum),
+ },
{
.type = PT_STR,
.id = "iptv_sname",
uint32_t in_max_timeout;
char *in_url;
+ int64_t in_channel_number;
uint32_t in_refetch_period;
int in_ssl_peer_verify;
char *in_remove_args;
char *mm_iptv_muxname;
char *mm_iptv_svcname;
+ int64_t mm_iptv_chnum;
int mm_iptv_respawn;
time_t mm_iptv_respawn_last;
return is->s_dvb_svcname;
}
+static int64_t
+iptv_service_channel_number ( service_t *s )
+{
+ iptv_service_t *is = (iptv_service_t *)s;
+ iptv_mux_t *im = (iptv_mux_t *)is->s_dvb_mux;
+ if (im->mm_iptv_chnum)
+ return im->mm_iptv_chnum;
+ return mpegts_service_channel_number(s);
+}
+
/*
* Create
*/
&mpegts_service_class, uuid,
(mpegts_mux_t*)im, sid, pmt, conf);
- is->s_config_save = iptv_service_config_save;
- is->s_delete = iptv_service_delete;
- is->s_channel_name = iptv_service_channel_name;
+ is->s_config_save = iptv_service_config_save;
+ is->s_delete = iptv_service_delete;
+ is->s_channel_name = iptv_service_channel_name;
+ is->s_channel_number = iptv_service_channel_number;
/* Set default service name */
if (!is->s_dvb_svcname || !*is->s_dvb_svcname)
#define dvb_mux_create1(n, u, c)\
dvb_mux_create0(n, MPEGTS_ONID_NONE, MPEGTS_TSID_NONE, NULL, u, c)
+/*
+ *
+ */
+int64_t mpegts_service_channel_number ( service_t *s );
+
#endif /* __TVH_MPEGTS_DVB_H__ */
/*
* Channel number
*/
-static int64_t
+int64_t
mpegts_service_channel_number ( service_t *s )
{
mpegts_service_t *ms = (mpegts_service_t*)s;