Hello,

I'm using libavformat to demux multimedia files (only AVI and MPEG Audio 
at the moment).

I need to write a function returning the current position in the file, 
in milliseconds. Another thread might call such a function periodically 
to display a time bar informing the user "where" he is in the file.

What's the best way to do this?

I suppose I can use the PTS field in AVPacket :

Every time I read a new frame with av_read_frame, I'd compute an actual 
time using pkt.pts and formatctx->streams[pkt.stream_index]->time_base, 
and store the result in some static global variable which I return when 
another thread wants to know "what time it is" ?

Is there a better way ? (Is the info perhaps already available elsewhere 
in the AVFormatContext ?)

-- 
Regards.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to