diff --git a/docs/html/config_muxes.html b/docs/html/config_muxes.html
index 3c616b23..fb23d2a1 100644
--- a/docs/html/config_muxes.html
+++ b/docs/html/config_muxes.html
@@ -94,7 +94,9 @@
directories specified by PATH.
Additional arguments may be separated
using spaces. A raw MPEG-TS stream is
- expected.
+ expected. The string ${service_name}
+ is substituted with the service name
+ field contents.
diff --git a/src/input/mpegts/iptv/iptv_pipe.c b/src/input/mpegts/iptv/iptv_pipe.c
index 2c676640..5c0484f8 100644
--- a/src/input/mpegts/iptv/iptv_pipe.c
+++ b/src/input/mpegts/iptv/iptv_pipe.c
@@ -33,7 +33,7 @@
static int
iptv_pipe_start ( iptv_mux_t *im, const char *_raw, const url_t *url )
{
- char *argv[32], *f, *raw, *s;
+ char *argv[32], *f, *raw, *s, *p, *a;
int i = 1, rd;
if (strncmp(_raw, "pipe://", 7))
@@ -55,9 +55,20 @@ iptv_pipe_start ( iptv_mux_t *im, const char *_raw, const url_t *url )
while (*s && *s != ' ')
s++;
if (f != s) {
- *(char *)s = '\0';
+ if (*s) {
+ *(char *)s = '\0';
+ s++;
+ }
+ p = strstr(f, "${service_name}");
+ if (p) {
+ a = alloca(strlen(f) + strlen(im->mm_iptv_svcname ?: ""));
+ *p = '\0';
+ strcpy(a, f);
+ strcat(a, im->mm_iptv_svcname ?: "");
+ strcat(a, p + 15);
+ f = a;
+ }
argv[i++] = f;
- s++;
}
}
argv[i] = NULL;
diff --git a/src/spawn.c b/src/spawn.c
index 419fa459..a770351f 100644
--- a/src/spawn.c
+++ b/src/spawn.c
@@ -381,7 +381,7 @@ spawn_and_give_stdout(const char *prog, char *argv[], int *rd, int redir_stderr)
prog = bin;
}
- if(!argv) argv = (void *)local_argv;
+ if (!argv) argv = (void *)local_argv;
if (!argv[0]) argv[0] = (char*)prog;
pthread_mutex_lock(&fork_lock);