No Video
Ian Davidson
id012c3076 at blueyonder.co.uk
Mon Jan 7 02:45:30 PST 2013
Thanks Kris,
I think that I'll be able to get that working now. (Probably, both
versions of my program!)
Ian
On 07/01/2013 10:24, Krzysztof Konopko wrote:
> Look how it's done in gst-launch.c:
> - signal handler is installed
>
> static void
> sigint_setup (void)
> {
> struct sigaction action;
>
> memset (&action, 0, sizeof (action));
> action.sa_handler = sigint_handler_sighandler;
>
> sigaction (SIGINT, &action, NULL);
> }
>
> - the signal handler sends the message
>
> /* post an application specific message */
> gst_element_post_message (GST_ELEMENT (pipeline),
> gst_message_new_application (GST_OBJECT (pipeline),
> gst_structure_new ("GstLaunchInterrupt",
> "message", G_TYPE_STRING, "Pipeline interrupted", NULL)));
>
> - the message is handled in the main loop
>
> case GST_MESSAGE_APPLICATION:{
> const GstStructure *s;
>
> s = gst_message_get_structure (message);
>
> if (gst_structure_has_name (s, "GstLaunchInterrupt")) {
> /* this application message is posted when we caught an
> interrupt and
> * we need to stop the pipeline. */
> PRINT (_("Interrupt: Stopping pipeline ...\n"));
> res = ELR_INTERRUPT;
> goto exit;
> }
> break;
> }
>
>
> Or you can read standard input and handle it in a bit simpler manner:
> http://kriscience.blogspot.co.uk/2012/12/reading-standard-input-from-gmainloop.html
>
> HTH,
> Kris
>
>
--
--
Ian Davidson
--
Facts used in this message may or may not reflect an underlying
objective reality. Facts are supplied for personal use only.
Recipients quoting supplied information do so at their own risk. Facts
supplied may vary in whole or part from widely accepted standards.
While painstakingly researched, facts may or may not be indicative of
actually occurring events or natural phenomena.
The author accepts no responsibility for personal loss or injury
resulting from memorisation and subsequent use.
More information about the gstreamer-devel
mailing list