iptv pipe: fix url / arg parsing bug, add ${service_name} substitution
This commit is contained in:
parent
7548fc5c3e
commit
c4f30d1e51
3 changed files with 18 additions and 5 deletions
|
@ -94,7 +94,9 @@
|
||||||
directories specified by PATH.
|
directories specified by PATH.
|
||||||
Additional arguments may be separated
|
Additional arguments may be separated
|
||||||
using spaces. A raw MPEG-TS stream is
|
using spaces. A raw MPEG-TS stream is
|
||||||
expected.
|
expected. The string ${service_name}
|
||||||
|
is substituted with the service name
|
||||||
|
field contents.
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
static int
|
static int
|
||||||
iptv_pipe_start ( iptv_mux_t *im, const char *_raw, const url_t *url )
|
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;
|
int i = 1, rd;
|
||||||
|
|
||||||
if (strncmp(_raw, "pipe://", 7))
|
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 != ' ')
|
while (*s && *s != ' ')
|
||||||
s++;
|
s++;
|
||||||
if (f != 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;
|
argv[i++] = f;
|
||||||
s++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
|
|
|
@ -381,7 +381,7 @@ spawn_and_give_stdout(const char *prog, char *argv[], int *rd, int redir_stderr)
|
||||||
prog = bin;
|
prog = bin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!argv) argv = (void *)local_argv;
|
if (!argv) argv = (void *)local_argv;
|
||||||
if (!argv[0]) argv[0] = (char*)prog;
|
if (!argv[0]) argv[0] = (char*)prog;
|
||||||
|
|
||||||
pthread_mutex_lock(&fork_lock);
|
pthread_mutex_lock(&fork_lock);
|
||||||
|
|
Loading…
Add table
Reference in a new issue