]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
transcode: the recent change for conditional transcoding caused a regression, fixes...
authorJaroslav Kysela <perex@perex.cz>
Wed, 15 Nov 2017 18:14:24 +0000 (19:14 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 15 Nov 2017 18:14:24 +0000 (19:14 +0100)
src/htsmsg.c
src/htsmsg.h
src/transcoding/transcode/stream.c

index a090b52bdb0789bf3a605e1124771d9ee43c333f..735d191a3d58866092c73d7d45a1a5a2293ba83d 100644 (file)
@@ -1303,3 +1303,24 @@ htsmsg_create_key_val(const char *key, const char *val)
   }
   return r;
 }
+
+/*
+ *
+ */
+int
+htsmsg_is_string_in_list(htsmsg_t *list, const char *str)
+{
+  const char *s;
+  htsmsg_field_t *f;
+
+  if (list == NULL || !list->hm_islist)
+    return 0;
+  HTSMSG_FOREACH(f, list) {
+    s = htsmsg_field_get_str(f);
+    if (s == NULL)
+      continue;
+    if (!strcasecmp(s, str))
+      return 1;
+  }
+  return 0;
+}
index f9b180ac36a361fd338d15c28c8e21ac20c0d3a3..265901c909061a971548aba8fb6c41c7248df257 100644 (file)
@@ -437,6 +437,8 @@ htsmsg_t *htsmsg_csv_2_list(const char *str, char delim);
 
 htsmsg_t *htsmsg_create_key_val(const char *key, const char *val);
 
+int htsmsg_is_string_in_list(htsmsg_t *list, const char *str);
+
 /**
  *
  */
index 92039e6b2d896ced33d9e0edb24f4318724a9022..909aef1c874488cf1ebfee9af962d6a8c5779abb 100644 (file)
@@ -29,21 +29,17 @@ tvh_stream_is_copy(TVHCodecProfile *profile, tvh_ssc_t *ssc,
                    const char *src_codecs)
 {
     const char *txtname;
-    char *codecs, *str, *token, *saveptr;
+    htsmsg_t *list;
+    int r;
 
     /* if the source codec is in the list, do the stream copy only */
     if (src_codecs && *src_codecs != '\0' && *src_codecs != '-') {
-        txtname = streaming_component_type2txt(ssc->ssc_type);
-        if (txtname == NULL)
-            goto cont;
-        codecs = tvh_strdupa(src_codecs);
-        if (codecs == NULL)
-            goto cont;
-        for (str = codecs; ; str = NULL) {
-            token = strtok_r(str, " ,|;" , &saveptr);
-            if (token == NULL)
-                break;
-            if (!strcasecmp(token, txtname))
+        list = htsmsg_csv_2_list(src_codecs, ',');
+        if (list) {
+            txtname = streaming_component_type2txt(ssc->ssc_type);
+            r = htsmsg_is_string_in_list(list, txtname);
+            htsmsg_destroy(list);
+            if (r)
                 goto cont;
         }
         return 1;