getting an accurate frame number from pipeline

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

getting an accurate frame number from pipeline

TimSC

Hi,

Thanks again people for help with gdkpixbufsink. I am now trying to  
get an accurate video frame number from a pipeline. I can change the  
format I am requesting but only GST_FORMAT_TIME and GST_FORMAT_PERCENT  
work as expected. When I ask for GST_FORMAT_BUFFERS, the query returns  
with the same result as GST_FORMAT_PERCENT.

int video_get_pos(GstFormat fmt, const char *text)
{
        GstQuery *query;
         gboolean res;
         query = gst_query_new_position (fmt);
         res = gst_element_query (pipeline, query);
         if (res) {
           gint64 pos;
           gst_query_parse_position (query, &fmt, &pos);
           printf ("position %s \t= %lld\n", text, (pos));
         }
         else {
           printf ("position query failed...\n");
         }
         gst_query_unref (query);
        return 0;
}

And I am querying with different formats like this:

        video_get_pos(GST_FORMAT_DEFAULT,"default");
        video_get_pos(GST_FORMAT_TIME,"time   ");
        video_get_pos(GST_FORMAT_BUFFERS,"buffers");
        video_get_pos(GST_FORMAT_PERCENT,"percent");

I get a result along these lines:

position default = 11040000000
position time     = 10882214000
position buffers = 11040000000
position percent = 11040000000

Is this a good approach to get an accurate frame number? Or do I have  
to work around and get the time in nanoseconds and multiply it by the  
frame rate?

I also have problems seeking using frame numbers. Is gstreamer trying  
to tell me something?

full code:  
http://www.sheerman-chase.org.uk/temp/gst-player-pixel2009-01-12d.tar.gz

Thanks,

Tim



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel