FFmpeg: fix memory leak with AVIOContext
When avformat_open_input is called with a user-provided AVIOContext, we
are responsible for freeing the AVIOContext instance.
Introducing a AVDemuxerContextDeleter that takes care of this, based on
the AVFMT_FLAG_CUSTOM_IO flag. The whole functionality is moved to a new
freeAVIOContext, which is also used in EncodingFormatContext.
Fixes: QTBUG-151185
Pick-to: 6.12
Change-Id: I4d64b04e8a281d3ee3e202e85f66dd69b82cd542
Reviewed-by: Nils Petter Skålerud <nils.petter.skalerud@qt.io>