I\'m currently trying to read small video files sent from a server
In order to read a file using libavformat, you are supposed to call
av_open_input_
This is great information and helped me out quite a bit, but there are a couple of issues people should be aware of. libavformat can and will mess with your buffer that you gave to avio_alloc_context. This leads to really annoying double-free errors or possibly memory leaks. When I started searching for the problem, I found https://lists.ffmpeg.org/pipermail/libav-user/2012-December/003257.html which nailed it perfectly.
My workaround when cleaning up from this work is to just go ahead and call
av_free(avioContext->buffer)
and then setting your own buffer pointer (that you allocated for your avio_alloc_context call) to NULL if you care.