Turning this gst-launch-1.0 command into a C++ app?

Allan Chandler allan.chandler at dti.com.au
Fri Nov 11 01:52:40 UTC 2016


I'm not sure I understand where you're coming from with this question.

I'll try answer the easy one first. It's possible the reason you don't see the GST debug stuff is because it's being sent to standard error and ">" redirects standard output. If you want to capture both of these, you can use something like "myProg >someFile 2>&1" which also directs stderr (2) to the same place as stdout (1).

In terms of getting the "main loop", GStreamer itself does not provide this functionality. If you want to have messages delivered to a loop, you need to create one yourself (via gtk or glib) and then notify Gstreamer elements to post messages to it.

By way of example, my current program calls a sequence:
	gst_init(argc, argv);
	GstElement *playbin = gst_parse_launch("<vide stream>", 0);
	gst_element_set_state(playbin, GST_STATE_PLAYING);
to actually kick off a video stream.

However, it also has:
	GstMainContext *context = g_main_context_new()
	g_main_context_push_thread_default(context);
	GMainLoop *mainLoop = g_main_loop_new(context, FALSE);
	:
	g_main_loop_run(m_mainLoop);
to kick of a GLib message pump.

In terms of connecting GStreamer signals to the message pump, you can use something like:
	GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(playbin));
	gst_bus_add_signal_watch(bus);
	g_signal_connect(bus, "message::state-changed", (GCallback)StateChangedCb, NULL);
and that particular signal should be delivered to your callback function:
	gboolean StateChangedCb(GstBus *bus, GstMessage *msg, gpointer data) {
		// bus is the bus (obviously).
		// msg is the constructed message which you can use to get extra details.
		// data is the pointer specified in the signal connect call above (NULL)
		//	in this case but can be used to deliver specific detail).
	}

Hope that helps and, as always, any corrections by those more adept in GStreamer are welcome.
Al.

-----Original Message-----
From: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] On Behalf Of rick b
Sent: Friday, 11 November 2016 1:53 AM
To: gstreamer-devel at lists.freedesktop.org
Subject: Re: Turning this gst-launch-1.0 command into a C++ app?

Hi Tim, I had thought about just using the gst-launch command inside my source code. And I have, it works. The problem is, I came into a situation where I needed the main app loop.  I had asked about how to get the main app loop and was told that the gst-launch command does not generate a loop. 

So, I'm back to trying to do this.

I went back and re-added the videovert element.  Still not working.  I reran and added --gst-debug-level=3 I get a bunch of vaapi errors and warnings.

I wanted to capture these out to a file but myExe --gst-debug-level=3 > myErrorFile.txt

However, NONE of the gstreamer debug output got put into that file.  I'm sure it's my lack of Linux skills that's the problem.  Is there a linux command command that I can run that will output all the --gst-debug-level output into a file?






--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Turning-this-gst-launch-1-0-command-into-a-C-app-tp4680502p4680600.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
https://linkprotect.cudasvc.com/url?a=https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel&c=E,1,uWtP-yYHCisOwUjYc860aQSeo3hJkessKmXDFwkGPDp6rjubOmZgHFEaZKDyx4bI1zkab5HRIa6DQig6RubJP1DYbF3MZwmRgWDv6F-4&typo=1


More information about the gstreamer-devel mailing list