Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
iptv pipe: fix url / arg parsing bug, add ${service_name} substitution
  • Loading branch information
perexg committed Nov 17, 2014
1 parent 7548fc5 commit c4f30d1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 3 additions & 1 deletion docs/html/config_muxes.html
Expand Up @@ -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.

</dl>

Expand Down
17 changes: 14 additions & 3 deletions src/input/mpegts/iptv/iptv_pipe.c
Expand Up @@ -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))
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/spawn.c
Expand Up @@ -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);
Expand Down

0 comments on commit c4f30d1

Please sign in to comment.