From dbe262dfbb8baaff2e18a921e91103340026c141 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 2 Nov 2000 20:10:08 +0000 Subject: [PATCH] Make sure the Gdk thread lock is not held inside the gstreamer pipeline. Original commit message from CVS: Make sure the Gdk thread lock is not held inside the gstreamer pipeline. Fix the videosink to not hold the Gdk lock when emitting a signal. All Gtk GUI apps using GStreamer should now handle the Gdk locks when handling signals from the pipeline (as it should be) --- gst/gst.c | 2 -- gstplay/gstmediaplay.c | 11 +++++++++++ gstplay/main.c | 15 ++++++--------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/gst/gst.c b/gst/gst.c index 53926b1..044a009 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -65,9 +65,7 @@ void gst_init(int *argc,char **argv[]) { * Enter the main GStreamer processing loop */ void gst_main() { - gdk_threads_enter(); gtk_main(); - gdk_threads_leave(); } /** diff --git a/gstplay/gstmediaplay.c b/gstplay/gstmediaplay.c index 510c1ad..2d0c432 100644 --- a/gstplay/gstmediaplay.c +++ b/gstplay/gstmediaplay.c @@ -271,6 +271,8 @@ gst_media_play_state_changed (GstPlay *play, g_return_if_fail (GST_IS_PLAY (play)); g_return_if_fail (GST_IS_MEDIA_PLAY (mplay)); + + gdk_threads_enter (); update_buttons (mplay, state); switch (state) { @@ -287,6 +289,7 @@ gst_media_play_state_changed (GstPlay *play, area_state = GST_STATUS_AREA_STATE_INIT; } gst_status_area_set_state (mplay->status, area_state); + gdk_threads_leave (); } void @@ -324,9 +327,11 @@ gst_media_play_frame_displayed (GstPlay *play, current_offset = gst_play_get_media_offset (play); if (current_time != mplay->last_time) { + gdk_threads_enter (); gst_media_play_update_status_area (mplay, current_time, total_time); update_slider (mplay, mplay->adjustment, current_offset*100.0/size); mplay->last_time = current_time; + gdk_threads_leave (); } } @@ -347,7 +352,9 @@ void on_toggle_play_toggled (GtkToggleButton *togglebutton, GstMediaPlay *play) { + gdk_threads_leave (); gst_play_play (play->play); + gdk_threads_enter (); update_buttons (play, GST_PLAY_STATE(play->play)); } @@ -355,7 +362,9 @@ void on_toggle_pause_toggled (GtkToggleButton *togglebutton, GstMediaPlay *play) { + gdk_threads_leave (); gst_play_pause (play->play); + gdk_threads_enter (); update_buttons (play, GST_PLAY_STATE(play->play)); } @@ -363,7 +372,9 @@ void on_toggle_stop_toggled (GtkToggleButton *togglebutton, GstMediaPlay *play) { + gdk_threads_leave (); gst_play_stop (play->play); + gdk_threads_enter (); update_buttons (play, GST_PLAY_STATE(play->play)); } diff --git a/gstplay/main.c b/gstplay/main.c index 6f9f78d..f7c8f28 100644 --- a/gstplay/main.c +++ b/gstplay/main.c @@ -4,30 +4,27 @@ */ #include - -//#define DEBUG_ENABLED - #include -#include #include "gstmediaplay.h" - int main (int argc, char *argv[]) { GstMediaPlay *play; - gst_init(&argc,&argv); + gst_init (&argc,&argv); gnome_init ("gstreamer", VERSION, argc, argv); - play = gst_media_play_new(); + play = gst_media_play_new (); if (argc > 1) { - gst_media_play_start_uri(play, argv[1]); + gst_media_play_start_uri (play, argv[1]); } - gst_main(); + gdk_threads_enter (); + gst_main (); + gdk_threads_leave (); return 0; } -- 2.7.4