daemon-conf: Add conf file parsing

Support to parse configuration files. By default, the default conf file
is parsed ({sysconfdir}/pinos/pinos.conf), but that can be changed with
an environment variable (PINOS_CONFIG_FILE). The file can contain
commands and assignments (no assignment supported this far).

Support for command module-load is added.
This commit is contained in:
Linus Svensson 2016-08-29 18:29:07 +02:00 committed by Wim Taymans
parent d654a1bcd6
commit 7d8e2d53f7
14 changed files with 729 additions and 59 deletions

View file

@ -18,7 +18,6 @@
*/
#include <string.h>
#include <gst/gst.h>
#include <gio/gio.h>
#include <client/pinos.h>
@ -27,42 +26,6 @@
static GMainLoop *loop;
static void
on_socket_notify (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
{
GSocket *socket;
GstElement *pipeline, *src, *filter;
GBytes *format;
GstCaps *caps;
GError *error = NULL;
pipeline = gst_parse_launch ("socketsrc name=src ! pinosdepay ! capsfilter name=filter ! videoconvert ! xvimagesink", &error);
if (error != NULL) {
g_warning ("error creating pipeline: %s", error->message);
g_clear_error (&error);
g_assert (pipeline != NULL);
}
/* configure socket in the socketsrc */
g_object_get (gobject, "socket", &socket, NULL);
g_print ("got socket %p\n", socket);
src = gst_bin_get_by_name (GST_BIN (pipeline), "src");
g_object_set (src, "socket", socket, NULL);
/* configure format as capsfilter */
g_object_get (gobject, "format", &format, NULL);
caps = gst_caps_from_string (g_bytes_get_data (format, NULL));
g_bytes_unref (format);
filter = gst_bin_get_by_name (GST_BIN (pipeline), "filter");
g_object_set (filter, "caps", caps, NULL);
gst_caps_unref (caps);
/* and set to playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
static void
on_stream_notify (GObject *gobject,
GParamSpec *pspec,
@ -113,7 +76,6 @@ on_state_notify (GObject *gobject,
stream = pinos_stream_new (c, "test", NULL);
g_signal_connect (stream, "notify::state", (GCallback) on_stream_notify, stream);
g_signal_connect (stream, "notify::socket", (GCallback) on_socket_notify, stream);
possible = NULL;
pinos_stream_connect (stream,