static FILE *logfile;
static const struct timeval restart_delay = {0, 300 * 1000};
-static struct audio_format_info afi[] = {
-
-[AUDIO_FORMAT_MP3] =
- {
- .write_cmd = "para_play",
- },
-[AUDIO_FORMAT_OGG] =
- {
- .write_cmd = "para_play",
- },
-};
+static struct audio_format_info afi[NUM_AUDIO_FORMATS];
static struct audiod_command cmds[] = {
{
/*
* log function. first argument is loglevel.
*/
-void para_log(int ll, char* fmt,...)
+void para_log(int ll, const char* fmt,...)
{
va_list argp;
FILE *outfd;
{
struct slot_info *s = &slot[slot_num];
struct audio_format_info *a;
- struct timeval now;
if (s->format < 0 || !s->receiver_node)
return;
exit(status);
}
-static char *glob_cmd(char *cmd)
+__malloc static char *glob_cmd(char *cmd)
{
char *ret, *replacement;
struct timeval tmp, delay, rss; /* real stream start */
int ret, fds[3] = {1, -1, -1};
struct slot_info *s = &slot[slot_num];
struct audio_format_info *a = &afi[s->format];
- char *glob = glob_cmd(a->write_cmd);
+ char *glob = NULL;
- PARA_INFO_LOG("starting stream writer: %s\n", glob? glob : a->write_cmd);
+ if (a->write_cmd)
+ glob = glob_cmd(a->write_cmd);
+ if (!glob)
+ glob = para_strdup("para_play");
+ PARA_INFO_LOG("starting stream writer: %s\n", glob);
open_filters(slot_num);
-
- ret = para_exec_cmdline_pid(&s->wpid, glob? glob : a->write_cmd, fds);
+ ret = para_exec_cmdline_pid(&s->wpid, glob, fds);
free(glob);
if (ret < 0) {
PARA_ERROR_LOG("exec failed (%d)\n", ret);
if (ret < 0)
goto out;
PARA_INFO_LOG("%s -> default filter: %s\n", audio_formats[i], filters[j].name);
- ret = add_filter(i, "wav");
+ ret = add_filter(i, para_strdup("wav"));
if (ret < 0)
goto out;
PARA_INFO_LOG("%s -> default filter: wav\n", audio_formats[i]);
static int open_stat_pipe(void)
{
int ret, fd[3] = {-1, 1, 0};
- char *argv[] = {BINDIR "/para_client", "stat", NULL};
pid_t pid;
- ret = para_exec(&pid, BINDIR "/para_client", argv, fd);
+ ret = para_exec_cmdline_pid(&pid, BINDIR "/para_client stat", fd);
if (ret >= 0) {
ret = fd[1];
PARA_NOTICE_LOG("stat pipe opened, fd %d\n", ret);