gst-play: use novel signal-adapter (requires gstplayer lib patch from https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/35)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-examples/-/merge_requests/33>
This commit is contained in:
Stephan Hesse 2020-04-28 23:12:44 +02:00 committed by Philippe Normand
parent f8cbae9d6e
commit d5a183cc2f
2 changed files with 19 additions and 16 deletions

View file

@ -357,24 +357,28 @@ play_new (gchar ** uris, gdouble initial_volume)
play->cur_idx = -1;
play->player =
gst_player_new (NULL, gst_player_g_main_context_signal_dispatcher_new
(NULL));
g_signal_connect (play->player, "position-updated",
G_CALLBACK (position_updated_cb), play);
g_signal_connect (play->player, "state-changed",
G_CALLBACK (state_changed_cb), play);
g_signal_connect (play->player, "buffering", G_CALLBACK (buffering_cb), play);
g_signal_connect (play->player, "end-of-stream",
G_CALLBACK (end_of_stream_cb), play);
g_signal_connect (play->player, "error", G_CALLBACK (error_cb), play);
g_signal_connect (play->player, "media-info-updated",
G_CALLBACK (media_info_cb), play);
gst_player_new (NULL);
play->loop = g_main_loop_new (NULL, FALSE);
play->desired_state = GST_STATE_PLAYING;
GstPlayerSignalAdapter *player_sig_adapt
= gst_player_signal_adapter_new(
gst_player_get_message_bus (play->player),
g_main_loop_get_context (play->loop));
g_signal_connect (player_sig_adapt, "position-updated",
G_CALLBACK (position_updated_cb), play);
g_signal_connect (player_sig_adapt, "state-changed",
G_CALLBACK (state_changed_cb), play);
g_signal_connect (player_sig_adapt, "buffering", G_CALLBACK (buffering_cb), play);
g_signal_connect (player_sig_adapt, "end-of-stream",
G_CALLBACK (end_of_stream_cb), play);
g_signal_connect (player_sig_adapt, "error", G_CALLBACK (error_cb), play);
g_signal_connect (player_sig_adapt, "media-info-updated",
G_CALLBACK (media_info_cb), play);
play_set_relative_volume (play, initial_volume - 1.0);
return play;

View file

@ -1743,8 +1743,7 @@ gtk_play_constructor (GType type, guint n_construct_params,
create_ui (self);
self->player =
gst_player_new (self->renderer,
gst_player_g_main_context_signal_dispatcher_new (NULL));
gst_player_new (self->renderer);
g_signal_connect (self->player, "position-updated",
G_CALLBACK (position_updated_cb), self);