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)
This commit is contained in:
Wim Taymans 2000-11-02 20:10:08 +00:00
parent e8ea96d23b
commit dbe262dfbb
3 changed files with 17 additions and 11 deletions

View file

@ -65,9 +65,7 @@ void gst_init(int *argc,char **argv[]) {
* Enter the main GStreamer processing loop * Enter the main GStreamer processing loop
*/ */
void gst_main() { void gst_main() {
gdk_threads_enter();
gtk_main(); gtk_main();
gdk_threads_leave();
} }
/** /**

View file

@ -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_PLAY (play));
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay)); g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
gdk_threads_enter ();
update_buttons (mplay, state); update_buttons (mplay, state);
switch (state) { switch (state) {
@ -287,6 +289,7 @@ gst_media_play_state_changed (GstPlay *play,
area_state = GST_STATUS_AREA_STATE_INIT; area_state = GST_STATUS_AREA_STATE_INIT;
} }
gst_status_area_set_state (mplay->status, area_state); gst_status_area_set_state (mplay->status, area_state);
gdk_threads_leave ();
} }
void void
@ -324,9 +327,11 @@ gst_media_play_frame_displayed (GstPlay *play,
current_offset = gst_play_get_media_offset (play); current_offset = gst_play_get_media_offset (play);
if (current_time != mplay->last_time) { if (current_time != mplay->last_time) {
gdk_threads_enter ();
gst_media_play_update_status_area (mplay, current_time, total_time); gst_media_play_update_status_area (mplay, current_time, total_time);
update_slider (mplay, mplay->adjustment, current_offset*100.0/size); update_slider (mplay, mplay->adjustment, current_offset*100.0/size);
mplay->last_time = current_time; mplay->last_time = current_time;
gdk_threads_leave ();
} }
} }
@ -347,7 +352,9 @@ void
on_toggle_play_toggled (GtkToggleButton *togglebutton, on_toggle_play_toggled (GtkToggleButton *togglebutton,
GstMediaPlay *play) GstMediaPlay *play)
{ {
gdk_threads_leave ();
gst_play_play (play->play); gst_play_play (play->play);
gdk_threads_enter ();
update_buttons (play, GST_PLAY_STATE(play->play)); update_buttons (play, GST_PLAY_STATE(play->play));
} }
@ -355,7 +362,9 @@ void
on_toggle_pause_toggled (GtkToggleButton *togglebutton, on_toggle_pause_toggled (GtkToggleButton *togglebutton,
GstMediaPlay *play) GstMediaPlay *play)
{ {
gdk_threads_leave ();
gst_play_pause (play->play); gst_play_pause (play->play);
gdk_threads_enter ();
update_buttons (play, GST_PLAY_STATE(play->play)); update_buttons (play, GST_PLAY_STATE(play->play));
} }
@ -363,7 +372,9 @@ void
on_toggle_stop_toggled (GtkToggleButton *togglebutton, on_toggle_stop_toggled (GtkToggleButton *togglebutton,
GstMediaPlay *play) GstMediaPlay *play)
{ {
gdk_threads_leave ();
gst_play_stop (play->play); gst_play_stop (play->play);
gdk_threads_enter ();
update_buttons (play, GST_PLAY_STATE(play->play)); update_buttons (play, GST_PLAY_STATE(play->play));
} }

View file

@ -4,30 +4,27 @@
*/ */
#include <config.h> #include <config.h>
//#define DEBUG_ENABLED
#include <gnome.h> #include <gnome.h>
#include <glade/glade.h>
#include "gstmediaplay.h" #include "gstmediaplay.h"
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
GstMediaPlay *play; GstMediaPlay *play;
gst_init(&argc,&argv); gst_init (&argc,&argv);
gnome_init ("gstreamer", VERSION, argc, argv); gnome_init ("gstreamer", VERSION, argc, argv);
play = gst_media_play_new(); play = gst_media_play_new ();
if (argc > 1) { 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; return 0;
} }