aboutsummaryrefslogtreecommitdiffstats
path: root/binding/afm-mediaplayer-binding.c
diff options
context:
space:
mode:
Diffstat (limited to 'binding/afm-mediaplayer-binding.c')
-rw-r--r--binding/afm-mediaplayer-binding.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index e46a7cb..24b66bf 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -711,7 +711,7 @@ static gboolean position_event(CustomData *data)
return TRUE;
}
-static void *gstreamer_loop_thread(void *ptr)
+static void gstreamer_init()
{
GstBus *bus;
json_object *response;
@@ -777,10 +777,6 @@ static void *gstreamer_loop_thread(void *ptr)
populate_playlist(val);
}
json_object_put(response);
-
- g_main_loop_run(g_main_loop_new(NULL, FALSE));
-
- return NULL;
}
static void onevent(const char *event, struct json_object *object)
@@ -843,6 +839,11 @@ static void onevent(const char *event, struct json_object *object)
afb_event_push(playlist_event, jresp);
}
+void *gstreamer_loop_thread(void *ptr)
+{
+ g_main_loop_run(g_main_loop_new(NULL, FALSE));
+}
+
static int init() {
pthread_t thread_id;
json_object *response, *query;
@@ -879,6 +880,8 @@ static int init() {
metadata_event = afb_daemon_make_event("metadata");
playlist_event = afb_daemon_make_event("playlist");
+ gstreamer_init();
+
return pthread_create(&thread_id, NULL, gstreamer_loop_thread, NULL);
}