[gst-devel] Duration of Pipeline

Anuroop Jesu jesuas at gmail.com
Mon Jan 17 08:04:01 CET 2011


Hi Umakant,

In function 'g_timeout_add' you pass the duration for which you want to run
your pipeline,

On timeout you exit from main loop, you don't need to seek. seek will not
exit from main loop and will continue to run till it reaches EOS.

I have tested the exit using the code as given below

static gboolean cb_print_position (GMainLoop *loop)
{
              g_main_loop_quit(loop);
              return TRUE;
}

gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING);
g_timeout_add (1000, (GSourceFunc) cb_print_position, playerloop);
g_main_loop_run(playerloop);

Correct me If I'm wrong, you want to play a stream for a X duration of time
and then exit correct.

Then above code will work for you.

With Warm Regards
Jesu Anuroop Suresh

"Any intelligent fool can make things bigger, more complex, and more
violent. It takes a touch of genius -- and a lot of courage -- to move in
the opposite direction."
"Anyone who has never made a mistake has never tried anything new."






On Mon, Jan 17, 2011 at 12:15 PM, Umakant Goyal <umakantgoyal1 at gmail.com>wrote:

> Hi,
>
> Thanks, As i mentioned in my last reply i have also tried to give time
> unit as nanosecond. But it did not work for me.
>
> It would be great if you can help me by telling what i am doing wrong
> in seek method to specify the duration of pipeline.
>
> Thanks
>
> On 1/17/11, Anuroop Jesu <jesuas at gmail.com> wrote:
> > Hi Umakant,
> >
> > Below code should solve your problem
> >
> > static gboolean
> > cb_end_stream (GstElement *pipeline)
> > {
> >        g_main_loop_quit(loop);
> > }
> > return TRUE;
> > }
> >
> >
> > Have the above function in your code and add "g_timeout_add" with
> required
> > value before you do run on main loop.
> >
> > gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING);
> > g_timeout_add (1000, (GSourceFunc) cb_print_position, pipeline);
> > g_main_loop_run(playerloop);
> >
> > With Warm Regards
> > Jesu Anuroop Suresh
> >
> > "Any intelligent fool can make things bigger, more complex, and more
> > violent. It takes a touch of genius -- and a lot of courage -- to move in
> > the opposite direction."
> > "Anyone who has never made a mistake has never tried anything new."
> >
> >
> >
> >
> >
> >
> > On Mon, Jan 17, 2011 at 11:06 AM, sudarshan bisht <
> bisht.sudarshan at gmail.com
> >> wrote:
> >
> >> Time should be in nano-seconds .
> >>
> >> For more info;
> >>
> >>
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-eventsseek.html
> >> <
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-eventsseek.html
> >
> >>
> >> On Mon, Jan 17, 2011 at 1:04 AM, Umakant Goyal
> >> <umakantgoyal1 at gmail.com>wrote:
> >>
> >>> Hi Thiago,
> >>>
> >>> I tried to run pipeline for specified period of time as suggested by
> you.
> >>> But it did not work for me. I want to run pipeline for 15 seconds for
> >>> that i
> >>> have done
> >>>
> >>>  bool flag = gst_element_seek (pipeline, 1.0, GST_FORMAT_TIME,
> >>> (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
> >>> GST_SEEK_TYPE_NONE, 0, GST_SEEK_TYPE_SET, 15*GST_SECOND);
> >>>
> >>> i have also tried following line of code
> >>>
> >>>  bool falg = gst_element_seek (vBin, 1.0, GST_FORMAT_TIME,
> >>> (GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE),
> >>> GST_SEEK_TYPE_SET, 0 * 15*GST_SECOND,  GST_SEEK_TYPE_SET,
> >>> 15*GST_SECOND);
> >>>
> >>> i have run above line of code in once in READY state and once in PAUSED
> >>> state. I have also tried GST_MSECOND instead of GST_SECOND. But nothing
> >>> works for me.
> >>>
> >>> Please help by telling where i am doing wrong while calling above line
> of
> >>> code.
> >>>
> >>> Thanks
> >>>
> >>> On Sun, Jan 16, 2011 at 2:14 AM, Thiago Sousa Santos <
> >>> thiago.sousa.santos at collabora.co.uk> wrote:
> >>>
> >>>> On Sun, 2011-01-16 at 01:12 +0530, Umakant Goyal wrote:
> >>>> > Hi All,
> >>>> >
> >>>> > Can i make a pipeline to run for specific period of time?
> >>>>
> >>>> Yes. You can send a seek event to the pipeline with a start and a stop
> >>>> time. Check
> >>>>
> >>>>
> http://www.gstreamer.net/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-seek
> >>>>
> >>>> --
> >>>> Thiago
> >>>>
> >>>> >
> >>>> > Thanks
> >>>> >
> >>>> >
> >>>>
> ------------------------------------------------------------------------------
> >>>> > Protect Your Site and Customers from Malware Attacks
> >>>> > Learn about various malware tactics and how to avoid them.
> Understand
> >>>> > malware threats, the impact they can have on your business, and how
> >>>> > you
> >>>> > can protect your company and customers by using code signing.
> >>>> > http://p.sf.net/sfu/oracle-sfdevnl
> >>>> > _______________________________________________
> >>>> > gstreamer-devel mailing list
> >>>> > gstreamer-devel at lists.sourceforge.net
> >>>> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> ------------------------------------------------------------------------------
> >>>> Protect Your Site and Customers from Malware Attacks
> >>>> Learn about various malware tactics and how to avoid them. Understand
> >>>> malware threats, the impact they can have on your business, and how
> you
> >>>> can protect your company and customers by using code signing.
> >>>> http://p.sf.net/sfu/oracle-sfdevnl
> >>>> _______________________________________________
> >>>> gstreamer-devel mailing list
> >>>> gstreamer-devel at lists.sourceforge.net
> >>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >>>>
> >>>
> >>>
> >>>
> >>>
> ------------------------------------------------------------------------------
> >>> Protect Your Site and Customers from Malware Attacks
> >>> Learn about various malware tactics and how to avoid them. Understand
> >>> malware threats, the impact they can have on your business, and how you
> >>> can protect your company and customers by using code signing.
> >>> http://p.sf.net/sfu/oracle-sfdevnl
> >>> _______________________________________________
> >>> gstreamer-devel mailing list
> >>> gstreamer-devel at lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >>>
> >>>
> >>
> >>
> >> --
> >> Regards,
> >>
> >> Sudarshan Bisht
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Protect Your Site and Customers from Malware Attacks
> >> Learn about various malware tactics and how to avoid them. Understand
> >> malware threats, the impact they can have on your business, and how you
> >> can protect your company and customers by using code signing.
> >> http://p.sf.net/sfu/oracle-sfdevnl
> >> _______________________________________________
> >> gstreamer-devel mailing list
> >> gstreamer-devel at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >>
> >>
> >
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110117/7baaf617/attachment.htm>


More information about the gstreamer-devel mailing list