stream video for a certain period
vineeth
nvineeth at gmail.com
Wed Jul 13 20:42:32 PDT 2011
See ,
http://developer.gnome.org/glib/2.29/glib-The-Main-Event-Loop.html#g-timeout-add-secondsand
once the timeout happens, to come out of loop you can call loop quit
--vineeth
On Tue, Jul 12, 2011 at 12:04 AM, Saravanakrishnan <
krishnan.saravanak at gmail.com> wrote:
> 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
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110714/fcead3e3/attachment.html>
More information about the gstreamer-devel
mailing list