Allocate avformat context and set its I/O context before using it This is the correct way to it (and is documented in avformat.h)