Restart Pipeline

killerrats koreysjunkmail at gmail.com
Thu Dec 21 22:41:09 UTC 2017


I even tried using the parse launch and did the same thing. do I have to do
something to clear the depays before running again? 

// ---------------- CODE ----------------------

this->srcPipeline = gst_parse_launch("rtspsrc name=source ! rtph264depay
name=videodepay ! h264parse name=videoparse ! avimux name=avimux ! appsink
name=appsink source. ! rtpmp4gdepay name=audiodepay ! aacparse
name=audioparse ! mux.", NULL);
	//this->srcPipeline = gst_pipeline_new("pipeline");
	this->source = gst_bin_get_by_name(GST_BIN(this->srcPipeline), "source");
	this->rtpdepay = gst_bin_get_by_name(GST_BIN(this->srcPipeline),
"videodepay");
	this->parse = gst_bin_get_by_name(GST_BIN(this->srcPipeline), "vidparse");
	this->audioRtpDepay = gst_bin_get_by_name(GST_BIN(this->srcPipeline),
"audiodepay");
	this->audioParse = gst_bin_get_by_name(GST_BIN(this->srcPipeline),
"audioparse");
	this->mux = gst_bin_get_by_name(GST_BIN(this->srcPipeline), "avimux");
	this->appsink = gst_bin_get_by_name(GST_BIN(this->srcPipeline), "appsink");

	g_object_set(this->source
		, "location", "[IP]", NULL);

	g_object_set(GST_OBJECT(this->appsink), "emit-signals", TRUE
		, "max-buffers", 1
		, "enable-last-sample", FALSE, NULL);

	g_signal_connect(appsink, "new-sample", G_CALLBACK(appsink_ToFile),
apService);

	this->bus = gst_element_get_bus(this->srcPipeline);

	gst_bus_add_signal_watch(this->bus);
	g_signal_connect(this->bus, "message", G_CALLBACK(bus_cb), apService);

	do
	{

		/* Start playing */
		if (gst_element_set_state(this->srcPipeline, GST_STATE_PLAYING) ==
GST_STATE_CHANGE_FAILURE) {
			g_printerr("Unable to set the pipeline to the playing state.\n");
			gst_object_unref(this->srcPipeline);
			{
				return;
			}
		}

		this->aEstablishedConnection = true;
		this->mLoop = g_main_loop_new(NULL, FALSE);
		g_main_loop_run(this->mLoop);
		this->aEstablishedConnection = false;
		this->gPlayingInterval = 0;
		this->gPausedTimeout = 0;

		/* Free resources */
		g_main_loop_unref(this->mLoop);

		gst_element_set_state(this->srcPipeline, GST_STATE_NULL);

		gst_element_set_state(this->source, GST_STATE_NULL);
		gst_element_set_state(this->rtpdepay, GST_STATE_NULL);
		gst_element_set_state(this->parse, GST_STATE_NULL);
		gst_element_set_state(this->audioRtpDepay, GST_STATE_NULL);
		gst_element_set_state(this->audioParse, GST_STATE_NULL);
		gst_element_set_state(this->mux, GST_STATE_NULL);
		gst_element_set_state(this->appsink, GST_STATE_NULL);

		g_object_set(this->source
			, "location", "[IP]", NULL);
}while(!this->aStopProgram);



-----
------------------------------
Gstreamer 1.12.4
------------------------------
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list