mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 19:20:35 +00:00
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.
This commit is contained in:
parent
f68bac6318
commit
6ed6b58929
2 changed files with 8 additions and 8 deletions
|
@ -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,8 +448,7 @@ play_next (GstPlay * play)
|
|||
if (play->repeat) {
|
||||
g_print ("Looping playlist \n");
|
||||
play->cur_idx = -1;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue