g_main_loop_run() freeze the window

doon don-prog at mail.ru
Tue Dec 15 13:47:33 PST 2015


I trying to create Gstreamer video player in C#. So I use Pinvoke for import
Gstreamer C++ functions. All looking nice but if I add in C++
"g_main_loop_run(loop);" my C# application going to freeze, I just can't
click any button or move my window. I think there is some problem due to
gmaincontext, but I don't know exactly what problem and how I can resolve
it. Here is the full .cpp code:
//-------------------------------------------------------------------
GstElement *pipeline;

	void seek_to_pos(double position) {
		gint64 len;
		gst_element_query_duration(pipeline, GST_FORMAT_TIME, &len);
		gst_element_seek_simple(pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
len*position);

	}

	void play_file(char* path_to_file, void* hwnd_ptr_of_window){
		gst_init(NULL, NULL);
		HWND hwnd = (HWND)hwnd_ptr_of_window;
		GMainLoop *loop = g_main_loop_new(NULL, FALSE);

		pipeline = gst_element_factory_make("playbin", "player");
		g_object_set (G_OBJECT (pipeline), "uri", path_to_file, NULL);

		gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(pipeline),
(guintptr)hwnd);

		gst_element_set_state(pipeline, GST_STATE_PLAYING);
		g_main_loop_run(loop);//problem
	}
//-------------------------------------------------------------------
Without "g_main_loop_run(loop);" string all works fine, but of course I need
it for some another things. 
So how I can resolve this problem? 



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/g-main-loop-run-freeze-the-window-tp4674922.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list