<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi all, I had a command line code to record video from network and it was working fine (it is listed below):<br>gst-launch udpsrc port=5000 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H263-1998" num-buffers=5000 ! queue ! rtph263pdepay ! 'video/x-h263,width=320,height=240,framerate=(fraction)25/1' ! queue ! avimux ! queue ! filesink location=test1.avi<br><br>So, I wanted to change this into a code so that I wanted to include it in my application and I failed. Please help me. I got an error on the gst_bin_add_many and gst_element_link_many functions. The code is presented below. Please help me. The error is the following:<br><br>(videorecorder:19632): GStreamer-CRITICAL **: gst_bin_add: assertion `GST_IS_ELEMENT (element)' failed<br>(videorecorder:19632): GStreamer-CRITICAL **: gst_element_link_pads_filtered: assertion `GST_IS_ELEMENT (dest)' failed<br><br>Thank you.<br><br>- Zelalem S. <br><br>#include <gst/gst.h><br>#include <stdio.h><br><br>int<br>main (int argc,<br> char *argv[])<br>{<br><br> GstElement *udpsource, *queue1, *queue2, *queue3, *h263depay, *avimuxer, *filedes, *pipeline;<br> GstCaps *caps, *caps2;<br> /* init GStreamer */<br> gst_init (&argc, &argv);<br> /* create element */<br><br> udpsource = gst_element_factory_make ("udpsrc", "udpsource");<br><br> queue1 = gst_element_factory_make ("queue", "queue1"); <br> queue2 = gst_element_factory_make ("queue", "queue2"); <br><br>// queue3 = gst_element_factory_make ("queue", "queue3"); <br><br> h263depay = gst_element_factory_make ("rtph263pdepay", "h263depay"); <br> avimuxer = gst_element_factory_make ("avimux", "avimuxer"); <br> filedes = gst_element_factory_make ("filesink", "filedes"); <br><br><br> caps = gst_caps_new_simple( "application/x-rtp", "media", G_TYPE_STRING, "video", "clock-rate",<br> G_TYPE_INT, 90000, "encoding-name", G_TYPE_STRING, "H263-1998", "num-buffers",G_TYPE_INT,5000,NULL);<br> caps2 = gst_caps_new_simple ("video/x-h263", "width", G_TYPE_INT, 320, "height", G_TYPE_INT, 240, <br> "framerate", GST_TYPE_FRACTION, 25, 1, NULL);<br><br>// g_object_set (G_OBJECT (udpsource), "port", 5000, NULL);<br> g_object_set (G_OBJECT (udpsource), "port", 5000, "caps", caps, NULL);<br> g_object_set (G_OBJECT (filedes), "location", "test20.avi", NULL);<br><br>// caps2 = gst_caps_new_simple("video/x-h263","width", 320, "height", 240, "framerate", 25, 1,NULL) ;<br>/* alternative */<br><br> <br> pipeline = gst_pipeline_new ("video-pipeline");<br><br>if (!pipeline || !udpsource || !queue1 || !queue2 || !h263depay || !avimuxer || !filedes || !caps || !caps2) {<br> g_printerr ("One of the element could not be created. Exiting.\n");<br> return -1;<br>}<br><br>//add elements to the pipeline<br>gst_bin_add_many (GST_BIN (pipeline),<br> udpsource, queue1, h263depay, caps2, avimuxer, queue2, filedes, NULL);<br><br><br>//link the elements<br>//gst_element_link_many (udpsource, queue1, h263depay, NULL);<br>//gst_element_link_many (avimuxer, queue2, filedes, NULL);<br><br>gst_element_link_many(udpsource, queue1, h263depay,caps2,avimuxer, queue2, filedes, NULL);<br><br>//link two elements with a filter (here h263depay and queue2 with caps2<br>//gboolean link_ok = gst_element_link_filtered (h263depay, avimuxer, caps2);<br><br>//start the pipeline<br>gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);<br><br><br> gst_object_unref (GST_OBJECT (pipeline));<br> return 0;<br>}<br><br /><hr />Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! <a href='http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us' target='_new'>Try it!</a></body>
</html>