Hi all, first of all excuse me for my quiet bad english it's not my natural
language. So my problème is that i dev a software where i stream with gstreamer my desktop, and i want to close the pipeline with the function g_main_quit(main_loop), but i dunno where to pace it. To be clear i want to exit of the function and close the pipeline. Here a portion of code : So how can exit the function with g_main_quit() function ? Thanks a lot , bye -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Your code was missing. I'll presume C.
You can put g_main_quit anywhere. But g_main_quit alone won't exit a function or immediately close a GStreamer pipeline. To exit a function, use language elements such as "return;". To close a GStreamer pipeline, g_main_quit will cause the main loop to exit, and what happens next depends on the code after your main loop. A return from main() will cause the GStreamer threads to exit. A more common method is to send an end of stream event, wait for the event to propagate, detect pipeline state change using a message signal handler, then destroy the pipeline and call g_main_quit. On Tue, Sep 11, 2018 at 10:47:42PM -0500, Rom6 wrote: > Hi all, first of all excuse me for my quiet bad english it's not my natural > language. > > So my problème is that i dev a software where i stream with gstreamer my > desktop, and i want to close the pipeline with the function > g_main_quit(main_loop), but i dunno where to pace it. > To be clear i want to exit of the function and close the pipeline. > > Here a portion of code : > > > > So how can exit the function with g_main_quit() function ? > > Thanks a lot , bye > > > > -- > Sent from: http://gstreamer-devel.966125.n4.nabble.com/ > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel -- James Cameron http://quozl.netrek.org/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi , well sry my last message was incomplet.
So i want to exit the function and close the pipeline for go back to another function (its a server applications) wish is on listening state, in order to call some other options. here the piece of code i tried to put on my last message : main_loop = g_main_loop_new (NULL, FALSE); data.loop = main_loop; data.pipeline = pipeline; gst_bus_add_signal_watch (bus); g_signal_connect (bus, "message", G_CALLBACK (cb_message), &data); g_main_loop_run (main_loop); /* Free resources */ g_main_loop_unref (main_loop); gst_object_unref (bus); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); free(buffer); close(csock); pthread_exit(NULL); So i make some test by putting g_main_quit(main_loop) function a differente place but the stream function stay how to say in the function and i want to go out of it, dunno if its clear sry. I really can't fixed this issue and htat make all my programmme is freezed cause of that. Thanks for your help -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
I finaly find how to do, but this solution is particular to my code.
in fact the code just in the post before should be wrote like that : main_loop = g_main_loop_new (NULL, FALSE); data.loop = main_loop; data.pipeline = pipeline; gst_bus_add_signal_watch (bus); g_signal_connect (bus, "message", G_CALLBACK (cb_message), &data); pthread_exit(NULL); g_main_loop_run (main_loop); /* Free resources */ g_main_loop_unref (main_loop); gst_object_unref (bus); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); free(buffer); close(csock); By putting pthread_exit(NULL) at this place i go out of the streaming function and go back to the infinty loop in another function wish have for work to disptach the differents options of the program, and i still in the stream main loop so i have the streaming in front of me + i can execute all others options of my software.That's what i wanted to do. Thanks, bye -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |