]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
IPTV: autonet - extract channel number from tvh-chnum m3u attribute, fixes #3281
authorJaroslav Kysela <perex@perex.cz>
Wed, 11 Nov 2015 19:56:08 +0000 (20:56 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Nov 2015 19:56:08 +0000 (20:56 +0100)
src/input/mpegts/iptv/iptv_auto.c
src/prop.c
src/prop.h

index ff86d799224220e09bb6ff5f7692b55095211d6f..a62001d56798f756645dafa97e0b42a9f04e6a46 100644 (file)
@@ -53,6 +53,7 @@ iptv_auto_network_process_m3u_item(iptv_network_t *in,
   htsbuf_queue_t q;
   int delim;
   size_t l;
+  int64_t chnum2;
   const char *url, *name, *logo, *epgid;
   char url2[512], custom[512], name2[128], buf[32], *n, *y;
 
@@ -69,7 +70,11 @@ iptv_auto_network_process_m3u_item(iptv_network_t *in,
        strncmp(url, "rtp://", 6)))
     return;
 
-  if (chnum) {
+  epgid = htsmsg_get_str(item, "tvh-chnum");
+  chnum2 = epgid ? prop_intsplit_from_str(epgid, CHANNEL_SPLIT) : 0;
+  if (chnum2) {
+    chnum += chnum2;
+  } else if (chnum) {
     if (chnum % CHANNEL_SPLIT)
       chnum += *total;
     else
index aceb7500ef5695748e7d88d5889648c8dac4f5ac..60fc309da352fc3a8916c21474f4ce90a9495b92 100644 (file)
@@ -155,12 +155,9 @@ prop_write_values
       }
       case PT_S64: {
         if (p->intsplit) {
-          char *s;
           if (!(new = htsmsg_field_get_str(f)))
             continue;
-          s64 = (int64_t)atol(new) * p->intsplit;
-          if ((s = strchr(new, '.')) != NULL)
-            s64 += (atol(s + 1) % p->intsplit);
+          s64 = prop_intsplit_from_str(new, p->intsplit);
         } else {
           if (htsmsg_field_get_s64(f, &s64))
             continue;
index bd44b94ba750baca9f4c548a97847820aefea75b..3c9ba7a5f81dc4cf62e32d9296c424932d78bcf9 100644 (file)
@@ -119,6 +119,14 @@ void prop_serialize
   (void *obj, const property_t *pl, htsmsg_t *m, htsmsg_t *list,
    int optmask, const char *lang);
 
+static inline int64_t prop_intsplit_from_str(const char *s, int64_t intsplit)
+{
+  int64_t s64 = (int64_t)atol(s) * intsplit;
+  if ((s = strchr(s, '.')) != NULL)
+    s64 += (atol(s + 1) % intsplit);
+  return s64;
+}
+
 #endif /* __TVH_PROP_H__ */
 
 /******************************************************************************