create simultaneous & dis-joint pipelines and terminate pipelines independently using timeout

killerrats koreysjunkmail at gmail.com
Mon Feb 25 18:22:09 UTC 2019


if your using windows you can do it this way. int main() on bottom. Hope this
helps! this is not tested but this is what i do in my windows application.
should be able to convert it to linux with replacing a few things here and
there.
#include #include class vPipeline{	private: 	std::string cmdLine;	vPipeline
*pPipe;	GstElement *pipeline;	GstBus *bus;		GstMessage *msg;		GMainLoop
*mLoop;			static unsigned int __stdcall TheStartPipeline(void* p_this)	{	
auto pPipe = (vPipeline*)p_this;				pPipe->startPipe();				return 0;	}
static gboolean handle_message(CustomData *data, GstMessage *msg) {		return
TRUE;	}	bool startPipe()	{		GstStateChangeReturn ret;		pipeline =
gst_parse_launch("",NULL);				this->bus =
gst_element_get_bus(this->aRtspPipeline.srcPipeline);		if (bus == nullptr)	
{			return false;		}		gst_bus_add_signal_watch(this->bus);	
this->aBusWatchSignalId = g_signal_connect(this->bus, "message",
G_CALLBACK(handle_message), this->pipeline);				ret =
gst_element_set_state(pipeline, GST_STATE_PLAYING);		if (ret ==
GST_STATE_CHANGE_FAILURE) {			g_printerr("Unable to set the pipeline to the
playing state.\n");			gst_object_unref(data.playbin);			return false;		}			
g_main_loop_run(mLoop);				return true;	}	public: 	vPipeline() 	{	
this->pPipe = (vPipeline*)this;	}	void SetPipelineString(std::string
commandLine)	{		cmdLine = commandLine;	}	void start()	{		HANDLE handle =		
reinterpret_cast(_beginthreadex(0, 0, &TheStartPipeline, pPipe, 0, 0));	
CloseHandle(handle);	}}int main(){/* Initialize GStreamer */	gst_init(&argc,
&argv);		// command line strings	std::string cmd1 = "udpsrc port=5000 !
\"application/x-rtp,media=(string)audio,clock-rate=(int)44100,
encoding-name=(string)L16,encoding-params=(string)1, channels=(int)1,
channel-positions=(int)1,payload=(int)96\" ! rtpL16depay ! filesink
location=/home/rohan/AAA.raw",cmd2 = "udpsrc port=5008 !
\"application/x-rtp,media=(string)audio,clock-rate=(int)44100,
encoding-name=(string)L16,encoding-params=(string)1, channels=(int)1,
channel-positions=(int)1,payload=(int)96\" ! rtpL16depay ! filesink
location=/home/rohan/BBB.raw";	// each pipeline	vPipeline pipe,pipe2;		//
pipeline 1	pipe.SetPipelineString(cmd1);	pipe.start();		// pipeline 2
pipe2.SetPipelineString(cmd2);	pipe2.start();		return 0;}




-----
------------------------------
Gstreamer 1.14.4
------------------------------
Windows
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190225/801e1a67/attachment.html>


More information about the gstreamer-devel mailing list