Question regarding gst_parse_launch function

qjqj quanjie at
Wed Nov 29 00:44:10 UTC 2017


I tried both with -e and without -e, the error I got was this:

[gstreamer] initialized gstreamer, version
[gstreamer] gstreamer decoder failed to create pipeline
[gstreamer]    (syntax error)
[gstreamer] failed to init gstCamera

gst-camera:  failed to initialize video device

Which is from parser, and here is my source code:

bool gstCamera::buildLaunchStr()
	std::ostringstream ss;
	//open ip camera
	ss << " udpsrc port=15004 !";
	ss << " application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay !
h264parse !"; 
	ss << " queue ! avdec_h264 ! xvimagesink sync=false async=false -e";
	mLaunchStr = ss.str();

	printf(LOG_GSTREAMER "gstreamer decoder pipeline string:\n");
	printf("%s\n", mLaunchStr.c_str());
	return true;

bool gstCamera::init()
	GError* err = NULL;

	// build pipeline string
	if( !buildLaunchStr() )
		printf(LOG_GSTREAMER "gstreamer decoder failed to build pipeline
		return false;

	// launch pipeline
	mPipeline = gst_parse_launch(mLaunchStr.c_str(), &err);

	if( err != NULL )
		printf(LOG_GSTREAMER "gstreamer decoder failed to create pipeline\n");
		printf(LOG_GSTREAMER "   (%s)\n", err->message);
		return false;

	// get the appsrc
	GstElement* appsinkElement = gst_bin_get_by_name(GST_BIN(pipeline),
	GstAppSink* appsink = GST_APP_SINK(appsinkElement);

	if( !appsinkElement || !appsink)
		printf(LOG_GSTREAMER "gstreamer failed to retrieve AppSink element from
		return false;
	mAppSink = appsink;
	// setup callbacks
	GstAppSinkCallbacks cb;
	memset(&cb, 0, sizeof(GstAppSinkCallbacks));
	cb.eos         = onEOS;
	cb.new_preroll = onPreroll;
	cb.new_sample  = onBuffer;
	gst_app_sink_set_callbacks(mAppSink, &cb, (void*)this, NULL);
	return true;

Sent from:

More information about the gstreamer-devel mailing list