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.


-hendrik
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to