avformat/utils: constrain the lifetime of the pointer returned by avformat_index_get_...