stream video for a certain period

Saravanakrishnan krishnan.saravanak at gmail.com
Mon Jul 11 11:34:44 PDT 2011


Hi,

I am new to gstreamer. My requirement is to stream a camera for a certain
period (say 2 mins) and then switch camera and stream again for 2 mins and
so on. The code looks like this


loop = g_main_loop_new (NULL, FALSE);

 /* create a server instance */
 server = gst_rtsp_server_new ();
 gst_rtsp_server_set_service( server, "554" );


 /* get the mapping for this server, every server has a default mapper
object
  * that be used to map uri mount points to media factories */
 mapping = gst_rtsp_server_get_media_mapping (server);

 /* make a media factory for a test stream. The default media factory can
use
  * gst-launch syntax to create pipelines.
  * any launch line works as long as it contains elements named pay%d. Each
  * element with pay%d names will be a stream */
 factory = gst_rtsp_media_factory_new ();
 gst_rtsp_media_factory_set_launch (factory, argv[1]);
 gst_rtsp_media_factory_set_shared( factory, 1 );

 /* attach the test factory to the /test url */
 gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);

 /* don't need the ref to the mapper anymore */
 g_object_unref (mapping);

 /* attach the server to the default maincontext */
 gst_rtsp_server_attach (server, NULL);

 /* start serving */
 g_main_loop_run (loop);


So, the g_main_loop_run (loop) function loops forever. How can I make it to
stop after certain period of time?

Thanks,
Krishnan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110711/27ab25e2/attachment-0001.htm>


More information about the gstreamer-devel mailing list