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

Dongwon Kang dwkang at camars.kaist.ac.kr
Thu Sep 8 06:56:18 CEST 2011


I realized I am using very old version of ffmpeg and found out there is
"seekable" flag in AVIOContext struct in the current code. This looks like
what I wanted. =) Setting it to 0 seems to work for our usage.

    /**
     * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not
seekable.
     */
    int seekable;

On Wed, Sep 7, 2011 at 2:27 PM, Dongwon Kang <dwkang at camars.kaist.ac.kr>wrote:

> 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
>
>


-- 
Dongwon Kang
  CA Lab, Div of CS, Dept of EECS, KAIST
  dwkang at camars.kaist.ac.kr (official)
  dongwon.kang at gmail.com (non-official)
  +82) 42-869-5578      +82) 16-705-2950


More information about the ffmpeg-user mailing list