Tracking time for which a pipeline has been in Playing state.

Yogesh Marwaha yogeshm.007 at gmail.com
Sun Feb 20 09:26:46 PST 2011


On Sunday 20 Feb 2011 22:01:21 Marco Ballesio wrote:
> Hi,
> 
> On Sun, Feb 20, 2011 at 4:46 PM, Yogesh Marwaha <yogeshm.007 at gmail.com> 
wrote:
> > Hi,
> > 
> > I'm coding a transcoding application (not using encodebin).
> > 
> > Upto now I had been using following code to get time for which the
> > pipeline has been in Playing state (To show user information like xx
> > minutes/seconds the operation has run for or to calcutate averate speed
> > and estimate remaining time etc.): -
> >        GstClockTime elapsedTime = GST_CLOCK_TIME_NONE;
> >        GstClock *clock = gst_element_get_clock(m_pPipeline);
> >        if(clock)
> >            elapsedTime = (gst_clock_get_time(clock) -
> > gst_element_get_base_time(m_pPipeline)) / GST_SECOND;
> > 
> > Pipeline is like this: -
> >        gst_bin_add_many(GST_BIN(m_pPipeline), source, queue,
> > audioConvert, audioEncoder, container, sink, NULL);
> > 
> > But then I added code to allow pausing the operation like this: -
> >    gst_element_set_state(m_pPipeline, GST_STATE_PAUSED);
> > 
> > Now pipeline is paused but the clock is not. It is running always.
> > 
> > What should I do achieve my target?
> 
> You should read this:
> 
> http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-synch
> ronisation.txt
> 
> and, of course, use the running time instead of the absolute time. By
> heart, it should be something like:
> 
> gst_clock_get_time(gst_element_get_clock(...)) - gst_element_get_base_time
> (...)
> 
> Regards
> 
> > Regards,
> > 
> > Yogesh Marwaha
> > http://sparklemedia.sourceforge.net/
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

I fail to understand how is your suggestion different than mine?

I have read 2nd and 3rd sections of document you pointed to and it seems  that 
I'm doing the same; may be I'm understanding something in a wrong way. Can you 
help me understand?

Regards,

Yogesh Marwaha


More information about the gstreamer-devel mailing list