<span class="Apple-style-span" style="border-collapse: collapse; color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 13px; ">Hi,<br><br>I am new to gstreamer. My requirement is to stream a camera for a certain<br>
period (say 2 mins) and then switch camera and stream again for 2 mins and<br>so on. The code looks like this<br><br><br>loop = g_main_loop_new (NULL, FALSE);<br><br> /* create a server instance */<br> server = gst_rtsp_server_new ();<br>
gst_rtsp_server_set_service( server, "554" );<br><br><br> /* get the mapping for this server, every server has a default mapper<br>object<br> * that be used to map uri mount points to media factories */<br> mapping = gst_rtsp_server_get_media_mapping (server);<br>
<br> /* make a media factory for a test stream. The default media factory can<br>use<br> * gst-launch syntax to create pipelines.<br> * any launch line works as long as it contains elements named pay%d. Each<br> * element with pay%d names will be a stream */<br>
factory = gst_rtsp_media_factory_new ();<br> gst_rtsp_media_factory_set_launch (factory, argv[1]);<br> gst_rtsp_media_factory_set_shared( factory, 1 );<br><br> /* attach the test factory to the /test url */<br> gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);<br>
<br> /* don't need the ref to the mapper anymore */<br> g_object_unref (mapping);<br><br> /* attach the server to the default maincontext */<br> gst_rtsp_server_attach (server, NULL);<br><br> /* start serving */<br> g_main_loop_run (loop);<br>
<br><br>So, the g_main_loop_run (loop) function loops forever. How can I make it to<br>stop after certain period of time?<br><br>Thanks,<br>Krishnan</span>