From 6ed6b5892925c2b1b7aca5068964b8f8607b206e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 12 Aug 2015 16:00:15 +0200 Subject: [PATCH] playback/player: player: Abstract the signal emission dispatching to a new interface This allows to implement signal dispatching to other event loop systems than GLib without having direct GLib support in the base GstPlayer class. A implementation for the GLib main context is provided and used in the applications and tests. --- playback/player/gst-play/gst-play.c | 10 +++++----- playback/player/gtk/gtk-play.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/playback/player/gst-play/gst-play.c b/playback/player/gst-play/gst-play.c index f22e3f23d3..368b814e8a 100644 --- a/playback/player/gst-play/gst-play.c +++ b/playback/player/gst-play/gst-play.c @@ -351,9 +351,10 @@ play_new (gchar ** uris, gdouble initial_volume) play->num_uris = g_strv_length (uris); play->cur_idx = -1; - play->player = gst_player_new (); + play->player = + gst_player_new_full (gst_player_g_main_context_signal_dispatcher_new + (NULL)); - g_object_set (play->player, "dispatch-to-main-context", TRUE, NULL); g_signal_connect (play->player, "position-updated", G_CALLBACK (position_updated_cb), play); g_signal_connect (play->player, "state-changed", @@ -447,9 +448,8 @@ play_next (GstPlay * play) if (play->repeat) { g_print ("Looping playlist \n"); play->cur_idx = -1; - } - else - return FALSE; + } else + return FALSE; } play_uri (play, play->uris[++play->cur_idx]); diff --git a/playback/player/gtk/gtk-play.c b/playback/player/gtk/gtk-play.c index b1ad7ac373..c601f32a81 100644 --- a/playback/player/gtk/gtk-play.c +++ b/playback/player/gtk/gtk-play.c @@ -1730,7 +1730,9 @@ gtk_play_constructor (GType type, guint n_construct_params, (GtkPlay *) G_OBJECT_CLASS (gtk_play_parent_class)->constructor (type, n_construct_params, construct_params); - self->player = gst_player_new (); + self->player = + gst_player_new_full (gst_player_g_main_context_signal_dispatcher_new + (NULL)); self->playing = TRUE; if (self->inhibit_cookie) @@ -1740,8 +1742,6 @@ gtk_play_constructor (GType type, guint n_construct_params, gtk_application_inhibit (GTK_APPLICATION (g_application_get_default ()), GTK_WINDOW (self), GTK_APPLICATION_INHIBIT_IDLE, "Playing media"); - g_object_set (self->player, "dispatch-to-main-context", TRUE, NULL); - create_ui (self); g_signal_connect (self->player, "position-updated",