[Ffmpeg-devel] feeding lavf with a ByteIOContext ?

Aurelien Jacobs aurel
Thu May 19 00:50:53 CEST 2005


Hi,

I wanted to use lavf, but I wanted to feed it with my own source of data.
(not a file nor an url).
I've seen 2 ways to do this with lavf :
 - using an URLProtocol with a fake protocol
 - using directly a ByteIOContext

For my purpose I really don't need all the overhead of URLProtocol so
I would like to use ByteIOContext directly. The URLProtocol seems well
supported but not the ByteIOContext, so I first would like to know if
ByteIOContext is really meant to be used outside of lavf or if it's
reserved for internal purpose ?

I finally managed to get ByteIOContext working directly, setting it
with init_put_byte and then using av_open_input_stream. But I had
to workaround a problem in lavf. In few places, lavf "suppose" that
the ByteIOContext struct was built through an URLProtocol, and
uses url_fileno to get the URLProtocol related to this ByteIOContext.
This obviously crashes when using ByteIOContext directly.
It was quite simple to avoid all those url_fileno calls in lavf, so
here is a patch.
The only 2 remaining url_fineno calls are in yuv.c and are used to
determine and generate the filenames for the Y,U and V planes, so I
guess that anyway, yuv.c will never be usable with a single
ByteIOContext.
So what about this patch ? is it the right thing to do ? should I
commit it ? (tested with make test and with mplayer -demuxer 35)

If using ByteIOContext directly is acceptable, I might try to write
some doc about how to use this.

Aurel
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lavf_fsize.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20050519/800aae86/attachment.txt>



More information about the ffmpeg-devel mailing list