Minor fixes, add tests for IO reading

* Does not currently work for all file types.
* Fix typo, check for C_NULL before calling av_free()