src/io/source_avcodec.c: replace with new context before closing old one