On Fri, 12 Jun 2009 20:58:56 -0400, Stas Oskin <stas.os...@gmail.com>
wrote:
but it seems to work only if I have the
whole media mapped to memory?
Well, libavformat likes to seek around and even close and reopen the
stream a few times during av_find_stream_info... which is very unfortunate.
Your options are to either buffer up enough packets for the detection to
work (and emulate seek and close/open), or feed the codec directly.
Feeding the codec directly bypasses all the avformat stuff, and should be
much more efficient. Note that you don't need ByteIOContext for that, you
just wrap your data in AVPacket. The trick is correctly initializing the
codec context if you don't know the parameters. I've never done it, and
could use some hints myself. But, you can always dig through the avformat
stuff and see what codec context fields they assign. Then, grab some
mpeg specification docs and write your own detection logic.
One other interesting idea is to buffer a number of packets ahead of time
(if you know that the stream has a consistent format) and then feed these
old packets through ByteIOContext until av_find_stream_info returns. then
start feeding it live packets.
And if there are easier ways that anyone knows, i'd love to hear them as
well.
-Mike
_______________________________________________
libav-user mailing list
libav-user@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/libav-user