[gst-devel] GstElement statistic retrieval

Ivan Murashko ivan.murashko at gmail.com
Wed Dec 30 10:08:49 CET 2009


Hi all,

This code retrieves correct info about how much time an element was in a
playing state (since last pause) may be somebody will need it too

GstClockTime getRunningTime(GstElement* branch)
{
    if (branch)
    {
        GstClock *clock = gst_element_get_clock(branch);
        if (clock)
        {
            return gst_clock_get_time(clock) -
                gst_element_get_base_time(branch);
        }
    }
    return 0ULL;
}

On Tue, Dec 29, 2009 at 2:57 PM, Ivan Murashko <ivan.murashko at gmail.com>wrote:

> Hello Wim,
>
> Thank you very much, seems that it works for me
>
>
> On Tue, Dec 29, 2009 at 2:41 PM, Wim Taymans <wim.taymans at gmail.com>wrote:
>
>> On Tue, 2009-12-29 at 14:00 +0300, Ivan Murashko wrote:
>> > Hi,
>> >
>> > I have an GstElement instance and want to know how many time the
>> > element was in PLAYING state.
>>
>> If you mean 'for how long the pipeline has been in the playing state'
>> then you can use gst_element_get_start_time() on the pipeline, which
>> gives you the running_time of when the pipeline was last paused. If you
>> set a pipeline to NULL and then get the start_time, you will get the
>> total amount of time spent in the playing state.
>>
>> Note however that this time resets to 0 after a flushing seek.
>>
>> Wim
>>
>> > As I understood gst_element_get_base_time() can help in the case the
>> > element is in the RUNNING state but is it possible to retrieve such
>> > info after the main pipeline was stopped (set in NULL state)?
>> >
>> > --
>> > Best regards,
>> > Ivan
>> >
>> ------------------------------------------------------------------------------
>> > This SF.Net email is sponsored by the Verizon Developer Community
>> > Take advantage of Verizon's best-in-class app development support
>> > A streamlined, 14 day to market process makes app distribution fast and
>> easy
>> > Join now and get one step closer to millions of Verizon customers
>> > http://p.sf.net/sfu/verizon-dev2dev
>> > _______________________________________________ gstreamer-devel mailing
>> list gstreamer-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Verizon Developer Community
>> Take advantage of Verizon's best-in-class app development support
>> A streamlined, 14 day to market process makes app distribution fast and
>> easy
>> Join now and get one step closer to millions of Verizon customers
>> http://p.sf.net/sfu/verizon-dev2dev
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>
>
>
> --
> Best regards,
> Ivan
>



-- 
Best regards,
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20091230/65d6875c/attachment.htm>


More information about the gstreamer-devel mailing list