[Libav-user] Question on implementing a custom IO callback in ByteIOContext.

Dongwon Kang dwkang at camars.kaist.ac.kr
Wed Sep 7 07:27:30 CEST 2011


Hi all,

I am trying to implement custom IO call backs by using ByteIOContext in
avio.h in order to support http sources.
The implementation of the most callbacks were pretty much straight forward,
but I faced a problem while handling seek() operation with SEEK_END flag.
The problem is that there are some cases that we don't know the actual size
of the source. (e.g. http source which chunked transfer
encoding<http://en.wikipedia.org/wiki/Chunked_transfer_encoding>
)

Regarding the callback for seek operation, I found some article which says:
http://cdry.wordpress.com/2009/09/09/using-custom-io-callbacks-with-ffmpeg/
"int64_t SeekFunc(void *opaque, int64_t
offset<http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/metadata__compat_8c.html#ed7ea92f45bd273dde380a45ddced592>,
int whence) ;
you must return the current position of your stream  in bytes (that is,
after the seeking is performed). If the seek has failed you must return <0."

So, my question is:
1. Will it be okay to return -1 if we don't know the actual size of the
source?
2. If so, will the ffmpeg demux code just fail to demux the source or treat
it as streaming source and continue parsing?

Any comments are welcome!
Thanks,
-- 
Dongwon Kang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110907/32d3eed9/attachment.html>


More information about the Libav-user mailing list