[Libav-user] Faulty handling of file: protocol on Windows

Jamal Waseem (RBEI/EAP3) Jamal.Waseem at de.bosch.com
Thu Jun 20 06:51:56 CEST 2013

Thanks a lot hendrik.
I will try this and will let you know the results.

Thanks again :)

-----Original Message-----
From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Hendrik Schreiber
Sent: Wednesday, June 19, 2013 1:07 PM
To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.
Subject: Re: [Libav-user] Faulty handling of file: protocol on Windows

On Jun 18, 2013, at 1:28 PM, Jamal Waseem (RBEI/EAP3) wrote:

> Feeding a file is fine to ffmpeg but what if I want to feed a payload to ffmpeg??
> How can I give this payload which is stored in char array to ffmpeg for decoding?

I'm not sure highjacking a thread is looked upon kindly here. Neither is topposting.
But in any case:

AVIOContext *io;
AVFormatContext *format_context;

format_context = avformat_alloc_context();
io = avio_alloc_context(buffer, buffer_size, 0, your_custom_pointer, read_callback, write_callback, seek_callback);
format_context->pb = io;

Then proceed with avformat_open_input(..) as you normally would. As filename/URL simply use something like "MyCustomIO".

read_callback, write_callback, and seek_callback are function pointers defined in http://www.ffmpeg.org/doxygen/trunk/structAVIOContext.html

If you choose not to implement the seek_callback (perhaps because you are streaming), make sure to call

io->seekable = 0;

Otherwise funny things happen (it would be nice, if avio_alloc_context did that automatically, when seek_callback is NULL).
http://stackoverflow.com/questions/13634539/how-can-libavformat-be-used-without-using-other-libav-libraries/13642438#13642438 may also be useful to you.

Good luck.

Libav-user mailing list
Libav-user at ffmpeg.org

More information about the Libav-user mailing list